|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.text.Format com.pcauto.util.QuantityFormat com.pcauto.util.DimensionFormat
DimensionFormat
provides several mechanisms to use
Dimension
objects:
Dimension
objects
Locale based constructors use a default scale of 2. The parse and format
methods are used to generate and format Dimension
objects respectively.
Nested Class Summary |
Nested classes inherited from class java.text.Format |
java.text.Format.Field |
Field Summary |
Fields inherited from class com.pcauto.util.QuantityFormat |
groupingUsed, scale, units |
Constructor Summary | |
DimensionFormat()
Creates new DimensionFormat instance based on default
Locale . |
|
DimensionFormat(DimensionUnits units,
int scale)
Constructs new DimensionFormat with units set to
int units and scale set to int scale. |
|
DimensionFormat(java.util.Locale loc)
Creates new DimensionFormat instance based on supplied
Locale |
Method Summary | |
java.lang.Object |
clone()
Creates new DimensionFormat object based on this
DimensionFormat . |
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Returns StringBuffer with supplied Dimension
quantity formatted in units. |
java.lang.String |
formatDimension(Dimension dim)
Returns String with supplied Dimension
quantity formatted in units. |
DimensionUnits |
getUnits()
Gets value for measurement unit. |
Dimension |
parseDimension(java.lang.String value)
Parses String based on units to return a
Dimension object. |
java.lang.Object |
parseObject(java.lang.String source,
java.text.ParsePosition pos)
Parses String based on units to return a
Dimension object. |
void |
setUnits(DimensionUnits units)
Sets value for measurement units. |
Methods inherited from class com.pcauto.util.QuantityFormat |
getScale, isGroupingUsed, setGroupingUsed, setScale |
Methods inherited from class java.text.Format |
format, formatToCharacterIterator, parseObject |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DimensionFormat()
DimensionFormat
instance based on default
Locale
.
public DimensionFormat(java.util.Locale loc)
DimensionFormat
instance based on supplied
Locale
loc
- Locale
to set correct dimension unitspublic DimensionFormat(DimensionUnits units, int scale)
DimensionFormat
with units set to
int
units and scale set to int
scale.
Method Detail |
public DimensionUnits getUnits()
DimensionUnits
value of current measurement unitspublic void setUnits(DimensionUnits units)
public java.lang.String formatDimension(Dimension dim)
String
with supplied Dimension
quantity formatted in units.
dim
- Dimension
object from which to format value
String
dimension in current unitspublic java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
StringBuffer
with supplied Dimension
quantity formatted in units.
obj
- Dimension
object from which to format value
StringBuffer
dimension in current unitspublic Dimension parseDimension(java.lang.String value)
String
based on units to return a
Dimension
object.
public java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition pos)
String
based on units to return a
Dimension
object.
pos
- ParsePosition
ignored in this implementation
Dimension
holding a value specified
in input String
NumberFormatException
- on non-numeric
String
inputpublic java.lang.Object clone()
DimensionFormat
object based on this
DimensionFormat
.
DimensionFormat
object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |