gishur.core.algorithms
Class Tracer

java.lang.Object
  |
  +--gishur.core.algorithms.Tracer

public class Tracer
extends java.lang.Object

A Tracer object is the central object for the recording of algorithms. It can be used to record many instances of objects that can be identified via its names. The object instances are stored at TraceObjects, that allow fast access to a specific recorded instance. Via the recording of defined record-steps - in our terms called TraceLabels - it is later possible to scope through the various instances of all recorded objects at these defined time points. To navigate easily through the recorded TraceLabels, one can use a TraceCursor. To mark algorithm classes that can record such debugging data, they should implement the TraceExecutor interface.

For easy recording and visualizing the recorded data, one should take a look at the TraceBar - a complete control bar to browse through the recorded algorithm. The TraceVisualizer interface helps for simple visualization of the recorded data.

Version:
1.0
Author:
Thomas Wolf

Constructor Summary
Tracer(java.lang.String name)
          Default Constructor.
 
Method Summary
 TraceCursor createTraceCursor()
           
 TraceObject createTraceObject(java.lang.String name)
          Creates a new TraceObject with the given name.
 TraceLabel[] getTraceLabels(int level)
           
 int maxUsedLevel()
           
 TraceObject object(java.lang.String name)
          Returns the TraceObject with the given name.
 java.util.Enumeration objects()
          Returns an enumeration of all recorded objects.
 int recLabelCount()
           
 void recordLabel(java.lang.String name, int level)
          Records a new TraceLabel with the specified name and level.
 void recordLabel(java.lang.String name, int type, int level)
          Records a new TraceLabel with the specified name, type and level.
 boolean recordMode()
          Returns true, if the Tracer is recording an algorithm.
 void startRecord()
           
 void stopRecord()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Tracer

public Tracer(java.lang.String name)
Default Constructor.
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

createTraceObject

public TraceObject createTraceObject(java.lang.String name)
Creates a new TraceObject with the given name. If a TraceObject with the given name exists, then this TraceObject will be returned (otherwise the newly created). New TraceObjects may only be created, if the Tracer is in record mode. The name must not be null.
Parameters:
name - the name of the new TraceObject
Returns:
the new created TraceObject

object

public TraceObject object(java.lang.String name)
Returns the TraceObject with the given name. If no such TraceObject exists, a new one will be created, but only if the Tracer is in record mode, otherwise null will be returned. The name must not be null.
Parameters:
name - the name of the TraceObject
Returns:
the stored TraceObject or a new created

objects

public java.util.Enumeration objects()
Returns an enumeration of all recorded objects.
Returns:
an enumeration of all recorded objects.

recLabelCount

public int recLabelCount()

maxUsedLevel

public int maxUsedLevel()

recordMode

public boolean recordMode()
Returns true, if the Tracer is recording an algorithm.
Returns:
true, if the Tracer is recording an algorithm.

startRecord

public void startRecord()

stopRecord

public void stopRecord()

recordLabel

public void recordLabel(java.lang.String name,
                        int type,
                        int level)
Records a new TraceLabel with the specified name, type and level.
Parameters:
name - the name of the new TraceLabel
type - the type of the TraceLabel
level - the level depth of the TraceLabel

recordLabel

public void recordLabel(java.lang.String name,
                        int level)
Records a new TraceLabel with the specified name and level.
Parameters:
name - the name of the new TraceLabel
level - the level depth of the TraceLabel

getTraceLabels

public TraceLabel[] getTraceLabels(int level)

createTraceCursor

public TraceCursor createTraceCursor()