Package org.jparsec.internal.util
Class Checks
java.lang.Object
org.jparsec.internal.util.Checks
Common facilities to check precondition, postcondition and invariants.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckArgument(boolean condition, String message) Checks that an argument satisfies requirement.static voidcheckArgument(boolean condition, String message, Object... args) Checks that an argument satisfies requirement.static intcheckMax(int max) Checks thatmaxisn't negative.static intcheckMin(int min) Checks thatminisn't negative.static voidcheckMinMax(int min, int max) Checks that neitherminormaxis negative andmin <= max.static intcheckNonNegative(int n, String message) Checks thatnisn't negative.static <T> TcheckNotNull(T value) Checks thatvaluecannot be null.static voidcheckNotNullState(Object object, String message) Checks thatobjectis not null.static voidcheckNotNullState(Object object, String message, Object... args) Checks thatobjectis not null.static voidcheckState(boolean condition, String message) Checks a certain state.static voidcheckState(boolean condition, String message, Object... args) Checks a certain state.
-
Constructor Details
-
Checks
public Checks()
-
-
Method Details
-
checkNotNull
Checks thatvaluecannot be null.- Throws:
NullPointerException
-
checkArgument
Checks that an argument satisfies requirement.- Parameters:
condition- the condition that has to be truemessage- the error message ifconditionis falseargs- the arguments to the error message- Throws:
IllegalArgumentException- ifconditionis false
-
checkArgument
public static void checkArgument(boolean condition, String message, Object... args) throws IllegalArgumentException Checks that an argument satisfies requirement.- Parameters:
condition- the condition that has to be truemessage- the error message ifconditionis falseargs- the arguments to the error message- Throws:
IllegalArgumentException- ifconditionis false
-
checkState
Checks a certain state.- Parameters:
condition- the condition of the state that has to be truemessage- the error message ifconditionis falseargs- the arguments to the error message- Throws:
IllegalStateException- ifconditionis false
-
checkState
public static void checkState(boolean condition, String message, Object... args) throws IllegalStateException Checks a certain state.- Parameters:
condition- the condition of the state that has to be truemessage- the error message ifconditionis falseargs- the arguments to the error message- Throws:
IllegalStateException- ifconditionis false
-
checkNotNullState
Checks thatobjectis not null.- Parameters:
object- the object that cannot be nullmessage- the error message ifconditionis falseargs- the arguments to the error message- Throws:
IllegalStateException- ifobjectis null
-
checkNotNullState
Checks thatobjectis not null.- Parameters:
object- the object that cannot be nullmessage- the error message ifconditionis falseargs- the arguments to the error message- Throws:
IllegalStateException- ifobjectis null
-
checkMinMax
public static void checkMinMax(int min, int max) Checks that neitherminormaxis negative andmin <= max. -
checkMin
public static int checkMin(int min) Checks thatminisn't negative. -
checkMax
public static int checkMax(int max) Checks thatmaxisn't negative. -
checkNonNegative
-