nz.ac.waikato.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
 java.lang.Object element()
          Shortcut for position().element().
 Position nextPosition()
           
 Position position()
           
 
Methods inherited from interface nz.ac.waikato.jdsl.core.api.ObjectIterator
hasNext, nextObject, object, reset
 

Method Detail

nextPosition

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

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

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


Copyright © 2009 ModelJUnit Project. All Rights Reserved.