Class RangeCheck
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.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic BigIntegercheckGreaterBig(BigInteger x, String x_name, BigInteger in_lower, String lower_name) Assert thatx(namedx_name) is greater thanin_lower(namedlower_name).static doublecheckGreaterDouble(double x, String x_name, double in_lower, String lower_name) Assert thatx(namedx_name) is greater thanin_lower(namedlower_name).static BigIntegercheckGreaterEqualBig(BigInteger x, String x_name, BigInteger in_lower, String lower_name) Assert thatx(namedx_name) is greater than or equal toin_lower(namedlower_name).static doublecheckGreaterEqualDouble(double x, String x_name, double in_lower, String lower_name) Assert thatx(namedx_name) is greater than or equal toin_lower(namedlower_name).static intcheckGreaterEqualInteger(int x, String x_name, int in_lower, String lower_name) Assert thatx(namedx_name) is greater than or equal toin_lower(namedlower_name).static longcheckGreaterEqualLong(long x, String x_name, long in_lower, String lower_name) Assert thatx(namedx_name) is greater than or equal toin_lower(namedlower_name).static intcheckGreaterInteger(int x, String x_name, int in_lower, String lower_name) Assert thatx(namedx_name) is greater thanin_lower(namedlower_name).static longcheckGreaterLong(long x, String x_name, long in_lower, String lower_name) Assert thatx(namedx_name) is greater thanin_lower(namedlower_name).static BigIntegercheckIncludedInBig(BigInteger x, String x_name, RangeInclusiveB range, String range_name) Assert thatx(namedx_name) is included in the given rangerange(namedrange_name).static intcheckIncludedInInteger(int x, String x_name, RangeInclusiveI range, String range_name) Assert thatx(namedx_name) is included in the given rangerange(namedrange_name).static longcheckIncludedInLong(long x, String x_name, RangeInclusiveL range, String range_name) Assert thatx(namedx_name) is included in the given rangerange(namedrange_name).static BigIntegercheckLessBig(BigInteger x, String x_name, BigInteger in_upper, String upper_name) Assert thatx(namedx_name) is less thanin_upper(namedupper_name).static doublecheckLessDouble(double x, String x_name, double in_upper, String upper_name) Assert thatx(namedx_name) is less thanin_upper(namedupper_name).static BigIntegercheckLessEqualBig(BigInteger x, String x_name, BigInteger in_upper, String upper_name) Assert thatx(namedx_name) is less than or equal toin_upper(namedupper_name).static doublecheckLessEqualDouble(double x, String x_name, double in_upper, String upper_name) Assert thatx(namedx_name) is less than or equal toin_upper(namedupper_name).static intcheckLessEqualInteger(int x, String x_name, int in_upper, String upper_name) Assert thatx(namedx_name) is less than or equal toin_upper(namedupper_name).static longcheckLessEqualLong(long x, String x_name, long in_upper, String upper_name) Assert thatx(namedx_name) is less than or equal toin_upper(namedupper_name).static intcheckLessInteger(int x, String x_name, int in_upper, String upper_name) Assert thatx(namedx_name) is less thanin_upper(namedupper_name).static longcheckLessLong(long x, String x_name, long in_upper, String upper_name) Assert thatx(namedx_name) is less thanin_upper(namedupper_name).static RangeInclusiveBcheckRangeIncludedInBig(RangeInclusiveB inner, String inner_name, RangeInclusiveB outer, String outer_name) Assert thatinner(namedinner_name) is included in the given rangeouter(namedouter_name).static RangeInclusiveIcheckRangeIncludedInInteger(RangeInclusiveI inner, String inner_name, RangeInclusiveI outer, String outer_name) Assert thatinner(namedinner_name) is included in the given rangeouter(namedouter_name).static RangeInclusiveLcheckRangeIncludedInLong(RangeInclusiveL inner, String inner_name, RangeInclusiveL outer, String outer_name) Assert thatinner(namedinner_name) is included in the given rangeouter(namedouter_name).
-
Method Details
-
checkGreaterLong
Assert that
x(namedx_name) is greater thanin_lower(namedlower_name).- Parameters:
x- The checked valuein_lower- The lower boundx_name- The name of the checked valuelower_name- The name of the lower bound- Returns:
- x
- Since:
- 2.0.0
-
checkGreaterInteger
Assert that
x(namedx_name) is greater thanin_lower(namedlower_name).- Parameters:
x- The checked valuein_lower- The lower boundx_name- The name of the checked valuelower_name- The name of the lower bound- Returns:
- x
- Since:
- 2.0.0
-
checkGreaterBig
public static BigInteger checkGreaterBig(BigInteger x, String x_name, BigInteger in_lower, String lower_name) Assert that
x(namedx_name) is greater thanin_lower(namedlower_name).- Parameters:
x- The checked valuein_lower- The lower boundx_name- The name of the checked valuelower_name- The name of the lower bound- Returns:
- x
-
checkGreaterDouble
public static double checkGreaterDouble(double x, String x_name, double in_lower, String lower_name) Assert that
x(namedx_name) is greater thanin_lower(namedlower_name).- Parameters:
x- The checked valuein_lower- The lower boundx_name- The name of the checked valuelower_name- The name of the lower bound- Returns:
- x
-
checkGreaterEqualLong
Assert that
x(namedx_name) is greater than or equal toin_lower(namedlower_name).- Parameters:
x- The checked valuein_lower- The lower boundx_name- The name of xlower_name- The name of the lower bound- Returns:
- x
- Since:
- 2.0.0
-
checkGreaterEqualInteger
Assert that
x(namedx_name) is greater than or equal toin_lower(namedlower_name).- Parameters:
x- The checked valuein_lower- The lower boundx_name- The name of xlower_name- The name of the lower bound- Returns:
- x
- Since:
- 2.0.0
-
checkGreaterEqualBig
public static BigInteger checkGreaterEqualBig(BigInteger x, String x_name, BigInteger in_lower, String lower_name) Assert that
x(namedx_name) is greater than or equal toin_lower(namedlower_name).- Parameters:
x- The checked valuein_lower- The lower boundx_name- The name of the checked valuelower_name- The name of the lower bound- Returns:
- x
-
checkGreaterEqualDouble
public static double checkGreaterEqualDouble(double x, String x_name, double in_lower, String lower_name) Assert that
x(namedx_name) is greater than or equal toin_lower(namedlower_name).- Parameters:
x- The checked valuein_lower- The lower boundx_name- The name of xlower_name- The name of the lower bound- Returns:
- x
-
checkIncludedInLong
public static long checkIncludedInLong(long x, String x_name, RangeInclusiveL range, String range_name) Assert that
x(namedx_name) is included in the given rangerange(namedrange_name).- Parameters:
x- The checked valuex_name- The name of the checked valuerange- The inclusive rangerange_name- The name of the inclusive range- Returns:
- x
- Since:
- 2.0.0
-
checkIncludedInInteger
public static int checkIncludedInInteger(int x, String x_name, RangeInclusiveI range, String range_name) Assert that
x(namedx_name) is included in the given rangerange(namedrange_name).- Parameters:
x- The checked valuex_name- The name of the checked valuerange- The inclusive rangerange_name- The name of the inclusive range- Returns:
- x
- Since:
- 2.0.0
-
checkIncludedInBig
public static BigInteger checkIncludedInBig(BigInteger x, String x_name, RangeInclusiveB range, String range_name) Assert that
x(namedx_name) is included in the given rangerange(namedrange_name).- Parameters:
x- The checked valuex_name- The name of the checked valuerange- The inclusive rangerange_name- The name of the inclusive range- Returns:
- x
-
checkLessLong
Assert that
x(namedx_name) is less thanin_upper(namedupper_name).- Parameters:
x- The checked valuein_upper- The upper boundx_name- The name of the checked valueupper_name- The name of the upper bound- Returns:
- x
- Since:
- 2.0.0
-
checkLessInteger
Assert that
x(namedx_name) is less thanin_upper(namedupper_name).- Parameters:
x- The checked valuein_upper- The upper boundx_name- The name of the checked valueupper_name- The name of the upper bound- Returns:
- x
- Since:
- 2.0.0
-
checkLessBig
public static BigInteger checkLessBig(BigInteger x, String x_name, BigInteger in_upper, String upper_name) Assert that
x(namedx_name) is less thanin_upper(namedupper_name).- Parameters:
x- The checked valuein_upper- The upper boundx_name- The name of the checked valueupper_name- The name of the upper bound- Returns:
- x
-
checkLessDouble
Assert that
x(namedx_name) is less thanin_upper(namedupper_name).- Parameters:
x- The checked valuein_upper- The upper boundx_name- The name of the checked valueupper_name- The name of the upper bound- Returns:
- x
-
checkLessEqualLong
Assert that
x(namedx_name) is less than or equal toin_upper(namedupper_name).- Parameters:
x- The checked valuein_upper- The upper boundx_name- The name of xupper_name- The name of the upper bound- Returns:
- x
- Since:
- 2.0.0
-
checkLessEqualInteger
Assert that
x(namedx_name) is less than or equal toin_upper(namedupper_name).- Parameters:
x- The checked valuein_upper- The upper boundx_name- The name of xupper_name- The name of the upper bound- Returns:
- x
- Since:
- 2.0.0
-
checkLessEqualBig
public static BigInteger checkLessEqualBig(BigInteger x, String x_name, BigInteger in_upper, String upper_name) Assert that
x(namedx_name) is less than or equal toin_upper(namedupper_name).- Parameters:
x- The checked valuein_upper- The upper boundx_name- The name of the checked valueupper_name- The name of the upper bound- Returns:
- x
-
checkLessEqualDouble
public static double checkLessEqualDouble(double x, String x_name, double in_upper, String upper_name) Assert that
x(namedx_name) is less than or equal toin_upper(namedupper_name).- Parameters:
x- The checked valuein_upper- The upper boundx_name- The name of xupper_name- The name of the upper bound- Returns:
- x
-
checkRangeIncludedInLong
public static RangeInclusiveL checkRangeIncludedInLong(RangeInclusiveL inner, String inner_name, RangeInclusiveL outer, String outer_name) Assert that
inner(namedinner_name) is included in the given rangeouter(namedouter_name).- Parameters:
inner- The checked rangeinner_name- The name of the checked rangeouter- The outer rangeouter_name- The name of the outer range- Returns:
- inner
- Since:
- 2.0.0
-
checkRangeIncludedInInteger
public static RangeInclusiveI checkRangeIncludedInInteger(RangeInclusiveI inner, String inner_name, RangeInclusiveI outer, String outer_name) Assert that
inner(namedinner_name) is included in the given rangeouter(namedouter_name).- Parameters:
inner- The checked rangeinner_name- The name of the checked rangeouter- The outer rangeouter_name- The name of the outer range- Returns:
- inner
- Since:
- 2.0.0
-
checkRangeIncludedInBig
public static RangeInclusiveB checkRangeIncludedInBig(RangeInclusiveB inner, String inner_name, RangeInclusiveB outer, String outer_name) Assert that
inner(namedinner_name) is included in the given rangeouter(namedouter_name).- Parameters:
inner- The checked rangeinner_name- The name of the checked rangeouter- The outer rangeouter_name- The name of the outer range- Returns:
- inner
-