@EqualityReference @ThreadSafe public final class RangeCheck 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 and Description |
|---|---|
static BigInteger |
checkGreaterBig(BigInteger x,
String x_name,
BigInteger in_lower,
String lower_name)
Assert that
x (named x_name) is greater than
in_lower (named lower_name). |
static double |
checkGreaterDouble(double x,
String x_name,
double in_lower,
String lower_name)
Assert that
x (named x_name) is greater than
in_lower (named lower_name). |
static BigInteger |
checkGreaterEqualBig(BigInteger x,
String x_name,
BigInteger in_lower,
String lower_name)
Assert that
x (named x_name) is greater than
or equal to in_lower (named lower_name). |
static double |
checkGreaterEqualDouble(double x,
String x_name,
double in_lower,
String lower_name)
Assert that
x (named x_name) is greater than
or equal to in_lower (named lower_name). |
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 BigInteger |
checkIncludedInBig(BigInteger x,
String x_name,
RangeInclusiveB range,
String range_name)
Assert that
x (named x_name) is included in
the given range range (named range_name). |
static int |
checkIncludedInInteger(int x,
String x_name,
RangeInclusiveI 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,
RangeInclusiveL range,
String range_name)
Assert that
x (named x_name) is included in
the given range range (named range_name). |
static BigInteger |
checkLessBig(BigInteger x,
String x_name,
BigInteger in_upper,
String upper_name)
Assert that
x (named x_name) is less than
in_upper (named upper_name). |
static double |
checkLessDouble(double x,
String x_name,
double in_upper,
String upper_name)
Assert that
x (named x_name) is less than
in_upper (named upper_name). |
static BigInteger |
checkLessEqualBig(BigInteger x,
String x_name,
BigInteger in_upper,
String upper_name)
Assert that
x (named x_name) is less than or
equal to in_upper (named upper_name). |
static double |
checkLessEqualDouble(double x,
String x_name,
double in_upper,
String upper_name)
Assert that
x (named x_name) is less than or
equal to in_upper (named upper_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 RangeInclusiveB |
checkRangeIncludedInBig(RangeInclusiveB inner,
String inner_name,
RangeInclusiveB outer,
String outer_name)
Assert that
inner (named inner_name) is
included in the given range outer (named
outer_name). |
static RangeInclusiveI |
checkRangeIncludedInInteger(RangeInclusiveI inner,
String inner_name,
RangeInclusiveI outer,
String outer_name)
Assert that
inner (named inner_name) is
included in the given range outer (named
outer_name). |
static RangeInclusiveL |
checkRangeIncludedInLong(RangeInclusiveL inner,
String inner_name,
RangeInclusiveL 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).
x - The checked valuein_lower - The lower boundx_name - The name of the checked valuelower_name - The name of the lower 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).
x - The checked valuein_lower - The lower boundx_name - The name of the checked valuelower_name - The name of the lower boundpublic static BigInteger checkGreaterBig(BigInteger x, String x_name, BigInteger in_lower, String lower_name)
Assert that x (named x_name) is greater than
in_lower (named lower_name).
x - The checked valuein_lower - The lower boundx_name - The name of the checked valuelower_name - The name of the lower boundpublic static double checkGreaterDouble(double x,
String x_name,
double in_lower,
String lower_name)
Assert that x (named x_name) is greater than
in_lower (named lower_name).
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).
x - The checked valuein_lower - The lower boundx_name - The name of xlower_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).
x - The checked valuein_lower - The lower boundx_name - The name of xlower_name - The name of the lower boundpublic static BigInteger checkGreaterEqualBig(BigInteger x, String x_name, BigInteger in_lower, String lower_name)
Assert that x (named x_name) is greater than
or equal to in_lower (named lower_name).
x - The checked valuein_lower - The lower boundx_name - The name of the checked valuelower_name - The name of the lower boundpublic static double checkGreaterEqualDouble(double x,
String x_name,
double in_lower,
String lower_name)
Assert that x (named x_name) is greater than
or equal to in_lower (named lower_name).
x - The checked valuein_lower - The lower boundx_name - The name of xlower_name - The name of the lower boundpublic static long checkIncludedInLong(long x,
String x_name,
RangeInclusiveL range,
String range_name)
Assert that x (named x_name) is included in
the given range range (named range_name).
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,
RangeInclusiveI range,
String range_name)
Assert that x (named x_name) is included in
the given range range (named range_name).
x - The checked valuex_name - The name of the checked valuerange - The inclusive rangerange_name - The name of the inclusive rangepublic static BigInteger checkIncludedInBig(BigInteger x, String x_name, RangeInclusiveB range, String range_name)
Assert that x (named x_name) is included in
the given range range (named range_name).
x - The checked valuex_name - The name of the checked valuerange - The inclusive rangerange_name - The name of the inclusive rangepublic 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).
x - The checked valuein_upper - The upper boundx_name - The name of the checked valueupper_name - The name of the upper 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).
x - The checked valuein_upper - The upper boundx_name - The name of the checked valueupper_name - The name of the upper boundpublic static BigInteger checkLessBig(BigInteger x, String x_name, BigInteger in_upper, String upper_name)
Assert that x (named x_name) is less than
in_upper (named upper_name).
x - The checked valuein_upper - The upper boundx_name - The name of the checked valueupper_name - The name of the upper boundpublic static double checkLessDouble(double x,
String x_name,
double in_upper,
String upper_name)
Assert that x (named x_name) is less than
in_upper (named upper_name).
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).
x - The checked valuein_upper - The upper boundx_name - The name of xupper_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).
x - The checked valuein_upper - The upper boundx_name - The name of xupper_name - The name of the upper boundpublic static BigInteger checkLessEqualBig(BigInteger x, String x_name, BigInteger in_upper, String upper_name)
Assert that x (named x_name) is less than or
equal to in_upper (named upper_name).
x - The checked valuein_upper - The upper boundx_name - The name of the checked valueupper_name - The name of the upper boundpublic static double checkLessEqualDouble(double x,
String x_name,
double in_upper,
String upper_name)
Assert that x (named x_name) is less than or
equal to in_upper (named upper_name).
x - The checked valuein_upper - The upper boundx_name - The name of xupper_name - The name of the upper boundpublic static RangeInclusiveL checkRangeIncludedInLong(RangeInclusiveL inner, String inner_name, RangeInclusiveL outer, String outer_name)
Assert that inner (named inner_name) is
included in the given range outer (named
outer_name).
inner - The checked rangeinner_name - The name of the checked rangeouter - The outer rangeouter_name - The name of the outer rangepublic static RangeInclusiveI checkRangeIncludedInInteger(RangeInclusiveI inner, String inner_name, RangeInclusiveI outer, String outer_name)
Assert that inner (named inner_name) is
included in the given range outer (named
outer_name).
inner - The checked rangeinner_name - The name of the checked rangeouter - The outer rangeouter_name - The name of the outer rangepublic static RangeInclusiveB checkRangeIncludedInBig(RangeInclusiveB inner, String inner_name, RangeInclusiveB outer, String outer_name)
Assert that inner (named inner_name) is
included in the given range outer (named
outer_name).
inner - The checked rangeinner_name - The name of the checked rangeouter - The outer rangeouter_name - The name of the outer rangeCopyright © 2015 <code@io7m.com> http://io7m.com