Class DoubleRange

java.lang.Object
dev.jorel.commandapi.wrappers.DoubleRange

public class DoubleRange extends Object
A class representing a range of doubles
  • Constructor Details

    • DoubleRange

      public DoubleRange(double low, double high)
      Constructs a DoubleRange with a lower bound and an upper bound
      Parameters:
      low - the lower bound of this range
      high - the upper bound of this range
  • Method Details

    • doubleRangeGreaterThanOrEq

      public static DoubleRange doubleRangeGreaterThanOrEq(double min)
      Constructs a DoubleRange with a given lower bound and no upper bound
      Parameters:
      min - the lower bound of this range
      Returns:
      a DoubleRange min..
    • doubleRangeLessThanOrEq

      public static DoubleRange doubleRangeLessThanOrEq(double max)
      Constructs a DoubleRange with a given upper bound and no lower bound
      Parameters:
      max - the upper bound of this range
      Returns:
      a DoubleRange ..max
    • getLowerBound

      public double getLowerBound()
      The lower bound of this range.
      Returns:
      the lower bound of this range
    • getUpperBound

      public double getUpperBound()
      The upper bound of this range.
      Returns:
      the upper bound of this range
    • isInRange

      public boolean isInRange(double f)
      Determines if a double is within range of the lower bound (inclusive) and the upper bound (inclusive).
      Parameters:
      f - the double to check within range
      Returns:
      true if the given double is within the declared range
    • toString

      public String toString()
      Converts this DoubleRange to a Minecraft string for use with arguments
      Overrides:
      toString in class Object
      Returns:
      a Minecraft string for use with arguments
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object