All Packages Class Hierarchy This Package Previous Next Index
Class AT.Ac.univie.imp.loeffler.util.Contract
java.lang.Object
|
+----AT.Ac.univie.imp.loeffler.util.Contract
- public final class Contract
- extends Object
Some minimal support for "design by contract".
- Author:
- Gerald Loeffler (Gerald.Loeffler@univie.ac.at)
-
Contract()
-
-
assert(boolean, String)
- check if a condition is met and throw exception if not
-
post(boolean, String)
- check if postcondition is met and throw exception if not
-
pre(boolean, String)
- check if precondition is met and throw exception if not
Contract
public Contract()
pre
public static void pre(boolean condition,
String msg)
- check if precondition is met and throw exception if not
- Parameters:
- condition - the precondition that must be met
- msg - if the condition is not met an object of class PreconditionNotMetException is thrown with the
message "A precondition was not met: " + msg + ".".
- Throws: PreconditionNotMetException
- if condition is not true
post
public static void post(boolean condition,
String msg)
- check if postcondition is met and throw exception if not
- Parameters:
- condition - the postcondition that must be met
- msg - if the condition is not met an object of class PostconditionNotMetException is thrown with the
message "A postcondition was not met: " + msg + ".".
- Throws: PostconditionNotMetException
- if condition is not true
assert
public static void assert(boolean condition,
String msg)
- check if a condition is met and throw exception if not
- Parameters:
- condition - the condition that must be met
- msg - if the condition is not met an object of class AssertionFailedException is thrown with the
message "An assertion failed: " + msg + ".".
- Throws: AssertionFailedException
- if condition is not true
All Packages Class Hierarchy This Package Previous Next Index