borland Packages  Class Hierarchy  jbcl.util Package  Index 

Diagnostic class

java.lang.Object
   +----borland.jbcl.util.Diagnostic

About the Diagnostic class

Variables  Properties  Methods  

The Diagnostic class collects useful diagnostic functions for debugging program flow and output. This class is excluded from the compiled version of your code, therefore, it doesn't show up in the actual build.

Use the compiler to strip the calls to the class, using the following command:

-exclude borland.jbcl.util.Diagnostic


Diagnostic variables

Variables implemented in this class

Diagnostic properties

*Read-only properties **Write-only properties

Properties implemented in java.lang.Object

Diagnostic methods

Methods implemented in this class

Methods implemented in java.lang.Object


Diagnostic variables

count

  public static int count = 0
A common counter variable used for line numbers for debug output messages. For example,
Diagnostic.out.println(++Diagnostic.count+"\tdebug message");

out

  public static PrintStream out = System.err

Diagnostic methods

addTraceCategory(java.lang.Object)

  public static void addTraceCategory(java.lang.Object category)
Category-based tracing and warning. Pass in a unique String, Class or other object that supports a meaningful toString operation. Then when any call to trace or warning that takes a category is called (for example, trace(Object category, String description)), the trace is only displayed if an addTraceCategory() call was made with the same category object.

check(boolean)

  public static void check(boolean condition)

check(boolean, java.lang.String)

  public static void check(boolean condition, java.lang.String description)
Check a condition within a method body. Use this to describe assumed results and state after internal operations. A check is raised if the given condition is false. An error here usually indicates an internal problem with the class.

debugRect(java.awt.Graphics, int, int, int, int)

  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.

enableChecking(boolean)

  public static void enableChecking(boolean enable)
Enables or disables the checking of conditions in precondition() and check().

enableOutput(boolean)

  public static void enableOutput(boolean enable)
Enables or disables all output of diagnostic messages to System.err.

exit(int)

  public static void exit(int code)

fail()

  public static void fail()

fail(java.lang.Exception)

  public static void fail(java.lang.Exception ex)

fail(java.lang.String)

  public static void fail(java.lang.String description)
A quick way to cause a check exception if the code reaches an unexpected location.

flush()

  public static void flush()
Flushes the diagnostic out Stream buffer.

getTraceLevel()

  public static int getTraceLevel()

needException()

  public static void needException()
Used to mark places where an Exception is needed.

precondition(boolean)

  public static void precondition(boolean condition)

precondition(boolean, java.lang.String)

  public static void precondition(boolean condition, java.lang.String description)
Allows you to assert a precondition before a method body is run. Use this to describe assumed state and parameter values. A precondition is raised if the given condition is not true. An error here usually indicates a problem with the use of the class.

print(java.lang.String)

  public static void print(java.lang.String message)
Prints a message to the diagnostic out stream.

println(java.lang.String)

  public static void println(java.lang.String message)
Prints a message to the diagnostic out stream.

printlnc(java.lang.String)

  public static void printlnc(java.lang.String message)

Prints a message to the diagnostic out stream, preceded by a line number (incremented count) and a tab character.

printStackTrace()

  public static void printStackTrace()
Prints a diagnostic stack trace of the current thread to the diagnostic out stream.

printStackTrace(java.lang.Throwable)

  public static void printStackTrace(java.lang.Throwable ex)

removeTraceCategory(java.lang.Object)

  public static void removeTraceCategory(java.lang.Object category)

setLogStream(java.io.PrintStream)

  public static void setLogStream(java.io.PrintStream log)
Explicitly set stream for diagnostic messages to be sent to.

setTraceLevel(int)

  public static void setTraceLevel(int level)
Sets the minimum threshold for trace and warning output. 0 is highest level +maxint is lowest level. Setting this level to -1 effectively turns off traces and warnings.

Note: This does not affect direct access to 'out', nor does it affect output in the checking functions. Use enableOutput() instead.

trace(int, java.lang.String)

  public static void trace(int level, java.lang.String description)
Outputs a trace if the threshold level is high enough and general output is enabled.

trace(java.lang.Object, int, java.lang.String)

  public static void trace(java.lang.Object category, int level, java.lang.String description)
Outputs a trace if the category and general output are both enabled.

trace(java.lang.Object, java.lang.String)

  public static void trace(java.lang.Object category, java.lang.String description)
Outputs a trace if the category and general output are enabled.

warn(int, boolean, java.lang.String)

  public static void warn(int level, boolean condition, java.lang.String description)
Outputs a warning if the threshold level is high enough, a condition is true, and general output is enabled.

warn(java.lang.Object, boolean, java.lang.String)

  public static void warn(java.lang.Object category, boolean condition, java.lang.String description)
Outputs a warning if the category is enabled, a condition is true, and general output is enabled.

warn(java.lang.Object, int, boolean, java.lang.String)

  public static void warn(java.lang.Object category, int level, boolean condition, java.lang.String description)
Outputs a warning if the category is enabled, a condition is true, and general output is enabled.

warn(java.lang.Object, java.lang.String)

  public static void warn(java.lang.Object category, java.lang.String description)