public class Count extends StatisticObject
Count class is simply counting something during an
experiment. Be careful the counter can be updated with positive and negative
integer numbers!
To get this Count object updated automatically every time a
ValueSupplier has changed, call the addObserver
(Observer) -method from the ValueSupplier of interest,
where Observer is this Count object. Aggregate to count non-integer (i.e.
double) values.UNDEFINED| Constructor and Description |
|---|
Count(Model ownerModel,
java.lang.String name,
boolean showInReport,
boolean showInTrace)
Constructor for a Count object.
|
Count(Model ownerModel,
java.lang.String name,
boolean showInReport,
boolean showInTrace,
boolean isResetResistant)
Constructor for a Count object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
activateInterArrivalTimeTally()
Activates the inter-arrival-time Tally to observe the timespans between
calls of the update-Method.
|
void |
activateInterArrivalTimeTally(boolean showTimeSpansInReport)
Activates the inter-arrival-time Tally to observe the timespans between
calls of the update-Method.
|
void |
activateInterArrivalTimeTally(java.lang.Class<? extends Reporter> reporterClass,
boolean showTimeSpansInReport)
Activates the inter-arrival-time Tally to observe the timespans between
calls of the update-Method.
|
Reporter |
createDefaultReporter()
Returns a Reporter to produce a report about this Count.
|
void |
deactivateInterArrivalTimeTally()
Deactivates the inter-arrival-time Tally to stop observing the timespans
between calls of the update-Method.
|
long |
getMaximum()
Returns the maximum value observed so far.
|
long |
getMinimum()
Returns the minimum value observed so far.
|
long |
getValue()
Returns the current counter value.
|
boolean |
isInterArrivalTimeTallyActivated()
Is the time between calls of the update-method be observed by a Tally?
|
void |
reset()
Resets this Count object by resetting (nearly) all variables to zero.
|
void |
setCorrespondingSchedulable(Schedulable correspondingSchedulable)
Sets the schedulable (e.g. entity) corresponding to this Reportable.
|
void |
update()
Increments the counter of this
Count object by one. |
void |
update(long n)
Increments the counter of this
Count object by the value
given in the parameter n. |
void |
update(java.util.Observable o,
java.lang.Object arg)
Implementation of the virtual
update(Observable, Object)
method of the Observer interface. |
getUnit, getUnitText, round, setUnitgetCorrespondingSchedulable, getDescription, getObservations, getReporter, incrementObservations, incrementObservations, reportIsOn, reportOff, reportOn, resetAt, setDescription, setReportercurrent, currentEntity, currentEntityAll, currentEvent, currentModel, currentSimProcess, debugIsOn, debugOff, debugOn, getModel, isExperimentCompatible, isModelCompatible, presentTime, sendDebugNote, sendMessage, sendTraceNote, sendWarning, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOngetName, getQuotedName, toStringpublic Count(Model ownerModel, java.lang.String name, boolean showInReport, boolean showInTrace)
ownerModel - Model : The model this Count is associated toname - java.lang.String : The name of this Count objectshowInReport - boolean : Flag for showing the report Set it to
true if this Count should show up in report. Set
it to false if this Count should not be shown in
report.showInTrace - boolean : Flag for showing this Count in trace files. Set it
to true if this Count should show up in trace.
Set it to false if this Count should not be shown
in trace.public Count(Model ownerModel, java.lang.String name, boolean showInReport, boolean showInTrace, boolean isResetResistant)
ownerModel - Model : The model this Count is associated toname - java.lang.String : The name of this Count objectshowInReport - boolean : Flag for showing the report Set it to
true if this Count should show up in report. Set
it to false if this Count should not be shown in
report.showInTrace - boolean : Flag for showing this Count in trace files. Set it
to true if this Count should show up in trace.
Set it to false if this Count should not be shown
in trace.isResetResistant - boolean : Flag for retaining the counter value during resets.
Set it to true if this Count should retain its
current value and only reset min, max and observations to 0.
Set it to false if this Count should also reset
its value to 0.public Reporter createDefaultReporter()
public void setCorrespondingSchedulable(Schedulable correspondingSchedulable)
setCorrespondingSchedulable in class ReportablecorrespondingSchedulable - Schedulable : The Schedulable corresponding to this Reportable.public long getMaximum()
public long getMinimum()
public void reset()
isResetResistant is set to true the
counter value will NOT be changed.reset in class Reportablepublic void update()
Count object by one.public void update(long n)
Count object by the value
given in the parameter n.n - long : The number that will be added to the counter of this
Count object.public void update(java.util.Observable o,
java.lang.Object arg)
update(Observable, Object)
method of the Observer interface. This method will be called
automatically from an Observable object within its
notifyObservers() method. null value) is passed as arg, the actual
value of the ValueSupplier will be fetched with the value()
method of the ValueSupplier. Otherwise it is expected that the actual
value is passed in the Object arg.o - java.util.Observable : The Observable calling this method
within its own notifyObservers() method.arg - Object : The Object with which this Count is
updated. Normally a long number which is added to the counter
or null.public long getValue()
public boolean isInterArrivalTimeTallyActivated()
public void activateInterArrivalTimeTally(java.lang.Class<? extends Reporter> reporterClass, boolean showTimeSpansInReport)
reporterClass - Class extends Reporter> : A reporter to be used by the
Tally.showTimeSpansInReport - boolean : Should the Reporter for the Tally use TimeSpans in
Report?public void activateInterArrivalTimeTally(boolean showTimeSpansInReport)
showTimeSpansInReport - boolean : Should the Reporter for the Tally use TimeSpans in
Report?public void activateInterArrivalTimeTally()
public void deactivateInterArrivalTimeTally()