public abstract class AbstractMa extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
AbstractMa.Mode |
static class |
AbstractMa.Type |
Modifier and Type | Field and Description |
---|---|
protected double |
lastSample |
protected long |
lastTimestamp |
protected AbstractMa.Mode |
mode |
protected double |
timeScale |
protected AbstractMa.Type |
type |
Modifier | Constructor and Description |
---|---|
protected |
AbstractMa()
empty constructor needed for externalizable
|
|
AbstractMa(AbstractMa.Type type,
AbstractMa.Mode mode,
double timeScale)
Constructs a new MA which use the given timescale.
|
Modifier and Type | Method and Description |
---|---|
abstract double |
getCurrent()
Gets the current value of the ema.
|
double |
getLastSample() |
long |
getLastTimestamp()
Gets the last time the ema was updated.
|
double |
getTimeScale() |
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) |
protected final AbstractMa.Type type
protected final AbstractMa.Mode mode
protected double timeScale
protected long lastTimestamp
protected double lastSample
protected AbstractMa()
public AbstractMa(AbstractMa.Type type, AbstractMa.Mode mode, double timeScale)
type
- type of EMAmode
- compute the ema by tick or timetimeScale
- timescale for the EMAs.public void processDouble(long timestamp, double data)
protected abstract void processDoubleLocal(long timestamp, double data)
public abstract double getCurrent()
public abstract void setCurrent(double value)
value
- new value of the ema state.public double getTimeScale()
public abstract void reset()
public void setTimeScale(double timeScale)
public long getLastTimestamp()
public double getLastSample()