Class UCharacterNameIterator

  • All Implemented Interfaces:
    ValueIterator

    class UCharacterNameIterator
    extends java.lang.Object
    implements ValueIterator

    Class enabling iteration of the codepoints and their names.

    Result of each iteration contains a valid codepoint that has valid name.

    See UCharacter.getNameIterator() for an example of use.

    Since:
    release 2.1, March 5 2002
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean iterateExtended​(ValueIterator.Element result, int limit)
      Iterate extended names.
      private boolean iterateGroup​(ValueIterator.Element result, int limit)
      Group name iteration, iterate all the names in the current 32-group and returns the first codepoint that has a valid name.
      private boolean iterateSingleGroup​(ValueIterator.Element result, int limit)
      Group name iteration, iterate all the names in the current 32-group and returns the first codepoint that has a valid name.
      boolean next​(ValueIterator.Element element)
      Gets the next result for this iteration and returns true if we are not at the end of the iteration, false otherwise.
      void reset()
      Resets the iterator to start iterating from the integer index UCharacter.MIN_VALUE or X if a setRange(X, Y) has been called previously.
      void setRange​(int start, int limit)
      Restricts the range of integers to iterate and resets the iteration to begin at the index argument start.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • m_choice_

        private int m_choice_
        Name choice
      • m_start_

        private int m_start_
        Start iteration range
      • m_limit_

        private int m_limit_
        End + 1 iteration range
      • m_current_

        private int m_current_
        Current codepoint
      • m_groupIndex_

        private int m_groupIndex_
        Group index
      • m_algorithmIndex_

        private int m_algorithmIndex_
        Algorithm index
      • GROUP_OFFSETS_

        private static char[] GROUP_OFFSETS_
        Group use
      • GROUP_LENGTHS_

        private static char[] GROUP_LENGTHS_
    • Constructor Detail

      • UCharacterNameIterator

        protected UCharacterNameIterator​(UCharacterName name,
                                         int choice)
        Constructor
        Parameters:
        name - name data
        choice - name choice from the class com.ibm.icu.lang.UCharacterNameChoice
    • Method Detail

      • next

        public boolean next​(ValueIterator.Element element)

        Gets the next result for this iteration and returns true if we are not at the end of the iteration, false otherwise.

        If the return boolean is a false, the contents of elements will not be updated.

        Specified by:
        next in interface ValueIterator
        Parameters:
        element - for storing the result codepoint and name
        Returns:
        true if we are not at the end of the iteration, false otherwise.
        See Also:
        ValueIterator.Element
      • reset

        public void reset()

        Resets the iterator to start iterating from the integer index UCharacter.MIN_VALUE or X if a setRange(X, Y) has been called previously.

        Specified by:
        reset in interface ValueIterator
      • setRange

        public void setRange​(int start,
                             int limit)

        Restricts the range of integers to iterate and resets the iteration to begin at the index argument start.

        If setRange(start, end) is not performed before next(element) is called, the iteration will start from the integer index UCharacter.MIN_VALUE and end at UCharacter.MAX_VALUE.

        If this range is set outside the range of UCharacter.MIN_VALUE and UCharacter.MAX_VALUE, next(element) will always return false.

        Specified by:
        setRange in interface ValueIterator
        Parameters:
        start - first integer in range to iterate
        limit - 1 integer after the last integer in range
        Throws:
        java.lang.IllegalArgumentException - thrown when attempting to set an illegal range. E.g limit <= start
      • iterateSingleGroup

        private boolean iterateSingleGroup​(ValueIterator.Element result,
                                           int limit)
        Group name iteration, iterate all the names in the current 32-group and returns the first codepoint that has a valid name.
        Parameters:
        result - stores the result codepoint and name
        limit - last codepoint + 1 in range to search
        Returns:
        false if a codepoint with a name is found in group and we can bail from further iteration, true to continue on with the iteration
      • iterateGroup

        private boolean iterateGroup​(ValueIterator.Element result,
                                     int limit)
        Group name iteration, iterate all the names in the current 32-group and returns the first codepoint that has a valid name.
        Parameters:
        result - stores the result codepoint and name
        limit - last codepoint + 1 in range to search
        Returns:
        false if a codepoint with a name is found in group and we can bail from further iteration, true to continue on with the iteration
      • iterateExtended

        private boolean iterateExtended​(ValueIterator.Element result,
                                        int limit)
        Iterate extended names.
        Parameters:
        result - stores the result codepoint and name
        limit - last codepoint + 1 in range to search
        Returns:
        false if a codepoint with a name is found and we can bail from further iteration, true to continue on with the iteration (this will always be false for valid codepoints)