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 byteReturns the value of the specified gene as a byte.default doubleReturns the value of the specified gene as a double.default floatReturns the value of the specified gene as a float.default intintValue()Returns the value of the specified gene as an int.default longReturns the value of the specified gene as a long.newInstance(Number number) Create a new gene from the givenvalueand the current bounds.default shortReturns 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:BoundedGeneCreate a new gene from the givenvalueand the current bounds.- Specified by:
newInstancein interfaceBoundedGene<N extends Number & Comparable<? super N>,G extends NumericGene<N, G>> - Specified by:
newInstancein 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.
-