structure
Class DoublyLinkedListIterator

java.lang.Object
  extended by structure.AbstractIterator
      extended by structure.DoublyLinkedListIterator
All Implemented Interfaces:
Enumeration, Iterator

public class DoublyLinkedListIterator
extends AbstractIterator

A private iterator for traversing a doubly linked list.


Constructor Summary
DoublyLinkedListIterator(DoublyLinkedListElement h)
          Construct an iterator over a doubly linked list hanging from head.
DoublyLinkedListIterator(DoublyLinkedListElement headDummy, DoublyLinkedListElement tailDummy)
           
 
Method Summary
 Object get()
          Get reference to value that is current.
 boolean hasNext()
          Determine if there are more elements to be considered.
 Object next()
          Returns reference to the current element, then increments iterator.
 void reset()
          Reset the iterator to the head of the list.
 
Methods inherited from class structure.AbstractIterator
hasMoreElements, nextElement, remove, value
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoublyLinkedListIterator

public DoublyLinkedListIterator(DoublyLinkedListElement h)
Construct an iterator over a doubly linked list hanging from head.

Parameters:
h - The head of the list to be traversed.

DoublyLinkedListIterator

public DoublyLinkedListIterator(DoublyLinkedListElement headDummy,
                                DoublyLinkedListElement tailDummy)
Method Detail

reset

public void reset()
Reset the iterator to the head of the list.

Specified by:
reset in class AbstractIterator

hasNext

public boolean hasNext()
Determine if there are more elements to be considered.

Specified by:
hasNext in interface Iterator
Specified by:
hasNext in class AbstractIterator
Returns:
True iff there are more elements to be considered.
See Also:
AbstractIterator.hasMoreElements()

next

public Object next()
Returns reference to the current element, then increments iterator.

Specified by:
next in interface Iterator
Specified by:
next in class AbstractIterator
Returns:
Reference to element that was current before increment.
See Also:
AbstractIterator.hasMoreElements(), AbstractIterator.value()

get

public Object get()
Get reference to value that is current.

Specified by:
get in class AbstractIterator
Returns:
A reference to the value that is current.