All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class oplan.util.Debug

java.lang.Object
   |
   +----oplan.util.Debug

public abstract class Debug
extends Object
Class for useful static debugging tools


Variable Index

 o on
Global on/off control over the debugging output produced by the note and noteln methods.
 o out
The output destination used by note and noteln.

Constructor Index

 o Debug()

Method Index

 o assert(boolean)
assert checks a condition that should always be true and throws an AssertionFailure if it is not.
 o assert(boolean, String)
A variant that allows a message that describes the assertion.
 o note(String)
note writes a string to Debug.out if Debug.on is true.
 o noteElements(Enumeration, String)
Prints the elements of an enumeration on separate lines with a specified prefix at the start of each line.
 o noteEnumeration(Enumeration)
Numbers and prints the elements of an Enumeration on separate lines.
 o noteEnumerationClasses(Enumeration)
Prints the elements of an Enumeration on separate lines, with an index number and and class name at the start of each line.
 o noteException(Exception)
Note an exception together with a backtrace.
 o noteln(String)
noteln writes a string, followed by a newline, to Debug.out if Debug.on is true.
 o noteln(String, int)
 o noteln(String, Object)
 o printlnNote(String)
 o printNote(String)
 o setNoteFile(String)
Sets the output destination for debugging notes.
 o setNoteStream(PrintStream)
Sets the output destination for debugging notes.
 o warn(String)
Use this to tell the user about minor problems.

Variables

 o on
 public static boolean on
Global on/off control over the debugging output produced by the note and noteln methods.

 o out
 public static PrintStream out
The output destination used by note and noteln. Do not assign directly to this variable. Call setNoteStream or setNoteFile instead.

Constructors

 o Debug
 public Debug()

Methods

 o note
 public static void note(String message)
note writes a string to Debug.out if Debug.on is true. It is intetended to replace System.out.print calls, for debugging output.

Unlike noteln, note does not print a newline after the message and does not have variants that take different arguments. The typical use of note is to use several calls to write a line of output. One potential problem with using note is that a different thread may print some other output between those calls.

 o noteln
 public static void noteln(String message)
noteln writes a string, followed by a newline, to Debug.out if Debug.on is true. It is intended to replace System.out.println calls, for debugging output. noteln has variants that take more than one argument. The arguments will be printed as strings with single spaces between. The aim here is to avoid string concatenation in the calls to noteln, so that the concatenation will not occur when debugging output is turned off.

 o noteln
 public static void noteln(String message,
                           Object whatever)
 o noteln
 public static void noteln(String message,
                           int i)
 o printNote
 private static synchronized void printNote(String message)
 o printlnNote
 private static synchronized void printlnNote(String message)
 o setNoteStream
 public static synchronized void setNoteStream(PrintStream s)
Sets the output destination for debugging notes.

 o setNoteFile
 public static synchronized void setNoteFile(String filename)
Sets the output destination for debugging notes.

 o noteException
 public static synchronized void noteException(Exception e)
Note an exception together with a backtrace. The note is always printed to System.out or System.err, even if debug output has been turned off or redirected to a file.

 o warn
 public static void warn(String message)
Use this to tell the user about minor problems. Warn prints a message to System.out, followed by a backtrace for the current thread.

 o noteEnumeration
 public static synchronized void noteEnumeration(Enumeration e)
Numbers and prints the elements of an Enumeration on separate lines.

 o noteEnumerationClasses
 public static synchronized void noteEnumerationClasses(Enumeration e)
Prints the elements of an Enumeration on separate lines, with an index number and and class name at the start of each line.

 o noteElements
 public static synchronized void noteElements(Enumeration e,
                                              String prefix)
Prints the elements of an enumeration on separate lines with a specified prefix at the start of each line.

 o assert
 public static void assert(boolean cond)
assert checks a condition that should always be true and throws an AssertionFailure if it is not. assert is typically used when all of the following apply: the subsequent code requires a condition to be true; in the absence of bugs, the condition always will be true at that point; and it is not obvious that the condition will be true.

AssertionFailure is a RuntimeException and so does not need to be listed in the "throws" clauses of method definitions. One reason for that is to avoid discouraging the use of assertions. If AssertionFailure had to be declared, then adding an assertion in a method that had none before would require nonlocal changes in the code.

See Also:
AssertionFailure
 o assert
 public static void assert(boolean cond,
                           String message)
A variant that allows a message that describes the assertion. The message will be printed when the assertion fails and will be included in the AssertionFailure exception.


All Packages  Class Hierarchy  This Package  Previous  Next  Index