edu.jhu.cs.cisst.algorithms.optimize.fmg.util
Class Contract

java.lang.Object
  extended by edu.jhu.cs.cisst.algorithms.optimize.fmg.util.Contract

public final class Contract
extends java.lang.Object

Some minimal support for "design by contract".

Author:
Gerald Loeffler (Gerald.Loeffler@univie.ac.at)

Constructor Summary
Contract()
           
 
Method Summary
static void post(boolean condition, java.lang.String msg)
          check if postcondition is met and throw exception if not.
static void pre(boolean condition, java.lang.String msg)
          check if precondition is met and throw exception if not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Contract

public Contract()
Method Detail

pre

public static void pre(boolean condition,
                       java.lang.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,
                        java.lang.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