public interface Chromosome<G extends Gene<?,G>> extends Verifiable, Iterable<G>, Factory<Chromosome<G>>
API Note:
Implementations of the Chromosome interface must be immutable
and guarantee an efficient random access (O(1)) to the genes.
| Modifier and Type | Method and Description |
|---|---|
default G |
getGene()
Return the first gene of this chromosome.
|
G |
getGene(int index)
Return the gene on the specified index.
|
int |
length()
Returns the length of the Chromosome.
|
Chromosome<G> |
newInstance(ISeq<G> genes)
A factory method which creates a new
Chromosome of specific type
and the given genes. |
default Stream<G> |
stream()
Returns a sequential
Stream of genes with this chromosome as
its source. |
ISeq<G> |
toSeq()
Return an unmodifiable sequence of the genes of this chromosome.
|
isValidforEach, iterator, spliteratorinstances, newInstanceChromosome<G> newInstance(ISeq<G> genes)
Chromosome of specific type
and the given genes.genes - the genes of the new chromosome. The given genes array is
not copied.Chromosome of the same type with the given genes.NullPointerException - if the given genes are null.IllegalArgumentException - if the length of the given gene sequence
is smaller than one.default G getGene()
G getGene(int index)
index - The gene index.IndexOutOfBoundsException - if the index is out of range
(index < 1 || index >= length()).int length()
ISeq<G> toSeq()
© 2007-2016 Franz Wilhelmstötter (2016-04-24 10:25)