public abstract class StatisticObject extends Reportable implements java.util.Observer
StatisticObject
class is the super class of all
other classes collecting statistical data. desmoj.core.simulator.Reportable
class so that it can provide
a reporter to represent the statistical data in the report. java.util.Observer
interface. So this
is the observer part of the observer pattern as described in [Gamm95] that is
observing the desmoj.statistic.ValueSupplier
. Whenever the
ValueSupplier
is changing it calls the
update(Observable, Object)
method of this
StatisticObject
. Which happens inside the
notifyObservers()
method of the observable
ValueSupplier
.
The virtual method update(Observable, Object)
has to be
implemented in all derived classes so that the StatisticObject
is updated when the observed ValueSupplier
has changed and its
notifyObservers()
method is called from its
notifyStatistics()
method.
ValueSupplier
Modifier and Type | Field and Description |
---|---|
static double |
UNDEFINED
Represents the value returned in case of an error.
|
Constructor and Description |
---|
StatisticObject(Model ownerModel,
java.lang.String name,
boolean showInReport,
boolean showInTrace)
Constructor for a StatisticObject, preliminarily without a unit assigned
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getUnit()
Get an optional unit of reported value.
|
java.lang.String |
getUnitText()
Textually wraps the output of
getUnit() , adding
brackets and displaying "none" if case unit is null . |
static double |
round(double d)
Rounds a double value with repect to the
PRECISION . |
void |
setUnit(java.lang.String unit)
Set an optional unit of reported value.
|
getCorrespondingSchedulable, getDescription, getObservations, getReporter, incrementObservations, incrementObservations, reportIsOn, reportOff, reportOn, reset, 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 static final double UNDEFINED
public StatisticObject(Model ownerModel, java.lang.String name, boolean showInReport, boolean showInTrace)
ownerModel
- Model : The model this StatisticObject is associated to.name
- java.lang.String : The name of this StatisticObjectshowInReport
- boolean : Flag for showing the report about this
StatisticObject.showInTrace
- boolean : Flag for showing this StatisticObject in trace
files.public static double round(double d)
PRECISION
.d
- double : The value to be roundedpublic void setUnit(java.lang.String unit)
public java.lang.String getUnit()
public java.lang.String getUnitText()
getUnit()
, adding
brackets and displaying "none" if case unit is null
.