public final class UnsignedRangeCheck 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.
RangeCheckException| Modifier and Type | Method | Description |
|---|---|---|
static int |
checkGreaterEqualInteger(int x,
String x_name,
int in_lower,
String lower_name) |
Assert that
x (named x_name) is greater than or equal to
in_lower (named lower_name). |
static long |
checkGreaterEqualLong(long x,
String x_name,
long in_lower,
String lower_name) |
Assert that
x (named x_name) is greater than or equal to
in_lower (named lower_name). |
static int |
checkGreaterInteger(int x,
String x_name,
int in_lower,
String lower_name) |
Assert that
x (named x_name) is greater than
in_lower (named lower_name). |
static long |
checkGreaterLong(long x,
String x_name,
long in_lower,
String lower_name) |
Assert that
x (named x_name) is greater than
in_lower (named lower_name). |
static int |
checkIncludedInInteger(int x,
String x_name,
UnsignedRangeInclusiveI range,
String range_name) |
Assert that
x (named x_name) is included in the given
range range (named range_name). |
static long |
checkIncludedInLong(long x,
String x_name,
UnsignedRangeInclusiveL range,
String range_name) |
Assert that
x (named x_name) is included in the given
range range (named range_name). |
static int |
checkLessEqualInteger(int x,
String x_name,
int in_upper,
String upper_name) |
Assert that
x (named x_name) is less than or equal to
in_upper (named upper_name). |
static long |
checkLessEqualLong(long x,
String x_name,
long in_upper,
String upper_name) |
Assert that
x (named x_name) is less than or equal to
in_upper (named upper_name). |
static int |
checkLessInteger(int x,
String x_name,
int in_upper,
String upper_name) |
Assert that
x (named x_name) is less than
in_upper (named upper_name). |
static long |
checkLessLong(long x,
String x_name,
long in_upper,
String upper_name) |
Assert that
x (named x_name) is less than
in_upper (named upper_name). |
static UnsignedRangeInclusiveI |
checkRangeIncludedInInteger(UnsignedRangeInclusiveI inner,
String inner_name,
UnsignedRangeInclusiveI outer,
String outer_name) |
Assert that
inner (named inner_name) is included in the
given range outer (named outer_name). |
static UnsignedRangeInclusiveL |
checkRangeIncludedInLong(UnsignedRangeInclusiveL inner,
String inner_name,
UnsignedRangeInclusiveL outer,
String outer_name) |
Assert that
inner (named inner_name) is included in the
given range outer (named outer_name). |
public static long checkGreaterLong(long x,
String x_name,
long in_lower,
String lower_name)
Assert that x (named x_name) is greater than
in_lower (named lower_name).
The values in question are assumed to be unsigned when performing the comparison.
x - The checked valuein_lower - The lower boundx_name - The name of the checked valuelower_name - The name of the lower boundpublic static long checkGreaterEqualLong(long x,
String x_name,
long in_lower,
String lower_name)
Assert that x (named x_name) is greater than or equal to
in_lower (named lower_name).
The values in question are assumed to be unsigned when performing the comparison.
x - The checked valuein_lower - The lower boundx_name - The name of xlower_name - The name of the lower boundpublic static long checkLessLong(long x,
String x_name,
long in_upper,
String upper_name)
Assert that x (named x_name) is less than
in_upper (named upper_name).
The values in question are assumed to be unsigned when performing the comparison.
x - The checked valuein_upper - The upper boundx_name - The name of the checked valueupper_name - The name of the upper boundpublic static long checkLessEqualLong(long x,
String x_name,
long in_upper,
String upper_name)
Assert that x (named x_name) is less than or equal to
in_upper (named upper_name).
The values in question are assumed to be unsigned when performing the comparison.
x - The checked valuein_upper - The upper boundx_name - The name of xupper_name - The name of the upper boundpublic static int checkGreaterInteger(int x,
String x_name,
int in_lower,
String lower_name)
Assert that x (named x_name) is greater than
in_lower (named lower_name).
The values in question are assumed to be unsigned when performing the comparison.
x - The checked valuein_lower - The lower boundx_name - The name of the checked valuelower_name - The name of the lower boundpublic static int checkGreaterEqualInteger(int x,
String x_name,
int in_lower,
String lower_name)
Assert that x (named x_name) is greater than or equal to
in_lower (named lower_name).
The values in question are assumed to be unsigned when performing the comparison.
x - The checked valuein_lower - The lower boundx_name - The name of xlower_name - The name of the lower boundpublic static int checkLessInteger(int x,
String x_name,
int in_upper,
String upper_name)
Assert that x (named x_name) is less than
in_upper (named upper_name).
The values in question are assumed to be unsigned when performing the comparison.
x - The checked valuein_upper - The upper boundx_name - The name of the checked valueupper_name - The name of the upper boundpublic static int checkLessEqualInteger(int x,
String x_name,
int in_upper,
String upper_name)
Assert that x (named x_name) is less than or equal to
in_upper (named upper_name).
The values in question are assumed to be unsigned when performing the comparison.
x - The checked valuein_upper - The upper boundx_name - The name of xupper_name - The name of the upper boundpublic static long checkIncludedInLong(long x,
String x_name,
UnsignedRangeInclusiveL range,
String range_name)
Assert that x (named x_name) is included in the given
range range (named range_name).
The values in question are assumed to be unsigned when performing the comparison.
x - The checked valuex_name - The name of the checked valuerange - The inclusive rangerange_name - The name of the inclusive rangepublic static int checkIncludedInInteger(int x,
String x_name,
UnsignedRangeInclusiveI range,
String range_name)
Assert that x (named x_name) is included in the given
range range (named range_name).
The values in question are assumed to be unsigned when performing the comparison.
x - The checked valuex_name - The name of the checked valuerange - The inclusive rangerange_name - The name of the inclusive rangepublic static UnsignedRangeInclusiveL checkRangeIncludedInLong(UnsignedRangeInclusiveL inner, String inner_name, UnsignedRangeInclusiveL outer, String outer_name)
Assert that inner (named inner_name) is included in the
given range outer (named outer_name).
The values in question are assumed to be unsigned when performing the comparison.
inner - The checked rangeinner_name - The name of the checked rangeouter - The outer rangeouter_name - The name of the outer rangepublic static UnsignedRangeInclusiveI checkRangeIncludedInInteger(UnsignedRangeInclusiveI inner, String inner_name, UnsignedRangeInclusiveI outer, String outer_name)
Assert that inner (named inner_name) is included in the
given range outer (named outer_name).
The values in question are assumed to be unsigned when performing the comparison.
inner - The checked rangeinner_name - The name of the checked rangeouter - The outer rangeouter_name - The name of the outer rangeCopyright © 2017 <code@io7m.com> http://io7m.com