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, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
byteValue, byteValue, doubleValue, doubleValue, floatValue, floatValue, intValue, intValue, longValue, longValue, shortValue, shortValue
getMax, getMin
as, getGene, getGene, iterator, length, stream, toSeq
isValid
forEach, spliterator
protected 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)
Chromosome
Chromosome
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()
Factory
newInstance
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 null
public 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.NullPointerException
- if the given genes
array is
null
public static DoubleChromosome of(Iterable<DoubleGene> genes)
DoubleChromosome
with the given genes.genes
- the genes of the chromosome.NullPointerException
- if the given genes
are null
IllegalArgumentException
- 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 DoubleGene
s (inclusively).max
- the max value of the DoubleGene
s (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
null
public static DoubleChromosome of(double min, double max, int length)
DoubleChromosome
.min
- the min value of the DoubleGene
s (inclusively).max
- the max value of the DoubleGene
s (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
null
public static DoubleChromosome of(DoubleRange range, int length)
DoubleChromosome
.range
- the integer range of the chromosome.length
- the length of the chromosome.DoubleChromosome
NullPointerException
- if the given range
is null
IllegalArgumentException
- 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 null
public A getMin()
BoundedChromosome
BoundedChromosome
.getMin
in interface BoundedChromosome<A extends Comparable<? super A>,G extends BoundedGene<A,G>>
BoundedChromosome
.public A getMax()
BoundedChromosome
BoundedChromosome
.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-11-18 20:30)