Class TernaryTree.Iterator

  • All Implemented Interfaces:
    java.util.Enumeration
    Enclosing class:
    TernaryTree

    private class TernaryTree.Iterator
    extends java.lang.Object
    implements java.util.Enumeration
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int cur
      current node index
      private java.lang.String curkey
      current key
      private java.lang.StringBuffer ks
      key stack implemented with a StringBuffer
      private java.util.Stack ns
      Node stack
    • Constructor Summary

      Constructors 
      Constructor Description
      Iterator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      char getValue()  
      boolean hasMoreElements()  
      java.lang.Object nextElement()  
      private void rewind()  
      private int run()
      traverse the tree to find next key
      private int up()
      traverse upwards
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Enumeration

        asIterator
    • Field Detail

      • cur

        private int cur
        current node index
      • curkey

        private java.lang.String curkey
        current key
      • ns

        private final java.util.Stack ns
        Node stack
      • ks

        private final java.lang.StringBuffer ks
        key stack implemented with a StringBuffer
    • Constructor Detail

      • Iterator

        public Iterator()
    • Method Detail

      • rewind

        private void rewind()
      • nextElement

        public java.lang.Object nextElement()
        Specified by:
        nextElement in interface java.util.Enumeration
      • getValue

        public char getValue()
      • hasMoreElements

        public boolean hasMoreElements()
        Specified by:
        hasMoreElements in interface java.util.Enumeration
      • up

        private int up()
        traverse upwards
      • run

        private int run()
        traverse the tree to find next key