|
||||||||||
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> net.sourceforge.cilib.cooperative.algorithmiterators.RandomAlgorithmIterator<E>
E
- The Algorithm type.public class RandomAlgorithmIterator<E extends Algorithm>
Iterate through a list of Algorithm
s in a random order. With this class it is possible
to move forwards and backwards in an iteration even though the order is random. To achieve this
an list of random indices are generated and the indices are used as the iteration order. The
iteration order will be different for every RandomAlgorithmIterator
object.
Field Summary |
---|
Fields inherited from class net.sourceforge.cilib.cooperative.algorithmiterators.SequentialAlgorithmIterator |
---|
algorithms, index |
Constructor Summary | |
---|---|
RandomAlgorithmIterator()
Construct a new RandomAlgorithmIterator . |
|
RandomAlgorithmIterator(List<E> a)
Construct a new RandomAlgorithmIterator for the supplied list. |
|
RandomAlgorithmIterator(RandomAlgorithmIterator rhs)
Construct a new RandomAlgorithmIterator 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. |
RandomAlgorithmIterator<E> |
getClone()
Clone this list iterator and return it. |
E |
next()
Gets the next element in the list. |
E |
previous()
Gets the previous element in the list. |
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 net.sourceforge.cilib.cooperative.algorithmiterators.SequentialAlgorithmIterator |
---|
hasNext, hasPrevious, nextIndex, previousIndex |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomAlgorithmIterator()
RandomAlgorithmIterator
.
public RandomAlgorithmIterator(List<E> a)
RandomAlgorithmIterator
for the supplied list. Generates the random
sequence of indices.
a
- the list that will be iterated through randomly.public RandomAlgorithmIterator(RandomAlgorithmIterator rhs)
RandomAlgorithmIterator
from the supplied one. This list iterator will
use the same random sequence of indices from the supplied RandomAlgorithmIterator
.
rhs
- the RandomAlgorithmIterator
that should be copied.Method Detail |
---|
public RandomAlgorithmIterator<E> getClone()
getClone
in interface AlgorithmIterator<E extends Algorithm>
getClone
in interface Cloneable
getClone
in class SequentialAlgorithmIterator<E extends Algorithm>
Object.clone()
public E next()
next
in interface Iterator<E extends Algorithm>
next
in interface ListIterator<E extends Algorithm>
next
in class SequentialAlgorithmIterator<E extends Algorithm>
{@link
- NoSuchElementException} when the current index is already at the end of the
list.public E previous()
previous
in interface ListIterator<E extends Algorithm>
previous
in class SequentialAlgorithmIterator<E extends Algorithm>
{@link
- NoSuchElementException} when the current index is already at the beginning of
the list.public void add(E algorithm)
add
in interface ListIterator<E extends Algorithm>
add
in class SequentialAlgorithmIterator<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>
remove
in class SequentialAlgorithmIterator<E extends Algorithm>
{@link
- 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>
set
in class SequentialAlgorithmIterator<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>
setAlgorithms
in class SequentialAlgorithmIterator<E extends Algorithm>
a
- The list of Algorithms to set.public E current()
current
in interface AlgorithmIterator<E extends Algorithm>
current
in class SequentialAlgorithmIterator<E extends Algorithm>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |