public class IntegerChromosome extends AbstractChromosome<G> implements NumericChromosome<Integer,IntegerGene>, Serializable
_genes, _valid
Modifier | Constructor and Description |
---|---|
|
IntegerChromosome(Integer min,
Integer max)
Create a new random
IntegerChromosome of length one. |
|
IntegerChromosome(Integer min,
Integer max,
int length)
Create a new random
IntegerChromosome . |
protected |
IntegerChromosome(ISeq<IntegerGene> genes)
Create a new chromosome from the given genes array.
|
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() |
IntegerChromosome |
newInstance()
Create a new instance of type T.
|
IntegerChromosome |
newInstance(ISeq<IntegerGene> genes)
A factory method which creates a new
Chromosome of specific type
and the given genes . |
static IntegerChromosome |
of(IntegerGene... genes)
Create a new
IntegerChromosome with the given genes. |
static IntegerChromosome |
of(int min,
int max)
Create a new random
IntegerChromosome of length one. |
static IntegerChromosome |
of(int min,
int max,
int length)
Create a new random
IntegerChromosome . |
static IntegerChromosome |
of(IntRange range)
Create a new random
IntegerChromosome of length one. |
static IntegerChromosome |
of(IntRange range,
int length)
Create a new random
IntegerChromosome . |
int[] |
toArray()
Returns an int array containing all of the elements in this chromosome
in proper sequence.
|
int[] |
toArray(int[] array)
Returns an int 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, length, stream, toSeq
isValid
forEach, iterator, spliterator
protected IntegerChromosome(ISeq<IntegerGene> genes)
genes
- the genes of the new chromosome.IllegalArgumentException
- if the gene sequence is emptyNullPointerException
- if the genes
are null
.public IntegerChromosome(Integer min, Integer max, int length)
IntegerChromosome
.min
- the min value of the IntegerGene
s (inclusively).max
- the max value of the IntegerGene
s (inclusively).length
- the length of the chromosome.NullPointerException
- if one of the arguments is null
.IllegalArgumentException
- if the length
is smaller than
one.public IntegerChromosome(Integer min, Integer max)
IntegerChromosome
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 int[] toArray(int[] 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 int[] toArray()
public static IntegerChromosome of(IntegerGene... genes)
IntegerChromosome
with the given genes.genes
- the genes of the chromosome.IllegalArgumentException
- if the length of the genes array is
empty.public static IntegerChromosome of(int min, int max, int length)
IntegerChromosome
.min
- the min value of the IntegerGene
s (inclusively).max
- the max value of the IntegerGene
s (inclusively).length
- the length of the chromosome.IntegerChromosome
IllegalArgumentException
- if the length is smaller than onepublic static IntegerChromosome of(IntRange range, int length)
IntegerChromosome
.range
- the integer range of the chromosome.length
- the length of the chromosome.IntegerChromosome
NullPointerException
- if the given range
is null
IllegalArgumentException
- if the length is smaller than onepublic static IntegerChromosome of(int min, int max)
IntegerChromosome
of length one.min
- the minimal value of this chromosome (inclusively).max
- the maximal value of this chromosome (inclusively).IntegerChromosome
of length onepublic static IntegerChromosome of(IntRange range)
IntegerChromosome
of length one.range
- the integer range of the chromosome.IntegerChromosome
of length oneNullPointerException
- if the given range
is null
public IntegerChromosome newInstance(ISeq<IntegerGene> genes)
Chromosome
Chromosome
of specific type
and the given genes
.newInstance
in interface Chromosome<IntegerGene>
genes
- the genes of the new chromosome. The given genes array is
not copied.Chromosome
of the same type with the given genes.public IntegerChromosome newInstance()
Factory
newInstance
in interface Factory<Chromosome<IntegerGene>>
public int hashCode()
public A getMin()
BoundedChromosome
BoundedChromosome
.getMin
in interface BoundedChromosome<A extends Comparable<? super A>,G extends org.jenetics.AbstractBoundedGene<A,G>>
BoundedChromosome
.public A getMax()
BoundedChromosome
BoundedChromosome
.getMax
in interface BoundedChromosome<A extends Comparable<? super A>,G extends org.jenetics.AbstractBoundedGene<A,G>>
BoundedChromosome
.© 2007-2016 Franz Wilhelmstötter (2016-12-26 11:02)