jdsl.core.api
Interface ObjectIterator

All Known Subinterfaces:
EdgeIterator, FaceIterator, LocatorIterator, PositionIterator, VertexIterator
All Known Implementing Classes:
ArrayObjectIterator, AbstractGraph.OO_to_O_MergerIterator

public interface ObjectIterator

Iterator over a set of objects. No order of the objects is required by this interface, although order may be promised or required by users of the interface. Conceptually, the iterator starts out positioned before the first object to be considered. With each call to next(), the iterator skips over another object and returns the object skipped over, until the iterator is positioned after the last object. Note that NoSuchElementException indicates two different failure states: when the iterator is positioned before the first object, object() fails; when the iterator is positioned after the last object, next() fails.

Version:
$Id: ObjectIterator.java,v 1.4 1999/08/02 21:31:37 mdh Exp $
Author:
Mark Handy

Method Summary
 boolean hasNext()
           
 java.lang.Object nextObject()
           
 java.lang.Object object()
           
 void reset()
          Puts the iterator back in its initial, before-the-first state
 

Method Detail

hasNext

public boolean hasNext()
Returns:
Whether there is at least one object still unseen

nextObject

public java.lang.Object nextObject()
                            throws java.util.NoSuchElementException
Returns:
Next object to consider
Throws:
java.util.NoSuchElementException - if iterator has moved past the last object

object

public java.lang.Object object()
                        throws java.util.NoSuchElementException
Returns:
The object returned by the most recent next()
Throws:
java.util.NoSuchElementException - When the iterator is in its initial, before-the-first-object state

reset

public void reset()
Puts the iterator back in its initial, before-the-first state