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)

Constructor Index

 o Contract()

Method Index

 o assert(boolean, String)
check if a condition is met and throw exception if not
 o post(boolean, String)
check if postcondition is met and throw exception if not
 o pre(boolean, String)
check if precondition is met and throw exception if not

Constructors

 o Contract
 public Contract()

Methods

 o 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
 o 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
 o 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