SSJ  3.2.1
Stochastic Simulation in Java
 All Classes Namespaces Functions Variables Pages
Public Member Functions | List of all members
Accumulate Class Reference

A subclass of umontreal.ssj.stat.StatProbe, for collecting statistics on a variable that evolves in simulation time, with a piecewise-constant trajectory. More...

Inheritance diagram for Accumulate:
[legend]
Collaboration diagram for Accumulate:
[legend]

Public Member Functions

 Accumulate ()
 Constructs a new Accumulate statistical probe using the default simulator and initializes it by invoking init().
 
 Accumulate (Simulator inSim)
 Constructs a new Accumulate statistical probe linked to the given simulator, and initializes it by invoking init(). More...
 
 Accumulate (String name)
 Constructs and initializes a new Accumulate statistical probe with name name and initial time 0, using the default simulator.
 
 Accumulate (Simulator inSim, String name)
 Constructs-initializes a new Accumulate statistical probe with name name and initial time 0. More...
 
void init ()
 Initializes the statistical collector and puts the current value of the corresponding variable to 0. More...
 
void init (double x)
 Same as init followed by update(x). More...
 
void update ()
 Updates the accumulator using the last value passed to update(double).
 
void update (double x)
 Gives a new observation x to the statistical collector. More...
 
double sum ()
 
double average ()
 Returns the time-average since the last initialization to the last call to update.
 
String shortReportHeader ()
 
String shortReport ()
 
String report ()
 Returns a string containing a report on this collector since its last initialization.
 
double getInitTime ()
 Returns the initialization time for this object. More...
 
double getLastTime ()
 Returns the last update time for this object. More...
 
double getLastValue ()
 Returns the value passed to this probe by the last call to its update method (or the initial value if update was never called after init ). More...
 
Simulator simulator ()
 Returns the simulator associated with this statistical probe. More...
 
void setSimulator (Simulator sim)
 Sets the simulator associated with this probe to sim. More...
 
Accumulate clone ()
 Clone this object.
 
- Public Member Functions inherited from StatProbe
abstract void init ()
 Initializes the statistical collector.
 
void setName (String name)
 Sets the name of this statistical collector to name.
 
String getName ()
 Returns the name associated with this probe, or null if no name was specified upon construction. More...
 
double min ()
 Returns the smallest value taken by the variable since the last initialization of this probe. More...
 
double max ()
 Returns the largest value taken by the variable since the last initialization of this probe. More...
 
double sum ()
 Returns the sum cumulated so far for this probe. More...
 
abstract double average ()
 Returns the average for this collector. More...
 
abstract String report ()
 Returns a string containing a report for this statistical collector. More...
 
abstract String shortReport ()
 Formats and returns a short, one-line report about this statistical probe. More...
 
abstract String shortReportHeader ()
 Returns a string containing the name of the values returned in the report strings. More...
 
boolean isBroadcasting ()
 Determines if this statistical probe is broadcasting observations to registered observers. More...
 
void setBroadcasting (boolean b)
 Instructs the probe to turn its broadcasting ON or OFF. More...
 
boolean isCollecting ()
 Determines if this statistical probe is collecting values. More...
 
void setCollecting (boolean b)
 Turns ON or OFF the collection of statistical observations. More...
 
void addObservationListener (ObservationListener l)
 Adds the observation listener l to the list of observers of this statistical probe. More...
 
void removeObservationListener (ObservationListener l)
 Removes the observation listener l from the list of observers of this statistical probe. More...
 
void clearObservationListeners ()
 Removes all observation listeners from the list of observers of this statistical probe.
 
void notifyListeners (double x)
 Notifies the observation x to all registered observers if broadcasting is ON. More...
 
StatProbe clone () throws CloneNotSupportedException
 

Additional Inherited Members

- Static Public Member Functions inherited from StatProbe
static String report (String globalName, StatProbe[] probes)
 Formats short reports for each statistical probe in the array probes while aligning the probes’ names. More...
 
static String report (String globalName, Iterable<?extends StatProbe > probes)
 Equivalent to report(String,StatProbe[]), except that probes is an Iterable object instead of an array. More...
 
- Protected Attributes inherited from StatProbe
String name
 
double maxValue
 
double minValue
 
double sumValue
 
boolean collect = true
 
boolean broadcast = false
 
boolean showNobs = true
 

Detailed Description

A subclass of umontreal.ssj.stat.StatProbe, for collecting statistics on a variable that evolves in simulation time, with a piecewise-constant trajectory.

Each time the variable changes its value, the method update(double) must be called to inform the probe of the new value. The probe can be reinitialized by init.

Constructor & Destructor Documentation

Accumulate ( Simulator  inSim)

Constructs a new Accumulate statistical probe linked to the given simulator, and initializes it by invoking init().

Parameters
inSimthe simulator of the current variable
Accumulate ( Simulator  inSim,
String  name 
)

Constructs-initializes a new Accumulate statistical probe with name name and initial time 0.

Parameters
namedescriptive name for the probe
inSimthe simulator of the current variable

Member Function Documentation

double getInitTime ( )

Returns the initialization time for this object.

This is the simulation time when init was called for the last time.

Returns
the initialization time for this object
double getLastTime ( )

Returns the last update time for this object.

This is the simulation time of the last call to update or the initialization time if update was never called after init.

Returns
the last update time of this object
double getLastValue ( )

Returns the value passed to this probe by the last call to its update method (or the initial value if update was never called after init ).

Returns
the last update value for this object
void init ( )

Initializes the statistical collector and puts the current value of the corresponding variable to 0.

Note: the initialization time, the last update time and the simulation time are not reset to 0 by this method. For this, Sim.init() must be used.

void init ( double  x)

Same as init followed by update(x).

Parameters
xinitial value of the probe
void setSimulator ( Simulator  sim)

Sets the simulator associated with this probe to sim.

One should call init after this method to reset the statistical probe.

Parameters
simthe simulator of this probe
Simulator simulator ( )

Returns the simulator associated with this statistical probe.

Returns
the associated simulator.
void update ( double  x)

Gives a new observation x to the statistical collector.

If broadcasting to observers is activated for this object, this method will also transmit the new information to the registered observers by invoking the methods notifyListeners(double).

Parameters
xnew observation given to the probe

The documentation for this class was generated from the following file: