public final class IntegerGene extends Object implements NumericGene<Integer,IntegerGene>, Mean<IntegerGene>, Comparable<IntegerGene>, Serializable
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.
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(IntegerGene other) |
boolean |
equals(Object obj) |
A |
getAllele()
Return the allele of this gene.
|
A |
getMax()
Return the allowed max value.
|
A |
getMin()
Return the allowed min value.
|
int |
hashCode() |
boolean |
isValid()
Check if this object is valid.
|
IntegerGene |
mean(IntegerGene that)
Return the (usually arithmetic) mean value of
this and
that. |
IntegerGene |
newInstance()
Return a new, random gene with the same type and with the same constraints
than this gene.
|
IntegerGene |
newInstance(Number number)
Create a new gene from the given
value and the current bounds. |
static IntegerGene |
of(int min,
int max)
Create a new random
IntegerGene. |
static IntegerGene |
of(int value,
int min,
int max)
Create a new random
IntegerGene with the given value and the
given range. |
static IntegerGene |
of(int value,
IntRange range)
Create a new random
IntegerGene with the given value and the
given range. |
static IntegerGene |
of(IntRange range)
Create a new random
IntegerGene. |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitbyteValue, doubleValue, floatValue, intValue, longValue, shortValuegetMax, getMin, isValidpublic int compareTo(IntegerGene other)
compareTo in interface Comparable<IntegerGene>compareTo in interface BoundedGene<Integer,IntegerGene>public static IntegerGene of(int value, int min, int max)
IntegerGene with the given value and the
given range. If the value isn't within the interval [min, max],
no exception is thrown. In this case the method
AbstractBoundedGene.isValid() returns false.value - the value of the gene.min - the minimal valid value of this gene (inclusively).max - the maximal valid value of this gene (inclusively).IntegerGene with the given valuepublic static IntegerGene of(int value, IntRange range)
IntegerGene with the given value and the
given range. If the value isn't within the interval [min, max],
no exception is thrown. In this case the method
AbstractBoundedGene.isValid() returns false.value - the value of the gene.range - the integer range to useIntegerGene with the give valueNullPointerException - if the given range is null.public static IntegerGene of(int min, int max)
IntegerGene. It is guaranteed that the value of
the IntegerGene lies in the interval [min, max].min - the minimal valid value of this gene (inclusively).max - the maximal valid value of this gene (inclusively).IntegerGenepublic static IntegerGene of(IntRange range)
IntegerGene. It is guaranteed that the value of
the IntegerGene lies in the interval [min, max].range - the integer range to useIntegerGeneNullPointerException - if the given range is null.public IntegerGene newInstance(Number number)
BoundedGenevalue and the current bounds.newInstance in interface NumericGene<Integer,IntegerGene>number - the value of the new gene.public IntegerGene newInstance()
Genegene.getClass() == gene.newInstance().getClass(). Implementations
of this method has to use the Random object which can
be fetched from the RandomRegistry.newInstance in interface Gene<Integer,IntegerGene>newInstance in interface Factory<IntegerGene>public IntegerGene mean(IntegerGene that)
Meanthis and
that. For NumericGenes the mean is the
arithmetic mean.mean in interface Mean<IntegerGene>that - the second value for calculating the mean.this and that.public A getAllele()
GenegetAllele in interface Gene<A extends Comparable<? super A>,G extends org.jenetics.AbstractBoundedGene<A,G>>public A getMin()
BoundedGenegetMin in interface BoundedGene<A extends Comparable<? super A>,G extends org.jenetics.AbstractBoundedGene<A,G>>public A getMax()
BoundedGenegetMax in interface BoundedGene<A extends Comparable<? super A>,G extends org.jenetics.AbstractBoundedGene<A,G>>public boolean isValid()
VerifiableisValid in interface BoundedGene<A extends Comparable<? super A>,G extends org.jenetics.AbstractBoundedGene<A,G>>isValid in interface Verifiable© 2007-2017 Franz Wilhelmstötter (2017-08-22 19:30)