ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.stat
Class AccumulateWithTimes

java.lang.Object
  extended by umontreal.iro.lecuyer.stat.StatProbe
      extended by umontreal.iro.lecuyer.stat.AccumulateWithTimes
All Implemented Interfaces:
Cloneable

public class AccumulateWithTimes
extends StatProbe
implements Cloneable

A subclass of StatProbe, for collecting statistics on a variable that evolves in time, with a piecewise-constant trajectory. Each time the variable changes its value, the method update must be called to inform the probe of the new value. The probe can be reinitialized by init. This class is similar to Accumulate, but it uses a user-specified times rather than simulation times.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.stat.StatProbe
broadcast, collect, maxValue, minValue, name, showNobs, sumValue
 
Constructor Summary
AccumulateWithTimes()
          Constructs a new Accumulate statistical probe and initializes it by invoking init().
AccumulateWithTimes(String name)
          Construct and initializes a new Accumulate statistical probe with name name and initial time 0.
 
Method Summary
 double average()
          Returns the time-average since the last initialization to the last call to update(double).
 AccumulateWithTimes clone()
          Clone this object.
 double getInitTime()
          Returns the initialization time for this object.
 double getLastTime()
          Returns the last update time for 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(double,double) was never called after init).
 void init()
          Initializes the statistical collector and puts the current value of the corresponding variable to 0 at time 0.
 void init(double time)
          Similar to init(), but the initial time is given by time.
 void init(double time, double x)
          Same as init followed by update(time, x).
 String report()
           
 String shortReport()
           
 String shortReportHeader()
           
 double sum()
           
 void update(double time)
          Updates the accumulator using the last value passed to update.
 void update(double time, double x)
          Gives a new observation (time, x) to the statistical collector.
 
Methods inherited from class umontreal.iro.lecuyer.stat.StatProbe
addObservationListener, clearObservationListeners, getName, isBroadcasting, isCollecting, max, min, notifyListeners, removeObservationListener, report, report, setBroadcasting, setCollecting, setName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccumulateWithTimes

public AccumulateWithTimes()
Constructs a new Accumulate statistical probe and initializes it by invoking init().


AccumulateWithTimes

public AccumulateWithTimes(String name)
Construct and initializes a new Accumulate statistical probe with name name and initial time 0.

Method Detail

init

public void init()
Initializes the statistical collector and puts the current value of the corresponding variable to 0 at time 0. A call to init should normally be followed immediately by a call to update to give the value of the variable at the initialization time.

Specified by:
init in class StatProbe

init

public void init(double time)
Similar to init(), but the initial time is given by time.


init

public void init(double time,
                 double x)
Same as init followed by update(time, x).

Parameters:
x - initial value of the probe

update

public void update(double time)
Updates the accumulator using the last value passed to update.


update

public void update(double time,
                   double x)
Gives a new observation (time, 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.

Parameters:
time - the time of the observation
x - new observation given to the probe

sum

public double sum()
Overrides:
sum in class StatProbe

average

public double average()
Returns the time-average since the last initialization to the last call to update(double).

Specified by:
average in class StatProbe

shortReportHeader

public String shortReportHeader()
Specified by:
shortReportHeader in class StatProbe

shortReport

public String shortReport()
Specified by:
shortReport in class StatProbe

report

public String report()
Specified by:
report in class StatProbe

getInitTime

public 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

public 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

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

Returns:
the last update value for this object

clone

public AccumulateWithTimes clone()
Clone this object.

Overrides:
clone in class StatProbe

ContactCenters
V. 0.9.9.

To submit a bug or ask questions, send an e-mail to Richard Simard.