Package io.jenetics
Interface BoundedGene<A extends Comparable<? super A>,G extends BoundedGene<A,G>>
-
- All Superinterfaces:
Comparable<G>
,Factory<G>
,Gene<A,G>
,Verifiable
- All Known Subinterfaces:
NumericGene<N,G>
- All Known Implementing Classes:
DoubleGene
,IntegerGene
,LongGene
public interface BoundedGene<A extends Comparable<? super A>,G extends BoundedGene<A,G>> extends Gene<A,G>, Comparable<G>
Base interface for genes where the alleles are bound by a minimum and a maximum value.- Since:
- 1.6
- Version:
- 6.0
- Author:
- Franz Wilhelmstötter
- See Also:
BoundedChromosome
- Implementation Requirements:
- Jenetics requires that the individuals (
Genotype
andPhenotype
) are not changed after they have been created. Therefore, all implementations of theBoundedGene
interface must also be immutable.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default int
compareTo(G other)
default boolean
isValid()
Check if this object is valid.A
max()
Return the allowed max value.A
min()
Return the allowed min value.G
newInstance(A value)
Create a new gene from the givenvalue
and the current bounds.-
Methods inherited from interface io.jenetics.Gene
allele, newInstance
-
-
-
-
Method Detail
-
isValid
default boolean isValid()
Description copied from interface:Verifiable
Check if this object is valid.- Specified by:
isValid
in interfaceVerifiable
- Returns:
- true if this object is valid, false otherwise.
-
compareTo
default int compareTo(G other)
- Specified by:
compareTo
in interfaceComparable<A extends Comparable<? super A>>
-
newInstance
G newInstance(A value)
Create a new gene from the givenvalue
and the current bounds.- Specified by:
newInstance
in interfaceGene<A extends Comparable<? super A>,G extends BoundedGene<A,G>>
- Parameters:
value
- the value of the new gene.- Returns:
- a new gene with the given value.
-
-