V - the type of elementspublic class SelectGenotype<V> extends IntegerGenotype
The SelectGenotype selects for each index an element from the given
list.
Example problem: Draw five times from an urn which contains three balls and
return the ball after each draw.
Example usage:
Example instance: [0=ball3, 1=ball2, 2=ball2, 3=ball1, 4=ball3]SelectGenotype<Ball> genotype = new SelectGenotype<Ball>(Arrays.asList(ball1, ball2, ball3)); genotype.init(new Random(), 5);
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<V> |
values |
bounds| Constructor and Description |
|---|
SelectGenotype(java.util.List<V> values)
Constructs a
SelectGenotype. |
SelectGenotype(V[] values)
Constructs a
SelectGenotype. |
| Modifier and Type | Method and Description |
|---|---|
V |
getValue(int index)
Returns the element value of the index.
|
<G extends Genotype> |
newInstance()
Constructs a new (empty) instance of this
Genotype. |
getLowerBound, getUpperBound, initadd, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizefinalize, getClass, notify, notifyAll, wait, wait, waitadd, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArrayprotected final java.util.List<V> values
public SelectGenotype(java.util.List<V> values)
SelectGenotype.values - the elements to be selectedpublic SelectGenotype(V[] values)
SelectGenotype.values - the elements to be selectedpublic V getValue(int index)
index - the indexpublic <G extends Genotype> G newInstance()
GenotypeGenotype.newInstance in interface GenotypenewInstance in class IntegerGenotypeG - the type of genotype for an implicit cast