public final class Postconditions extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
checkPostcondition(boolean condition,
String message)
A specialized version of
checkPostcondition(Object, boolean,
Function) that does not mention an input value. |
static void |
checkPostcondition(boolean condition,
Supplier<String> message)
A specialized version of
checkPostcondition(Object, boolean,
Function) that does not mention an input value. |
static <T> T |
checkPostcondition(T value,
boolean condition,
Function<T,String> describer)
Evaluate the given
predicate using value as input. |
static <T> T |
checkPostcondition(T value,
ContractConditionType<T> condition)
Evaluate the given
predicate using value as input. |
static <T> T |
checkPostcondition(T value,
Predicate<T> predicate,
Function<T,String> describer)
Evaluate the given
predicate using value as input. |
static double |
checkPostconditionD(double value,
boolean condition,
DoubleFunction<String> describer)
A
double specialized version of checkPostcondition(Object,
boolean, Function) |
static double |
checkPostconditionD(double value,
ContractDoubleConditionType condition)
A
double specialized version of checkPostcondition(Object,
ContractConditionType). |
static double |
checkPostconditionD(double value,
DoublePredicate predicate,
DoubleFunction<String> describer)
A
double specialized version of checkPostcondition(Object,
Predicate, Function) |
static int |
checkPostconditionI(int value,
boolean condition,
IntFunction<String> describer)
An
int specialized version of checkPostcondition(Object,
boolean, Function). |
static int |
checkPostconditionI(int value,
ContractIntConditionType condition)
An
int specialized version of checkPostcondition(Object,
ContractConditionType). |
static int |
checkPostconditionI(int value,
IntPredicate predicate,
IntFunction<String> describer)
An
int specialized version of checkPostcondition(Object,
ContractConditionType). |
static long |
checkPostconditionL(long value,
boolean condition,
LongFunction<String> describer)
A
long specialized version of checkPostcondition(Object,
Predicate, Function) |
static long |
checkPostconditionL(long value,
ContractLongConditionType condition)
A
long specialized version of checkPostcondition(Object,
ContractConditionType). |
static long |
checkPostconditionL(long value,
LongPredicate predicate,
LongFunction<String> describer)
A
long specialized version of checkPostcondition(Object,
Predicate, Function) |
static <T> T |
checkPostconditions(T value,
ContractConditionType<T>... conditions)
Evaluate all of the given
conditions using value as
input. |
static double |
checkPostconditionsD(double value,
ContractDoubleConditionType... conditions)
A
double specialized version of checkPostconditions(Object,
ContractConditionType[]) |
static int |
checkPostconditionsI(int value,
ContractIntConditionType... conditions)
An
int specialized version of checkPostconditions(Object,
ContractConditionType[]) |
static long |
checkPostconditionsL(long value,
ContractLongConditionType... conditions)
A
long specialized version of checkPostconditions(Object,
ContractConditionType[]) |
@SafeVarargs public static <T> T checkPostconditions(T value, ContractConditionType<T>... conditions) throws PostconditionViolationException
Evaluate all of the given conditions using value as
input.
All of the conditions are evaluated and the function throws PostconditionViolationException if any of the conditions are false, or
raise an exception that is not of type Error. Exceptions of type
Error are propagated immediately, without any further contract
checking.
T - The type of valuesvalue - The valueconditions - The set of conditionsPostconditionViolationException - If any of the conditions are falsepublic static int checkPostconditionsI(int value,
ContractIntConditionType... conditions)
throws PostconditionViolationException
int specialized version of checkPostconditions(Object,
ContractConditionType[])value - The valueconditions - The conditions the value must obeyPostconditionViolationException - If any of the conditions are falsepublic static long checkPostconditionsL(long value,
ContractLongConditionType... conditions)
throws PostconditionViolationException
long specialized version of checkPostconditions(Object,
ContractConditionType[])value - The valueconditions - The conditions the value must obeyPostconditionViolationException - If any of the conditions are falsepublic static double checkPostconditionsD(double value,
ContractDoubleConditionType... conditions)
throws PostconditionViolationException
double specialized version of checkPostconditions(Object,
ContractConditionType[])value - The valueconditions - The conditions the value must obeyPostconditionViolationException - If any of the conditions are falsepublic static <T> T checkPostcondition(T value,
ContractConditionType<T> condition)
throws PostconditionViolationException
Evaluate the given predicate using value as input.
The function throws PostconditionViolationException if the
predicate is false.
T - The type of valuesvalue - The valuecondition - The predicatePostconditionViolationException - If the predicate is falsepublic static <T> T checkPostcondition(T value,
Predicate<T> predicate,
Function<T,String> describer)
Evaluate the given predicate using value as input.
The function throws PostconditionViolationException if the
predicate is false.
T - The type of valuesvalue - The valuepredicate - The predicatedescriber - A describer for the predicatePostconditionViolationException - If the predicate is falsepublic static <T> T checkPostcondition(T value,
boolean condition,
Function<T,String> describer)
Evaluate the given predicate using value as input.
The function throws PostconditionViolationException if the
predicate is false.
T - The type of valuesvalue - The valuecondition - The predicatedescriber - A describer for the predicatePostconditionViolationException - If the predicate is falsepublic static void checkPostcondition(boolean condition,
String message)
throws PostconditionViolationException
checkPostcondition(Object, boolean,
Function) that does not mention an input value.condition - The predicatemessage - The predicate descriptionPostconditionViolationException - Iff predicate == falsepublic static void checkPostcondition(boolean condition,
Supplier<String> message)
throws PostconditionViolationException
checkPostcondition(Object, boolean,
Function) that does not mention an input value.condition - The predicatemessage - The predicate description supplierPostconditionViolationException - Iff predicate == falsepublic static int checkPostconditionI(int value,
ContractIntConditionType condition)
throws PostconditionViolationException
int specialized version of checkPostcondition(Object,
ContractConditionType).value - The valuecondition - The predicatePostconditionViolationException - If the predicate is falsepublic static int checkPostconditionI(int value,
IntPredicate predicate,
IntFunction<String> describer)
int specialized version of checkPostcondition(Object,
ContractConditionType).value - The valuepredicate - The predicatedescriber - The describer for the predicatePostconditionViolationException - If the predicate is falsepublic static int checkPostconditionI(int value,
boolean condition,
IntFunction<String> describer)
int specialized version of checkPostcondition(Object,
boolean, Function).value - The valuecondition - The predicatedescriber - The describer for the predicatePostconditionViolationException - If the predicate is falsepublic static long checkPostconditionL(long value,
ContractLongConditionType condition)
throws PostconditionViolationException
long specialized version of checkPostcondition(Object,
ContractConditionType).value - The valuecondition - The predicatePostconditionViolationException - If the predicate is falsepublic static long checkPostconditionL(long value,
LongPredicate predicate,
LongFunction<String> describer)
long specialized version of checkPostcondition(Object,
Predicate, Function)value - The valuepredicate - The predicatedescriber - The describer of the predicatePostconditionViolationException - If the predicate is falsepublic static long checkPostconditionL(long value,
boolean condition,
LongFunction<String> describer)
long specialized version of checkPostcondition(Object,
Predicate, Function)condition - The predicatevalue - The valuedescriber - The describer of the predicatePostconditionViolationException - If the predicate is falsepublic static double checkPostconditionD(double value,
ContractDoubleConditionType condition)
throws PostconditionViolationException
double specialized version of checkPostcondition(Object,
ContractConditionType).value - The valuecondition - The predicatePostconditionViolationException - If the predicate is falsepublic static double checkPostconditionD(double value,
DoublePredicate predicate,
DoubleFunction<String> describer)
double specialized version of checkPostcondition(Object,
Predicate, Function)value - The valuepredicate - The predicatedescriber - The describer of the predicatePostconditionViolationException - If the predicate is falsepublic static double checkPostconditionD(double value,
boolean condition,
DoubleFunction<String> describer)
double specialized version of checkPostcondition(Object,
boolean, Function)value - The valuecondition - The predicatedescriber - The describer of the predicatePostconditionViolationException - If the predicate is falseCopyright © 2017 <code@io7m.com> http://io7m.com