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 BigInteger
checkGreaterBig
(BigInteger x, String x_name, BigInteger in_lower, String lower_name) Assert thatx
(namedx_name
) is greater thanin_lower
(namedlower_name
).static double
checkGreaterDouble
(double x, String x_name, double in_lower, String lower_name) Assert thatx
(namedx_name
) is greater thanin_lower
(namedlower_name
).static BigInteger
checkGreaterEqualBig
(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 double
checkGreaterEqualDouble
(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 int
checkGreaterEqualInteger
(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 long
checkGreaterEqualLong
(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 int
checkGreaterInteger
(int x, String x_name, int in_lower, String lower_name) Assert thatx
(namedx_name
) is greater thanin_lower
(namedlower_name
).static long
checkGreaterLong
(long x, String x_name, long in_lower, String lower_name) Assert thatx
(namedx_name
) is greater thanin_lower
(namedlower_name
).static BigInteger
checkIncludedInBig
(BigInteger x, String x_name, RangeInclusiveB range, String range_name) Assert thatx
(namedx_name
) is included in the given rangerange
(namedrange_name
).static int
checkIncludedInInteger
(int x, String x_name, RangeInclusiveI range, String range_name) Assert thatx
(namedx_name
) is included in the given rangerange
(namedrange_name
).static long
checkIncludedInLong
(long x, String x_name, RangeInclusiveL range, String range_name) Assert thatx
(namedx_name
) is included in the given rangerange
(namedrange_name
).static BigInteger
checkLessBig
(BigInteger x, String x_name, BigInteger in_upper, String upper_name) Assert thatx
(namedx_name
) is less thanin_upper
(namedupper_name
).static double
checkLessDouble
(double x, String x_name, double in_upper, String upper_name) Assert thatx
(namedx_name
) is less thanin_upper
(namedupper_name
).static BigInteger
checkLessEqualBig
(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 double
checkLessEqualDouble
(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 int
checkLessEqualInteger
(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 long
checkLessEqualLong
(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 int
checkLessInteger
(int x, String x_name, int in_upper, String upper_name) Assert thatx
(namedx_name
) is less thanin_upper
(namedupper_name
).static long
checkLessLong
(long x, String x_name, long in_upper, String upper_name) Assert thatx
(namedx_name
) is less thanin_upper
(namedupper_name
).static RangeInclusiveB
checkRangeIncludedInBig
(RangeInclusiveB inner, String inner_name, RangeInclusiveB outer, String outer_name) Assert thatinner
(namedinner_name
) is included in the given rangeouter
(namedouter_name
).static RangeInclusiveI
checkRangeIncludedInInteger
(RangeInclusiveI inner, String inner_name, RangeInclusiveI outer, String outer_name) Assert thatinner
(namedinner_name
) is included in the given rangeouter
(namedouter_name
).static RangeInclusiveL
checkRangeIncludedInLong
(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
-