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. |
|
LongChromosome(Long min,
Long max)
Deprecated.
Use
of(long, long) instead. |
|
LongChromosome(Long min,
Long max,
int length)
Deprecated.
Use
of(long, long, int) instead. |
|
LongChromosome(Long min,
Long max,
IntRange lengthRange)
Deprecated.
Use
of(long, long, IntRange) instead. |
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, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
byteValue, byteValue, doubleValue, doubleValue, floatValue, floatValue, intValue, intValue, longValue, longValue, shortValue, shortValue
getMax, getMin
isValid
forEach, iterator, spliterator
protected 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.@Deprecated public LongChromosome(Long min, Long max, IntRange lengthRange)
of(long, long, IntRange)
instead.min
- the min value of the LongGene
s (inclusively).max
- the max value of the LongGene
s (inclusively).lengthRange
- the allowed length range of the chromosome.NullPointerException
- if one of the arguments is null
.IllegalArgumentException
- if the length is smaller than one@Deprecated public LongChromosome(Long min, Long max, int length)
of(long, long, int)
instead.LongChromosome
.min
- the min value of the LongGene
s (inclusively).max
- the max value of the LongGene
s (inclusively).length
- the length of the chromosome.NullPointerException
- if one of the arguments is null
.IllegalArgumentException
- if the length
is smaller than
one.@Deprecated public LongChromosome(Long min, Long max)
of(long, long)
instead.LongChromosome
of length one.min
- the minimal value of this chromosome (inclusively).max
- the maximal value of this chromosome (inclusively).NullPointerException
- if one of the arguments is null
.public LongChromosome newInstance(ISeq<LongGene> genes)
Chromosome
Chromosome
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()
Factory
newInstance
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 null
public long[] toArray()
public static LongChromosome of(LongGene... genes)
LongChromosome
with the given genes.genes
- the genes of the chromosome.IllegalArgumentException
- if the length of the genes array is
empty.NullPointerException
- if the given genes
are null
public static LongChromosome of(Iterable<LongGene> genes)
LongChromosome
with the given genes.genes
- the genes of the chromosome.NullPointerException
- if the given genes
are null
IllegalArgumentException
- if the length of the genes array is
empty.public static LongChromosome of(long min, long max, IntRange lengthRange)
min
- the min value of the LongGene
s (inclusively).max
- the max value of the LongGene
s (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
null
public static LongChromosome of(long min, long max, int length)
LongChromosome
.min
- the min value of the LongGene
s (inclusively).max
- the max value of the LongGene
s (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
null
public static LongChromosome of(LongRange range, int length)
LongChromosome
.range
- the long range of the chromosome.length
- the length of the chromosome.LongChromosome
NullPointerException
- if the given range
is null
IllegalArgumentException
- 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 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-2018 Franz Wilhelmstötter (2018-10-28 17:23)