Bees v0.5.0 API

bees.core
Class Assert

java.lang.Object
  |
  +--bees.core.Assert

public final class Assert
extends java.lang.Object

Provides a number of static functions for verifying state in the system. The basic check() function tests its argument and throws an exception if it's false/NULL. The require() and ensure() methods are simply aliases for check() and used to imply pre/post conditions for functions.

Author:
Utah Janos Team

Inner Class Summary
static class Assert.AssertFailure
          A run-time Error is thrown if an check fails.
 
Method Summary
static void check(boolean test)
          Check a boolean is true.
static void check(boolean test, java.lang.String msg)
          Check a boolean is true.
static void check(java.lang.Object obj)
          Check that an object reference is not null.
static void ensure(boolean test)
          Ensure a boolean is true.
static void ensure(java.lang.Object obj)
          Ensure an object reference is not null.
static void require(boolean test)
          Require a boolean to be true.
static void require(java.lang.Object obj)
          Require an object reference to be non-null.
 
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 test)
                  throws Assert.AssertFailure
Check a boolean is true.
Parameters:
test - The boolean to test.
Throws:
Assert.AssertFailure - if test if false.

check

public static void check(boolean test,
                         java.lang.String msg)
                  throws Assert.AssertFailure
Check a boolean is true.
Parameters:
test - The boolean to test.
msg - A description of the tested value.
Throws:
Assert.AssertFailure - if test if false.

check

public static void check(java.lang.Object obj)
                  throws Assert.AssertFailure
Check that an object reference is not null.
Parameters:
obj - The object reference to check.
Throws:
Assert.AssertFailure - if obj is null.

require

public static void require(boolean test)
                    throws Assert.AssertFailure
Require a boolean to be true.
Parameters:
test - The boolean to test.
Throws:
Assert.AssertFailure - if test if false.

require

public static void require(java.lang.Object obj)
                    throws Assert.AssertFailure
Require an object reference to be non-null.
Parameters:
obj - The object reference to check.
Throws:
Assert.AssertFailure - if obj is null

ensure

public static void ensure(boolean test)
                   throws Assert.AssertFailure
Ensure a boolean is true.
Parameters:
test - The boolean to test.
Throws:
Assert.AssertFailure - if test if false.

ensure

public static void ensure(java.lang.Object obj)
                   throws Assert.AssertFailure
Ensure an object reference is not null.
Parameters:
obj - The object reference to check.
Throws:
Assert.AssertFailure - if obj is null.

Bees v0.5.0 API

This documentation is Copyright (C) 2002 The University of Utah. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for Bees v0.5.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/