Class AbstractMa

java.lang.Object
io.deephaven.numerics.movingaverages.AbstractMa
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Ema

public abstract class AbstractMa extends Object implements Serializable
Base class for computing moving averages.
See Also:
  • Field Details

    • type

      protected final AbstractMa.Type type
    • mode

      protected final AbstractMa.Mode mode
    • timeScale

      protected double timeScale
    • lastTimestamp

      protected long lastTimestamp
    • lastSample

      protected double lastSample
  • Constructor Details

    • AbstractMa

      protected AbstractMa()
      empty constructor needed for externalizable
    • AbstractMa

      public AbstractMa(AbstractMa.Type type, AbstractMa.Mode mode, double timeScale)
      Constructs a new MA which use the given timescale.
      Parameters:
      type - type of EMA
      mode - compute the ema by tick or time
      timeScale - 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()