jdsl.core.ref
Class AbstractArrayIterator

java.lang.Object
  extended byjdsl.core.ref.AbstractArrayIterator
Direct Known Subclasses:
ArrayLocatorIterator, ArrayPositionIterator

public abstract class AbstractArrayIterator
extends 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()
           
 Object element()
           
 boolean hasNext()
           
protected  Accessor nextAccessor()
           
 Object nextObject()
          Takes O(1) time
 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.

Method Detail

hasNext

public boolean hasNext()

element

public Object element()
               throws NoSuchElementException
Throws:
NoSuchElementException

nextObject

public Object nextObject()
Takes O(1) time


object

public Object object()
              throws NoSuchElementException
Takes O(1) time

Throws:
NoSuchElementException

reset

public void reset()
Takes O(1) time


checkBeforeStart

protected void checkBeforeStart()
                         throws NoSuchElementException
Throws:
NoSuchElementException

nextAccessor

protected Accessor nextAccessor()