Module io.jenetics.base
Package io.jenetics
Interface NumericGene<N extends Number & Comparable<? super N>,G extends NumericGene<N,G>>
- All Superinterfaces:
BoundedGene<N,
,G> Comparable<G>
,Factory<G>
,Gene<N,
,G> Self<G>
,Verifiable
- All Known Implementing Classes:
BigIntegerGene
,DoubleGene
,IntegerGene
,LongGene
public interface NumericGene<N extends Number & Comparable<? super N>,G extends NumericGene<N,G>>
extends BoundedGene<N,G>
Base interface for numeric genes.
-
Method Summary
Modifier and TypeMethodDescriptiondefault byte
Returns the value of the specified gene as a byte.default double
Returns the value of the specified gene as a double.default float
Returns the value of the specified gene as a float.default int
intValue()
Returns the value of the specified gene as an int.default long
Returns the value of the specified gene as a long.newInstance
(Number number) Create a new gene from the givenvalue
and the current bounds.default short
Returns the value of the specified gene as a short.Methods inherited from interface io.jenetics.Gene
allele, newInstance
-
Method Details
-
byteValue
Returns the value of the specified gene as a byte. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to
type
byte
.
-
shortValue
Returns the value of the specified gene as a short. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to
type
short
.
-
intValue
Returns the value of the specified gene as an int. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to
type
int
.
-
longValue
Returns the value of the specified gene as a long. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to
type
long
.
-
floatValue
Returns the value of the specified gene as a float. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to
type
float
.
-
doubleValue
Returns the value of the specified gene as a double. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to
type
double
.
-
newInstance
Description copied from interface:BoundedGene
Create a new gene from the givenvalue
and the current bounds.- Specified by:
newInstance
in interfaceBoundedGene<N extends Number & Comparable<? super N>,
G extends NumericGene<N, G>> - Specified by:
newInstance
in interfaceGene<N extends Number & Comparable<? super N>,
G extends NumericGene<N, G>> - Parameters:
number
- the value of the new gene.- Returns:
- a new gene with the given value.
-