public class HistogramAccumulate extends Accumulate
HistogramAccumulate
class is providing a statistic analysis about
values. With each update an observed value is changed. An interval is divided
into sections with an under- and an overflow section. When a value is updated
it will be decided to which section it belongs to and the time where the observed
value is in that section will be updated. In the end the report will show how
long values belong to which section. UNDEFINED
Constructor and Description |
---|
HistogramAccumulate(Model ownerModel,
java.lang.String name,
double[] range,
boolean showInReport,
boolean showInTrace)
Constructor for a Histogram object with user-defined interval cells that will NOT be connected to a
ValueSupplier . |
HistogramAccumulate(Model ownerModel,
java.lang.String name,
double lowerEnd,
double upperEnd,
int cells,
boolean showInReport,
boolean showInTrace)
Constructor for a Histogram object with equidistant interval cells that will NOT be connected to a
ValueSupplier . |
HistogramAccumulate(Model ownerModel,
java.lang.String name,
ValueSupplier valSup,
boolean automatic,
double[] range,
boolean showInReport,
boolean showInTrace)
Constructor for a Histogram object with user-defined interval cells that will be connected to a
ValueSupplier . |
HistogramAccumulate(Model ownerModel,
java.lang.String name,
ValueSupplier valSup,
boolean automatic,
double lowerEnd,
double upperEnd,
int cells,
boolean showInReport,
boolean showInTrace)
Constructor for a Histogram object with equidistant interval cells that will be connected to a
ValueSupplier . |
Modifier and Type | Method and Description |
---|---|
void |
changeParameters(double[] range)
Changes the parameters of the interval and its number of segments.
|
void |
changeParameters(double low,
double up,
int cel)
Changes the parameters of the interval and its number of segments.
|
Reporter |
createDefaultReporter()
Returns a Reporter to produce a report about this Histogram.
|
int |
getCells()
Returns the number of cells the interval is divided into.
|
double |
getLowerLimit(int cell)
Returns the lower limit of the given cell.
|
double |
getMeanWidth()
Returns the mean width of all cells.
|
int[] |
getMostFrequentedCells()
Returns the numbers of the most frequented cells, so far.
|
TimeSpan |
getObservationsInCell(int cell)
Returns the observations made for the given cell, so far.
|
double |
getUpperLimit()
Returns the upper limit of the whole interval.
|
void |
reset()
Resets this Histogram object by resetting the counters for each cell to
zero.
|
void |
update()
Updates this
Histogram object by fetching the actual value
of the ValueSupplier and processing it. |
void |
update(double value)
Updates this
Histogram object with the double value given
as parameter. |
void |
update(java.util.Observable o,
java.lang.Object arg)
Implementation of the virtual
update(Observable, Object)
method of the Observer interface. |
doesRetainLastValueOnReset, getMean, getPeriodMeasured, getStdDev, pause, setRetainLastValueOnReset
getLastValue, getMaximum, getMinimum, update
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 HistogramAccumulate(Model ownerModel, java.lang.String name, double lowerEnd, double upperEnd, int cells, boolean showInReport, boolean showInTrace)
ValueSupplier
.ownerModel
- Model : The model this Histogram is associated to.name
- java.lang.String : The name of this Histogram object.lowerEnd
- double : The lower end of the interval.upperEnd
- double : The upper end of the interval.cells
- int : The number of cells (sections) the given interval will
be divided into.showInReport
- boolean : Flag for showing the report about this Histogram.showInTrace
- boolean : Flag for showing the trace output of this Histogram.public HistogramAccumulate(Model ownerModel, java.lang.String name, ValueSupplier valSup, boolean automatic, double lowerEnd, double upperEnd, int cells, boolean showInReport, boolean showInTrace)
ValueSupplier
.ownerModel
- Model : The model this Histogram is associated to.name
- java.lang.String : The name of this Histogram object.valSup
- ValueSupplier : The ValueSupplier providing the value for this
Histogram. The given ValueSupplier will be observed by this
Histogram object.automatic
- boolean : Flag for observing the ValueSupplier at every tick
of the SimClock. Set it to true
to have it
observed at every SimClock tick.lowerEnd
- double : The lower end of the interval.upperEnd
- double : The upper end of the interval.cells
- int : The number of cells (sections) the given interval will
be divided into.showInReport
- boolean : Flag for showing the report about this Histogram.showInTrace
- boolean : Flag for showing the trace output of this Histogram.public HistogramAccumulate(Model ownerModel, java.lang.String name, double[] range, boolean showInReport, boolean showInTrace)
ValueSupplier
.ownerModel
- Model : The model this Histogram is associated to.name
- java.lang.String : The name of this Histogram object.range
- double[] : The interval with the lower limit of each cell and the upper limit of the interval as the final value.showInReport
- boolean : Flag for showing the report about this Histogram.showInTrace
- boolean : Flag for showing the trace output of this Histogram.public HistogramAccumulate(Model ownerModel, java.lang.String name, ValueSupplier valSup, boolean automatic, double[] range, boolean showInReport, boolean showInTrace)
ValueSupplier
.ownerModel
- Model : The model this Histogram is associated to.name
- java.lang.String : The name of this Histogram object.valSup
- ValueSupplier : The ValueSupplier providing the value for this
Histogram. The given ValueSupplier will be observed by this
Histogram object.automatic
- boolean : Flag for observing the ValueSupplier at every tick
of the SimClock. Set it to true
to have it
observed at every SimClock tick.range
- double[] : The interval with the lower limit of each cell and the upper limit of the interval as the final value.showInReport
- boolean : Flag for showing the report about this Histogram.showInTrace
- boolean : Flag for showing the trace output of this Histogram.public void changeParameters(double low, double up, int cel)
low
- double : The lower end of the interval.up
- double : The upper end of the interval.cel
- int : The number of cells (sections) the given interval will
be divided into.public void changeParameters(double[] range)
range
- double[] : The array holding the lower limits of the interval sections and the upper limit as the final value.public Reporter createDefaultReporter()
createDefaultReporter
in class Accumulate
public int getCells()
public double getMeanWidth()
public double getLowerLimit(int cell)
UNDEFINED
(-1) will be returned.cell
- int : The cell for which we want to know its lower limit.
Should be zero or positive.public int[] getMostFrequentedCells()
public TimeSpan getObservationsInCell(int cell)
cell
- int : The cell of which want to get the number of observations
made for.public double getUpperLimit()
public void reset()
changeParameters
method after the reset.reset
in class Accumulate
public void update()
Histogram
object by fetching the actual value
of the ValueSupplier
and processing it. The
ValueSupplier
is passed in the constructor of this
Histogram
object. This update()
method
complies with the one described in DESMO, see [Page91].update
in class Accumulate
public void update(double value)
Histogram
object with the double value given
as parameter. In some cases it might be more convenient to pass the value
this Histogram
will be updated with directly within the
update(double val)
method instead of going via the
ValueSupplier
.update
in class Accumulate
val
- double : The value with which this Histogram
will be updated.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.update
in interface java.util.Observer
update
in class Accumulate
o
- java.util.Observable : The Observable calling this method
within its own notifyObservers()
method.arg
- Object : The Object with which this Tally
is
updated. Normally a double number which is added to the
statistics or null
.