Module io.jenetics.base
Package io.jenetics
Interface BoundedGene<A extends Comparable<? super A>,G extends BoundedGene<A,G>>
- All Superinterfaces:
Comparable<G>,Factory<G>,Gene<A,,G> Self<G>,Verifiable
- All Known Subinterfaces:
NumericGene<N,G>
- All Known Implementing Classes:
BigIntegerGene,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.
-
Method Summary
Modifier and TypeMethodDescriptiondefault intdefault booleanisValid()Check if this object is valid.max()Return the allowed max value.default GReturn the maximum value ofthisand the givenothervalue.min()Return the allowed min value.default GReturn the minimum value ofthisand the givenothervalue.newInstance(A value) Create a new gene from the givenvalueand the current bounds.Methods inherited from interface io.jenetics.Gene
allele, newInstance
-
Method Details
-
min
Return the allowed min value.- Returns:
- The allowed min value.
-
max
Return the allowed max value.- Returns:
- The allowed max value.
-
isValid
Description copied from interface:VerifiableCheck if this object is valid.- Specified by:
isValidin interfaceVerifiable- Returns:
- true if this object is valid, false otherwise.
-
compareTo
- Specified by:
compareToin interfaceComparable<A extends Comparable<? super A>>
-
min
Return the minimum value ofthisand the givenothervalue.- Parameters:
other- the other value- Returns:
- the minimum value of
thisand the givenother - Throws:
NullPointerException- ifotherisnull- Since:
- 7.0
-
max
Return the maximum value ofthisand the givenothervalue.- Parameters:
other- the other value- Returns:
- the maximum value of
thisand the givenother - Throws:
NullPointerException- ifotherisnull- Since:
- 7.0
-
newInstance
Create a new gene from the givenvalueand the current bounds.- Specified by:
newInstancein 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.
-