org.das2.datum.format
Class ExponentialDatumFormatter

java.lang.Object
  extended by org.das2.datum.format.DatumFormatter
      extended by org.das2.datum.format.ExponentialDatumFormatter

public class ExponentialDatumFormatter
extends DatumFormatter

Formats Datums forcing a given exponent and number of decimal places. This is useful for axes where each of the labels should have the same exponent. Zero is treated specially, just "0" is returned. This helps one to quickly identify zero on the axis.


Constructor Summary
ExponentialDatumFormatter(int digits, int exponent)
           
 
Method Summary
 java.lang.String format(Datum datum)
           
 java.lang.String format(Datum datum, Units units)
           
 java.lang.String grannyFormat(Datum datum)
          Returns the datum formatted as a String with special formatting characters.
 java.lang.String grannyFormat(Datum datum, Units units)
          formats the Datum in the context of the units.
 java.lang.String toString()
           
 
Methods inherited from class org.das2.datum.format.DatumFormatter
axisFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExponentialDatumFormatter

public ExponentialDatumFormatter(int digits,
                                 int exponent)
Method Detail

format

public java.lang.String format(Datum datum)
Specified by:
format in class DatumFormatter

format

public java.lang.String format(Datum datum,
                               Units units)
Overrides:
format in class DatumFormatter

grannyFormat

public java.lang.String grannyFormat(Datum datum,
                                     Units units)
Description copied from class: DatumFormatter
formats the Datum in the context of the units.

Overrides:
grannyFormat in class DatumFormatter

grannyFormat

public java.lang.String grannyFormat(Datum datum)
Description copied from class: DatumFormatter
Returns the datum formatted as a String with special formatting characters. As with format, this should be out-of-context and should be tagged with the Units. The default implementation just returns the result of DatumFormatter.format(org.das2.datum.Datum)

Overrides:
grannyFormat in class DatumFormatter

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object