public abstract class Interpolator
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
Interpolator.AnalogInterpolator
For analog tags, the value is ramps directly between the values
|
protected static class |
Interpolator.DiscreteInterpolator
For discrete tags, the value is flat until it then changes, at the timestamp of B
|
Constructor and Description |
---|
Interpolator() |
Modifier and Type | Method and Description |
---|---|
static Interpolator |
createAnalogInterpolator() |
static Interpolator |
createDiscreteInterpolator() |
ProcessedValue |
getValueAt(long timestamp)
Returns the (potentially) interpolated value at the time.
|
protected abstract ProcessedValue |
interpolate(HistoricalValue a,
HistoricalValue b,
long timestamp)
"A" or "B" can be null, but the situation will be A |
protected ProcessedValue |
interpolateDiscrete(HistoricalValue a,
HistoricalValue b,
long timestamp) |
protected ProcessedValue |
interpolateLinear(HistoricalValue a,
HistoricalValue b,
long timestamp) |
void |
update(HistoricalValue value)
Adds the value to the interpolator.
|
protected ProcessedValue |
valueFor(HistoricalValue v,
long ts,
boolean provisional) |
public static Interpolator createDiscreteInterpolator()
public static Interpolator createAnalogInterpolator()
public void update(HistoricalValue value) throws java.lang.IllegalArgumentException
value
- java.lang.IllegalArgumentException
- if the incoming value has a timestamp less than a previously added value.public ProcessedValue getValueAt(long timestamp) throws java.lang.IllegalArgumentException
timestamp
- java.lang.IllegalArgumentException
- if the time requested is before a previously requested time. All requests must go forward.protected ProcessedValue valueFor(HistoricalValue v, long ts, boolean provisional)
protected abstract ProcessedValue interpolate(HistoricalValue a, HistoricalValue b, long timestamp)
protected ProcessedValue interpolateDiscrete(HistoricalValue a, HistoricalValue b, long timestamp)
protected ProcessedValue interpolateLinear(HistoricalValue a, HistoricalValue b, long timestamp)