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