public class TruncatingSimpleStatsTimeVarying extends SimpleStatsTimeVarying
This version adds an inner class, Truncate, which schedules a Truncate event, ensuring that the truncation occurs at exactly the correct time.
Modifier and Type | Class and Description |
---|---|
class |
TruncatingSimpleStatsTimeVarying.Truncate
This class is responsible for scheduling truncation at exactly the
correct time.
|
Modifier and Type | Field and Description |
---|---|
protected double |
lastObservation |
private TruncatingSimpleStatsTimeVarying.Truncate |
truncate |
protected boolean |
truncated |
private double |
truncationPoint |
diff, eventList, lastTime, mean, startTime, variance
count, DEFAULT_NAME, DEFAULT_NUMBER_FORMAT, maxObs, minObs, name, numberFormat
EOL
Constructor and Description |
---|
TruncatingSimpleStatsTimeVarying(double truncationPoint)
Instantiate a TruncatingSimpleStatsTimeVarying with the given
truncationPoint and the default name.
|
TruncatingSimpleStatsTimeVarying(java.lang.String name,
double truncationPoint)
Instantiate a TruncatingSimpleStatsTimeVarying with the given name and
given truncationPoint
|
Modifier and Type | Method and Description |
---|---|
double |
getTruncationPoint() |
boolean |
isTruncated() |
void |
newObservation(double x)
Saves last value; if truncation point has been reached, clear the
statistics, set truncated to "true", set the startTime to the
truncationPoint, and call super.newObservation(x).
|
void |
reset()
sets truncated to false
|
void |
setEventList(BasicEventList eventList) |
void |
setTruncationPoint(double truncationPoint) |
getEventList, getEventListID, getMean, getSamplingType, getStandardDeviation, getStartTime, getVariance, setEventListID, setSamplingType
clone, getCount, getDataLine, getMaxObs, getMinObs, getName, newObservation, newObservation, newObservation, propertyChange, setName, setNumberFormat, toString
protected boolean truncated
private double truncationPoint
private TruncatingSimpleStatsTimeVarying.Truncate truncate
protected double lastObservation
public TruncatingSimpleStatsTimeVarying(java.lang.String name, double truncationPoint)
name
- Name of property to listen fortruncationPoint
- Time when statistics will be resetpublic TruncatingSimpleStatsTimeVarying(double truncationPoint)
truncationPoint
- given truncation pointpublic void reset()
reset
in interface SampleStatistics
reset
in class SimpleStatsTimeVarying
public void newObservation(double x)
newObservation
in interface SampleStatistics
newObservation
in class SimpleStatsTimeVarying
x
- Given observationpublic boolean isTruncated()
public double getTruncationPoint()
public void setTruncationPoint(double truncationPoint)
truncationPoint
- Given truncation pointjava.lang.IllegalArgumentException
- if given truncationPoint < 0.0public void setEventList(BasicEventList eventList)
setEventList
in interface EventListAware
setEventList
in class SimpleStatsTimeVarying