@Override public String toString() { final StringBuffer buf = new StringBuffer(); buf.append("Time Series with delta: " + this.deltaTime + " " + this.deltaTimeUnit + " starting at: " + this.getStartTime() + " " + this.timeSeriesTimeUnit); for (final ITimeSeriesPoint<T> curPoint : this.getPoints()) { buf.append(curPoint); } return buf.toString(); }
@Override public String toString() { final StringBuffer buf = new StringBuffer(); buf.append("Time Series with delta: " + this.deltaTime + " " + this.deltaTimeUnit + " starting at: " + this.getStartTime() + " " + this.timeSeriesTimeUnit); for (final ITimeSeriesPoint<T> curPoint : this.getPoints()) { buf.append(curPoint); } return buf.toString(); }
@Override public long getEndTime() { if (this.getPoints().isEmpty()) { throw new IllegalStateException("The TimeSeries is empty, so no end time can be returned."); } else { return this.getStartTime() + (this.timeSeriesStepSize * (this.getPoints().size() - 1)); } }
@Override public long getEndTime() { if (this.getPoints().isEmpty()) { throw new IllegalStateException("The TimeSeries is empty, so no end time can be returned."); } else { return this.getStartTime() + (this.timeSeriesStepSize * (this.getPoints().size() - 1)); } }
/** * Test of the getter and appends methods. */ @Test public void testGettersAndAppendingValues() { Assert.assertEquals(this.timeUnit, this.unboundTS.getDeltaTimeUnit()); Assert.assertEquals(this.startTime, this.unboundTS.getStartTime()); Assert.assertEquals(0, this.unboundTS.size()); this.unboundTS.append(666.0); this.unboundTS.append(666.0); Assert.assertEquals(2, this.unboundTS.size()); }
@Test public void testTimeUnitPropagation() { final TimeSeries<Double> testTS = new TimeSeries<Double>(1L, TimeUnit.NANOSECONDS, 10L, TimeUnit.MILLISECONDS); testTS.append(1.0); Assert.assertEquals(TimeUnit.NANOSECONDS, testTS.getTimeSeriesTimeUnit()); Assert.assertEquals(TimeUnit.MILLISECONDS, testTS.getDeltaTimeUnit()); Assert.assertEquals(1L, testTS.getStartTime()); Assert.assertEquals(1L, testTS.getEndTime()); Assert.assertEquals(10000000L, testTS.getStepSize()); testTS.append(1.0); Assert.assertEquals(10000001L, testTS.getEndTime()); } }