public class Aggregate extends StatisticObjectSupportingTimeSpans
Aggregate
class is simply counting (aggregating) a continuous (i.e. double)
value during an experiment. Be careful the aggregate can be updated with positive and negative
values!
To get this Aggregate
object updated automatically every time a
ValueSupplier
has changed, call the addObserver
(Observer)
-method from the ValueSupplier
of interest,
where Observer is this Aggregate
object. Count
to aggregate integer values.UNDEFINED
Constructor and Description |
---|
Aggregate(Model ownerModel,
java.lang.String name,
boolean showInReport,
boolean showInTrace)
Constructor for a Aggregate object.
|
Aggregate(Model ownerModel,
java.lang.String name,
boolean showInReport,
boolean showInTrace,
boolean isResetResistant)
Constructor for a Aggregate object.
|
Modifier and Type | Method and Description |
---|---|
Reporter |
createDefaultReporter()
Returns a Reporter to produce a report about this Aggregate.
|
double |
getMaximum()
Returns the maximum value observed so far.
|
double |
getMinimum()
Returns the minimum value observed so far.
|
double |
getValue()
Returns the current value of the aggregate.
|
void |
reset()
Resets this Aggregate object by resetting (nearly) all variables to zero.
|
void |
update(double n)
Increments the value of this
Aggregate 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. |
void |
update(TimeSpan t)
Updates this data collector object with a specific
TimeSpan . |
getShowTimeSpansInReport, getUnit, setShowTimeSpansInReport
getUnitText, round, setUnit
getCorrespondingSchedulable, getDescription, getObservations, getReporter, incrementObservations, incrementObservations, reportIsOn, reportOff, reportOn, resetAt, setCorrespondingSchedulable, setDescription, setReporter
current, currentEntity, currentEntityAll, currentEvent, currentModel, currentSimProcess, debugIsOn, debugOff, debugOn, getModel, isExperimentCompatible, isModelCompatible, presentTime, sendDebugNote, sendMessage, sendTraceNote, sendWarning, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOn
getName, getQuotedName, toString
public Aggregate(Model ownerModel, java.lang.String name, boolean showInReport, boolean showInTrace)
ownerModel
- Model : The model this Aggregate is associated toname
- java.lang.String : The name of this Aggregate objectshowInReport
- boolean : Flag for showing the report Set it to
true
if this Aggregate should show up in report.
Set it to false
if this Aggregate should not be
shown in report.showInTrace
- boolean : Flag for showing this Aggregate in trace files. Set it
to true
if this Aggregate should show up in trace.
Set it to false
if this Aggregate should not be
shown in trace.public Aggregate(Model ownerModel, java.lang.String name, boolean showInReport, boolean showInTrace, boolean isResetResistant)
ownerModel
- Model : The model this Aggregate is associated toname
- java.lang.String : The name of this Aggregate objectshowInReport
- boolean : Flag for showing the report Set it to
true
if this Aggregate should show up in report.
Set it to false
if this Aggregate should not be
shown in report.showInTrace
- boolean : Flag for showing this Aggregate in trace files. Set it
to true
if this Aggregate should show up in trace.
Set it to false
if this Aggregate should not be
shown in trace.isResetResistant
- boolean : Flag for retaining the value of the aggregate during resets.
Set it to true
if this Aggregate should retain its
current value and only reset min, max and observations to 0.
Set it to false
if this Aggregate should also reset
its value to 0.public Reporter createDefaultReporter()
public double getMaximum()
public double getMinimum()
public void reset()
isResetResistant
is set to true
the value of the aggregate will NOT be changed.reset
in class Reportable
public void update(TimeSpan t)
StatisticObjectSupportingTimeSpans
TimeSpan
.update
in class StatisticObjectSupportingTimeSpans
t
- TimeSpan : The time span to update this data collector.public void update(double n)
Aggregate
object by the value
given in the parameter n.n
- double : The number that will be added to the value of this
Aggregate
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 Aggregate
is
updated. Normally a double number which is added to the value of the aggregate
or null
.public double getValue()