java.lang.Object
io.jenetics.ext.BigIntegerGene
- All Implemented Interfaces:
BoundedGene<BigInteger,
,BigIntegerGene> Gene<BigInteger,
,BigIntegerGene> NumericGene<BigInteger,
,BigIntegerGene> Factory<BigIntegerGene>
,Mean<BigIntegerGene>
,Self<BigIntegerGene>
,Verifiable
,Serializable
,Comparable<BigIntegerGene>
public final class BigIntegerGene
extends Object
implements NumericGene<BigInteger,BigIntegerGene>, Mean<BigIntegerGene>, Serializable
Numeric chromosome implementation which holds an arbitrary sized integer
number.
This is a
value-based class; use of identity-sensitive operations (including
reference equality (==
), identity hash code, or synchronization) on
instances of IntegerGene
may have unpredictable results and should
be avoided.
- Since:
- 3.5
- Version:
- 6.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionallele()
Return the allele of this gene.boolean
int
hashCode()
max()
Return the allowed max value.mean
(BigIntegerGene that) Return the (usually arithmetic) mean value ofthis
andthat
.min()
Return the allowed min value.Return a new, random gene with the same type and with the same constraints as this gene.newInstance
(Number number) Create a new gene from the givenvalue
and the current bounds.newInstance
(BigInteger value) Create a new gene from the givenvalue
and the current bounds.static BigIntegerGene
of
(BigInteger min, BigInteger max) Create a new randomBigIntegerGene
.static BigIntegerGene
of
(BigInteger value, BigInteger min, BigInteger max) Create a new randomBigIntegerGene
with the given value and the given range.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.jenetics.BoundedGene
compareTo, isValid, max, min
Methods inherited from interface io.jenetics.NumericGene
byteValue, doubleValue, floatValue, intValue, longValue, shortValue
-
Method Details
-
allele
Description copied from interface:Gene
Return the allele of this gene.- Specified by:
allele
in interfaceGene<BigInteger,
BigIntegerGene> - Returns:
- the allele of this gene.
-
min
Description copied from interface:BoundedGene
Return the allowed min value.- Specified by:
min
in interfaceBoundedGene<BigInteger,
BigIntegerGene> - Returns:
- The allowed min value.
-
max
Description copied from interface:BoundedGene
Return the allowed max value.- Specified by:
max
in interfaceBoundedGene<BigInteger,
BigIntegerGene> - Returns:
- The allowed max value.
-
mean
Description copied from interface:Mean
Return the (usually arithmetic) mean value ofthis
andthat
. ForNumericGene
s the mean is the arithmetic mean.- Specified by:
mean
in interfaceMean<BigIntegerGene>
- Parameters:
that
- the second value for calculating the mean.- Returns:
- the mean value of
this
andthat
.
-
newInstance
Description copied from interface:BoundedGene
Create a new gene from the givenvalue
and the current bounds.- Specified by:
newInstance
in interfaceNumericGene<BigInteger,
BigIntegerGene> - Parameters:
number
- the value of the new gene.- Returns:
- a new gene with the given value.
-
newInstance
Description copied from interface:BoundedGene
Create a new gene from the givenvalue
and the current bounds.- Specified by:
newInstance
in interfaceBoundedGene<BigInteger,
BigIntegerGene> - Specified by:
newInstance
in interfaceGene<BigInteger,
BigIntegerGene> - Parameters:
value
- the value of the new gene.- Returns:
- a new gene with the given value.
-
newInstance
Description copied from interface:Gene
Return a new, random gene with the same type and with the same constraints as this gene. For all genes returned by this method holdsgene.getClass() == gene.newInstance().getClass()
. Implementations of this method have to use theRandomGenerator
object which can be fetched from theRandomRegistry
.- Specified by:
newInstance
in interfaceFactory<BigIntegerGene>
- Specified by:
newInstance
in interfaceGene<BigInteger,
BigIntegerGene> - Returns:
- a new instance of type T
-
hashCode
-
equals
-
toString
-
of
Create a new randomBigIntegerGene
with the given value and the given range. If thevalue
isn't within the interval [min, max), no exception is thrown. In this case the methodBoundedGene.isValid()
returnsfalse
.- Parameters:
value
- the value of the gene.min
- the minimal valid value of this gene (inclusively).max
- the maximal valid value of this gene (exclusively).- Returns:
- a new random
BigIntegerGene
- Throws:
NullPointerException
- if one of the arguments isnull
-
of
Create a new randomBigIntegerGene
. It is guaranteed that the value of theBigIntegerGene
lies in the interval [min, max).- Parameters:
min
- the minimal valid value of this gene (inclusively).max
- the maximal valid value of this gene (exclusively).- Returns:
- a new random
BigIntegerGene
- Throws:
NullPointerException
- if one of the arguments isnull
-