jdsl.core.ref
Class Assertion

java.lang.Object
  |
  +--jdsl.core.ref.Assertion

public final class Assertion
extends java.lang.Object

Helps to check invariant conditions in program and check correctness of implementation. Warning: not thread safe. Undefined behavior if several threads fail on assertion checks simultaneously.

Version:
$Id: Assertion.java,v 1.4 2001/03/21 17:25:11 lv Exp $
Author:
Benety Goh (bg@cs.brown.edu)

Method Summary
static void check(boolean mustBeTrue)
          Never use this method to indicate bad user input; this method is for asserting internal correctness of the implementation only.
static void check(boolean mustBeTrue, java.lang.String message)
          Never use this method to indicate bad user input; this method is for asserting internal correctness of the implementation only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

check

public static void check(boolean mustBeTrue)
                  throws AssertionException
Never use this method to indicate bad user input; this method is for asserting internal correctness of the implementation only.
Parameters:
mustBeTrue - expression that is assumed to be true
Throws:
AssertionException - If mustBeTrue is false

check

public static void check(boolean mustBeTrue,
                         java.lang.String message)
                  throws AssertionException
Never use this method to indicate bad user input; this method is for asserting internal correctness of the implementation only.
Parameters:
mustBeTrue - expression that is assumed to be true
message - description of the problem
Throws:
AssertionException - If mustBeTrue is false