mascoptLib.util
Class Trace

java.lang.Object
  |
  +--mascoptLib.util.Trace

public class Trace
extends Object

This class provides an elegant way of trace your programs.

The trace print some message on output. You can activate or unactivate the trace such that you can leave your traces in the program.

The trace provides a level system: you can display the messages converning one level. You can see the level already define in the parameter section of this class.

Version:
Thu Mar 28 11:25:00 2002
Author:
bbongiov@bing.inria.fr

Field Summary
static int ALL
          Trace Level 0
static int ERROR
          Trace Level 1
static int MEMORY
          Trace Level 2
 
Constructor Summary
Trace()
           
 
Method Summary
static void finalizeObj(String id)
          Finalize an object referenced by an id.
static long getTime(int ref)
          Returns the time in ms from the last start of this timer
static void newObj(String id)
          Add an object with an id in object Alive references.
static void print(String s)
          Print a string on the Trace.
static void print(String s, int level)
          Print a string on the Trace.
static void printErr(String s)
          Print a string on the Error Trace.
static void printErrln(String s)
          Print a string on the Error Trace.
static void println(String s)
          Print a string on the Trace.
static void println(String s, int level)
          Print a string on the Trace.
static void printObjectsAlive()
          Prints all object alive.
static void setNameObj(String id, String name)
          Change the name of the object referenced by an id.
static void setVisible(boolean b)
          Switch the trace mode.
static void setVisible(boolean b, int level)
          Switch the trace mode for a level only.
static void setVisibleErr(boolean b)
          Switch the trace mode for errors.
static void startTime(int ref)
          Start a time count. 10 timers can be launched.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL

public static int ALL
Trace Level 0


ERROR

public static int ERROR
Trace Level 1


MEMORY

public static int MEMORY
Trace Level 2

Constructor Detail

Trace

public Trace()
Method Detail

setVisible

public static void setVisible(boolean b)
Switch the trace mode. This function activate the trace mode. All the traces call will be executed after this function and will stop when finding switching again.

Parameters:
b - indicate the Trace mode

setVisible

public static void setVisible(boolean b,
                              int level)
Switch the trace mode for a level only. This function activate the trace mode. All the traces call will be executed after this function and will stop when finding switching again.

Parameters:
level - the level to switch.
b - indicate the Trace mode.

setVisibleErr

public static void setVisibleErr(boolean b)
Switch the trace mode for errors. Some errors can be hidden and this methods displays it when turning on the Error trace mode.

Parameters:
b - indicate the Trace error mode

print

public static void print(String s)
Print a string on the Trace.

Parameters:
s - the string to print

println

public static void println(String s)
Print a string on the Trace.

Parameters:
s - the string to print

print

public static void print(String s,
                         int level)
Print a string on the Trace.

Parameters:
s - the string to print

println

public static void println(String s,
                           int level)
Print a string on the Trace.

Parameters:
s - the string to print

printErr

public static void printErr(String s)
Print a string on the Error Trace.

Parameters:
s - the string to print

printErrln

public static void printErrln(String s)
Print a string on the Error Trace.

Parameters:
s - the string to print

startTime

public static void startTime(int ref)
Start a time count. 10 timers can be launched. Start a timer and then, get the time of the next Trace.

Parameters:
ref - the timer number

getTime

public static long getTime(int ref)
Returns the time in ms from the last start of this timer

Parameters:
ref - the timer number
Returns:
the time in ms

newObj

public static void newObj(String id)
Add an object with an id in object Alive references.

Parameters:
id - the id of the object.

setNameObj

public static void setNameObj(String id,
                              String name)
Change the name of the object referenced by an id.

Parameters:
id - the id of the object.
name - its name.

finalizeObj

public static void finalizeObj(String id)
Finalize an object referenced by an id.

Parameters:
id - the id object.

printObjectsAlive

public static void printObjectsAlive()
Prints all object alive.