Class MeasureUnitImpl.UnitsParser

  • Enclosing class:
    MeasureUnitImpl

    public static class MeasureUnitImpl.UnitsParser
    extends java.lang.Object
    • Field Detail

      • savedTrie

        private static volatile CharsTrie savedTrie
      • fSource

        private final java.lang.String fSource
      • fIndex

        private int fIndex
      • fAfterPer

        private boolean fAfterPer
      • fSawAnd

        private boolean fSawAnd
    • Constructor Detail

      • UnitsParser

        private UnitsParser​(java.lang.String identifier)
    • Method Detail

      • parseForIdentifier

        public static MeasureUnitImpl parseForIdentifier​(java.lang.String identifier)
        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:
        java.lang.IllegalArgumentException - in case of invalid identifier.
      • nextSingleUnit

        private SingleUnitImpl nextSingleUnit()
        Returns the next "single unit" via result.

        If a "-per-" was parsed, the result will have appropriate negative dimensionality.

        Throws:
        java.lang.IllegalArgumentException - if we parse both compound units and "-and-", since mixed compound units are not yet supported - TODO(CLDR-13701).
      • hasNext

        private boolean hasNext()