public final class Genotype<G extends Gene<?,G>> extends Object implements Factory<Genotype<G>>, Iterable<Chromosome<G>>, Verifiable, Serializable
Genotype. It is the
 structural representative of an individual. This class is the encoded problem
 solution with one to many Chromosome.
 
 
 
 final Genotype<DoubleGene> genotype = Genotype.of(
     DoubleChromosome.of(0.0, 1.0, 8),
     DoubleChromosome.of(1.0, 2.0, 10),
     DoubleChromosome.of(0.0, 10.0, 9),
     DoubleChromosome.of(0.1, 0.9, 5)
 );DoubleGene has been chosen as
 gene type.| Modifier and Type | Method and Description | 
|---|---|
| boolean | equals(Object obj) | 
| G | get(int chromosomeIndex,
   int geneIndex)Return the gene from the given chromosome- and gene index. | 
| Chromosome<G> | getChromosome()Return the first chromosome. | 
| Chromosome<G> | getChromosome(int index)Return the chromosome at the given index. | 
| G | getGene() | 
| int | getNumberOfGenes()Return the number of genes this genotype consists of. | 
| int | hashCode() | 
| boolean | isValid()Test if this genotype is valid. | 
| Iterator<Chromosome<G>> | iterator() | 
| int | length()Getting the number of chromosomes of this genotype. | 
| Genotype<G> | newInstance()Return a new, random genotype by creating new, random chromosomes (calling
 the  Factory.newInstance()method) from the chromosomes of this
 genotype. | 
| static <G extends Gene<?,G>> | of(Chromosome<G> first,
  Chromosome<G>... rest)Create a new  Genotypefrom a given array ofChromosomes. | 
| static <G extends Gene<?,G>> | of(Factory<? extends Chromosome<G>> factory,
  int n)Create a new  Genotypewhich consists ofnchromosomes,
 which are created by the givenfactory. | 
| static <G extends Gene<?,G>> | of(Iterable<? extends Chromosome<G>> chromosomes)Create a new  Genotypefrom a given array ofchromosomes. | 
| ISeq<Chromosome<G>> | toSeq() | 
| String | toString() | 
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic Chromosome<G> getChromosome(int index)
index - Chromosome index.IndexOutOfBoundsException - if
         (index < 0 || index >= _length).public Chromosome<G> getChromosome()
 final Genotype<DoubleGene> gt = ...
 final Chromosome<DoubleGene> chromosome = gt.getChromosome(0);public G getGene()
Gene of the first Chromosome of this
 Genotype. This is a shortcut for
 
 final Genotype<DoubleGene> gt = ...
 final DoubleGene gene = gt.getChromosome(0).getGene(0);Gene of the first Chromosome of this
         Genotype.public G get(int chromosomeIndex, int geneIndex)
gt.getChromosome(chromosomeIndex).getGene(geneIndex).chromosomeIndex - the chromosome indexgeneIndex - the gene index within the chromosomeIndexOutOfBoundsException - if the given indexes are not within the
         allowed rangepublic ISeq<Chromosome<G>> toSeq()
public Iterator<Chromosome<G>> iterator()
public int length()
public int getNumberOfGenes()
public boolean isValid()
Chromosomes are valid.isValid in interface Verifiablepublic Genotype<G> newInstance()
Factory.newInstance() method) from the chromosomes of this
 genotype.@SafeVarargs public static <G extends Gene<?,G>> Genotype<G> of(Chromosome<G> first, Chromosome<G>... rest)
Genotype from a given array of Chromosomes.G - the gene typefirst - the first Chromosome of the Genotyperest - the rest of the genotypes chromosomes.Genotype from the given chromosomesNullPointerException - if chromosomes is null or
         one of its element.public static <G extends Gene<?,G>> Genotype<G> of(Factory<? extends Chromosome<G>> factory, int n)
Genotype which consists of n chromosomes,
 which are created by the given factory. This method can be used
 for easily creating a gene matrix. The following example will
 create a 10x5 DoubleGene matrix.
 
 final Genotype<DoubleGene> gt = Genotype
     .of(DoubleChromosome.of(0.0, 1.0, 10), 5);G - the gene typefactory - the factory which creates the chromosomes this genotype
        consists ofn - the number of chromosomes this genotype consists ofGenotype containing n chromosomesIllegalArgumentException - if n < 1.NullPointerException - if the factory is null.public static <G extends Gene<?,G>> Genotype<G> of(Iterable<? extends Chromosome<G>> chromosomes)
Genotype from a given array of chromosomes.G - the gene typechromosomes - the Chromosomes the returned genotype consists
        ofGenotype from the given chromosomesNullPointerException - if chromosomes is null or
         one of its element.IllegalArgumentException - if chromosome.length() < 1.© 2007-2014 Franz Wilhelmstötter (2014-12-28 10:45)