Class WindowSeriesStore
java.lang.Object
com.wualabs.qtsurfer.engine.core.state.WindowSeriesStore
- All Implemented Interfaces:
WindowSeries, WritableWindowSeries, Iterable<Double>
- Direct Known Subclasses:
MovingAverage
Stores n periods of past data. Default implementation of a WritableWindowSeries
-
Constructor Details
-
WindowSeriesStore
public WindowSeriesStore(int windowSize)
-
-
Method Details
-
add
public void add(double value) Adds a value to the rolling window. When the window exceeds its configured size, the oldest value is removed and passed toonRollingWindow(double)for cleanup (e.g., subtracting from a running sum).- Specified by:
addin interfaceWritableWindowSeries- Parameters:
value- the value to add to the window
-
getValue
public double getValue(int index) - Specified by:
getValuein interfaceWindowSeries
-
size
public int size()- Specified by:
sizein interfaceWindowSeries
-
isEmpty
public boolean isEmpty() -
clear
public void clear()- Specified by:
clearin interfaceWritableWindowSeries
-
iterator
-
onRollingWindow
protected void onRollingWindow(double firstValue) Call back with discarded first value from buffer;- Parameters:
firstValue-
-
getWindowSize
public int getWindowSize()- Specified by:
getWindowSizein interfaceWindowSeries
-