IDebug
© 1997-2001 Joseph Kiniry
© 2000-2001 KindSoftware
© 1997-1999 Caltech
All Rights Reserved

idebug
Class SimpleCollect

java.lang.Object
  |
  +--idebug.Collect
        |
        +--idebug.SimpleCollect
All Implemented Interfaces:
java.lang.Cloneable

public class SimpleCollect
extends Collect
implements java.lang.Cloneable

A default simple core interface to gathering statistics.

Users of IDebug wishing to keep statistics on their system need to inherit from this abstract class and implement the protected methods. The simplest means to collect statistics are to use a hashtable keyed on statistic (since their hashCode is valid) and store Double objects corresponding to the current value of that statistic. This class implements this method as an example and for use.

Note that this class performs no filtering whatsoever. Regardless of the current debug context, etc., this class will keep track of all statistics.

Version:
$Revision: 2146 $ $Date: 2005-02-13 16:54:27 +0000 (Sun, 13 Feb 2005) $
Author:
Joseph R. Kiniry
See Also:
Statistic, Collect

Constructor Summary
SimpleCollect()
           Construct a new SimpleCollect class.
 
Method Summary
 java.lang.Object clone()
           
 double currentValue(Statistic statistic)
           What is the current value for specific statistic?
 double decrement(Statistic statistic)
           Decrement a statistic by the default value.
 double decrement(Statistic statistic, double value)
           Decrement a statistic by a specified value.
 double increment(Statistic statistic)
           Increment a statistic by the default value.
 double increment(Statistic statistic, double value)
           Increment a statistic by a specified value.
 void register(Statistic statistic)
           Register a statistic with the collector.
 java.lang.Object report(Statistic statistic)
           Report on a particular statistic.
 java.lang.Object reportAll()
           Report on all statistics.
 double reset(Statistic statistic)
           Reset a statistic to the default start value.
 double set(Statistic statistic, double value)
           Set a statistic to a specific value.
 void unregister(Statistic statistic)
           Unregister a statistic with the collector.
 
Methods inherited from class idebug.Collect
checkDebugCollectRef, checkStatisticID, isRegistered, isValidCategory, isValidLevel, setDebug
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleCollect

public SimpleCollect()

Construct a new SimpleCollect class.

Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

register

public void register(Statistic statistic)

Register a statistic with the collector.

Overrides:
register in class Collect
Parameters:
statistic - the statistic to register.

unregister

public void unregister(Statistic statistic)

Unregister a statistic with the collector.

Overrides:
unregister in class Collect
Parameters:
statistic - the statistic to unregister.

currentValue

public double currentValue(Statistic statistic)

What is the current value for specific statistic?

Overrides:
currentValue in class Collect
Parameters:
statistic - the statistic being modified.
Returns:
the old value of the statistic.

report

public java.lang.Object report(Statistic statistic)

Report on a particular statistic.

Overrides:
report in class Collect
Parameters:
statistic - the statistic being reported on.
Returns:
a simple String textual report.

reportAll

public java.lang.Object reportAll()

Report on all statistics.

Overrides:
reportAll in class Collect
Returns:
a report on all statistics as a concatented String textual report.
See Also:
report(Statistic)

increment

public double increment(Statistic statistic,
                        double value)

Increment a statistic by a specified value.

Overrides:
increment in class Collect
Parameters:
statistic - the statistic being modified.
value - the amount to increment the statistic.
Returns:
the old value of the statistic.

increment

public double increment(Statistic statistic)

Increment a statistic by the default value.

Overrides:
increment in class Collect
Parameters:
statistic - the statistic being modified.
Returns:
the old value of the statistic.

decrement

public double decrement(Statistic statistic,
                        double value)

Decrement a statistic by a specified value.

Overrides:
decrement in class Collect
Parameters:
statistic - the statistic being modified.
value - the amount to decrement the statistic.
Returns:
the old value of the statistic.

decrement

public double decrement(Statistic statistic)

Decrement a statistic by the default value.

Overrides:
decrement in class Collect
Parameters:
statistic - the statistic being modified.
Returns:
the old value of the statistic.

reset

public double reset(Statistic statistic)

Reset a statistic to the default start value.

Overrides:
reset in class Collect
Parameters:
statistic - the statistic to reset.
Returns:
the old value of the statistic.

set

public double set(Statistic statistic,
                  double value)

Set a statistic to a specific value.

Overrides:
set in class Collect
Parameters:
statistic - the statistic being modified.
value - the new value of the statistic.
Returns:
the old value of the statistic.

IDebug
© 1997-2001 Joseph Kiniry
© 2000-2001 KindSoftware
© 1997-1999 Caltech
All Rights Reserved