|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.borland.primetime.util.Debug
The Debug class is used for debugging purposes (obviously). In a production build, this class is excluded by the compiler. Thus, all references to this class are removed from the compiled code. Typical usage is for testing preconditions and checks (assertions), as well as logging output to help debug the JBuilder product and addins.
Field Summary | |
static int |
count
Common counter variable used as 'line numbers' for debug output messages. |
static java.io.PrintStream |
out
|
Constructor Summary | |
Debug()
|
Method Summary | |
static void |
addTraceCategory(java.lang.Object category)
Category based tracing and warning. |
static void |
assert(boolean condition)
Asserts a condition. |
static void |
assert(boolean condition,
java.lang.String description)
Asserts a condition before a method body is run. |
static void |
debugRect(java.awt.Graphics g,
int x,
int y,
int width,
int height)
Paints a color-cycled hashmarked rectangle in the passed bounds. |
static void |
enableAssert(boolean enable)
Enables or disables the checking of conditions in precondition() and check() |
static void |
enableOutput(boolean enable)
Enables or disables all output of debug messages to System.err. |
static void |
flush()
Flushes the debug out stream buffer. |
static void |
print(java.lang.String message)
Prints a message to the debug out stream. |
static void |
println(java.lang.String message)
Prints a message (and a cr/lf) to the debug out stream. |
static void |
printlnc(java.lang.String message)
Prints a message to the debug out stream preceded by a line number (incremented count) and a tab character. |
static void |
printStackTrace()
Prints a debug stack trace of the current thread to the debug out stream. |
static void |
printStackTrace(java.lang.Throwable ex)
Prints an exception's stack trace to the debug out stream. |
static void |
removeTraceCategory(java.lang.Object category)
|
static void |
setLogStream(java.io.PrintStream log)
Explicitly sets stream for debug messages to be sent to. |
static void |
trace(java.lang.Object category,
java.lang.String description)
Output a trace if the category is enabled and general output is enabled. |
static void |
trace(java.lang.Object category,
java.lang.Throwable ex)
Output a stack trace if the category is enabled and general output is enabled. |
static void |
warn(java.lang.Object category,
boolean condition,
java.lang.String description)
Output a warning if the category is enabled, and a condition is true, and general output is enabled. |
static void |
warn(java.lang.Object category,
java.lang.String description)
Outputs a warning if the category is enabled and general output is enabled. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static java.io.PrintStream out
public static int count
Common counter variable used as 'line numbers' for debug output messages.
Example useage: Debug.out.println(++Debug.count+"\tDebug Message");
or for the same output use: Debug.printlnc("Debug Message");
Constructor Detail |
public Debug()
Method Detail |
public static void enableOutput(boolean enable)
public static void setLogStream(java.io.PrintStream log)
public static void enableAssert(boolean enable)
public static void assert(boolean condition) throws AssertionException
Asserts a condition. Use this to describe assumed state and parameter values. An AssertionExcpetion is raised if the given condition is not true.
An error here usually indicates a problem with the use of the class.
public static void assert(boolean condition, java.lang.String description) throws AssertionException
Asserts a condition before a method body is run. Use this to describe assumed state and parameter values. A AssertionExcpetion is raised if the given condition is not true.
An error here usually indicates a problem with the use of the class.
public static void addTraceCategory(java.lang.Object category)
Category based tracing and warning.
Pass in a unique Class or other object that supports a meaningful toString operation. Then when any call to trace or warning is called, the trace is only displayed if an addTraceCategory() call was made with the same category object.
Typical useage is: addTraceCategory(SomeObject.class);
public static void removeTraceCategory(java.lang.Object category)
public static void trace(java.lang.Object category, java.lang.String description)
Output a trace if the category is enabled and general output is enabled.
Typical useage is: trace(SomeObject.class, "doing something to SomeObject now...");
public static void trace(java.lang.Object category, java.lang.Throwable ex)
Output a stack trace if the category is enabled and general output is enabled.
Typical useage is: trace(SomeObject.class, x);
public static void warn(java.lang.Object category, boolean condition, java.lang.String description)
Output a warning if the category is enabled, and a condition is true, and general output is enabled.
Typical useage: warn(SomeObject.class, someObject1.isBroken(), "someObject1 is broken!");
public static void warn(java.lang.Object category, java.lang.String description)
Outputs a warning if the category is enabled and general output is enabled.
Typical useage: warn(SomeObject.class, "this shouldn't have happened!");
public static void printStackTrace()
public static void printStackTrace(java.lang.Throwable ex)
public static void println(java.lang.String message)
public static void print(java.lang.String message)
public static void printlnc(java.lang.String message)
Prints a message to the debug out stream preceded by a line number (incremented count) and a tab character. This is used to track repetetive operations (like painting algorhythms).
Typical useage: printlnc("SomeObject.paint() called");
public static void flush()
public static void debugRect(java.awt.Graphics g, int x, int y, int width, int height)
Paints a color-cycled hashmarked rectangle in the passed bounds. Used for debugging paint messages. As subsequent calls are made to debugRect, the hash direction of the debug rectangle will alternate directions, cycle through colors, and vary in hash-mark spacing. This is to allow a viewer to distinguish between different and often repetetive calls to debugRect.
Typical useage:
public void paint(Graphics g) {
Rectangle clip = g.getClipBounds();
Debug.debugRect(g, clip.x, clip.y, clip.width, clip.height);
}
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |