public final class Check extends Object
Modifier and Type | Method and Description |
---|---|
static int |
gt(int n,
int limit)
Throws an
IllegalArgumentException if the integer n is not greater than
limit ; otherwise, returns n . |
static long |
gt(long n,
long limit)
|
static int |
inRange(int n,
int min,
int max)
Throws an
IllegalArgumentException if the integer n is outside of
the range [min , max ] (inclusive); otherwise, returns n . |
static int |
isEq(int a,
int b)
|
static <T> T |
isEq(T a,
T b)
|
static void |
isFalse(boolean b)
|
static void |
isTrue(boolean b)
|
static int |
lt(int n,
int limit)
|
static long |
lt(long n,
long limit)
|
static int |
nonNegative(int n)
|
static long |
nonNegative(long n)
|
static double |
notNaN(double n)
|
static int |
positive(int n)
|
static long |
positive(long n)
|
public static <T> T isEq(T a, T b)
T
- the type of a
and b
a
- the first argument, may be null
b
- the second argument, may be null
a
if a == b
IllegalArgumentException
- if a != b
public static int isEq(int a, int b)
a
- the first argumentb
- the second argumenta
if a == b
IllegalArgumentException
- if a != b
public static int inRange(int n, int min, int max)
IllegalArgumentException
if the integer n
is outside of
the range [min
, max
] (inclusive); otherwise, returns n
.n
- the integer to test for inclusion in the rangemin
- minimummax
- maximumn
if n >= min && n <= max
IllegalArgumentException
- if n < min || n > max
public static int lt(int n, int limit)
n
- the integer to be testedlimit
- the limitn
if n < limit
IllegalArgumentException
- if n >= limit
public static long lt(long n, long limit)
n
- the long to be testedlimit
- the limitn
if n < limit
IllegalArgumentException
- if n >= limit
public static int gt(int n, int limit)
IllegalArgumentException
if the integer n
is not greater than
limit
; otherwise, returns n
.n
- the integer to be testedlimit
- the limitn
if n > limit
IllegalArgumentException
- if n <= limit
public static long gt(long n, long limit)
n
- the long to be testedlimit
- the limitn
if n > limit
IllegalArgumentException
- if n <= limit
public static void isTrue(boolean b)
b
- boolean value to testIllegalArgumentException
- if b
is false
public static void isFalse(boolean b)
b
- boolean value to testIllegalArgumentException
- if b
is true
public static int nonNegative(int n)
n
- the integer to be testedn
if n >= 0
IllegalArgumentException
- if n < 0
public static long nonNegative(long n)
n
- the long to be testedn
if n >= 0
IllegalArgumentException
- if n < 0
public static int positive(int n)
n
- the integer to be testedn
if n > 0
IllegalArgumentException
- if n <= 0
public static long positive(long n)
n
- the long to be testedn
if n > 0
IllegalArgumentException
- if n <= 0
public static double notNaN(double n)
n
- the double to be testedn
if is not NaNIllegalArgumentException
- if n
is NaNCopyright © 2016. All rights reserved.