|
|||||||||
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.VolumeFormat
VolumeFormat
provides several mechanisms to use Volume
objects:
Volume
objects
Locale based constructors use a default scale of 2. The parse and format
methods are used to generate and format Volume
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 | |
VolumeFormat()
Constructs new VolumeFormat instance based on default
Locale . |
|
VolumeFormat(java.util.Locale loc)
Constructs new VolumeFormat instance based on supplied
Locale . |
|
VolumeFormat(VolumeUnits units,
int scale)
Constructs new VolumeFormat with units set to
VolumeUnits units and scale set to int scale. |
Method Summary | |
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Returns StringBuffer with supplied Volume
quantity formatted in units. |
java.lang.String |
formatVolume(Volume vol)
Returns String with supplied Volume
quantity formatted in units. |
VolumeUnits |
getUnits()
Gets value for measurement units. |
java.lang.Object |
parseObject(java.lang.String source,
java.text.ParsePosition pos)
Parses String based on units to return
a Volume object as an Object . |
Volume |
parseVolume(java.lang.String value)
Parses String based on units to return
a Volume object. |
void |
setUnits(VolumeUnits 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 |
clone, format, formatToCharacterIterator, parseObject |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public VolumeFormat()
VolumeFormat
instance based on default
Locale
.
public VolumeFormat(java.util.Locale loc)
VolumeFormat
instance based on supplied
Locale
.
loc
- Locale
to set correct measurement unitspublic VolumeFormat(VolumeUnits units, int scale)
VolumeFormat
with units set to
VolumeUnits
units and scale set to int
scale.
units
- VolumeUnits
to set unitsscale
- int
to set scaleMethod Detail |
public java.lang.String formatVolume(Volume vol)
String
with supplied Volume
quantity formatted in units.
vol
- Volume
object from which to format value
String
volume in current unitspublic java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
StringBuffer
with supplied Volume
quantity formatted in units.
obj
- Object
object from which to format valuetoAppendTo
- (@link StringBuffer} buffer to append value topos
- FieldPosition
ignored in this implementation
StringBuffer
volume in current units
IllegalArgumentException
- if obj is not of type
Volume
.public Volume parseVolume(java.lang.String value)
String
based on units to return
a Volume
object.
public java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition pos)
String
based on units to return
a Volume
object as an Object
.
public void setUnits(VolumeUnits units)
units
- VolumeUnits
new value for measurement unitspublic VolumeUnits getUnits()
VolumeUnits
value of current measurement units
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |