@Test public void previous_using_tooLargeInterval() { setup(ExpressionLookBack.fromScrapeCount(10)); assertNotNull(impl.getPreviousCollectionPair(Duration.standardDays(1))); assertEquals(Optional.empty(), impl.getPreviousCollection(Duration.standardDays(1))); }
@Override public Optional<TimeSeriesCollection> getPreviousCollection(int n) { if (n < 0) throw new IllegalArgumentException("cannot look into the future"); if (n == 0) return Optional.of(getCurrentCollection()); if (n - 1 >= previous_.size()) return Optional.empty(); return Optional.of(previous_.get(n - 1)); }
AbstractTSCPair implements TimeSeriesCollectionPair { @Override public Optional<TimeSeriesCollection> getPreviousCollection(int n) { if (n < 0) throw new IllegalArgumentException("cannot look into the future"); if (n == 0) return Optional.of(getCurrentCollection()); if (n - 1 >= previous_.size()) return Optional.empty(); return Optional.of(previous_.get(n - 1)); } }
AbstractTSCPair implements TimeSeriesCollectionPair { @Override public Optional<TimeSeriesCollection> getPreviousCollection(int n) { if (n < 0) throw new IllegalArgumentException("cannot look into the future"); if (n == 0) return Optional.of(getCurrentCollection()); if (n - 1 >= previous_.size()) return Optional.empty(); return Optional.of(previous_.get(n - 1)); } protected  AbstractTSCPair(); protected  AbstractTSCPair(AbstractTSCPair original); }
AbstractTSCPair implements TimeSeriesCollectionPair { @Override public Optional<TimeSeriesCollection> getPreviousCollection(int n) { if (n < 0) throw new IllegalArgumentException("cannot look into the future"); if (n == 0) return Optional.of(getCurrentCollection()); if (n - 1 >= previous_.size()) return Optional.empty(); return Optional.of(previous_.get(n - 1)); } protected  AbstractTSCPair(); protected  AbstractTSCPair(AbstractTSCPair original); @Override abstract TimeSeriesCollection getCurrentCollection(); @Override Optional<TimeSeriesCollection> getPreviousCollection(int n); @Override String toString(); @Override int size(); }
AbstractTSCPair implements TimeSeriesCollectionPair { @Override public Optional<TimeSeriesCollection> getPreviousCollection(int n) { if (n < 0) throw new IllegalArgumentException("cannot look into the future"); if (n == 0) return Optional.of(getCurrentCollection()); if (n - 1 >= previous_.size()) return Optional.empty(); return Optional.of(previous_.get(n - 1)); } protected  AbstractTSCPair(); protected  AbstractTSCPair(AbstractTSCPair original); @Override abstract TimeSeriesCollection getCurrentCollection(); @Override Optional<TimeSeriesCollection> getPreviousCollection(int n); @Override String toString(); @Override int size();  }