protected static class SimpleUnitFormat.DefaultFormat extends SimpleUnitFormat
SimpleUnitFormat.ASCIIFormat, SimpleUnitFormat.DefaultFormat, SimpleUnitFormat.Flavor| Modifier and Type | Field and Description |
|---|---|
protected Map<String,javax.measure.Unit<?>> |
nameToUnit
Deprecated.
Holds the name to unit mapping.
|
protected Map<javax.measure.Unit<?>,String> |
unitToName
Deprecated.
Holds the unit to name mapping.
|
| Modifier and Type | Method and Description |
|---|---|
void |
alias(javax.measure.Unit<?> unit,
String alias)
Deprecated.
Attaches a system-wide alias to this unit.
|
Appendable |
format(javax.measure.Unit<?> unit,
Appendable appendable)
Deprecated.
Formats the specified unit.
|
protected static boolean |
isUnitIdentifierPart(char ch)
Deprecated.
|
protected boolean |
isValidIdentifier(String name)
Deprecated.
Indicates if the specified name can be used as unit identifier.
|
void |
label(javax.measure.Unit<?> unit,
String label)
Deprecated.
Attaches a system-wide label to the specified unit.
|
protected String |
nameFor(javax.measure.Unit<?> unit)
Deprecated.
|
javax.measure.Unit<?> |
parse(CharSequence csq)
Deprecated.
|
protected javax.measure.Unit<?> |
parse(CharSequence csq,
int index)
Deprecated.
Parses a portion of the specified
CharSequence from the specified position to produce a unit. |
javax.measure.Unit<?> |
parse(CharSequence csq,
ParsePosition cursor)
Deprecated.
Parses a portion of the specified
CharSequence from the specified position to produce a unit. |
javax.measure.Unit<? extends javax.measure.Quantity> |
parseProductUnit(CharSequence csq,
ParsePosition pos)
Deprecated.
Parses a sequence of character to produce a unit or a rational product of unit.
|
javax.measure.Unit<? extends javax.measure.Quantity> |
parseSingleUnit(CharSequence csq,
ParsePosition pos)
Deprecated.
Parses a sequence of character to produce a single unit.
|
protected String |
prefixFor(javax.measure.UnitConverter converter)
Deprecated.
|
String |
toString()
Deprecated.
|
protected javax.measure.Unit<?> |
unitFor(String name)
Deprecated.
|
format, getInstance, getInstance, getNewInstance, getNewInstance, parseObjectformatprotected final Map<String,javax.measure.Unit<?>> nameToUnit
protected final Map<javax.measure.Unit<?>,String> unitToName
public void label(javax.measure.Unit<?> unit, String label)
SimpleUnitFormat SimpleUnitFormat.getInstance().label(DAY.multiply(365), "year");
SimpleUnitFormat.getInstance().label(METER.multiply(0.3048), "ft"); If the specified label is already associated to an unit the previous
association is discarded or ignored.label in interface javax.measure.format.UnitFormatlabel in class SimpleUnitFormatunit - the unit being labeled.label - the new label for this unit.public void alias(javax.measure.Unit<?> unit, String alias)
SimpleUnitFormat SimpleUnitFormat.getInstance().alias(METER.multiply(0.3048), "foot");
SimpleUnitFormat.getInstance().alias(METER.multiply(0.3048), "feet"); SimpleUnitFormat.getInstance().alias(METER, "meter");
SimpleUnitFormat.getInstance().alias(METER, "metre"); If the specified label is already associated to an unit the previous association is
discarded or ignored.alias in class SimpleUnitFormatunit - the unit being aliased.alias - the alias attached to this unit.protected boolean isValidIdentifier(String name)
SimpleUnitFormatisValidIdentifier in class SimpleUnitFormatname - the identifier to be tested.true if the name specified can be used as label or alias for this format;false otherwise.protected static boolean isUnitIdentifierPart(char ch)
public javax.measure.Unit<? extends javax.measure.Quantity> parseSingleUnit(CharSequence csq, ParsePosition pos) throws javax.measure.format.MeasurementParseException
SimpleUnitFormatparseSingleUnit in class SimpleUnitFormatcsq - the CharSequence to parse.pos - an object holding the parsing index and error position.Unit parsed from the character sequence.javax.measure.format.MeasurementParseExceptionpublic javax.measure.Unit<? extends javax.measure.Quantity> parseProductUnit(CharSequence csq, ParsePosition pos) throws javax.measure.format.MeasurementParseException
SimpleUnitFormatparseProductUnit in class SimpleUnitFormatcsq - the CharSequence to parse.pos - an object holding the parsing index and error position.Unit parsed from the character sequence.javax.measure.format.MeasurementParseExceptionpublic Appendable format(javax.measure.Unit<?> unit, Appendable appendable) throws IOException
SimpleUnitFormatformat in interface javax.measure.format.UnitFormatformat in class SimpleUnitFormatunit - the unit to format.appendable - the appendable destination.appendable, with formatted text appended.IOException - if an error occurs.public javax.measure.Unit<?> parse(CharSequence csq) throws javax.measure.format.MeasurementParseException
javax.measure.format.MeasurementParseExceptionprotected javax.measure.Unit<?> parse(CharSequence csq, int index) throws IllegalArgumentException
AbstractUnitFormatCharSequence from the specified position to produce a unit. If there is no unit to parse
AbstractUnit.ONE is returned.parse in class AbstractUnitFormatcsq - the CharSequence to parse.index - the current parsing index.IllegalArgumentException - if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).public javax.measure.Unit<?> parse(CharSequence csq, ParsePosition cursor) throws IllegalArgumentException
AbstractUnitFormatCharSequence from the specified position to produce a unit. If there is no unit to parse
AbstractUnit.ONE is returned.parse in interface javax.measure.format.UnitFormatparse in class AbstractUnitFormatcsq - the CharSequence to parse.cursor - the cursor holding the current parsing index.IllegalArgumentException - if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).Copyright © 2005–2022 Units of Measurement project. All rights reserved.