Class IntegerRange

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

public class IntegerRange extends Object
A class representing a range of integers
  • Constructor Details

    • IntegerRange

      public IntegerRange(int low, int high)
      Constructs an IntegerRange 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

    • integerRangeGreaterThanOrEq

      public static IntegerRange integerRangeGreaterThanOrEq(int min)
      Constructs an IntegerRange with a given lower bound and no upper bound
      Parameters:
      min - the lower bound of this range
      Returns:
      an IntegerRange min..
    • integerRangeLessThanOrEq

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

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

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

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

      public String toString()
      Converts this IntegerRange 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