G - the gene type.public abstract class AbstractChromosome<G extends Gene<?,G>> extends Object implements Chromosome<G>, RandomAccess, Serializable
_genes is not
null and the length of the genes > 0.| Modifier and Type | Field and Description |
|---|---|
protected ISeq<G> |
_genes
Array of genes which forms the chromosome.
|
protected Boolean |
_valid
Indicates whether this chromosome is valid or not.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractChromosome(ISeq<? extends G> genes)
Create a new
AbstractChromosome from the given genes
array. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
G |
getGene(int index)
Return the gene on the specified index.
|
int |
hashCode() |
boolean |
isValid()
Check if this object is valid.
|
Iterator<G> |
iterator() |
int |
length()
Returns the length of the Chromosome.
|
ISeq<G> |
toSeq()
Return an unmodifiable sequence of the genes of this chromosome.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitas, getGene, newInstance, streamforEach, spliteratorinstances, newInstanceprotected transient ISeq<G extends Gene<?,G>> _genes
protected AbstractChromosome(ISeq<? extends G> genes)
AbstractChromosome from the given genes
array.genes - the genes that form the chromosome.NullPointerException - if the given gene array is null.IllegalArgumentException - if the length of the gene sequence is
empty.public G getGene(int index)
ChromosomegetGene in interface Chromosome<G extends Gene<?,G>>index - The gene index.public ISeq<G> toSeq()
ChromosometoSeq in interface Chromosome<G extends Gene<?,G>>public boolean isValid()
VerifiableisValid in interface Verifiablepublic int length()
Chromosomelength in interface Chromosome<G extends Gene<?,G>>© 2007-2017 Franz Wilhelmstötter (2017-04-28 16:50)