Class DoubleMaxHeap.UnsortedIter

  • All Implemented Interfaces:
    DoubleHeap.UnsortedIter, Iter
    Enclosing class:
    DoubleMaxHeap

    private class DoubleMaxHeap.UnsortedIter
    extends java.lang.Object
    implements DoubleHeap.UnsortedIter
    Unsorted iterator - in heap order. Does not poll the heap.

    Use this class as follows:

     
     for (DoubleHeap.UnsortedIter iter = heap.unsortedIter(); iter.valid(); iter.next()) {
       doSomething(iter.get());
     }
     
     
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int pos
      Iterator position.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private UnsortedIter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      DoubleMaxHeap.UnsortedIter advance()
      Moves the iterator forward to the next entry.
      double get()
      Get the iterators current object.
      boolean valid()
      Returns true if the iterator currently points to a valid object.
      • Methods inherited from class java.lang.Object

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

      • pos

        protected int pos
        Iterator position.
    • Constructor Detail

      • UnsortedIter

        private UnsortedIter()
    • Method Detail

      • valid

        public boolean valid()
        Description copied from interface: Iter
        Returns true if the iterator currently points to a valid object.
        Specified by:
        valid in interface Iter
        Returns:
        a boolean value, whether the position is valid.
      • advance

        public DoubleMaxHeap.UnsortedIter advance()
        Description copied from interface: Iter
        Moves the iterator forward to the next entry.
        Specified by:
        advance in interface Iter
        Returns:
        The iterator itself.