jdsl.core.api
Interface PositionIterator

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

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:
JDSL 2.1.1
Author:
Mark Handy

Method Summary
 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 NoSuchElementException
Returns:
Next position to consider
Throws:
NoSuchElementException - if iterator has moved past the last position to be seen

position

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

element

public Object element()
               throws NoSuchElementException
Shortcut for position().element(). Same as the inherited object() method.

Returns:
Element of the position that would be returned by position()
Throws:
NoSuchElementException - When the iterator is in its initial, before-the-first-position state