SSJ
V. 1.2.5.

umontreal.iro.lecuyer.stat
Class StatProbe

java.lang.Object
  extended by java.util.Observable
      extended by umontreal.iro.lecuyer.stat.StatProbe
Direct Known Subclasses:
Accumulate, Tally

public abstract class StatProbe
extends Observable

The objects of this class are statistical probes or collectors, which are elementary devices for collecting statistics. Each probe collects statistics on a given variable. The subclasses Tally, TallyStore, and Accumulate (from package simevents) implement two specific types of probes, for the case of successive observations X1, X2, X3,..., and for the case of a variable whose value evolves in time, respectively.

StatProbe extends Observable from package java.util, allowing statistical probes to register Observer objects. When a probe is updated, i.e., receives a new statistical observation, it broadcasts this new data to all registered observers. The broadcasting of observations to registered observers can be turned ON or OFF at any time. It is initially OFF by default and should stay OFF when there are no registered observers, to avoid unnecessary overhead.

The data collection by the statistical probe itself can also be turned ON or OFF. By default, it is initially ON. We can turn it OFF, for example, if we want to use the statistical probe only to pass data to the observers, and do not need it to store any information.


Constructor Summary
StatProbe()
           
 
Method Summary
abstract  double average()
          Returns the average for this collector.
 Object clone()
           
 String getName()
          Returns the name associated with this probe, or null if no name was specified upon construction.
abstract  void init()
          Initializes the statistical collector.
 double max()
          Returns the largest value taken by the variable since the last initialization of this probe.
 double min()
          Returns the smallest value taken by the variable since the last initialization of this probe.
abstract  String report()
          Returns a string containing a report for this statistical collector.
 void setBroadcasting(boolean b)
          Instructs the probe to turn its broadcasting ON or OFF.
 void setCollecting(boolean b)
          Turns ON or OFF the statistical collection of statistical observations.
 void setName(String name)
          Sets the name of this statistical collector to name.
 double sum()
          Returns the sum cumulated so far for this probe.
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatProbe

public StatProbe()
Method Detail

init

public abstract void init()
Initializes the statistical collector.


setName

public void setName(String name)
Sets the name of this statistical collector to name.


getName

public String getName()
Returns the name associated with this probe, or null if no name was specified upon construction.

Returns:
the name associated to this collector, or null if not specified

min

public double min()
Returns the smallest value taken by the variable since the last initialization of this probe.

Returns:
the smallest value taken by the collector since last initialization

max

public double max()
Returns the largest value taken by the variable since the last initialization of this probe.

Returns:
the largest value taken by the collector since last initialization

sum

public double sum()
Returns the sum cumulated so far for this probe. The meaning of this sum depends on the subclass (e.g., Tally or Accumulate).

Returns:
the sum for this probe

average

public abstract double average()
Returns the average for this collector.

Returns:
the average value of the collected observations

report

public abstract String report()
Returns a string containing a report for this statistical collector.

Returns:
a report for this probe, represented as a string

setBroadcasting

public void setBroadcasting(boolean b)
Instructs the probe to turn its broadcasting ON or OFF. The default value is OFF.

Warning: To avoid useless overhead and performance degradation, broadcasting should never be turned ON when there are no registered observers.

Parameters:
b - true to turn broadcasting ON, false to turn it OFF

setCollecting

public void setCollecting(boolean b)
Turns ON or OFF the statistical collection of statistical observations. The default value is ON. When statistical collection is turned OFF, observations added to the probe are passed to the registered observers if broadcasting is turned ON, but are not counted as observations by the probe itself.

Parameters:
b - true to activate statistical collection, false to deactivate it

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

SSJ
V. 1.2.5.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.