Class Interpolator
- java.lang.Object
-
- com.inductiveautomation.ignition.gateway.sqltags.history.query.processing.Interpolator
-
- Direct Known Subclasses:
DatasourceQueryExecutor.MixedModeInterpolator
,Interpolator.AnalogInterpolator
,Interpolator.DiscreteInterpolator
public abstract class Interpolator extends java.lang.Object
Created by colby.clegg on 7/31/2015.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Interpolator.AnalogInterpolator
For analog tags, the value is ramps directly between the valuesprotected static class
Interpolator.DiscreteInterpolator
For discrete tags, the value is flat until it then changes, at the timestamp of B
-
Constructor Summary
Constructors Constructor Description Interpolator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Interpolator
createAnalogInterpolator()
static Interpolator
createDiscreteInterpolator()
ProcessedValue
getValueAt(long timestamp)
Returns the (potentially) interpolated value at the time.protected abstract ProcessedValue
interpolate(long timestamp)
"A" or "B" can be null, but the situation will be A < timestamp < B, if present.protected ProcessedValue
interpolateDiscrete(long timestamp)
protected ProcessedValue
interpolateLinear(long timestamp)
protected abstract boolean
needsDoubles()
void
update(HistoricalValue value)
Adds the value to the interpolator.protected ProcessedValue
valueFor(java.lang.Object value, QualityCode qual, long ts, boolean provisional)
Returns interpolated processed value.protected ProcessedValue
valueFor(java.lang.Object value, QualityCode qual, long ts, boolean provisional, boolean interpolated)
-
-
-
Method Detail
-
createDiscreteInterpolator
public static Interpolator createDiscreteInterpolator()
-
createAnalogInterpolator
public static Interpolator createAnalogInterpolator()
-
update
public void update(HistoricalValue value) throws java.lang.IllegalArgumentException
Adds the value to the interpolator. Values must go foward in time, and an exception will be thrown if a value is added out of order.- Throws:
java.lang.IllegalArgumentException
- if the incoming value has a timestamp less than a previously added value.
-
getValueAt
public ProcessedValue getValueAt(long timestamp) throws java.lang.IllegalArgumentException
Returns the (potentially) interpolated value at the time. Note that the timestamp must always be later than previous requests! Time must only move forward.- Throws:
java.lang.IllegalArgumentException
- if the time requested is before a previously requested time. All requests must go forward.
-
valueFor
protected ProcessedValue valueFor(java.lang.Object value, QualityCode qual, long ts, boolean provisional)
Returns interpolated processed value.
-
valueFor
protected ProcessedValue valueFor(java.lang.Object value, QualityCode qual, long ts, boolean provisional, boolean interpolated)
-
needsDoubles
protected abstract boolean needsDoubles()
-
interpolate
protected abstract ProcessedValue interpolate(long timestamp)
"A" or "B" can be null, but the situation will be A < timestamp < B, if present.
-
interpolateDiscrete
protected ProcessedValue interpolateDiscrete(long timestamp)
-
interpolateLinear
protected ProcessedValue interpolateLinear(long timestamp)
-
-