Class MeasureUnitImpl.UnitsParser
java.lang.Object
com.ibm.icu.impl.units.MeasureUnitImpl.UnitsParser
- Enclosing class:
MeasureUnitImpl
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classContains a single unit or a constant.(package private) static class(package private) static enumToken states definitions. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate intprivate booleanprivate booleanprivate Stringprivate static MeasureUnit.MeasurePrefix[]private static CharsTrieprivate final CharsTrie -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static MeasureUnit.MeasurePrefixgetPrefixFromTrieIndex(int trieIndex) private static intprivate booleanhasNext()Returns the next "single unit" via result.private MeasureUnitImplparse()static MeasureUnitImplparseForIdentifier(String identifier) Construct a MeasureUnit from a CLDR Unit Identifier, defined in UTS 35.private voidHelper function to process alias replacement.
-
Field Details
-
savedTrie
-
trie
-
fSource
-
fIndex
private int fIndex -
fAfterPer
private boolean fAfterPer -
fJustAfterPer
private boolean fJustAfterPer -
fSawAnd
private boolean fSawAnd -
measurePrefixValues
-
-
Constructor Details
-
UnitsParser
-
-
Method Details
-
parseForIdentifier
Construct a MeasureUnit from a CLDR Unit Identifier, defined in UTS 35. Validates and canonicalizes the identifier.- Returns:
- MeasureUnitImpl object or null if the identifier is empty.
- Throws:
IllegalArgumentException- in case of invalid identifier.
-
getPrefixFromTrieIndex
-
getTrieIndexForPrefix
-
parse
-
nextSingleUnit
Returns the next "single unit" via result.If a "-per-" was parsed, the result will have appropriate negative dimensionality.
- Throws:
IllegalArgumentException- if we parse both compound units and "-and-", since mixed compound units are not yet supported - TODO(CLDR-13701).
-
hasNext
private boolean hasNext() -
nextToken
-
processAlias
Helper function to process alias replacement.- Parameters:
token- The token of TYPE_ALIAS to process
-