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:
AbstractTreeChromosome,AnyChromosome,BigIntegerChromosome,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
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractChromosome(ISeq<? extends G> genes) Create a newAbstractChromosomefrom the givengenesarray. -
Method Summary
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.jenetics.util.BaseSeq
forEach, isEmpty, iterator, listIterator, nonEmpty, spliterator, streamMethods inherited from interface io.jenetics.Chromosome
as, gene, newInstanceMethods 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 isnullthe validation state hasn't been calculated yet.
-
-
Constructor Details
-
AbstractChromosome
Create a newAbstractChromosomefrom the givengenesarray.- 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:BaseSeqReturn the value at the givenindex. -
length
Description copied from interface:BaseSeqReturn the length of this sequence. Once the sequence is created, the length can't be changed. -
isValid
Description copied from interface:VerifiableCheck if this object is valid.- Specified by:
isValidin interfaceChromosome<G extends Gene<?,G>> - Specified by:
isValidin interfaceVerifiable- Returns:
- true if this object is valid, false otherwise.
-
hashCode
-
equals
-
toString
-