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

public abstract class Range<T> extends Object
Represents the base for any data type that is numeric.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Range(T value)
    Constructs a new Range with the value.
    Range(T minimum, T maximum)
    Constructs a new Range with a minimum and a maximum value.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    Retrieves the maximum value of the range.
    Retrieves the minimum value of the range.
    int
     
    abstract boolean
    isInRange(T value)
    Whether the given value is in range of the minimum and the maximum.
    void
    setMaximum(T maximum)
    Changes the maximum value of the range.
    void
    setMinimum(T minimum)
    Changes the minimum value of the range.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Range

      public Range(T minimum, T maximum)
      Constructs a new Range with a minimum and a maximum value.
      Parameters:
      minimum - The minimum of the range.
      maximum - The maximum of the range.
    • Range

      public Range(T value)
      Constructs a new Range with the value.
      Parameters:
      value - The value of the range.
  • Method Details

    • getMinimum

      public T getMinimum()
      Retrieves the minimum value of the range.
      Returns:
      The range's minimum value.
    • setMinimum

      public void setMinimum(T minimum)
      Changes the minimum value of the range.
      Parameters:
      minimum - The new minimum value.
    • getMaximum

      public T getMaximum()
      Retrieves the maximum value of the range.
      Returns:
      The range's maximum value.
    • setMaximum

      public void setMaximum(T maximum)
      Changes the maximum value of the range.
      Parameters:
      maximum - The new maximum value.
    • isInRange

      public abstract boolean isInRange(T value)
      Whether the given value is in range of the minimum and the maximum.
      Parameters:
      value - The value to be checked.
      Returns:
      true if the value in the range of minimum and maximum, otherwise false.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object