|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.generic.util.Assert
The target platforms for the Tensegrity Graph API are the JDK
versions 1.3 or newer.
Unfortunately there is no assert keyword or mechanism
shipped with the 1.3 version of the JDK. Because of this, the
Tensegrity Graph Framework comes with a mechanism that resembles
assertions and permits their use.
Class Assert therefore contains methods for assertions thrown
at runtime. Specifying what effects failed assertions have at runtime is
done by means of a flag defined in class Debug, namely
Debug.DO_ASSERT. This flag determines whether a
subclass of a runtime exception is thrown if an assertion fails.
Using the if-statement on the global flag Debug.DO_ASSERT
is mandatory. This global final static boolean flag allows a compiler
to safely exclude the body of the if-statement from non-debug builds. In order to
exclude all assertion code from a production build, it is sufficient to set the
flag Debug.DO_ASSERT to false.
Class Assert provides static methods and no public constructors.
| Field Summary | |
static java.lang.String |
DIVIDE_BY_ZERO
Predefined reasons for failed assertions. |
static java.lang.String |
ILLEGAL_ARRAY_LENGTH
Predefined reasons for failed assertions. |
static java.lang.String |
ILLEGAL_TYPE
Predefined reasons for failed assertions. |
static java.lang.String |
ILLEGAL_VALUE
Predefined reasons for failed assertions. |
static java.lang.String |
NON_NEGATIVE_ARGUMENT
Predefined reasons for failed assertions. |
static java.lang.String |
NON_NULL_ARGUMENT
Predefined reasons for failed assertions. |
static java.lang.String |
NON_NULL_ARGUMENTS
Predefined reasons for failed assertions. |
static java.lang.String |
POSITIVE_ARGUMENT
Predefined reasons for failed assertions. |
| Method Summary | |
static void |
check(boolean condition)
Triggers an assert failed processing if the condition is not true. |
static void |
check(boolean condition,
java.lang.String what)
Triggers an assert failed processing if the condition is not true. |
static void |
fail()
Always triggers an assert failed processing. |
static void |
fail(java.lang.String what)
Always triggers an assert failed processing. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String NON_NEGATIVE_ARGUMENT
public static final java.lang.String POSITIVE_ARGUMENT
public static final java.lang.String NON_NULL_ARGUMENT
public static final java.lang.String NON_NULL_ARGUMENTS
public static final java.lang.String DIVIDE_BY_ZERO
public static final java.lang.String ILLEGAL_ARRAY_LENGTH
public static final java.lang.String ILLEGAL_TYPE
public static final java.lang.String ILLEGAL_VALUE
| Method Detail |
public static final void fail()
AssertException - thrown only if the Debug flag for
assertion is enabled.public static final void fail(java.lang.String what)
what - additional information associated with the particular
failure
AssertException - thrown only if the Debug flag for
assertion is enabled.public static final void check(boolean condition)
condition - the condition to check
AssertException - thrown only if the Debug flag for
assertion is enabled.
public static final void check(boolean condition,
java.lang.String what)
condition - the condition to checkwhat - additional information associated with the particular
check
AssertException - thrown only if the Debug flag for
assertion is enabled.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||