@Test public void interpolateString() { when(pastValue.getMetrics()).thenReturn(singletonMap(TESTMETRIC, MetricValue.fromStrValue("foo"))); when(futureValue.getMetrics()).thenReturn(singletonMap(TESTMETRIC, MetricValue.fromStrValue("bar"))); InterpolatedTSC interpolatedTSC = new InterpolatedTSC(new EmptyTimeSeriesCollection(midDate), singletonList(past), singletonList(future)); assertTrue(interpolatedTSC.get(TESTGROUP).isPresent()); assertEquals(TESTGROUP, interpolatedTSC.get(TESTGROUP).get().getGroup()); assertEquals(Optional.of(MetricValue.fromStrValue("foo")), interpolatedTSC.get(TESTGROUP).get().findMetric(TESTMETRIC)); }
@Override public Optional<TimeSeriesValue> get(GroupName name) { final TimeSeriesValue interpolated = interpolatedTsvMap.get(name); if (interpolated != null) return Optional.of(interpolated); return current.get(name); }
InterpolatedTSC extends AbstractTimeSeriesCollection implements TimeSeriesCollection { @Override public Optional<TimeSeriesValue> get(GroupName name) { final TimeSeriesValue interpolated = interpolatedTsvMap.get(name); if (interpolated != null) return Optional.of(interpolated); return current.get(name); } }
InterpolatedTSC extends AbstractTimeSeriesCollection implements TimeSeriesCollection { @Override public Optional<TimeSeriesValue> get(GroupName name) { final TimeSeriesValue interpolated = interpolatedTsvMap.get(name); if (interpolated != null) return Optional.of(interpolated); return current.get(name); } InterpolatedTSC(TimeSeriesCollection current, Collection<TimeSeriesCollection> backward, Collection<TimeSeriesCollection> forward); }
InterpolatedTSC extends AbstractTimeSeriesCollection implements TimeSeriesCollection { @Override public Optional<TimeSeriesValue> get(GroupName name) { final TimeSeriesValue interpolated = interpolatedTsvMap.get(name); if (interpolated != null) return Optional.of(interpolated); return current.get(name); } InterpolatedTSC(TimeSeriesCollection current, Collection<TimeSeriesCollection> backward, Collection<TimeSeriesCollection> forward); @Override DateTime getTimestamp(); @Override boolean isEmpty(); @Override Set<GroupName> getGroups(Predicate<? super GroupName> filter); @Override Set<SimpleGroupPath> getGroupPaths(Predicate<? super SimpleGroupPath> filter); @Override Collection<TimeSeriesValue> getTSValues(); @Override TimeSeriesValueSet getTSValue(SimpleGroupPath name); @Override Optional<TimeSeriesValue> get(GroupName name); @Override TimeSeriesValueSet get(Predicate<? super SimpleGroupPath> pathFilter, Predicate<? super GroupName> groupFilter); }
InterpolatedTSC extends AbstractTimeSeriesCollection implements TimeSeriesCollection { @Override public Optional<TimeSeriesValue> get(GroupName name) { final TimeSeriesValue interpolated = interpolatedTsvMap.get(name); if (interpolated != null) return Optional.of(interpolated); return current.get(name); } InterpolatedTSC(TimeSeriesCollection current, Collection<TimeSeriesCollection> backward, Collection<TimeSeriesCollection> forward); @Override DateTime getTimestamp(); @Override boolean isEmpty(); @Override Set<GroupName> getGroups(Predicate<? super GroupName> filter); @Override Set<SimpleGroupPath> getGroupPaths(Predicate<? super SimpleGroupPath> filter); @Override Collection<TimeSeriesValue> getTSValues(); @Override TimeSeriesValueSet getTSValue(SimpleGroupPath name); @Override Optional<TimeSeriesValue> get(GroupName name); @Override TimeSeriesValueSet get(Predicate<? super SimpleGroupPath> pathFilter, Predicate<? super GroupName> groupFilter);  }