public class Accumulate extends StatProbe implements java.lang.Cloneable
| Constructor and Description |
|---|
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().
|
Accumulate(Simulator inSim,
java.lang.String name)
Construct and initializes a new Accumulate
statistical probe with name name and initial time 0.
|
Accumulate(java.lang.String name)
Construct and initializes a new Accumulate
statistical probe with name name and initial time 0, using the default simulator.
|
| Modifier and Type | Method and Description |
|---|---|
double |
average()
Returns the time-average since the last initialization
to the last call to update.
|
Accumulate |
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()
|
void |
init()
Initializes the statistical collector and puts the current
value of the corresponding variable to 0.
|
void |
init(double x)
|
java.lang.String |
report()
Returns a string containing a report for this statistical
collector.
|
void |
setSimulator(Simulator sim)
Sets the simulator associated with this probe to sim.
|
java.lang.String |
shortReport()
Formats and returns a short, one-line report
about this statistical probe.
|
java.lang.String |
shortReportHeader()
Returns a string containing
the name of the values returned in the report
strings.
|
Simulator |
simulator()
Returns the simulator associated with this statistical probe.
|
double |
sum()
Returns the sum cumulated so far for this probe.
|
void |
update()
Updates the accumulator using the last value passed
to
update. |
void |
update(double x)
Gives a new observation x to the statistical collector.
|
addObservationListener, clearObservationListeners, getName, isBroadcasting, isCollecting, max, min, notifyListeners, removeObservationListener, report, report, setBroadcasting, setCollecting, setNamepublic Accumulate()
public Accumulate(Simulator inSim)
inSim - the simulator of the current variablepublic Accumulate(java.lang.String name)
public Accumulate(Simulator inSim, java.lang.String name)
name - descriptive name for the probeinSim - the simulator of the current variablepublic void init()
update to give the value of the variable at the
initialization time.public void init(double x)
x - initial value of the probepublic void update()
update.public void update(double x)
notifyListeners.x - new observation given to the probepublic double sum()
StatProbeTally or
Accumulate).
This returns 0
if the probe was not updated since the last initialization.public double average()
public java.lang.String shortReportHeader()
StatProbe
System.out.println (probe1.shortReportHeader());
System.out.println (probe1.getName() + " " + probe1.shortReport());
System.out.println (probe2.getName() + " " + probe2.shortReport());
...
Alternatively, one can use report (String,StatProbe[])
to get a report with aligned probe names.shortReportHeader in class StatProbepublic java.lang.String shortReport()
StatProbeshortReportHeader().
This report should not contain any end-of-line character, and does not
include the name of the probe.
Its contents depends on the statistical probe as well as on the
parameters set by the user through probe-specific methods.shortReport in class StatProbepublic java.lang.String report()
StatProbepublic double getInitTime()
init was called for
the last time.public double getLastTime()
update or
the initialization time if update was never called after
init.public double getLastValue()
update method (or the initial value if
update was never called after init).public Simulator simulator()
public void setSimulator(Simulator sim)
init after this method to reset the statistical probe.sim - the simulator of this probepublic Accumulate clone()
To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.