26package umontreal.ssj.simevents;
31import java.util.Observable;
32import umontreal.ssj.util.PrintfFormat;
33import umontreal.ssj.stat.StatProbe;
46 private double initTime;
47 private double lastTime;
48 private double lastValue;
70 throw new NullPointerException();
96 throw new NullPointerException();
109 maxValue = Double.MIN_VALUE;
110 minValue = Double.MAX_VALUE;
115 initTime = lastTime = sim.time();
145 double time = sim.time();
150 sumValue += lastValue * (time - lastTime);
171 double periode = lastTime - initTime;
173 return sumValue / periode;
184 pf.
append(-10,
" average");
206 str.
append(
"REPORT on Accumulate stat. collector ==> " + name);
209 str.
append(12, 2, 2, initTime);
210 str.
append(13, 2, 2, lastTime);
211 str.
append(11, 3, 2, minValue);
212 str.
append(12, 3, 2, (
double) maxValue);
266 throw new NullPointerException();
276 }
catch (CloneNotSupportedException e) {
277 throw new IllegalStateException(
"Accumulate can't clone");
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...
Accumulate(Simulator inSim, String name)
Constructs-initializes a new Accumulate statistical probe with name name and initial time 0.
double average()
Returns the time-average since the last initialization to the last call to update.
double sum()
Returns the sum cumulated so far for this probe.
Accumulate(Simulator inSim)
Constructs a new Accumulate statistical probe linked to the given simulator, and initializes it by in...
void update(double x)
Gives a new observation x to the statistical collector.
String report()
Returns a string containing a report on this collector since its last initialization.
void update()
Updates the accumulator using the last value passed to update(double).
Accumulate()
Constructs a new Accumulate statistical probe using the default simulator and initializes it by invok...
Simulator simulator()
Returns the simulator associated with this statistical probe.
Accumulate(String name)
Constructs and initializes a new Accumulate statistical probe with name name and initial time 0,...
String shortReport()
Formats and returns a short, one-line report about this statistical probe.
void init(double x)
Same as init followed by update(x).
void setSimulator(Simulator sim)
Sets the simulator associated with this probe to sim.
void init()
Initializes the statistical collector and puts the current value of the corresponding variable to 0.
String shortReportHeader()
Returns a string containing the name of the values returned in the report strings.
double getInitTime()
Returns the initialization time for this object.
Accumulate clone()
Clone this object.
Represents the executive of a discrete-event simulator.
static Simulator getDefaultSimulator()
Returns the default simulator instance used by the deprecated class.
The objects of this class are statistical probes or collectors, which are elementary devices for coll...
void notifyListeners(double x)
Notifies the observation x to all registered observers if broadcasting is ON.
double min()
Returns the smallest value taken by the variable since the last initialization of this probe.
double max()
Returns the largest value taken by the variable since the last initialization of this probe.