Package org.uma.jmetal.util.bounds
Interface Bounds<T extends java.lang.Comparable<T>>
- Type Parameters:
T- the type ofBounds
- All Superinterfaces:
java.io.Serializable
public interface Bounds<T extends java.lang.Comparable<T>>
extends java.io.Serializable
Describes a pair of lower and upper bounds for a
Comparable value.-
Method Summary
Modifier and Type Method Description static <T extends java.lang.Comparable<T>>
Bounds<T>create(T lowerBound, T upperBound)Create aBoundswith the given lower and upper limits.static <T extends java.lang.Comparable<T>>
Bounds<T>fromPair(org.apache.commons.lang3.tuple.Pair<T,T> pair)Deprecated.This method is here for legacy purpose.TgetLowerBound()TgetUpperBound()default Trestrict(T value)Restrict the given value within theseBounds.default org.apache.commons.lang3.tuple.Pair<T,T>toPair()Deprecated.This method is here for legacy purpose.
-
Method Details
-
getLowerBound
T getLowerBound()- Returns:
- the lower limit of these
Bounds
-
getUpperBound
T getUpperBound()- Returns:
- the upper limit of these
Bounds
-
restrict
Restrict the given value within theseBounds. If the value is lower, it is replaced bygetLowerBound(). If the value is higher, it is replaced bygetUpperBound(). Otherwise it is returned as provided.- Parameters:
value- the value to restrict- Returns:
- the value or one of the limits
-
create
Create aBoundswith the given lower and upper limits. -
fromPair
@Deprecated static <T extends java.lang.Comparable<T>> Bounds<T> fromPair(org.apache.commons.lang3.tuple.Pair<T,T> pair)Deprecated.This method is here for legacy purpose. Do not use since it should disappear soon.Utility method to convert a legacyPairinto aBounds. The resultingBoundsrepresents the state of thePairat call time. Later changes of thePairdo not reflect on the previously createdBounds. It allows to not keep a reference on thePairinstance, which can be garbage collected.- Type Parameters:
T- the type of elements- Parameters:
pair- thePairto translate- Returns:
- the resulting
Bounds
-
toPair
Deprecated.This method is here for legacy purpose. Do not use since it should disappear soon.Utility method to convert thisBoundsinto a legacyPair. The resultingPairrepresents the state of theBoundsat call time. Later changes of theBoundsdo not reflect on the previously createdPair. It allows to not keep a reference on theBoundsinstance, which can be garbage collected.- Returns:
- a
Pairrepresenting thisBounds
-