Class CharsTrie.Iterator

  • All Implemented Interfaces:
    java.util.Iterator<CharsTrie.Entry>
    Enclosing class:
    CharsTrie

    public static final class CharsTrie.Iterator
    extends java.lang.Object
    implements java.util.Iterator<CharsTrie.Entry>
    Iterator for all of the (string, value) pairs in a CharsTrie.
    • Field Detail

      • chars_

        private java.lang.CharSequence chars_
      • pos_

        private int pos_
      • initialPos_

        private int initialPos_
      • remainingMatchLength_

        private int remainingMatchLength_
      • initialRemainingMatchLength_

        private int initialRemainingMatchLength_
      • skipValue_

        private boolean skipValue_
      • str_

        private java.lang.StringBuilder str_
      • maxLength_

        private int maxLength_
      • stack_

        private java.util.ArrayList<java.lang.Long> stack_
    • Constructor Detail

      • Iterator

        private Iterator​(java.lang.CharSequence trieChars,
                         int offset,
                         int remainingMatchLength,
                         int maxStringLength)
    • Method Detail

      • reset

        public CharsTrie.Iterator reset()
        Resets this iterator to its initial state.
        Returns:
        this
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<CharsTrie.Entry>
        Returns:
        true if there are more elements.
      • next

        public CharsTrie.Entry next()
        Finds the next (string, value) pair if there is one. If the string is truncated to the maximum length and does not have a real value, then the value is set to -1. In this case, this "not a real value" is indistinguishable from a real value of -1.
        Specified by:
        next in interface java.util.Iterator<CharsTrie.Entry>
        Returns:
        An Entry with the string and value of the next element.
        Throws:
        java.util.NoSuchElementException - - iteration has no more elements.
      • remove

        public void remove()
        Iterator.remove() is not supported.
        Specified by:
        remove in interface java.util.Iterator<CharsTrie.Entry>
        Throws:
        java.lang.UnsupportedOperationException - (always)
      • branchNext

        private int branchNext​(int pos,
                               int length)