@Override public List<SampledValue> getValues(long startTime, long endTime) { SortedSet<SampledValue> elements = getSubset(startTime, endTime); return getValuesInternal(elements); }
@Override public boolean replaceValuesFixedStep(long startTime, List<Value> values, long stepSize, long timeOfCalculation) { replaceValuesFixedStep(startTime, values, stepSize); m_lastCalculationTime = timeOfCalculation; return true; }
@Override public boolean addValues(Collection<SampledValue> values, long timeOfCalculation) { addValues(values); m_lastCalculationTime = timeOfCalculation; return true; }
@Override public FloatTimeSeries times(float factor) { final FloatTimeSeries result; synchronized (this) { result = new FloatTreeTimeSeries(this); } result.multiplyBy(factor); return result; }
@Override public MemoryTimeSeries clone() { return new TreeTimeSeries(this, m_type); }
@Override public boolean replaceValuesFixedStep(long startTime, List<Value> values, long stepSize) { final long endTime = startTime + stepSize * values.size(); deleteValues(startTime, endTime); long t = startTime; for (Value value : values) { addValue(t, value); t += stepSize; } return true; }
@Override public boolean addValues(Collection<SampledValue> values, long timeOfCalculation) { addValues(values); m_lastCalculationTime = timeOfCalculation; return true; }
@Override public boolean replaceValues(long startTime, long endTime, Collection<SampledValue> values) { deleteValues(startTime, endTime); addValues(values); return true; }
@Override public MemoryTimeSeries clone() { return new ArrayTimeSeries(this, m_type); }
@Override public float integratePositive(TimeInterval interval) { List<TimeInterval> positiveDomains = getPositiveDomain(interval); float result = 0.f; for (TimeInterval subDomain : positiveDomains) { result += integrate(subDomain); } return result; }
@Override public boolean addValue(long timestamp, Value value, long timeOfCalculation) { addValue(timestamp, value); m_lastCalculationTime = timeOfCalculation; return true; }
@Override public final boolean addValues(Collection<SampledValue> values) { // TODO make more performant by sorting only once, not after every new value insterted. for (SampledValue value : values) { addValue(value); } return true; }
@Override public FloatTreeTimeSeries read(ReadOnlyTimeSeries schedule) { return (FloatTreeTimeSeries) super.read(schedule); }
@Override public boolean replaceValuesFixedStep(long startTime, List<Value> values, long stepSize, long timeOfCalculation) { replaceValuesFixedStep(startTime, values, stepSize); m_lastCalculationTime = timeOfCalculation; return true; }
@Override final public boolean deleteValues(long endTime) { deleteValues(0, endTime); return true; }
/** * Creates a series that has the constant value for all times. */ public FloatTreeTimeSeries(float value) { super(FloatValue.class); setConstant(value); }
@Override public List<SampledValue> downsample(long t0, long t1, long minimumInterval) { if (isFloatTimeSeries) return ((FloatTimeSeries) input).downsample(t0, t1, minimumInterval); FloatTimeSeries ftt = new FloatTreeTimeSeries(); ftt.read(input, t0, t1); return ftt.downsample(t0, t1, minimumInterval); }
@Override public boolean addValue(long timestamp, Value value, long timeOfCalculation) { addValue(timestamp, value); m_lastCalculationTime = timeOfCalculation; return true; }
@Override public FloatTreeTimeSeries read(ReadOnlyTimeSeries schedule, long start, long end) { return (FloatTreeTimeSeries) super.read(schedule, start, end); }
@Override public boolean addValue(long timestamp, Value value) { addValue(new SampledValue(value, timestamp, Quality.GOOD)); return true; }