|
JADE v6.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.text.Format
com.dautelle.physics.QuantityFormat
This class provides the interface for formatting and parsing
quantities.
| Nested Class Summary |
| Nested classes inherited from class java.text.Format |
java.text.Format.Field |
| Constructor Summary | |
protected |
QuantityFormat()
Base constructor. |
| Method Summary | |
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Formats a quantity and appends the resulting text to a given string buffer. |
abstract java.lang.StringBuffer |
format(Quantity quantity,
java.lang.StringBuffer toAppendTo,
Unit outputUnit)
Formats a quantity and appends the resulting text to a given string buffer. |
static QuantityFormat |
getDefaultInstance()
Returns the default quantity format instance. |
static QuantityFormat |
getInstance()
Returns the context local quantity format
(default getDefaultInstance()). |
abstract Quantity |
parse(java.lang.CharSequence source)
Parses text from a character sequence to produce a quantity. |
java.lang.Object |
parseObject(java.lang.String source,
java.text.ParsePosition pos)
Parses text from a string to produce an object. |
static void |
setInstance(QuantityFormat format)
Sets the context local quantity format. |
| 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 |
protected QuantityFormat()
| Method Detail |
public static QuantityFormat getInstance()
context local quantity format
(default getDefaultInstance()).
public static void setInstance(QuantityFormat format)
context local quantity format.
format - the new local/global format.public static final QuantityFormat getDefaultInstance()
]1.32, 1.34[.
public final java.lang.StringBuffer format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
obj - the quantity to format.toAppendTo - where the text is to be appendedpos - a FieldPosition identifying a field
in the formatted text (not used).
toAppendTo,
with formatted text appended.
java.lang.NullPointerException - if toAppendTo is
null
java.lang.IllegalArgumentException - if this format cannot format the given
object (e.g. not a Quantity instance).
public final java.lang.Object parseObject(java.lang.String source,
java.text.ParsePosition pos)
source - a String, part of which should be parsed.pos - a ParsePosition object with index and error
index information.
Object parsed from the string. In case of
error, returns null.public abstract Quantity parse(java.lang.CharSequence source) throws java.text.ParseException
source - the characters sequence to be parsed.
Quantity parsed from the string.
java.text.ParseException - if a parsing error occurs.public abstract java.lang.StringBuffer format(Quantity quantity, java.lang.StringBuffer toAppendTo, Unit outputUnit)
quantity - the quantity to format.toAppendTo - where the text is to be appended.outputUnit - the output unit for the quantity.
toAppendTo,
with formatted text appended.
java.lang.NullPointerException - if toAppendTo is
null
java.lang.IllegalArgumentException - if this format cannot format the given
object (e.g. not a Quantity instance).
|
JADE v6.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||