public class Statistic extends java.lang.Object implements Basic
Modifier and Type | Field and Description |
---|---|
static int |
DATA_Observations |
static int |
DATA_TimeSeries |
static int |
INDEX_Mean_StdDev |
static int |
INDEX_Min_Max |
static int |
INDEX_None |
Constructor and Description |
---|
Statistic(Model model,
java.lang.String id,
int typeData,
int typeIndex,
boolean aggregate,
long timeLow,
long timeHigh,
double valueLow,
double valueHigh,
int histogramCells)
Constructor
|
Modifier and Type | Method and Description |
---|---|
Grafic |
createGrafic(java.lang.String viewId,
int x,
int y,
int animationType,
boolean isIntValue,
java.awt.Dimension deltaSize,
boolean infopane)
build an instance of StatisticGrafic
|
long |
getFirstTime()
get first observation time
|
Grafic |
getGrafic()
get an existing StatisticGrafic instance.
|
XIntervalSeries |
getHistogram()
get histogram in jFreeChart data structure.
|
double |
getHistogramHigh()
get highest border of highest histogram cell
|
double |
getHistogramIntervalLength()
get length of one histogram cell
|
double |
getHistogramLow()
get lowest border of lowest histogram cell
|
java.lang.String |
getId() |
long |
getLastTime()
get last observation time
|
double |
getLastValue()
get last stored value
|
double |
getMax()
get max value
|
double |
getMean()
get mean
for typeData = Statistic.DATA_Observations, all values have the same weight.
|
double |
getMin()
get min value
|
Model |
getModel() |
java.lang.String |
getName() |
long |
getObservationLength()
get length of observation time
|
XYSeries |
getObservationSerie()
get observation series in jFreeChart data structure.
|
double |
getStdDev()
get standard deviation
for typeData = Statistic.DATA_Observations, all values have the same weight.
|
long |
getTimeHigh()
get high value of time axis
|
long |
getTimeLow()
get low value of time axis
|
TimeSeries |
getTimeSerie()
get time series in jFreeChart data structure.
|
int |
getTypeData()
gets TypeData.
|
int |
getTypeIndex()
gets TypeData.
|
double |
getValueHigh()
get high value of value axis
|
double |
getValueLow()
get low value of value axis
|
boolean |
hasHistogramSupport()
when no. of histogram cells greater zero
|
boolean |
hasValue()
true when one or more points stored.
|
void |
reset()
reset statistic object, used by warnup
called from Model.resetStatistic(...)
|
void |
setName(java.lang.String name)
Possibility to specify a name of a instance.
|
void |
update(double value,
long time)
add a new point to the time/observation series.
|
public static final int DATA_TimeSeries
public static final int DATA_Observations
public static final int INDEX_None
public static final int INDEX_Min_Max
public static final int INDEX_Mean_StdDev
public Statistic(Model model, java.lang.String id, int typeData, int typeIndex, boolean aggregate, long timeLow, long timeHigh, double valueLow, double valueHigh, int histogramCells)
model
- used animation.model.Modelid
- must be uniquetypeData
- one of the following values:
Statistic.DATA_Observations
Statistic.DATA_TimeSeriestypeIndex
- one of the following values:
Statistic.INDEX_None
Statistic.INDEX_Min_Max
Statistic.INDEX_Mean_StdDevaggregate
- true: the values will be aggregated
false: the original values will be usedtimeLow
- lowest expected time, will be changed when a lower time is observed.
Used to avoid axis changes.timeHigh
- highest expected time, will be changed when a higher time is observed.
Used to avoid axis changes.valueLow
- lowest expected value, will be changed when a lower value is observed.
Used to avoid axis changes.valueHigh
- highest expected value, will be changed when a higher value is observed.
Used to avoid axis changes.histogramCells
- No. of histogram cells between valueLow and valueHigh.
Every cell has the same length.
For values outside of [valueLow, valueHigh] additional cells will be created.
When <= 0, no histogram data support.public void reset()
public java.lang.String getId()
getId
in interface ClassBasic
public void setName(java.lang.String name)
name
- public void update(double value, long time) throws ModelException
value
- time
- ModelException
- when times are not (strictly) increasing.public boolean hasValue()
public int getTypeData()
public int getTypeIndex()
public boolean hasHistogramSupport()
public double getValueLow()
public double getValueHigh()
public long getTimeLow()
public long getTimeHigh()
public double getLastValue() throws ModelException
ModelException,
- when no value storedModelException
public double getMin() throws ModelException
ModelException,
- when typeIndex != Statistic.INDEX_Min_MaxModelException
public double getMax() throws ModelException
ModelException,
- when typeIndex != Statistic.INDEX_Min_MaxModelException
public double getMean() throws ModelException
ModelException,
- when typeIndex != Statistic.INDEX_Mean_StdDevModelException
public double getStdDev() throws ModelException
ModelException,
- when typeIndex != Statistic.INDEX_Mean_StdDevModelException
public long getFirstTime() throws ModelException
ModelException,
- when no observation is stored.ModelException
public long getLastTime() throws ModelException
ModelException,
- when no observation is stored.ModelException
public long getObservationLength() throws ModelException
ModelException,
- when no observation is stored.ModelException
public TimeSeries getTimeSerie() throws ModelException
ModelException,
- when typeData != Statistic.DATA_TimeSeriesModelException
public XYSeries getObservationSerie() throws ModelException
ModelException,
- when typeData != Statistic.DATA_ObservationsModelException
public XIntervalSeries getHistogram() throws ModelException
ModelException,
- when histogramCells > 0 (in constructor)ModelException
public double getHistogramIntervalLength()
public double getHistogramLow()
public double getHistogramHigh()
public Grafic createGrafic(java.lang.String viewId, int x, int y, int animationType, boolean isIntValue, java.awt.Dimension deltaSize, boolean infopane) throws ModelException
viewId
- Id of viewx
- x Coordinate of Middle pointy
- y Coordinate of Middle pointanimationType
- Possible values:
StatisticGrafic.ANIMATION_LastValue,
StatisticGrafic.ANIMATION_TimeValueDiagram
StatisticGrafic.ANIMATION_HistogramisIntValue
- In typeAnimation == StatisticGrafic.ANIMATION_LastValue
value is shown as integer.deltaSize
- Each animation type has a default size.
This size can be incremented/decremented by deltaSize.
Null means no change.ModelException