public final class DoubleGene extends Object implements NumericGene<Double,DoubleGene>, Mean<DoubleGene>
Constructor and Description |
---|
DoubleGene(Double value,
Double min,
Double max)
Create a new random
DoubleGene with the given value and the
given range. |
Modifier and Type | Method and Description |
---|---|
byte |
byteValue()
Returns the value of the specified gene as an byte.
|
int |
compareTo(G other) |
Object |
copy()
Deprecated.
|
double |
doubleValue()
Returns the value of the specified gene as an double.
|
boolean |
equals(Object obj) |
float |
floatValue()
Returns the value of the specified gene as an float.
|
A |
getAllele()
Return the allele of this gene.
|
A |
getMax()
Return the allowed max value.
|
A |
getMin()
Return the allowed min value.
|
int |
hashCode() |
int |
intValue()
Returns the value of the specified gene as an int.
|
boolean |
isValid()
Check if this object is valid.
|
long |
longValue()
Returns the value of the specified gene as an long.
|
DoubleGene |
mean(DoubleGene that)
Return the (usually arithmetic) mean value of
this and
that . |
DoubleGene |
newInstance()
Return a new, random gene of the same type than this gene.
|
DoubleGene |
newInstance(Number number)
Create a new gene from the given
value and the current bounds. |
static DoubleGene |
of(double min,
double max)
Create a new random
DoubleGene . |
static DoubleGene |
of(double value,
double min,
double max)
Create a new random
DoubleGene with the given value and the
given range. |
short |
shortValue()
Returns the value of the specified gene as an short.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
byteValue, doubleValue, floatValue, intValue, longValue, shortValue
getMax, getMin
isValid
compareTo
public DoubleGene(Double value, Double min, Double max)
DoubleGene
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 (exclusively).NullPointerException
- if one of the arguments is null
.public static DoubleGene of(double value, double min, double max)
DoubleGene
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 (exclusively).public static DoubleGene of(double min, double max)
DoubleGene
. It is guaranteed that the value
of the DoubleGene
lies in the interval [min, max).min
- the minimal valid value of this gene (inclusively).max
- the maximal valid value of this gene (exclusively).public DoubleGene newInstance(Number number)
BoundedGene
value
and the current bounds.newInstance
in interface NumericGene<Double,DoubleGene>
number
- the value of the new gene.public DoubleGene newInstance()
Gene
gene.getClass() ==
gene.newInstance().getClass()
.newInstance
in interface Gene<Double,DoubleGene>
newInstance
in interface Factory<DoubleGene>
public DoubleGene mean(DoubleGene that)
Mean
this
and
that
. For NumberGene
s the mean is the
arithmetic mean.mean
in interface Mean<DoubleGene>
that
- the second value for calculating the mean.this
and that
.public byte byteValue()
NumericGene
byteValue
in interface NumericGene<N extends Number & Comparable<? super N>,G extends org.jenetics.AbstractNumericGene<N,G>>
byte
.public short shortValue()
NumericGene
shortValue
in interface NumericGene<N extends Number & Comparable<? super N>,G extends org.jenetics.AbstractNumericGene<N,G>>
short
.public int intValue()
NumericGene
intValue
in interface NumericGene<N extends Number & Comparable<? super N>,G extends org.jenetics.AbstractNumericGene<N,G>>
int
.public long longValue()
NumericGene
longValue
in interface NumericGene<N extends Number & Comparable<? super N>,G extends org.jenetics.AbstractNumericGene<N,G>>
long
.public float floatValue()
NumericGene
floatValue
in interface NumericGene<N extends Number & Comparable<? super N>,G extends org.jenetics.AbstractNumericGene<N,G>>
float
.public double doubleValue()
NumericGene
doubleValue
in interface NumericGene<N extends Number & Comparable<? super N>,G extends org.jenetics.AbstractNumericGene<N,G>>
double
.public A getAllele()
Gene
getAllele
in interface Gene<A extends Comparable<? super A>,G extends org.jenetics.AbstractBoundedGene<A,G>>
public A getMin()
BoundedGene
getMin
in interface BoundedGene<A extends Comparable<? super A>,G extends org.jenetics.AbstractBoundedGene<A,G>>
public A getMax()
BoundedGene
getMax
in interface BoundedGene<A extends Comparable<? super A>,G extends org.jenetics.AbstractBoundedGene<A,G>>
@Deprecated public Object copy()
copy
in interface ValueType
copy
in interface Gene<A extends Comparable<? super A>,G extends org.jenetics.AbstractBoundedGene<A,G>>
public boolean isValid()
Verifiable
isValid
in interface Verifiable
public int compareTo(G other)
compareTo
in interface Comparable<G extends org.jenetics.AbstractBoundedGene<A,G>>
© 2007-2014 Franz Wilhelmstötter (2014-03-07 19:35)