public class LongChromosome extends AbstractChromosome<G> implements NumericChromosome<Long,LongGene>, Serializable
LongGene,
Serialized Form_genes, _valid| Modifier | Constructor and Description |
|---|---|
protected |
LongChromosome(ISeq<LongGene> 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 |
|---|---|
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.
|
LongStream |
longStream()
Returns a sequential stream of the alleles with this chromosome as its
source.
|
LongChromosome |
newInstance()
Create a new instance of type T.
|
LongChromosome |
newInstance(ISeq<LongGene> genes)
A factory method which creates a new
Chromosome of specific type
and the given genes. |
static LongChromosome |
of(Iterable<LongGene> genes)
Create a new
LongChromosome with the given genes. |
static LongChromosome |
of(LongGene... genes)
Create a new
LongChromosome with the given genes. |
static LongChromosome |
of(long min,
long max)
Create a new random
LongChromosome of length one. |
static LongChromosome |
of(long min,
long max,
int length)
Create a new random
LongChromosome. |
static LongChromosome |
of(long min,
long max,
IntRange lengthRange)
Create a new random chromosome.
|
static LongChromosome |
of(LongRange range)
Create a new random
LongChromosome of length one. |
static LongChromosome |
of(LongRange range,
int length)
Create a new random
LongChromosome. |
static LongChromosome |
of(LongRange range,
IntRange lengthRange)
Create a new random chromosome.
|
long[] |
toArray()
Returns an long array containing all of the elements in this chromosome
in proper sequence.
|
long[] |
toArray(long[] array)
Returns an long 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, getMinas, getGene, getGene, iterator, length, stream, toSeqisValidforEach, spliteratorprotected LongChromosome(ISeq<LongGene> 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 LongChromosome newInstance(ISeq<LongGene> genes)
ChromosomeChromosome of specific type
and the given genes.newInstance in interface Chromosome<LongGene>genes - the genes of the new chromosome. The given genes array is
not copied.Chromosome of the same type with the given genes.public LongChromosome newInstance()
FactorynewInstance in interface Factory<Chromosome<LongGene>>public LongStream longStream()
public long[] toArray(long[] 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 long[] toArray()
public static LongChromosome of(LongGene... genes)
LongChromosome with the given genes.genes - the genes of the chromosome.NullPointerException - if the given genes are nullIllegalArgumentException - if the length of the genes array is
empty or the given genes doesn't have the same range.public static LongChromosome of(Iterable<LongGene> genes)
LongChromosome 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 LongChromosome of(long min, long max, IntRange lengthRange)
min - the min value of the LongGenes (inclusively).max - the max value of the LongGenes (inclusively).lengthRange - the allowed length range of the chromosome.IntegerChromosome 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 LongChromosome of(long min, long max, int length)
LongChromosome.min - the min value of the LongGenes (inclusively).max - the max value of the LongGenes (inclusively).length - the length of the chromosome.LongChromosome with the given gene parameters.IllegalArgumentException - if the length is smaller than
one.public static LongChromosome of(LongRange range, IntRange lengthRange)
range - the integer range of the chromosome.lengthRange - the allowed length range of the chromosome.LongChromosome 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 LongChromosome of(LongRange range, int length)
LongChromosome.range - the long range of the chromosome.length - the length of the chromosome.LongChromosomeNullPointerException - if the given range is nullIllegalArgumentException - if the length is smaller than
one.public static LongChromosome of(long min, long max)
LongChromosome of length one.min - the minimal value of this chromosome (inclusively).max - the maximal value of this chromosome (inclusively).LongChromosome with the given gene parameters.public static LongChromosome of(LongRange range)
LongChromosome of length one.range - the long range of the chromosome.LongChromosome 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-11-18 20:30)