|
|||||||||
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.DensityFormat
DensityFormat
provides several mechanisms to use
Density
objects:
Density
objects
Locale based constructors use a default scale of 2. The parse and format
methods are used to generate and format Density
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 | |
DensityFormat()
Creates new DensityFormat instance based on default
Locale . |
|
DensityFormat(DensityUnits units,
int scale)
Constructs new DensityFormat with units set to
int units and scale set to int scale. |
|
DensityFormat(java.util.Locale loc)
Creates new DensityFormat instance based on supplied
Locale |
Method Summary | |
java.lang.Object |
clone()
Creates new DensityFormat object based on this
DensityFormat . |
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Returns StringBuffer with supplied Density
quantity formatted in units. |
java.lang.String |
formatDensity(Density den)
Returns String with supplied Density
quantity formatted in units. |
DensityUnits |
getUnits()
Gets value for measurement unit. |
Density |
parseDensity(java.lang.String value)
Parses String based on units to return a
Density object. |
java.lang.Object |
parseObject(java.lang.String source,
java.text.ParsePosition pos)
Parses String based on units to return a
Density object. |
void |
setUnits(DensityUnits 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 DensityFormat()
DensityFormat
instance based on default
Locale
.
public DensityFormat(java.util.Locale loc)
DensityFormat
instance based on supplied
Locale
loc
- Locale
to set correct density unitspublic DensityFormat(DensityUnits units, int scale)
DensityFormat
with units set to
int
units and scale set to int
scale.
Method Detail |
public DensityUnits getUnits()
DensityUnits
value of current measurement unitspublic void setUnits(DensityUnits units)
public java.lang.String formatDensity(Density den)
String
with supplied Density
quantity formatted in units.
String
density in current unitspublic java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
StringBuffer
with supplied Density
quantity formatted in units.
obj
- Density
object from which to format value
StringBuffer
density in current unitspublic Density parseDensity(java.lang.String value)
String
based on units to return a
Density
object.
public java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition pos)
String
based on units to return a
Density
object.
pos
- ParsePosition
ignored in this implementation
Density
holding a value specified
in input String
NumberFormatException
- on non-numeric
String
inputpublic java.lang.Object clone()
DensityFormat
object based on this
DensityFormat
.
DensityFormat
object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |