jdsl.core.api
Interface PositionIterator

All Superinterfaces:
ObjectIterator
All Known Subinterfaces:
EdgeIterator, FaceIterator, VertexIterator
All Known Implementing Classes:
ArrayPositionIterator, InOrderIterator, PostOrderIterator, PreOrderIterator

public interface PositionIterator
extends ObjectIterator

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

Version:
$Id: PositionIterator.java,v 1.3 1999/08/02 21:15:50 mdh Exp $
Author:
Mark Handy

Method Summary
 java.lang.Object element()
          Shortcut for position().element().
 Position nextPosition()
           
 Position position()
           
 
Methods inherited from interface jdsl.core.api.ObjectIterator
hasNext, nextObject, object, reset
 

Method Detail

nextPosition

public Position nextPosition()
                      throws java.util.NoSuchElementException
Returns:
Next position to consider
Throws:
java.util.NoSuchElementException - if iterator has moved past the last position to be seen

position

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

element

public java.lang.Object element()
                         throws java.util.NoSuchElementException
Shortcut for position().element(). Same as the inherited object() method.
Returns:
Element of the position that would be returned by position()
Throws:
java.util.NoSuchElementException - When the iterator is in its initial, before-the-first-position state