SSJ  3.3.1 Stochastic Simulation in Java
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 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 ()

Returns a string containing the name of the values returned in the report strings. More...

Determines if this statistical probe is broadcasting observations to registered observers. More...

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...

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

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 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.

## ◆ Accumulate() [1/2]

 Accumulate ( Simulator inSim )

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

Parameters
 inSim the simulator of the current variable

## ◆ Accumulate() [2/2]

 Accumulate ( Simulator inSim, String name )

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

Parameters
 name descriptive name for the probe inSim the simulator of the current variable

## ◆ getInitTime()

 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

## ◆ getLastTime()

 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

## ◆ getLastValue()

 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

## ◆ init() [1/2]

 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.

## ◆ init() [2/2]

 void init ( double x )

Same as init followed by update(x).

Parameters
 x initial value of the probe

## ◆ setSimulator()

 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
 sim the simulator of this probe

## ◆ simulator()

 Simulator simulator ( )

Returns the simulator associated with this statistical probe.

Returns
the associated simulator.

## ◆ update()

 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
 x new observation given to the probe

The documentation for this class was generated from the following file:
• Accumulate.java