cds.util
Class Debug

java.lang.Object
  extended bycds.util.Debug

public class Debug
extends java.lang.Object

Debugging routines and tools

Version:
1.0 Apr 2002
Author:
Marc Wenger/CDS

Field Summary
(package private) static java.io.PrintStream dbgOutput
           
(package private) static boolean on
           
(package private) static java.io.BufferedReader rd
           
(package private) static java.lang.Runtime rt
           
 
Constructor Summary
Debug()
           
 
Method Summary
static java.lang.String dialog(java.lang.String question)
          Dialog routine.
static void display(java.lang.String txt)
          Displays a string on the standard error output.
static void setActive(boolean set_on)
          Sets the debugging Display() method active or not
static void setOutput(java.lang.String filename)
          Defines the output for the Debug class messages.
static void showMemory(java.lang.String id, boolean doGarbageCollection)
          Show memory status.
static void sleep(int millisec)
          Sleeps x milliseconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

on

static boolean on

rd

static java.io.BufferedReader rd

dbgOutput

static java.io.PrintStream dbgOutput

rt

static java.lang.Runtime rt
Constructor Detail

Debug

public Debug()
Method Detail

setActive

public static void setActive(boolean set_on)
Sets the debugging Display() method active or not

Parameters:
set_on - if true, the Display() routine is active. if false, all the debugging output is suppressed

setOutput

public static void setOutput(java.lang.String filename)
Defines the output for the Debug class messages. By default, it is output to the System.err stream. It can be specified as "out" (System.out), "err" (System.err) or any other filename.


display

public static void display(java.lang.String txt)
Displays a string on the standard error output. The Thread name is prepended to the String.

Parameters:
txt - String to display

showMemory

public static void showMemory(java.lang.String id,
                              boolean doGarbageCollection)
Show memory status. It can be preceeded or not by a garbage collection.

Parameters:
id - identification written on the display line
doGarbageCollection - if true, a garbage collection is done before getting the heap status

sleep

public static void sleep(int millisec)
Sleeps x milliseconds. The same as Thread.sleep(), but includes the try..catch stuff.
This method should only be used for debugging purposes, mainly for testing threads by introducing some delay.

Parameters:
millisec - number of milliseconds to wait.

dialog

public static java.lang.String dialog(java.lang.String question)
Dialog routine. Displays a prompt and waits for an answer.

Parameters:
question - String to display before waiting for an answer
Returns:
The typed answer. End of programme or other events need to be managed by the calling routine