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

java.lang.Object
  extended by nz.ac.waikato.jdsl.core.ref.AbstractArrayIterator
Direct Known Subclasses:
ArrayLocatorIterator, ArrayPositionIterator

public abstract class AbstractArrayIterator
extends java.lang.Object

A class abstracting the common parts of ArrayPositionIterator and ArrayLocatorIterator.

Version:
JDSL 2.1.1
Author:
Luca Vismara (lv)

Field Summary
protected  int iCurrentIndex_
           
protected  int iLastIndex_
           
 
Constructor Summary
protected AbstractArrayIterator(Accessor[] array)
          Uses the array to store the elements that this iterator traverses.
protected AbstractArrayIterator(Accessor[] array, int num)
          Traverses through the array until the first num elements have been returned.
 
Method Summary
protected  void checkBeforeStart()
           
 java.lang.Object element()
           
 boolean hasNext()
           
protected  Accessor nextAccessor()
           
 java.lang.Object nextObject()
          Takes O(1) time
 java.lang.Object object()
          Takes O(1) time
 void reset()
          Takes O(1) time
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iCurrentIndex_

protected int iCurrentIndex_

iLastIndex_

protected int iLastIndex_
Constructor Detail

AbstractArrayIterator

protected AbstractArrayIterator(Accessor[] 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.

AbstractArrayIterator

protected AbstractArrayIterator(Accessor[] array,
                                int num)
                         throws BoundaryViolationException
Traverses through the array until the first num elements have been returned. The array is NOT copied.

Throws:
BoundaryViolationException
Method Detail

hasNext

public boolean hasNext()

element

public java.lang.Object element()
                         throws java.util.NoSuchElementException
Throws:
java.util.NoSuchElementException

nextObject

public java.lang.Object nextObject()
Takes O(1) time


object

public java.lang.Object object()
                        throws java.util.NoSuchElementException
Takes O(1) time

Throws:
java.util.NoSuchElementException

reset

public void reset()
Takes O(1) time


checkBeforeStart

protected void checkBeforeStart()
                         throws java.util.NoSuchElementException
Throws:
java.util.NoSuchElementException

nextAccessor

protected Accessor nextAccessor()


Copyright © 2009 ModelJUnit Project. All Rights Reserved.