gishur.core
Class ArrayEnumeration

java.lang.Object
  |
  +--gishur.core.ArrayEnumeration
All Implemented Interfaces:
java.util.Enumeration

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

The ArrayEnumeration enumerates arrays (of Objects) via the Enumeration interface of java.util.

Version:
1.0
Author:
Thomas Wolf

Constructor Summary
ArrayEnumeration(java.lang.Object[] array)
          Creates an ArrayEnumeration, that enumerates the given array.
ArrayEnumeration(java.lang.Object[] array, int start, int length)
          Creates an ArrayEnumeration, that enumerates the given sub-array.
 
Method Summary
 boolean hasMoreElements()
          Tests if this enumeration contains more elements.
 java.lang.Object nextElement()
          Returns the next element of this enumeration if this enumeration object has at least one more element to provide.
 java.lang.String toString()
          Overrides java.lang.Object.toString().
static java.lang.String toString(java.lang.Object[] a)
          Converts an array a to a string using commas "," to separate array elements.
static java.lang.String toString(java.lang.Object[] a, int start, int len)
          Converts a subarray starting at start with length len to a string using commas "," to separate array elements.
static java.lang.String toString(java.lang.Object[] a, int start, int len, java.lang.String separator)
          Converts a subarray starting at start with length len to a string using the separation string separator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayEnumeration

public ArrayEnumeration(java.lang.Object[] array,
                        int start,
                        int length)
Creates an ArrayEnumeration, that enumerates the given sub-array. If the given length is less than 0, the array will be extended to the end.
Parameters:
array - the array to enumerate
start - the start index
length - the subarray length (if <=0, then to the end of the array)
Throws:
NullPointerException - if the array is null.

ArrayEnumeration

public ArrayEnumeration(java.lang.Object[] array)
Creates an ArrayEnumeration, that enumerates the given array.
Parameters:
array - the array to enumerate
Throws:
NullPointerException - if the array is null.
Method Detail

toString

public java.lang.String toString()
Overrides java.lang.Object.toString().
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

toString

public static final java.lang.String toString(java.lang.Object[] a,
                                              int start,
                                              int len,
                                              java.lang.String separator)
Converts a subarray starting at start with length len to a string using the separation string separator.
Parameters:
a - object array
start - start index
len - length of subarray
separator - separation string between elements
Returns:
string representation of the subarray

toString

public static final java.lang.String toString(java.lang.Object[] a,
                                              int start,
                                              int len)
Converts a subarray starting at start with length len to a string using commas "," to separate array elements.
Parameters:
a - object array
Returns:
string representation of the array a

toString

public static final java.lang.String toString(java.lang.Object[] a)
Converts an array a to a string using commas "," to separate array elements.
Parameters:
a - object array
Returns:
string representation of the array a

hasMoreElements

public boolean hasMoreElements()
Tests if this enumeration contains more elements.
Specified by:
hasMoreElements in interface java.util.Enumeration
Returns:
true if and only if this enumeration object contains at least one more element to provide; false otherwise.

nextElement

public java.lang.Object nextElement()
Returns the next element of this enumeration if this enumeration object has at least one more element to provide.
Specified by:
nextElement in interface java.util.Enumeration
Returns:
the next element of this enumeration.
Throws:
java.util.NoSuchElementException - if no more elements exist.