nz.ac.waikato.jdsl.core.ref
Class ArrayPositionIterator

java.lang.Object
  extended by nz.ac.waikato.jdsl.core.ref.AbstractArrayIterator
      extended by nz.ac.waikato.jdsl.core.ref.ArrayPositionIterator
All Implemented Interfaces:
ObjectIterator, PositionIterator

public class ArrayPositionIterator
extends AbstractArrayIterator
implements PositionIterator

An array-based positional iterator.

Version:
JDSL 2.1.1
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 nz.ac.waikato.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 nz.ac.waikato.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 nz.ac.waikato.jdsl.core.api.PositionIterator
element
 
Methods inherited from interface nz.ac.waikato.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.

Throws:
BoundaryViolationException
Method Detail

position

public Position position()
                  throws java.util.NoSuchElementException
Specified by:
position in interface 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
Returns:
Next position to consider
Throws:
java.util.NoSuchElementException - if iterator has moved past the last position to be seen


Copyright © 2009 ModelJUnit Project. All Rights Reserved.