Class UnsignedRangeCheck
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:
-
RangeCheckException
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 intcheckIncludedInInteger(int x, String x_name, UnsignedRangeInclusiveI range, String range_name) Assert thatx(namedx_name) is included in the given rangerange(namedrange_name).static longcheckIncludedInLong(long x, String x_name, UnsignedRangeInclusiveL range, String range_name) Assert thatx(namedx_name) is included in the given rangerange(namedrange_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 UnsignedRangeInclusiveIcheckRangeIncludedInInteger(UnsignedRangeInclusiveI inner, String inner_name, UnsignedRangeInclusiveI outer, String outer_name) Assert thatinner(namedinner_name) is included in the given rangeouter(namedouter_name).static UnsignedRangeInclusiveLcheckRangeIncludedInLong(UnsignedRangeInclusiveL inner, String inner_name, UnsignedRangeInclusiveL 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).The values in question are assumed to be unsigned when performing the comparison.
- 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).The values in question are assumed to be unsigned when performing the comparison.
- Parameters:
x- The checked valuein_lower- The lower boundx_name- The name of xlower_name- The name of the lower bound- Returns:
- x
-
checkLessLong
Assert that
x(namedx_name) is less thanin_upper(namedupper_name).The values in question are assumed to be unsigned when performing the comparison.
- 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).The values in question are assumed to be unsigned when performing the comparison.
- Parameters:
x- The checked valuein_upper- The upper boundx_name- The name of xupper_name- The name of the upper bound- Returns:
- x
-
checkGreaterInteger
Assert that
x(namedx_name) is greater thanin_lower(namedlower_name).The values in question are assumed to be unsigned when performing the comparison.
- 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
-
checkGreaterEqualInteger
Assert that
x(namedx_name) is greater than or equal toin_lower(namedlower_name).The values in question are assumed to be unsigned when performing the comparison.
- Parameters:
x- The checked valuein_lower- The lower boundx_name- The name of xlower_name- The name of the lower bound- Returns:
- x
-
checkLessInteger
Assert that
x(namedx_name) is less thanin_upper(namedupper_name).The values in question are assumed to be unsigned when performing the comparison.
- 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
-
checkLessEqualInteger
Assert that
x(namedx_name) is less than or equal toin_upper(namedupper_name).The values in question are assumed to be unsigned when performing the comparison.
- Parameters:
x- The checked valuein_upper- The upper boundx_name- The name of xupper_name- The name of the upper bound- Returns:
- x
-
checkIncludedInLong
public static long checkIncludedInLong(long x, String x_name, UnsignedRangeInclusiveL range, String range_name) Assert that
x(namedx_name) is included in the given rangerange(namedrange_name).The values in question are assumed to be unsigned when performing the comparison.
- Parameters:
x- The checked valuex_name- The name of the checked valuerange- The inclusive rangerange_name- The name of the inclusive range- Returns:
- x
-
checkIncludedInInteger
public static int checkIncludedInInteger(int x, String x_name, UnsignedRangeInclusiveI range, String range_name) Assert that
x(namedx_name) is included in the given rangerange(namedrange_name).The values in question are assumed to be unsigned when performing the comparison.
- Parameters:
x- The checked valuex_name- The name of the checked valuerange- The inclusive rangerange_name- The name of the inclusive range- Returns:
- x
-
checkRangeIncludedInLong
public static UnsignedRangeInclusiveL checkRangeIncludedInLong(UnsignedRangeInclusiveL inner, String inner_name, UnsignedRangeInclusiveL outer, String outer_name) Assert that
inner(namedinner_name) is included in the given rangeouter(namedouter_name).The values in question are assumed to be unsigned when performing the comparison.
- Parameters:
inner- The checked rangeinner_name- The name of the checked rangeouter- The outer rangeouter_name- The name of the outer range- Returns:
- inner
-
checkRangeIncludedInInteger
public static UnsignedRangeInclusiveI checkRangeIncludedInInteger(UnsignedRangeInclusiveI inner, String inner_name, UnsignedRangeInclusiveI outer, String outer_name) Assert that
inner(namedinner_name) is included in the given rangeouter(namedouter_name).The values in question are assumed to be unsigned when performing the comparison.
- Parameters:
inner- The checked rangeinner_name- The name of the checked rangeouter- The outer rangeouter_name- The name of the outer range- Returns:
- inner
-