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>
,Verifiable
- All Known Implementing Classes:
DoubleGene
,IntegerGene
,LongGene
public interface NumericGene<N extends Number & Comparable<? super N>,G extends NumericGene<N,G>> extends BoundedGene<N,G>, Comparable<G>
Base interface for numeric genes.- Since:
- 1.6
- Version:
- 3.0
- See Also:
NumericChromosome
- Implementation Requirements:
- Jenetics requires that the individuals (
Genotype
andPhenotype
) are not changed after they have been created. Therefore, all implementations of theNumericGene
interface must also be immutable.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default byte
byteValue()
Returns the value of the specified gene as an byte.default double
doubleValue()
Returns the value of the specified gene as an double.default float
floatValue()
Returns the value of the specified gene as an float.default int
intValue()
Returns the value of the specified gene as an int.default long
longValue()
Returns the value of the specified gene as an long.G
newInstance(Number number)
Create a new gene from the givenvalue
and the current bounds.default short
shortValue()
Returns the value of the specified gene as an short.-
Methods inherited from interface io.jenetics.BoundedGene
compareTo, isValid, max, min
-
Methods inherited from interface io.jenetics.Gene
allele, newInstance
-
-
-
-
Method Detail
-
byteValue
default byte byteValue()
Returns the value of the specified gene as an byte. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to
type
byte
.
-
shortValue
default short shortValue()
Returns the value of the specified gene as an short. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to
type
short
.
-
intValue
default int 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
default long longValue()
Returns the value of the specified gene as an long. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to
type
long
.
-
floatValue
default float floatValue()
Returns the value of the specified gene as an float. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to
type
float
.
-
doubleValue
default double doubleValue()
Returns the value of the specified gene as an double. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to
type
double
.
-
newInstance
G newInstance(Number number)
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.
-
-