/** * Copy constructor. */ public FloatTreeTimeSeries(FloatTimeSeries other) { super(other.getValueType()); addValues(other.getValues(Long.MIN_VALUE)); setInterpolationMode(other.getInterpolationMode()); }
@Override public final void setConstant(float value) { deleteValues(); setInterpolationMode(InterpolationMode.STEPS); addValue(Long.MIN_VALUE, new FloatValue(value)); addValue(0, new FloatValue(value)); }
/** * Apply the bi-linear operator on all points of this. Second operator input * is taken from values. Store the values in this. */ public void applyBilinearOperator(BilinearSampledValueOperator operator, ReadOnlyTimeSeries values) { // final FloatTimeSeries factors = new FloatTreeTimeSeries(values); final TimeSeriesMerger merger = new TimeSeriesMerger(this, values); // calculate the new values for this. final List<SampledValue> newValues = new ArrayList<>(merger.getTimestamps().size()); for (Long t : merger.getTimestamps()) { final SampledValue v1 = this.getValueSecure(t); final SampledValue v2 = getValueSecure(values, t); final SampledValue newValue = operator.apply(v1, v2); newValues.add(newValue); } // replace values in this with new values and set interpolation mode. deleteValues(); addValues(newValues); setInterpolationMode(merger.getInterpolationMode()); }
ts.addValue(new SampledValue(new FloatValue(Float.NaN), endTime, Quality.BAD)); ts.setInterpolationMode(targetMode); return ts;