Class Trie2.Trie2Iterator

  • All Implemented Interfaces:
    java.util.Iterator<Trie2.Range>
    Enclosing class:
    Trie2

    class Trie2.Trie2Iterator
    extends java.lang.Object
    implements java.util.Iterator<Trie2.Range>
    Implementation class for an iterator over a Trie2. Iteration over a Trie2 first returns all of the ranges that are indexed by code points, then returns the special alternate values for the lead surrogates
    • Field Detail

      • nextStart

        private int nextStart
      • limitCP

        private int limitCP
      • doingCodePoints

        private boolean doingCodePoints
      • doLeadSurrogates

        private boolean doLeadSurrogates
    • Method Detail

      • next

        public Trie2.Range next()
        The main next() function for Trie2 iterators
        Specified by:
        next in interface java.util.Iterator<Trie2.Range>
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<Trie2.Range>
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<Trie2.Range>
      • rangeEndLS

        private int rangeEndLS​(char startingLS)
        Find the last lead surrogate in a contiguous range with the same Trie2 value as the input character. Use the alternate Lead Surrogate values from the Trie2, not the code-point values. Note: Trie2_16 and Trie2_32 override this implementation with optimized versions, meaning that the implementation here is only being used with Trie2Writable. The code here is logically correct with any type of Trie2, however.
        Parameters:
        c - The character to begin with.
        Returns:
        The last contiguous character with the same value.