T - the element type of the Iteratorpublic class Enumerator<T> extends java.lang.Object implements java.util.Iterator<Enumerated<T>>, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected int |
m_Index
the index.
|
protected java.util.Iterator<T> |
m_Iterator
the base iterable object.
|
protected int |
m_Start
the starting index.
|
protected int |
m_Step
the step size.
|
| Constructor and Description |
|---|
Enumerator(java.lang.Iterable<T> iterable)
Initializes the iterator.
|
Enumerator(java.lang.Iterable<T> iterable,
int start)
Initializes the iterator.
|
Enumerator(java.lang.Iterable<T> iterable,
int start,
int step)
Initializes the iterator.
|
Enumerator(java.util.Iterator<T> iterator)
Initializes the iterator.
|
Enumerator(java.util.Iterator<T> iterator,
int start)
Initializes the iterator.
|
Enumerator(java.util.Iterator<T> iterator,
int start,
int step)
Initializes the iterator.
|
Enumerator(T[] array)
Initializes the array.
|
Enumerator(T[] array,
int start)
Initializes the array.
|
Enumerator(T[] array,
int start,
int step)
Initializes the array.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getStart()
Returns the starting index.
|
int |
getStep()
Returns the step size between indices of elements.
|
boolean |
hasNext()
Whether there is another element available.
|
Enumerated<T> |
next()
Returns the next element wrapper.
|
java.lang.String |
toString()
Returns a simple string representation of the wrapper.
|
protected java.util.Iterator<T> m_Iterator
protected int m_Index
protected int m_Start
protected int m_Step
public Enumerator(java.lang.Iterable<T> iterable)
iterable - the iterablepublic Enumerator(java.lang.Iterable<T> iterable, int start)
iterable - the iteratorstart - the starting indexpublic Enumerator(java.lang.Iterable<T> iterable, int start, int step)
iterable - the iteratorstart - the starting indexstep - the steps between indicespublic Enumerator(T[] array)
array - the arraypublic Enumerator(T[] array, int start)
array - the arraystart - the starting indexpublic Enumerator(T[] array, int start, int step)
array - the arraystart - the starting indexstep - the steps between indicespublic Enumerator(java.util.Iterator<T> iterator)
iterator - the iteratorpublic Enumerator(java.util.Iterator<T> iterator, int start)
iterator - the iteratorstart - the starting indexpublic Enumerator(java.util.Iterator<T> iterator, int start, int step)
iterator - the iteratorstart - the starting indexstep - the steps between indicespublic int getStart()
public int getStep()
public boolean hasNext()
hasNext in interface java.util.Iterator<Enumerated<T>>public Enumerated<T> next()
next in interface java.util.Iterator<Enumerated<T>>public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2019 University of Waikato, Hamilton, NZ. All Rights Reserved.