All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gnu.jel.debug.Debug

java.lang.Object
   |
   +----gnu.jel.debug.Debug

public final class Debug
extends Object
This class used for incorporating internal checks and assertions into the code.
None of these functions does anything if Debug.enabled is false.
If you really want to throw ALL debug messages from the final, compiler generated, code -- wrap calls to Debug methods into the if statement, checking Debug.enabled constant. As shown in the example :
 import cz.fzu.metlov.jel.*;
 ..... BLA BLA BLA ...
 if (Debug.enabled) {
  Debug.println("I want this message to disappear in the optimized version");
  Debug.assert(foo==superTimeConsumingFunction(bar), 
 "I do not want to evaluate superTimeConsumingFunction(), when optimized."); 
 }; 


Variable Index

 o enabled
Determines if debugging is enabled in current compilation.

Constructor Index

 o Debug()

Method Index

 o assert(boolean)
Checks for the condition.
 o assert(boolean, String)
Checks for the condition.
 o println(String)
Prints a line of the debug output.
 o reportThrowable(Throwable)
Reports an exception, which should not occur(i.e.
 o reportThrowable(Throwable, String)
Reports an exception, which should not occur(i.e.

Variables

 o enabled
 public static final boolean enabled
Determines if debugging is enabled in current compilation.

Constructors

 o Debug
 public Debug()

Methods

 o println
 public static final void println(String message)
Prints a line of the debug output. The resulting line goes to System.err and is prefixed by "[DEBUG] ".

Parameters:
message - message to print.
 o assert
 public static final void assert(boolean condition,
                                 String message)
Checks for the condition. If condition is false this function prints a given message to the System.err along with the stack trace.

Parameters:
condition - is the condition to check.
message - is the message to print if condition is false.
 o assert
 public static final void assert(boolean condition)
Checks for the condition. If condition is false this function prints a "Assertion failed." to the System.err along with the stack trace.

Parameters:
condition - is the condition to check.
 o reportThrowable
 public static final void reportThrowable(Throwable t,
                                          String message)
Reports an exception, which should not occur(i.e. handled improperly).

Parameters:
t - is what was thrown.
message - is algorithm specific message.
 o reportThrowable
 public static final void reportThrowable(Throwable t)
Reports an exception, which should not occur(i.e. handled improperly).

Parameters:
t - is what was thrown.

All Packages  Class Hierarchy  This Package  Previous  Next  Index