|
Release Planner v1.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--rp.util.Debug
The Debug class is the API used for programatic insertion of debugging statements and assertions in code. Here is an example of its use:
public class Test { public static void main(String args[]) { Debug.parseOptions(args); // extracts -d options and consolidates remaining ones Debug.put("hello world!"); // default message level 1 Debug.put("goodbye", 4); // message level 4 int i = 5; Debug.assert(i==7); // message level 0 } }
Method Summary | |
static void |
assert(boolean condition)
Insist on a condition. |
static void |
assert(boolean condition,
java.lang.String msg)
Insist on a condition with an associated message. |
static void |
classInvariant(boolean condition)
Insist on a class invariant condition. |
static void |
classInvariant(boolean condition,
java.lang.String msg)
Insist on a class invariant with an associated message. |
static void |
loopInvariant(boolean condition)
Insist on an loop invariant condition. |
static void |
loopInvariant(boolean condition,
java.lang.String msg)
Insist on a loop invariant with an associated message. |
static java.lang.String |
options(boolean summary)
Returns debug command line option usage documentation suitable for merging into a larger command-line usage message. |
static void |
parseOptions(java.lang.String[] args)
Parses command-line debug options. |
static void |
post(boolean condition)
Insist on a post-condition. |
static void |
post(boolean condition,
java.lang.String msg)
Insist on a post-condition with an associated message. |
static void |
pre(boolean condition)
Insist on a pre-condition. |
static void |
pre(boolean condition,
java.lang.String msg)
Insist on a pre-condition with an associated message. |
static void |
put(java.lang.String msg)
Prints a message to the debug log file at debug level 1. |
static void |
put(java.lang.String msg,
int messageLevel)
Prints a message to the debug log file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void put(java.lang.String msg)
msg
- Message to write to the log file.public static void put(java.lang.String msg, int messageLevel)
msg
- Message to write to the log file.messageLevel
- the debug Level 0-9 (0 always prints)public static void assert(boolean condition)
condition
- Boolean value to test the assertion.public static void assert(boolean condition, java.lang.String msg)
condition
- Boolean value to test the assertion.msg
- Message to write the debug log file on failure of the the assertion.public static void pre(boolean condition)
condition
- Boolean value to test the assertion.public static void pre(boolean condition, java.lang.String msg)
condition
- Boolean value to test the assertion.msg
- Message to write the debug log file on failure of the the assertion.public static void post(boolean condition)
condition
- Boolean value to test the assertion.public static void post(boolean condition, java.lang.String msg)
condition
- Boolean value to test the assertion.msg
- Message to write the debug log file on failure of the the assertion.public static void loopInvariant(boolean condition)
condition
- Boolean value to test the assertion.public static void loopInvariant(boolean condition, java.lang.String msg)
condition
- Boolean value to test the assertion.msg
- Message to write the debug log file on failure of the the assertion.public static void classInvariant(boolean condition)
condition
- Boolean value to test the assertion.public static void classInvariant(boolean condition, java.lang.String msg)
condition
- Boolean value to test the assertion.msg
- Message to write the debug log file on failure of the the assertion.public static java.lang.String options(boolean summary)
summary
- When true returns single-line usage summary.
When false, returns multi-line option details.public static void parseOptions(java.lang.String[] args) throws CommandLineOptionError
args
- command line options
CommandLineOptionError
- If a parsing error.
|
Release Planner v1.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |