This class represents the locale sensitive format.
Note that the grammar has been left-factored to be suitable for use by a top-down parser generator such as JavaCC
| Lexical Entities: | ||
|---|---|---|
| <sign> | := | "+" | "-" |
| <digit> | := | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" |
| <superscript_digit> | := | "⁰" | "¹" | "²" | "³" | "⁴" | "⁵" | "⁶" | "⁷" | "⁸" | "⁹" |
| <integer> | := | (<digit>)+ |
| <number> | := | (<sign>)? (<digit>)* (".")? (<digit>)+ (("e" | "E") (<sign>)? (<digit>)+)? |
| <exponent> | := | ( "^" ( <sign> )? <integer> ) | ( "^(" (<sign>)? <integer> ( "/" (<sign>)? <integer> )? ")" ) | ( <superscript_digit> )+ |
| <initial_char> | := | ? Any Unicode character excluding the following: ASCII control & whitespace (\u0000 - \u0020), decimal digits '0'-'9', '(' (\u0028), ')' (\u0029), '*' (\u002A), '+' (\u002B), '-' (\u002D), '.' (\u002E), '/' (\u005C), ':' (\u003A), '^' (\u005E), '²' (\u00B2), '³' (\u00B3), '·' (\u00B7), '¹' (\u00B9), '⁰' (\u2070), '⁴' (\u2074), '⁵' (\u2075), '⁶' (\u2076), '⁷' (\u2077), '⁸' (\u2078), '⁹' (\u2079) ? |
| <unit_identifier> | := | <initial_char> ( <initial_char> | <digit> )* |
| Non-Terminals: | ||
| <unit_expr> | := | <mix_expr> |
| <mix_expr> | := | <add_expr> ( ":" <add_expr> )* |
| <add_expr> | := | ( <number> <sign> )? <mul_expr> ( <sign> <number> )? |
| <mul_expr> | := | <exponent_expr> ( ( ( "*" | "·" ) <exponent_expr> ) | ( "/" <exponent_expr> ) )* |
| <exponent_expr> | := | ( <atomic_expr> ( <exponent> )? ) | (<integer> "^" <atomic_expr>) | ( ( "log" ( <integer> )? ) | "ln" ) "(" <add_expr> ")" ) |
| <atomic_expr> | := | <number> | <unit_identifier> | ( "(" <add_expr> ")" ) |
| Modifier and Type | Field and Description |
|---|---|
| private static final LocalUnitFormat | DEFAULT_INSTANCE
DefaultQuantityFactory locale instance. |
| private final transient SymbolMap |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Appendable | format(Unit<?>
the unit to format. unit, Appendable the appendable destination. appendable)Implements abstract tech. Implements javax. Formats the specified unit. |
| private void | formatExponent(Unit<?>
Unit the unit to be formatted unit, int int the numerator of the fractional power pow, int int the denominator of the fractional power root, boolean boolean continued, Appendable true if the converter expression should begin with an operator, otherwise false. This will always be
true unless the unit being modified is equal to Unit.ONE.StringBuffer the buffer to append to. No assumptions should be made about its content. buffer)Format the given unit raised to the given fractional power to the given |
| private int | Returns: the operator precedence of the outermost operator in the unit expression that was outputthe unit to be formatted unit, Appendable the buffer)StringBuilder to be written toFormat the given unit to the given StringBuilder, then return the operator precedence of the outermost operator in the unit expression that was formatted. |
| public static LocalUnitFormat | |
| public static LocalUnitFormat | |
| public static LocalUnitFormat | |
| protected SymbolMap | Returns: SymbolMap the current symbol mapGet the symbol map used by this instance to map between |
| public boolean | isLocaleSensitive()
Overrides default javax. Returns |
| protected Unit | parse(CharSequence
the csq, int CharSequence to parse.the current parsing index. index)Implements abstract tech. Parses a portion of the specified |
| public Unit | parse(CharSequence
the csq, ParsePosition CharSequence to parse.the cursor holding the current parsing index. cursor)Implements abstract tech. Implements javax. Parses a portion of the specified |
| public Unit | parse(CharSequence
the csq)CharSequence to parse.Implements javax. Parses the text into an instance of |
| public String |
| DEFAULT_INSTANCE | back to summary |
|---|---|
| private static final LocalUnitFormat DEFAULT_INSTANCE DefaultQuantityFactory locale instance. If the default locale is changed after the class is initialized, this instance will no longer be used. | |
| symbolMap | back to summary |
|---|---|
| private final transient SymbolMap symbolMap The symbol map used by this instance to map between | |
| LocalUnitFormat | back to summary |
|---|---|
| private LocalUnitFormat(SymbolMap symbols) Base constructor.
| |
| format | back to summary |
|---|---|
| public Appendable format(Unit<?> unit, Appendable appendable) throws IOException Implements abstract tech. Implements javax. Doc from tech. Formats the specified unit.
| |
| formatExponent | back to summary |
|---|---|
| private void formatExponent(Unit<?> unit, int pow, int root, boolean continued, Appendable buffer) throws IOException Format the given unit raised to the given fractional power to the given
| |
| formatInternal | back to summary |
|---|---|
| private int formatInternal(Unit<?> unit, Appendable buffer) throws IOException Format the given unit to the given StringBuilder, then return the operator precedence of the outermost operator in the unit expression that was
formatted. See
| |
| getInstance | back to summary |
|---|---|
| public static LocalUnitFormat getInstance() Returns the instance for the current default locale (non-ascii characters are allowed) | |
| getInstance | back to summary |
|---|---|
| public static LocalUnitFormat getInstance(Locale locale) Returns an instance for the given locale.
| |
| getInstance | back to summary |
|---|---|
| public static LocalUnitFormat getInstance(SymbolMap symbols) Returns an instance for the given symbol map. | |
| getSymbols | back to summary |
|---|---|
| protected SymbolMap getSymbols() Get the symbol map used by this instance to map between
| |
| isLocaleSensitive | back to summary |
|---|---|
| public boolean isLocaleSensitive() Overrides default javax. Doc from javax. Returns
In environments that do not support a
| |
| parse | back to summary |
|---|---|
| protected Unit Implements abstract tech. Doc from tech. Parses a portion of the specified
| |
| parse | back to summary |
|---|---|
| public Unit Implements abstract tech. Implements javax. Doc from tech. Parses a portion of the specified
| |
| parse | back to summary |
|---|---|
| public Unit Implements javax. Doc from javax. Parses the text into an instance of The parse must complete normally and parse the entire text. If the parse completes without reading the entire length of the text, an exception is thrown. If any other problem occurs during parsing, an exception is thrown.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |