Class RangeHalfOpenCheck

java.lang.Object
com.io7m.jranges.RangeHalfOpenCheck

public final class RangeHalfOpenCheck extends Object

Functions for enforcing range constraints at run time.

The functions are intended for use in the manner of assertions. That is, the program should behave identically if all of the checks are removed. The functions raise RangeCheckException upon failure. Exceptions of this type are not intended to be caught and handled; they indicate program bugs.

Since:
4.0.0
See Also:
  • Method Details

    • checkIncludedInLong

      public static long checkIncludedInLong(long x, String x_name, RangeHalfOpenL range, String range_name)

      Assert that x (named x_name) is included in the given range range (named range_name).

      Parameters:
      x - The checked value
      x_name - The name of the checked value
      range - The inclusive range
      range_name - The name of the inclusive range
      Returns:
      x
      Since:
      4.0.0
    • checkIncludedInInteger

      public static int checkIncludedInInteger(int x, String x_name, RangeHalfOpenI range, String range_name)

      Assert that x (named x_name) is included in the given range range (named range_name).

      Parameters:
      x - The checked value
      x_name - The name of the checked value
      range - The inclusive range
      range_name - The name of the inclusive range
      Returns:
      x
      Since:
      4.0.0
    • checkIncludedInBig

      public static BigInteger checkIncludedInBig(BigInteger x, String x_name, RangeHalfOpenB range, String range_name)

      Assert that x (named x_name) is included in the given range range (named range_name).

      Parameters:
      x - The checked value
      x_name - The name of the checked value
      range - The inclusive range
      range_name - The name of the inclusive range
      Returns:
      x
    • checkRangeIncludedInLong

      public static RangeHalfOpenL checkRangeIncludedInLong(RangeHalfOpenL inner, String inner_name, RangeHalfOpenL outer, String outer_name)

      Assert that inner (named inner_name) is included in the given range outer (named outer_name).

      Parameters:
      inner - The checked range
      inner_name - The name of the checked range
      outer - The outer range
      outer_name - The name of the outer range
      Returns:
      inner
      Since:
      4.0.0
    • checkRangeIncludedInInteger

      public static RangeHalfOpenI checkRangeIncludedInInteger(RangeHalfOpenI inner, String inner_name, RangeHalfOpenI outer, String outer_name)

      Assert that inner (named inner_name) is included in the given range outer (named outer_name).

      Parameters:
      inner - The checked range
      inner_name - The name of the checked range
      outer - The outer range
      outer_name - The name of the outer range
      Returns:
      inner
      Since:
      4.0.0
    • checkRangeIncludedInBig

      public static RangeHalfOpenB checkRangeIncludedInBig(RangeHalfOpenB inner, String inner_name, RangeHalfOpenB outer, String outer_name)

      Assert that inner (named inner_name) is included in the given range outer (named outer_name).

      Parameters:
      inner - The checked range
      inner_name - The name of the checked range
      outer - The outer range
      outer_name - The name of the outer range
      Returns:
      inner