Package net.minestom.server.utils.math
Class Range<T>
java.lang.Object
net.minestom.server.utils.math.Range<T>
- Type Parameters:
T- The type numeric of the range object.
- Direct Known Subclasses:
ByteRange,DoubleRange,FloatRange,IntRange,LongRange,ShortRange
Represents the base for any data type that is numeric.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanRetrieves the maximum value of the range.Retrieves the minimum value of the range.inthashCode()abstract booleanWhether the givenvalueis in range of the minimum and the maximum.voidsetMaximum(T maximum) Changes the maximum value of the range.voidsetMinimum(T minimum) Changes the minimum value of the range.
-
Constructor Details
-
Range
- Parameters:
minimum- The minimum of the range.maximum- The maximum of the range.
-
Range
Constructs a newRangewith thevalue.- Parameters:
value- The value of the range.
-
-
Method Details
-
getMinimum
Retrieves the minimum value of the range.- Returns:
- The range's minimum value.
-
setMinimum
Changes the minimum value of the range.- Parameters:
minimum- The new minimum value.
-
getMaximum
Retrieves the maximum value of the range.- Returns:
- The range's maximum value.
-
setMaximum
Changes the maximum value of the range.- Parameters:
maximum- The new maximum value.
-
isInRange
Whether the givenvalueis in range of the minimum and the maximum.- Parameters:
value- The value to be checked.- Returns:
trueif the value in the range ofminimumandmaximum, otherwisefalse.
-
equals
-
hashCode
public int hashCode()
-