|
|||||||||
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.ElapsedTimeFormat
ElapsedTimeFormat
is a concrete class for formatting and
parsing ElapsedTime
objects.
If no current pattern for the formatter is specified at instantiation, the
global pattern will be used to create all new
ElapsedTimeFormat
objects.
The reserved letters for formatter pattern definitions, are defined below:
All literals should be enclosed into single quotes '', except . and :
The smallest time unit in the pattern string can use a scale, which should be specified in the pattern (for example, hh:mm.mm).
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 | |
ElapsedTimeFormat()
Constructs new ElapsedTimeFormat using global pattern. |
|
ElapsedTimeFormat(java.lang.String format)
Constructs new ElapsedTimeFormat instance
based on pattern specified. |
Method Summary | |
static void |
applyGlobalPattern(java.lang.String format)
Sets new global pattern to be used as default for new objects. |
void |
applyPattern(java.lang.String format)
Sets new pattern for this ElapsedTimeFormat . |
protected double |
convertUnits(double value,
int srcUnit,
int destUnit)
|
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Returns StringBuffer with ElapsedTime formatted in
current format. |
java.lang.String |
formatElapsedTime(ElapsedTime time)
Returns String with ElapsedTime formatted in
current format. |
int |
getRoundingMode()
Get current rounding mode. |
ElapsedTime |
parseElapsedTime(java.lang.String value)
Parses String based on units to return an
ElapsedTime object. |
java.lang.Object |
parseObject(java.lang.String source,
java.text.ParsePosition pos)
Parses String based on units to return an
ElapsedTime object. |
void |
setRoundingMode(int roundingMode)
Sets rounding mode to be used by the smallest time unit in the current pattern string. |
static java.lang.String |
toGlobalPattern()
Returns current global pattern String . |
java.lang.String |
toPattern()
Returns current pattern string |
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 ElapsedTimeFormat()
ElapsedTimeFormat
using global pattern.
public ElapsedTimeFormat(java.lang.String format)
ElapsedTimeFormat
instance
based on pattern specified.
format
- String
Method Detail |
public static void applyGlobalPattern(java.lang.String format)
format
- String
public static java.lang.String toGlobalPattern()
String
.
String
global patternpublic void applyPattern(java.lang.String format)
ElapsedTimeFormat
.
format
- String
public java.lang.String toPattern()
string
String
patternpublic void setRoundingMode(int roundingMode)
BigDecimal
class.
roundingMode
- int
public int getRoundingMode()
int
public ElapsedTime parseElapsedTime(java.lang.String value) throws java.text.ParseException
String
based on units to return an
ElapsedTime
object.
value
- String
to be converted
to ElapsedTime
object
ElapsedTime
holding a value specified
in input String
java.text.ParseException
public java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition pos)
String
based on units to return an
ElapsedTime
object.
source
- String
to be converted
to ElapsedTime
objectpos
- ParsePosition
(can't be null)
Object
a ElapsedTime
holding a value specified
in input String
NumberFormatException
- on
non-numeric String
inputpublic java.lang.String formatElapsedTime(ElapsedTime time)
String
with ElapsedTime
formatted in
current format.
time
- ElapsedTime
object from which to format value
String
ElapsedTime
in current formatpublic java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
StringBuffer
with ElapsedTime
formatted in
current format.
obj
- Object
The object to formattoAppendTo
- int
where the text is to be appendedpos
- On input: an alignment field, if desired.
StringBuffer
ElapsedTime
in current formatprotected double convertUnits(double value, int srcUnit, int destUnit)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |