Top Description Constructors Methods
org.jparsec.internal.util

public final Class Checks

extends Object
Class Inheritance

Common facilities to check precondition, postcondition and invariants.
Author
Ben Yu

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
checkArgument(boolean
the condition that has to be true
condition
,
String
the error message if condition is false
message
)

Checks that an argument satisfies requirement.

public static void
checkArgument(boolean
the condition that has to be true
condition
,
String
the error message if condition is false
message
,
Object...
the arguments to the error message
args
)

Checks that an argument satisfies requirement.

public static int
checkMax(int max)

Checks that max isn't negative.

public static int
checkMin(int min)

Checks that min isn't negative.

public static void
checkMinMax(int min, int max)

Checks that neither min or max is negative and min <= max.

public static int
checkNonNegative(int n, String message)

Checks that n isn't negative.

public static <T> T
checkNotNull(T value)

Checks that value cannot be null.

public static void
checkNotNullState(Object
the object that cannot be null
object
,
String
the error message if condition is false
message
)

Checks that object is not null.

public static void
checkNotNullState(Object
the object that cannot be null
object
,
String
the error message if condition is false
message
,
Object...
the arguments to the error message
args
)

Checks that object is not null.

public static void
checkState(boolean
the condition of the state that has to be true
condition
,
String
the error message if condition is false
message
)

Checks a certain state.

public static void
checkState(boolean
the condition of the state that has to be true
condition
,
String
the error message if condition is false
message
,
Object...
the arguments to the error message
args
)

Checks a certain state.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Checksback to summary
public Checks()

Method Detail

checkArgumentback to summary
public static void checkArgument(boolean condition, String message) throws IllegalArgumentException

Checks that an argument satisfies requirement.

Parameters
condition:boolean

the condition that has to be true

message:String

the error message if condition is false

Exceptions
IllegalArgumentException:
if condition is false
checkArgumentback to summary
public static void checkArgument(boolean condition, String message, Object... args) throws IllegalArgumentException

Checks that an argument satisfies requirement.

Parameters
condition:boolean

the condition that has to be true

message:String

the error message if condition is false

args:Object[]

the arguments to the error message

Exceptions
IllegalArgumentException:
if condition is false
checkMaxback to summary
public static int checkMax(int max)

Checks that max isn't negative.

checkMinback to summary
public static int checkMin(int min)

Checks that min isn't negative.

checkMinMaxback to summary
public static void checkMinMax(int min, int max)

Checks that neither min or max is negative and min <= max.

checkNonNegativeback to summary
public static int checkNonNegative(int n, String message)

Checks that n isn't negative. Or throws an IllegalArgumentException with message.

checkNotNullback to summary
public static <T> T checkNotNull(T value) throws NullPointerException

Checks that value cannot be null.

checkNotNullStateback to summary
public static void checkNotNullState(Object object, String message)

Checks that object is not null.

Parameters
object:Object

the object that cannot be null

message:String

the error message if condition is false

Exceptions
IllegalStateException:
if object is null
checkNotNullStateback to summary
public static void checkNotNullState(Object object, String message, Object... args)

Checks that object is not null.

Parameters
object:Object

the object that cannot be null

message:String

the error message if condition is false

args:Object[]

the arguments to the error message

Exceptions
IllegalStateException:
if object is null
checkStateback to summary
public static void checkState(boolean condition, String message) throws IllegalStateException

Checks a certain state.

Parameters
condition:boolean

the condition of the state that has to be true

message:String

the error message if condition is false

Exceptions
IllegalStateException:
if condition is false
checkStateback to summary
public static void checkState(boolean condition, String message, Object... args) throws IllegalStateException

Checks a certain state.

Parameters
condition:boolean

the condition of the state that has to be true

message:String

the error message if condition is false

args:Object[]

the arguments to the error message

Exceptions
IllegalStateException:
if condition is false