Class AbstractMa
java.lang.Object
io.deephaven.numerics.movingaverages.AbstractMa
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Ema
Base class for computing moving averages.
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected double
protected long
protected final AbstractMa.Mode
protected double
protected final AbstractMa.Type
-
Constructor Summary
ModifierConstructorDescriptionprotected
empty constructor needed for externalizableAbstractMa
(AbstractMa.Type type, AbstractMa.Mode mode, double timeScale) Constructs a new MA which use the given timescale. -
Method Summary
Modifier and TypeMethodDescriptionabstract double
Gets the current value of the ema.double
long
Gets the last time the ema was updated.double
void
processDouble
(long timestamp, double data) protected abstract void
processDoubleLocal
(long timestamp, double data) abstract void
reset()
abstract void
setCurrent
(double value) Sets the current value of the ema state.void
setTimeScale
(double timeScale)
-
Field Details
-
type
-
mode
-
timeScale
protected double timeScale -
lastTimestamp
protected long lastTimestamp -
lastSample
protected double lastSample
-
-
Constructor Details
-
AbstractMa
protected AbstractMa()empty constructor needed for externalizable -
AbstractMa
Constructs a new MA which use the given timescale.- Parameters:
type
- type of EMAmode
- compute the ema by tick or timetimeScale
- timescale for the EMAs.
-
-
Method Details
-
processDouble
public void processDouble(long timestamp, double data) -
processDoubleLocal
protected abstract void processDoubleLocal(long timestamp, double data) -
getCurrent
public abstract double getCurrent()Gets the current value of the ema.- Returns:
- current value of the ema.
-
setCurrent
public abstract void setCurrent(double value) Sets the current value of the ema state.- Parameters:
value
- new value of the ema state.
-
getTimeScale
public double getTimeScale() -
reset
public abstract void reset() -
setTimeScale
public void setTimeScale(double timeScale) -
getLastTimestamp
public long getLastTimestamp()Gets the last time the ema was updated.- Returns:
- last time the ema was updated.
-
getLastSample
public double getLastSample()
-