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, wait
as, getGene, newInstance, stream
forEach, spliterator
instances, newInstance
protected final 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)
Chromosome
getGene
in interface Chromosome<G extends Gene<?,G>>
index
- The gene index.public ISeq<G> toSeq()
Chromosome
toSeq
in interface Chromosome<G extends Gene<?,G>>
public boolean isValid()
Verifiable
isValid
in interface Verifiable
public int length()
Chromosome
length
in interface Chromosome<G extends Gene<?,G>>
© 2007-2017 Franz Wilhelmstötter (2017-11-16 19:35)