public class DoubleChromosome extends AbstractChromosome<G> implements NumericChromosome<Double,DoubleGene>, Serializable
DoubleGene,
Serialized Form_genes, _valid| Modifier | Constructor and Description |
|---|---|
protected |
DoubleChromosome(ISeq<DoubleGene> genes,
IntRange lengthRange)
Create a new chromosome from the given
genes and the allowed
length range of the chromosome. |
| Modifier and Type | Method and Description |
|---|---|
DoubleStream |
doubleStream()
Returns a sequential stream of the alleles with this chromosome as its
source.
|
boolean |
equals(Object obj) |
A |
getMax()
Return the maximum value of this
BoundedChromosome. |
A |
getMin()
Return the minimum value of this
BoundedChromosome. |
int |
hashCode() |
IntRange |
lengthRange()
Return the allowed length range of the chromosome.
|
DoubleChromosome |
newInstance()
Create a new instance of type T.
|
DoubleChromosome |
newInstance(ISeq<DoubleGene> genes)
A factory method which creates a new
Chromosome of specific type
and the given genes. |
static DoubleChromosome |
of(double min,
double max)
Create a new random
DoubleChromosome of length one. |
static DoubleChromosome |
of(double min,
double max,
int length)
Create a new random
DoubleChromosome. |
static DoubleChromosome |
of(double min,
double max,
IntRange lengthRange)
Create a new random chromosome.
|
static DoubleChromosome |
of(DoubleGene... genes)
Create a new
DoubleChromosome with the given genes. |
static DoubleChromosome |
of(DoubleRange range)
Create a new random
DoubleChromosome of length one. |
static DoubleChromosome |
of(DoubleRange range,
int length)
Create a new random
DoubleChromosome. |
static DoubleChromosome |
of(DoubleRange range,
IntRange lengthRange)
Create a new random chromosome.
|
static DoubleChromosome |
of(Iterable<DoubleGene> genes)
Create a new
DoubleChromosome with the given genes. |
double[] |
toArray()
Returns an double array containing all of the elements in this chromosome
in proper sequence.
|
double[] |
toArray(double[] array)
Returns an double array containing all of the elements in this chromosome
in proper sequence.
|
getGene, isValid, iterator, length, toSeq, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitbyteValue, byteValue, doubleValue, doubleValue, floatValue, floatValue, intValue, intValue, longValue, longValue, shortValue, shortValuegetMax, getMinisValidforEach, iterator, spliteratorprotected DoubleChromosome(ISeq<DoubleGene> genes, IntRange lengthRange)
genes and the allowed
length range of the chromosome.genes - the genes that form the chromosome.lengthRange - the allowed length range of the chromosomeNullPointerException - if one of the arguments is null.IllegalArgumentException - if the length of the gene sequence is
empty, doesn't match with the allowed length range, the minimum
or maximum of the range is smaller or equal zero or the given
range size is zero.public DoubleChromosome newInstance(ISeq<DoubleGene> genes)
ChromosomeChromosome of specific type
and the given genes.newInstance in interface Chromosome<DoubleGene>genes - the genes of the new chromosome. The given genes array is
not copied.Chromosome of the same type with the given genes.public DoubleChromosome newInstance()
FactorynewInstance in interface Factory<Chromosome<DoubleGene>>public DoubleStream doubleStream()
public double[] toArray(double[] array)
array - the array into which the elements of this chromosomes are to
be stored, if it is big enough; otherwise, a new array is
allocated for this purpose.NullPointerException - if the given array is nullpublic double[] toArray()
public static DoubleChromosome of(DoubleGene... genes)
DoubleChromosome with the given genes.genes - the genes of the chromosome.IllegalArgumentException - if the length of the genes array is
empty or the given genes doesn't have the same range.public static DoubleChromosome of(Iterable<DoubleGene> genes)
DoubleChromosome with the given genes.genes - the genes of the chromosome.NullPointerException - if the given genes are nullIllegalArgumentException - if the of the genes iterable is empty or
the given genes doesn't have the same range.public static DoubleChromosome of(double min, double max, IntRange lengthRange)
min - the min value of the DoubleGenes (inclusively).max - the max value of the DoubleGenes (exclusively).lengthRange - the allowed length range of the chromosome.DoubleChromosome with the given parameterIllegalArgumentException - if the length of the gene sequence is
empty, doesn't match with the allowed length range, the minimum
or maximum of the range is smaller or equal zero or the given
range size is zero.NullPointerException - if the given lengthRange is
nullpublic static DoubleChromosome of(double min, double max, int length)
DoubleChromosome.min - the min value of the DoubleGenes (inclusively).max - the max value of the DoubleGenes (exclusively).length - the length of the chromosome.DoubleChromosome with the given parameterIllegalArgumentException - if the length is smaller than
one.public static DoubleChromosome of(DoubleRange range, IntRange lengthRange)
range - the integer range of the chromosome.lengthRange - the allowed length range of the chromosome.DoubleChromosome with the given parameterIllegalArgumentException - if the length of the gene sequence is
empty, doesn't match with the allowed length range, the minimum
or maximum of the range is smaller or equal zero or the given
range size is zero.NullPointerException - if the given lengthRange is
nullpublic static DoubleChromosome of(DoubleRange range, int length)
DoubleChromosome.range - the integer range of the chromosome.length - the length of the chromosome.DoubleChromosomeNullPointerException - if the given range is nullIllegalArgumentException - if the length is smaller than
one.public static DoubleChromosome of(double min, double max)
DoubleChromosome of length one.min - the minimal value of this chromosome (inclusively).max - the maximal value of this chromosome (exclusively).DoubleChromosome with the given parameterpublic static DoubleChromosome of(DoubleRange range)
DoubleChromosome of length one.range - the double range of the chromosome.DoubleChromosome of length oneNullPointerException - if the given range is nullpublic A getMin()
BoundedChromosomeBoundedChromosome.getMin in interface BoundedChromosome<A extends Comparable<? super A>,G extends BoundedGene<A,G>>BoundedChromosome.public A getMax()
BoundedChromosomeBoundedChromosome.getMax in interface BoundedChromosome<A extends Comparable<? super A>,G extends BoundedGene<A,G>>BoundedChromosome.public int hashCode()
public IntRange lengthRange()
© 2007-2019 Franz Wilhelmstötter (2019-06-23 15:39)