|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.cilib.cooperative.algorithmiterators.SequentialAlgorithmIterator<E>
E
- The Algorithm
type.public class SequentialAlgorithmIterator<E extends Algorithm>
Iterate through a list of Algorithm
s in a sequential order.
Field Summary | |
---|---|
protected List<E> |
algorithms
|
protected int |
index
|
Constructor Summary | |
---|---|
SequentialAlgorithmIterator()
Construct a new SequentialAlgorithmIterator . |
|
SequentialAlgorithmIterator(List<E> a)
Construct a new SequentialAlgorithmIterator for the supplied list. |
|
SequentialAlgorithmIterator(SequentialAlgorithmIterator rhs)
Construct a new SequentialAlgorithmIterator from the supplied one. |
Method Summary | |
---|---|
void |
add(E algorithm)
Inserts the specified element into the list. |
E |
current()
Returns the element at the current index. |
SequentialAlgorithmIterator<E> |
getClone()
Clone this list iterator and return it. |
boolean |
hasNext()
Returns true if this list iterator has more elements when traversing the list in the forward direction. |
boolean |
hasPrevious()
Returns true if this list iterator has more elements when traversing the list in the reverse direction. |
E |
next()
Gets the next element in the list. |
int |
nextIndex()
Returns the index of the element that would be returned by a subsequent call to next. |
E |
previous()
Gets the previous element in the list. |
int |
previousIndex()
Returns the index of the element that would be returned by a subsequent call to previous. |
void |
remove()
Removes from the list the last element that was returned by next or previous. |
void |
set(E algorithm)
Replaces the last element returned by next or previous with the specified element. |
void |
setAlgorithms(List<E> a)
Sets the list that will be iterated through. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected List<E extends Algorithm> algorithms
protected int index
Constructor Detail |
---|
public SequentialAlgorithmIterator()
SequentialAlgorithmIterator
.
public SequentialAlgorithmIterator(List<E> a)
SequentialAlgorithmIterator
for the supplied list.
a
- the list that will be iterated through sequentially.public SequentialAlgorithmIterator(SequentialAlgorithmIterator rhs)
SequentialAlgorithmIterator
from the supplied one.
rhs
- the SequentialAlgorithmIterator
that should be copied.Method Detail |
---|
public SequentialAlgorithmIterator<E> getClone()
getClone
in interface AlgorithmIterator<E extends Algorithm>
getClone
in interface Cloneable
Object.clone()
public E next()
next
in interface Iterator<E extends Algorithm>
next
in interface ListIterator<E extends Algorithm>
NoSuchElementException
- when the current index is already at the end of the list.public E previous()
previous
in interface ListIterator<E extends Algorithm>
NoSuchElementException
- when the current index is already at the beginning of the list.public boolean hasNext()
hasNext
in interface Iterator<E extends Algorithm>
hasNext
in interface ListIterator<E extends Algorithm>
public boolean hasPrevious()
hasPrevious
in interface ListIterator<E extends Algorithm>
public int nextIndex()
nextIndex
in interface ListIterator<E extends Algorithm>
public int previousIndex()
previousIndex
in interface ListIterator<E extends Algorithm>
public void add(E algorithm)
add
in interface ListIterator<E extends Algorithm>
algorithm
- The Algorithm to add.public void remove()
remove
in interface Iterator<E extends Algorithm>
remove
in interface ListIterator<E extends Algorithm>
IndexOutOfBoundsException
- when the current element index is past the beginning or end of the list.public void set(E algorithm)
set
in interface ListIterator<E extends Algorithm>
algorithm
- The element with which to replace the last element returned by next or previous.public void setAlgorithms(List<E> a)
setAlgorithms
in interface AlgorithmIterator<E extends Algorithm>
a
- The list of Algorithms to set.public E current()
current
in interface AlgorithmIterator<E extends Algorithm>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |