| Overview | Package | Class | Tree | Deprecated | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||
java.lang.Object
|
+--ncsa.horizon.coordinates.formatters.GenericAxisPosFormatter
|
+--ncsa.horizon.coordinates.formatters.MetricAxisPosFormatter
The base unit is usually specified in the constructor.
| Inner classes inherited from class ncsa.horizon.coordinates.formatters.GenericAxisPosFormatter | |
| GenericAxisPosFormatter.Modes | |
| Field Summary | |
| java.util.Hashtable | abbmap
a map that translates prefixes into powers |
| boolean | abbreviate
if true, use the abbreviation for the scale prefix |
| java.util.Vector | abbreviations
a container for the prefixes |
| static java.lang.String[] | abbrevList
prefix abbreviations |
| boolean | fixed
if true, the prefix to be used is fixed |
| int | ipower
the native base ten logarithmic scale; it is assumed that the input values to the toString(double) methods are in units of 10^ipower (relative to the base unit). |
| int | minpow
the smallest (most negative) power supported. |
| static java.lang.String | myname
|
| int | opower
the desired output base ten logarithmic scale; if fixed equals true, toString(double) will attempt to print the value in units of 10^opower (relative to the base unit), assuming there is a known prefix for that power. |
| static int[] | powerList
the prefix powers |
| java.util.Vector | prefixes
a container for the prefixes |
| static java.lang.String[] | prefixList
the supported prefixes |
| java.util.Hashtable | prefmap
a map that translates prefixes into powers |
| java.lang.String | unit
the base measurement unit (e.g. |
| Fields inherited from class ncsa.horizon.coordinates.formatters.GenericAxisPosFormatter | |
| fmt, myname | |
| Constructor Summary | |
| MetricAxisPosFormatter(java.lang.String unit)
format values of specified units. |
|
| MetricAxisPosFormatter()
format values with no base unit (only prefix will appear). |
|
| MetricAxisPosFormatter(java.lang.String unit,
int inPower)
format values using the specified unit and the prefix abbreviation for the specified power |
|
| MetricAxisPosFormatter(java.lang.String unit,
int inPower,
boolean useAbbreviation)
format values using the specified unit and the prefix abbreviation for the specified power |
|
| MetricAxisPosFormatter(java.lang.String unit,
int inPower,
int outPower,
boolean useAbbreviation)
format values using the specified unit and the prefix for the specified power |
|
| Method Summary | |
| java.lang.String | AbbrevFor(int power)
return the prefix abbreviation that will be used for a given power, or null if one is not known. |
| java.lang.Object | clone()
|
| void | fixPrefix(int power)
when formatting values with toString(double), attempt to use the prefix associated with this power. |
| void | fixPrefix()
when formatting values with toString(double), attempt to use the current default output prefix (set either at construction or during the last call to fixPrefix(int). |
| void | freePrefix()
when formatting values with toString(double), attempt to use the current default output prefix (set either at construction or during the last call to fixPrefix(int). |
| int | getDefPrefixPower()
return the current default output prefix power that will be used by toString(double) when isFixed() = true. |
| void | initialize()
loads the prefix and abbreviation lists |
| boolean | isAbbreviated()
return whether abbreviations are used |
| boolean | isFixed()
return true if this formatter will use a fixed prefix |
| static void | main(java.lang.String[] args)
|
| static int | maxPower(java.util.Vector list,
int power,
int minpow)
return the higest power that is less than or equal to the requested power for which there is a name in the given list. |
| java.lang.String | prefixFor(int power)
return the prefix that will be used for a given power, or null if one is not known |
| void | revmap()
update the reverse maps |
| double | scaleValue(double val,
java.lang.StringBuffer unitBuf)
scale the input value and return unit appropriate for that scale |
| void | setAbbreviated(boolean useAbbreviation)
set whether abbreviations are used |
| void | setMinPower(int power)
shift the lists of prefixes and abbreviations to use a new minimum power. |
| void | setUnit(java.lang.String unitName)
set the basic unit (word or abbreviation) |
| void | setUnitPower(int power)
assume that the values input to toString(double) will be in units of 10^power (relative to the current unit name). |
| java.lang.String | toString(double val)
return a value as a string with a specified precision |
| java.lang.String | toString(double val,
int prec)
return a value as a string with a specified precision |
| void | useAbbrev(int power,
java.lang.String abbrev)
use a given abbreviation for the specified power |
| void | usePrefix(int power,
java.lang.String prefix)
use a given prefix for the specified power |
| double | valueOf(java.lang.String s)
parse the String representation of a floating point number |
| Methods inherited from class ncsa.horizon.coordinates.formatters.GenericAxisPosFormatter | |
| clone, getFormat, getPrecision, main, setMode, setPrecision, toString, toString, toString, valueOf | |
| Methods inherited from class java.lang.Object | |
| clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait | |
| Field Detail |
protected java.lang.String unit
protected int ipower
protected int opower
protected boolean fixed
protected boolean abbreviate
protected static final java.lang.String[] prefixList
protected static final java.lang.String[] abbrevList
protected static final int[] powerList
protected java.util.Vector prefixes
protected java.util.Vector abbreviations
protected java.util.Hashtable prefmap
protected java.util.Hashtable abbmap
protected int minpow
protected static final java.lang.String myname
| Constructor Detail |
public MetricAxisPosFormatter(java.lang.String unit)
unit
- the unit name, can be an abbreviationpublic MetricAxisPosFormatter()
public MetricAxisPosFormatter(java.lang.String unit,
int inPower)
unit
- the unit name, can be an abbreviation
inPower
- assume that values input to toString(double) will
be in units of 10^inPower, relative to unit
public MetricAxisPosFormatter(java.lang.String unit,
int inPower,
boolean useAbbreviation)
unit
- the unit name, can be an abbreviation
inPower
- assume that values input to toString(double) will
be in units of 10^inPower, relative to unit
public MetricAxisPosFormatter(java.lang.String unit,
int inPower,
int outPower,
boolean useAbbreviation)
unit
- the unit name, can be an abbreviation
inPower
- assume that values input to toString(double) will
be in units of 10^inPower, relative to unit
outPower
- the power for the prefix to be used; if a prefix
for this power is not known, the highest valued
prefix that is less than request will be used.
useAbbreviation
- if true, the prefix abbreviation should be
used.| Method Detail |
public java.lang.String toString(double val)
val
- the input value
public java.lang.String toString(double val,
int prec)
val
- the input value
prec
- the number of places right of the decimal point
public double valueOf(java.lang.String s)
throws java.lang.NumberFormatException
public java.lang.Object clone()
public static int maxPower(java.util.Vector list,
int power,
int minpow)
list
- the Vector to check
power
- the requested power
minpow
- the minimum power in the listpublic void setUnit(java.lang.String unitName)
public void setAbbreviated(boolean useAbbreviation)
public void setUnitPower(int power)
public void fixPrefix(int power)
public void fixPrefix()
public void freePrefix()
public int getDefPrefixPower()
public boolean isFixed()
public boolean isAbbreviated()
public void usePrefix(int power,
java.lang.String prefix)
public java.lang.String prefixFor(int power)
public void useAbbrev(int power,
java.lang.String abbrev)
public java.lang.String AbbrevFor(int power)
protected void initialize()
protected void revmap()
protected void setMinPower(int power)
protected double scaleValue(double val,
java.lang.StringBuffer unitBuf)
val
- the input value
unitBuf
- a buffer to append unit topublic static void main(java.lang.String[] args)
| Overview | Package | Class | Tree | Deprecated | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||