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:
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 int
default boolean
isValid()
Check if this object is valid.max()
Return the allowed max value.default G
Return the maximum value ofthis
and the givenother
value.min()
Return the allowed min value.default G
Return the minimum value ofthis
and the givenother
value.newInstance
(A value) Create a new gene from the givenvalue
and 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:Verifiable
Check if this object is valid.- Specified by:
isValid
in interfaceVerifiable
- Returns:
- true if this object is valid, false otherwise.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<A extends Comparable<? super A>>
-
min
Return the minimum value ofthis
and the givenother
value.- Parameters:
other
- the other value- Returns:
- the minimum value of
this
and the givenother
- Throws:
NullPointerException
- ifother
isnull
- Since:
- 7.0
-
max
Return the maximum value ofthis
and the givenother
value.- Parameters:
other
- the other value- Returns:
- the maximum value of
this
and the givenother
- Throws:
NullPointerException
- ifother
isnull
- Since:
- 7.0
-
newInstance
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.
-