Package io.jenetics.ext
Class BigIntegerChromosome
- java.lang.Object
-
- io.jenetics.AbstractChromosome<BigIntegerGene>
-
- io.jenetics.ext.BigIntegerChromosome
-
- All Implemented Interfaces:
BoundedChromosome<BigInteger,BigIntegerGene>
,Chromosome<BigIntegerGene>
,NumericChromosome<BigInteger,BigIntegerGene>
,BaseSeq<BigIntegerGene>
,Factory<Chromosome<BigIntegerGene>>
,Verifiable
,Serializable
,Iterable<BigIntegerGene>
,RandomAccess
public class BigIntegerChromosome extends AbstractChromosome<BigIntegerGene> implements NumericChromosome<BigInteger,BigIntegerGene>, Serializable
Numeric chromosome implementation which holds arbitrary sized integer numbers.- Since:
- 3.5
- Version:
- 5.2
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class io.jenetics.AbstractChromosome
_genes, _valid
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BigIntegerChromosome(ISeq<BigIntegerGene> genes)
Create a new chromosome from the given genes array.BigIntegerChromosome(BigInteger min, BigInteger max)
Create a new randomDoubleChromosome
of length one.BigIntegerChromosome(BigInteger min, BigInteger max, int length)
Create a new randomBigIntegerChromosome
with the givenlength
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BigInteger
max()
BigInteger
min()
BigIntegerChromosome
newInstance()
BigIntegerChromosome
newInstance(ISeq<BigIntegerGene> genes)
static BigIntegerChromosome
of(BigIntegerGene... genes)
Create a newDoubleChromosome
with the given genes.static BigIntegerChromosome
of(BigInteger min, BigInteger max)
Create a new randomDoubleChromosome
of length one.static BigIntegerChromosome
of(BigInteger min, BigInteger max, int length)
Create a new randomDoubleChromosome
.-
Methods inherited from class io.jenetics.AbstractChromosome
equals, get, hashCode, isValid, length, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.jenetics.util.BaseSeq
get, isEmpty, iterator, length, listIterator, nonEmpty, spliterator, stream
-
Methods inherited from interface io.jenetics.Chromosome
as, gene, isValid
-
Methods inherited from interface io.jenetics.NumericChromosome
byteValue, byteValue, doubleValue, doubleValue, floatValue, floatValue, intValue, intValue, longValue, longValue, shortValue, shortValue
-
-
-
-
Constructor Detail
-
BigIntegerChromosome
protected BigIntegerChromosome(ISeq<BigIntegerGene> genes)
Create a new chromosome from the given genes array.- Parameters:
genes
- the genes of the new chromosome.- Throws:
IllegalArgumentException
- if thegenes.length()
is smaller than one.NullPointerException
- if thegenes
arenull
.IllegalArgumentException
- if the gene sequence is empty
-
BigIntegerChromosome
public BigIntegerChromosome(BigInteger min, BigInteger max, int length)
Create a new randomBigIntegerChromosome
with the givenlength
.- Parameters:
min
- the min value of theBigIntegerGene
s (inclusively).max
- the max value of theBigIntegerGene
s (inclusively).length
- the length of the chromosome.- Throws:
NullPointerException
- if one of the arguments isnull
.IllegalArgumentException
- if thelength
is smaller than one.
-
BigIntegerChromosome
public BigIntegerChromosome(BigInteger min, BigInteger max)
Create a new randomDoubleChromosome
of length one.- Parameters:
min
- the minimal value of this chromosome (inclusively).max
- the maximal value of this chromosome (exclusively).- Throws:
NullPointerException
- if one of the arguments isnull
.
-
-
Method Detail
-
min
public BigInteger min()
- Specified by:
min
in interfaceBoundedChromosome<BigInteger,BigIntegerGene>
-
max
public BigInteger max()
- Specified by:
max
in interfaceBoundedChromosome<BigInteger,BigIntegerGene>
-
newInstance
public BigIntegerChromosome newInstance(ISeq<BigIntegerGene> genes)
- Specified by:
newInstance
in interfaceChromosome<BigIntegerGene>
-
newInstance
public BigIntegerChromosome newInstance()
- Specified by:
newInstance
in interfaceFactory<Chromosome<BigIntegerGene>>
-
of
public static BigIntegerChromosome of(BigIntegerGene... genes)
Create a newDoubleChromosome
with the given genes.- Parameters:
genes
- the genes of the chromosome.- Returns:
- a new chromosome with the given genes.
- Throws:
IllegalArgumentException
- if the length of the genes array is empty.NullPointerException
- if the givengenes
array isnull
-
of
public static BigIntegerChromosome of(BigInteger min, BigInteger max, int length)
Create a new randomDoubleChromosome
.- Parameters:
min
- the min value of theDoubleGene
s (inclusively).max
- the max value of theDoubleGene
s (exclusively).length
- the length of the chromosome.- Returns:
- a new
DoubleChromosome
with the given parameter
-
of
public static BigIntegerChromosome of(BigInteger min, BigInteger max)
Create a new randomDoubleChromosome
of length one.- Parameters:
min
- the minimal value of this chromosome (inclusively).max
- the maximal value of this chromosome (exclusively).- Returns:
- a new
DoubleChromosome
with the given parameter
-
-