|
Jeospace API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jeospace.text.LengthFormat
Formats Length objects into readable strings
and parses strings into Length objects.
Usage notes:
NumberFormat to decode the magnitude of the Length
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.
LengthFormat 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.
Length,
LengthUnit,
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 Length object. |
protected static LengthUnit[] |
UNIT
|
protected LengthUnit |
units
|
protected java.lang.String |
unitSymbol
|
| Constructor Summary | |
LengthFormat()
Construct a LengthFormat object initialized to the default locale. |
|
LengthFormat(java.util.Locale locale)
Construct a LengthFormat object initialized to the specified locale. |
|
LengthFormat(java.util.Locale locale,
Mult multiplier,
LengthUnit units)
Construct a LengthFormat object initialized to the specified locale,
multiplier and Length units. |
|
LengthFormat(Mult multiplier,
LengthUnit units)
Construct a LengthFormat object initialized to the default locale and
specified multiplier and Length units. |
|
| Method Summary | |
void |
clearFormatOptions()
Clear the multiplier and units of display for the format method of this LengthFormat object. |
java.lang.Object |
clone()
Return a copy of this LengthFormat object. |
boolean |
equals(java.lang.Object obj)
Compare two LengthFormats for equality. |
java.lang.String |
format(Length inLength)
Format the passed Length object into a human readable String. |
java.text.NumberFormat |
getNumberFormat()
Return the NumberFormat object associated
with this LengthFormat object |
Length |
parse(java.lang.String inText)
Parse the passed String into an Length object. |
void |
setFormatOptions(Mult multiplier,
LengthUnit units)
Set the multiplier and units of display for the format method of this LengthFormat 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 Length object.
protected boolean formatOptionsAreSet
protected java.lang.String multiplierSymbol
protected java.lang.String unitSymbol
protected Mult multiplier
protected LengthUnit units
protected static final Mult[] MULT
protected static final LengthUnit[] UNIT
protected final java.lang.String[] localizedUnitSymbol
| Constructor Detail |
public LengthFormat()
LengthFormat object initialized to the default locale.
The multiplier and units from the Length object will be used for formatting.
public LengthFormat(Mult multiplier,
LengthUnit units)
LengthFormat object initialized to the default locale and
specified multiplier and Length units.
public LengthFormat(java.util.Locale locale)
LengthFormat object initialized to the specified locale.
The multiplier and units from the Length object will be used.
public LengthFormat(java.util.Locale locale,
Mult multiplier,
LengthUnit units)
LengthFormat object initialized to the specified locale,
multiplier and Length units.
| Method Detail |
public java.text.NumberFormat getNumberFormat()
NumberFormat object associated
with this LengthFormat object
public void clearFormatOptions()
LengthFormat object. This will cause the multiplier
and units from the Length object will be used for formatting.
public void setFormatOptions(Mult multiplier,
LengthUnit units)
LengthFormat object.
multiplier - the Mult objectunits - the LengthUnit objectpublic java.lang.String format(Length inLength)
Length object into a human readable String.
inLength - the Length object to format.
Length object.
public Length parse(java.lang.String inText)
throws java.text.ParseException
Length object.
inText - the string to parse.
Length object.
java.text.ParseExceptionpublic java.lang.Object clone()
LengthFormat object. Overrides Cloneable.
LengthFormat object.public boolean equals(java.lang.Object obj)
LengthFormats for equality. The result is true
if and only if the argument object is not null, is a LengthFormat object
and represents a LengthFormat of the same type and style.
Two LengthFormat objects are equal only when the format
method will produce identical results with equal Length objects as
arguments.
|
Jeospace API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||