|
Jeospace API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jeospace.text.MassFormat
Formats Mass objects into readable strings
and parses strings into Mass objects.
Usage notes:
NumberFormat to decode the magnitude of the Mass
represented by the string. Blank characters between any of these three fields
of the string ( units, multiplier, magnitude ) will be ignored.
parse and format only read and write units and
multipliers as symbols. Parsing and formatting with full names is not
implemented.
MassFormat utilizes NumberFormat to parse and format
the numeric magnitude. The NumberFormat object is declared as public
and it's properties may be customized through it's public methods. Note that
NumberFormat does not gracefully handle very large ( larger than
Long.MAX_VALUE ) or very small numbers which may be truncated.
Mass,
MassUnit,
Mult,
NumberFormat| Field Summary | |
protected boolean |
formatOptionsAreSet
|
protected java.lang.String[] |
localizedUnitSymbol
|
protected static Mult[] |
MULT
|
protected Mult |
multiplier
|
protected java.lang.String |
multiplierSymbol
|
protected java.text.NumberFormat |
nf
NumberFormat object used to format and parse
the magnitude portion of a Mass object. |
protected static MassUnit[] |
UNIT
|
protected MassUnit |
units
|
protected java.lang.String |
unitSymbol
|
| Constructor Summary | |
MassFormat()
Construct a MassFormat object initialized to the default locale. |
|
MassFormat(java.util.Locale locale)
Construct a MassFormat object initialized to the specified locale. |
|
MassFormat(java.util.Locale locale,
Mult multiplier,
MassUnit units)
Construct a MassFormat object initialized to the specified locale,
multiplier and Mass units. |
|
MassFormat(Mult multiplier,
MassUnit units)
Construct a MassFormat object initialized to the default locale and
specified multiplier and Mass units. |
|
| Method Summary | |
void |
clearFormatOptions()
Clear the multiplier and units of display for the format method of this MassFormat object. |
java.lang.Object |
clone()
Return a copy of this MassFormat object. |
boolean |
equals(java.lang.Object obj)
Compare two MassFormats for equality. |
java.lang.String |
format(Mass inMass)
Format the passed Mass object into a human readable String. |
java.text.NumberFormat |
getNumberFormat()
Return the NumberFormat object associated
with this MassFormat object |
Mass |
parse(java.lang.String inText)
Parse the passed String into an Mass object. |
void |
setFormatOptions(Mult multiplier,
MassUnit units)
Set the multiplier and units of display for the format method of this MassFormat object. |
| Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected final java.text.NumberFormat nf
NumberFormat object used to format and parse
the magnitude portion of a Mass object.
protected boolean formatOptionsAreSet
protected java.lang.String multiplierSymbol
protected java.lang.String unitSymbol
protected Mult multiplier
protected MassUnit units
protected static final Mult[] MULT
protected static final MassUnit[] UNIT
protected final java.lang.String[] localizedUnitSymbol
| Constructor Detail |
public MassFormat()
MassFormat object initialized to the default locale.
The multiplier and units from the Mass object will be used for formatting.
public MassFormat(Mult multiplier,
MassUnit units)
MassFormat object initialized to the default locale and
specified multiplier and Mass units.
public MassFormat(java.util.Locale locale)
MassFormat object initialized to the specified locale.
The multiplier and units from the Mass object will be used.
public MassFormat(java.util.Locale locale,
Mult multiplier,
MassUnit units)
MassFormat object initialized to the specified locale,
multiplier and Mass units.
| Method Detail |
public java.text.NumberFormat getNumberFormat()
NumberFormat object associated
with this MassFormat object
public void clearFormatOptions()
MassFormat object. This will cause the multiplier
and units from the Mass object will be used for formatting.
public void setFormatOptions(Mult multiplier,
MassUnit units)
MassFormat object.
multiplier - the Mult objectunits - the MassUnit objectpublic java.lang.String format(Mass inMass)
Mass object into a human readable String.
inMass - the Mass object to format.
Mass object.
public Mass parse(java.lang.String inText)
throws java.text.ParseException
Mass object.
inText - the string to parse.
Mass object.
java.text.ParseExceptionpublic java.lang.Object clone()
MassFormat object. Overrides Cloneable.
MassFormat object.public boolean equals(java.lang.Object obj)
MassFormats for equality. The result is true
if and only if the argument object is not null, is a MassFormat object
and represents a MassFormat of the same type and style.
Two MassFormat objects are equal only when the format
method will produce identical results with equal Mass objects as
arguments.
|
Jeospace API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||