Package com.ibm.icu.impl.units
Class MeasureUnitImpl.UnitsParser
java.lang.Object
com.ibm.icu.impl.units.MeasureUnitImpl.UnitsParser
- Enclosing class:
MeasureUnitImpl
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
Contains a single unit or a constant.(package private) static class
(package private) static enum
Token states definitions. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private int
private boolean
private boolean
private final String
private static MeasureUnit.MeasurePrefix[]
private static CharsTrie
private final CharsTrie
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static MeasureUnit.MeasurePrefix
getPrefixFromTrieIndex
(int trieIndex) private static int
private boolean
hasNext()
Returns the next "single unit" via result.private MeasureUnitImpl
parse()
static MeasureUnitImpl
parseForIdentifier
(String identifier) Construct a MeasureUnit from a CLDR Unit Identifier, defined in UTS 35.
-
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
-