edu.rice.comp211.laundry.iterator
Interface ReadIteratorI<T>

All Known Subinterfaces:
BiIteratorI<T>, IteratorI<T>

public interface ReadIteratorI<T>

An iterator that traverses a collection of objects of type T without modifying it. When an iterator traverses a list, the list behaves as if it is circular with a dummy element between the last and first elements.


Method Summary
 boolean atEnd()
           
 boolean atStart()
           
 T currentItem()
           
 void first()
          Moves cursor to first element of the collection.
 void next()
          Moves cursor to next element of the collection.
 

Method Detail

first

void first()
Moves cursor to first element of the collection. Places the cursor on dummy element if collection is empty.


next

void next()
Moves cursor to next element of the collection. If current is the last element (atLast() == true) on entry, moves cursor to dummy element following the last element.


atEnd

boolean atEnd()
Returns:
true if the cursor is pointing to dummy element following the collection.

atStart

boolean atStart()
Returns:
true if the cursor is pointing to the first element of the collection. atEnd() => ! atStart().

currentItem

T currentItem()
Returns:
the current element (pointed to by the cursor).
Throws:
IteratorException - if the cursor is pointing to the dummy element.