org.openbp.common.util.iterator
Class ArrayEnumerator

java.lang.Object
  extended by org.openbp.common.util.iterator.ArrayEnumerator
All Implemented Interfaces:
java.util.Enumeration

public class ArrayEnumerator
extends java.lang.Object
implements java.util.Enumeration

Array enumerator class. Implements the Enumerator interface to get an enumerator for objects contained in an array.

Author:
Heiko Erhardt

Constructor Summary
ArrayEnumerator(java.lang.Object[] array)
          Default constructor.
ArrayEnumerator(java.lang.Object[] array, int start, int count)
          Constructor.
 
Method Summary
 boolean hasMoreElements()
          Checks if there are more array elements.
 java.lang.Object nextElement()
          Gets the current array element and advances the current position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayEnumerator

public ArrayEnumerator(java.lang.Object[] array)
Default constructor. The enumerator will enumerate all items in the array.

Parameters:
array - Array to enumerate

ArrayEnumerator

public ArrayEnumerator(java.lang.Object[] array,
                       int start,
                       int count)
Constructor. The enumerator will enumerate all items in the array, starting with index 'start' and ending with index 'start' + 'count'.

Parameters:
array - Array to enumerate
start - Index of the first object to return
count - Number of objects to enumerate
Method Detail

hasMoreElements

public boolean hasMoreElements()
Checks if there are more array elements.

Specified by:
hasMoreElements in interface java.util.Enumeration

nextElement

public java.lang.Object nextElement()
Gets the current array element and advances the current position.

Specified by:
nextElement in interface java.util.Enumeration
Returns:
The object at the current position


Copyright © 2011. All Rights Reserved.