umontreal.iro.lecuyer.simevents
Class Accumulate
- java.lang.Object
-
- umontreal.iro.lecuyer.stat.StatProbe
-
- umontreal.iro.lecuyer.simevents.Accumulate
-
- All Implemented Interfaces:
- java.lang.Cloneable
public class Accumulate extends StatProbe implements java.lang.Cloneable
-
-
Constructor Summary
Constructors 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doubleaverage()Returns the time-average since the last initialization to the last call to update.Accumulateclone()Clone this object.doublegetInitTime()Returns the initialization time for this object.doublegetLastTime()Returns the last update time for this object.doublegetLastValue()voidinit()Initializes the statistical collector and puts the current value of the corresponding variable to 0.voidinit(double x)java.lang.Stringreport()Returns a string containing a report for this statistical collector.voidsetSimulator(Simulator sim)Sets the simulator associated with this probe to sim.java.lang.StringshortReport()Formats and returns a short, one-line report about this statistical probe.java.lang.StringshortReportHeader()Returns a string containing the name of the values returned in the report strings.Simulatorsimulator()Returns the simulator associated with this statistical probe.doublesum()Returns the sum cumulated so far for this probe.voidupdate()Updates the accumulator using the last value passed toupdate.voidupdate(double x)Gives a new observation 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
-
-
-
-
Constructor Detail
-
Accumulate
public Accumulate()
Constructs a new Accumulate statistical probe using the default simulator and initializes it by invoking init().
-
Accumulate
public 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
public Accumulate(java.lang.String name)
Construct and initializes a new Accumulate statistical probe with name name and initial time 0, using the default simulator.
-
Accumulate
public Accumulate(Simulator inSim, java.lang.String name)
Construct and initializes a new Accumulate statistical probe with name name and initial time 0.- Parameters:
name- descriptive name for the probeinSim- the simulator of the current variable
-
-
Method Detail
-
init
public void init()
Initializes the statistical collector and puts the current value of the corresponding variable to 0. A call to init should normally be followed immediately by a call toupdateto give the value of the variable at the initialization time.
-
init
public void init(double x)
- Parameters:
x- initial value of the probe
-
update
public void update()
Updates the accumulator using the last value passed toupdate.
-
update
public 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 methodsnotifyListeners.- Parameters:
x- new observation given to the probe
-
sum
public double sum()
Description copied from class:StatProbeReturns the sum cumulated so far for this probe. The meaning of this sum depends on the subclass (e.g.,TallyorAccumulate). This returns 0 if the probe was not updated since the last initialization.
-
average
public double average()
Returns the time-average since the last initialization to the last call to update.
-
shortReportHeader
public java.lang.String shortReportHeader()
Description copied from class:StatProbeReturns a string containing the name of the values returned in the report strings. The returned string must depend on the type of probe and on the reporting options only. It must not depend on the observations received by the probe. This can be used as header when printing several reports. For example,System.out.println (probe1.shortReportHeader()); System.out.println (probe1.getName() + " " + probe1.shortReport()); System.out.println (probe2.getName() + " " + probe2.shortReport()); ...Alternatively, one can usereport(String,StatProbe[]) to get a report with aligned probe names.- Specified by:
shortReportHeaderin classStatProbe- Returns:
- the header string for the short reports.
-
shortReport
public java.lang.String shortReport()
Description copied from class:StatProbeFormats and returns a short, one-line report about this statistical probe. This line is composed of whitespace-separated fields which must correspond to the column names given byshortReportHeader(). 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.- Specified by:
shortReportin classStatProbe- Returns:
- the short report for the probe.
-
report
public java.lang.String report()
Description copied from class:StatProbeReturns a string containing a report for this statistical collector. The contents of this report depends on the statistical probe as well as on the parameters set by the user through probe-specific methods.
-
getInitTime
public double getInitTime()
Returns the initialization time for this object. This is the simulation time wheninitwas 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 toupdateor the initialization time ifupdatewas never called afterinit.- Returns:
- the last update time of this object
-
getLastValue
public double getLastValue()
Returns the value passed to this probe by the last call to itsupdatemethod (or the initial value ifupdatewas never called afterinit).- Returns:
- the last update value for this object
-
simulator
public Simulator simulator()
Returns the simulator associated with this statistical probe.- Returns:
- the associated simulator.
-
setSimulator
public void setSimulator(Simulator sim)
Sets the simulator associated with this probe to sim. One should callinitafter this method to reset the statistical probe.- Parameters:
sim- the simulator of this probe
-
clone
public Accumulate clone()
Clone this object.
-
-
DMelt 3.0 © DataMelt by jWork.ORG