jdsl.core.ref
Class ArrayPositionIterator

java.lang.Object
  |
  +--jdsl.core.ref.AbstractArrayIterator
        |
        +--jdsl.core.ref.ArrayPositionIterator
All Implemented Interfaces:
ObjectIterator, PositionIterator

public class ArrayPositionIterator
extends AbstractArrayIterator
implements PositionIterator

An array-based positional iterator.

Version:
$Id: ArrayPositionIterator.java,v 1.5 2000/11/05 23:01:29 lv Exp $
Author:
Mike Boilen (mgb), Benoit Hudson (bh), Ryan Shaun Baker (rsb), Luca Vismara (lv), Mark Handy

Field Summary
protected  Position[] posArray_
           
 
Fields inherited from class jdsl.core.ref.AbstractArrayIterator
iCurrentIndex_, iLastIndex_
 
Constructor Summary
ArrayPositionIterator(Position[] array)
          Uses the array to store the elements that this iterator traverses.
ArrayPositionIterator(Position[] array, int num)
          Traverses through the array, which is not copied, until num elements have been returned.
 
Method Summary
 Position nextPosition()
           
 Position position()
           
 
Methods inherited from class jdsl.core.ref.AbstractArrayIterator
checkBeforeStart, element, hasNext, nextAccessor, nextObject, object, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jdsl.core.api.PositionIterator
element
 
Methods inherited from interface jdsl.core.api.ObjectIterator
hasNext, nextObject, object, reset
 

Field Detail

posArray_

protected Position[] posArray_
Constructor Detail

ArrayPositionIterator

public ArrayPositionIterator(Position[] array)
Uses the array to store the elements that this iterator traverses. The array is NOT copied.
Parameters:
array - The elements that this iterator should traverse.

ArrayPositionIterator

public ArrayPositionIterator(Position[] array,
                             int num)
                      throws BoundaryViolationException
Traverses through the array, which is not copied, until num elements have been returned.
Method Detail

position

public Position position()
                  throws java.util.NoSuchElementException
Specified by:
position in interface PositionIterator
Following copied from interface: jdsl.core.api.PositionIterator
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

nextPosition

public Position nextPosition()
                      throws java.util.NoSuchElementException
Specified by:
nextPosition in interface PositionIterator
Following copied from interface: jdsl.core.api.PositionIterator
Returns:
Next position to consider
Throws:
java.util.NoSuchElementException - if iterator has moved past the last position to be seen