java.lang.Object
io.jenetics.AbstractChromosome<G>
- Type Parameters:
G
- the gene type.
- All Implemented Interfaces:
Chromosome<G>
,BaseSeq<G>
,Factory<Chromosome<G>>
,Verifiable
,Iterable<G>
,RandomAccess
- Direct Known Subclasses:
AnyChromosome
,CharacterChromosome
,DoubleChromosome
,IntegerChromosome
,LongChromosome
,PermutationChromosome
public abstract class AbstractChromosome<G extends Gene<?,G>>
extends Object
implements Chromosome<G>
The abstract base implementation of the Chromosome interface. The implementors
of this class must assure that the protected member
_genes
is not
null
and the length of the genes
> 0.- Since:
- 1.0
- Version:
- 5.2
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractChromosome
(ISeq<? extends G> genes) Create a newAbstractChromosome
from the givengenes
array. -
Method Summary
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.jenetics.util.BaseSeq
forEach, isEmpty, iterator, listIterator, nonEmpty, spliterator, stream
Methods inherited from interface io.jenetics.Chromosome
as, gene, newInstance
Methods inherited from interface io.jenetics.util.Factory
instances, newInstance
-
Field Details
-
_genes
Array of genes which forms the chromosome. This array must be initialized by the derived classes. -
_valid
Indicates whether this chromosome is valid or not. If the variable isnull
the validation state hasn't been calculated yet.
-
-
Constructor Details
-
AbstractChromosome
Create a newAbstractChromosome
from the givengenes
array.- Parameters:
genes
- the genes that form the chromosome.- Throws:
NullPointerException
- if the given gene array isnull
.IllegalArgumentException
- if the length of the gene sequence is empty.
-
-
Method Details
-
get
Description copied from interface:BaseSeq
Return the value at the givenindex
. -
length
Description copied from interface:BaseSeq
Return the length of this sequence. Once the sequence is created, the length can't be changed. -
isValid
Description copied from interface:Verifiable
Check if this object is valid.- Specified by:
isValid
in interfaceChromosome<G extends Gene<?,
G>> - Specified by:
isValid
in interfaceVerifiable
- Returns:
- true if this object is valid, false otherwise.
-
hashCode
-
equals
-
toString
-