GroupByFilter implements Filter, Serializable { @Override public boolean satisfy(Statistics statistics) { return satisfyStartEndTime(statistics.getStartTime(), statistics.getEndTime()); } GroupByFilter(long interval, long slidingStep, long startTime, long endTime);  GroupByFilter(); @Override boolean satisfy(Statistics statistics); @Override boolean satisfy(long time, Object value); @Override boolean satisfyStartEndTime(long startTime, long endTime); @Override boolean containStartEndTime(long startTime, long endTime); @Override Filter copy(); @Override String toString(); @Override void serialize(DataOutputStream outputStream); @Override void deserialize(ByteBuffer buffer); @Override FilterSerializeId getSerializeId(); @Override boolean equals(Object obj); @Override int hashCode(); long getStartTime(); long getEndTime();  }
@Test public void TestStatisticsSatisfy() { Statistics statistics = new LongStatistics(); statistics.setStartTime(0); statistics.setEndTime(7); assertFalse(groupByFilter.satisfy(statistics)); statistics.setStartTime(8 + 30 * 24 + 3 + 6 + 1); statistics.setEndTime(8 + 30 * 24 + 3 + 6 + 2); assertFalse(groupByFilter.satisfy(statistics)); statistics.setStartTime(0); statistics.setEndTime(9); assertTrue(groupByFilter.satisfy(statistics)); statistics.setStartTime(32); statistics.setEndTime(34); assertTrue(groupByFilter.satisfy(statistics)); statistics.setStartTime(32); statistics.setEndTime(36); assertTrue(groupByFilter.satisfy(statistics)); statistics.setStartTime(36); statistics.setEndTime(37); assertFalse(groupByFilter.satisfy(statistics)); statistics.setStartTime(36); statistics.setEndTime(55); assertFalse(groupByFilter.satisfy(statistics)); statistics.setStartTime(35); statistics.setEndTime(56); assertTrue(groupByFilter.satisfy(statistics)); statistics.setStartTime(35); statistics.setEndTime(58); assertTrue(groupByFilter.satisfy(statistics)); statistics.setStartTime(8 + 30 * 24 + 3 + 1); statistics.setEndTime(8 + 30 * 24 + 5); assertFalse(groupByFilter.satisfy(statistics)); statistics.setStartTime(8 + 30 * 24 + 3 + 1); statistics.setEndTime(8 + 30 * 24 + 8); assertFalse(groupByFilter.satisfy(statistics)); }
@Test public void TestSatisfy() { assertFalse(groupByFilter.satisfy(0, null)); assertFalse(groupByFilter.satisfy(7, null)); assertFalse(groupByFilter.satisfy(12, null)); assertFalse(groupByFilter.satisfy(8 + 30 * 24 + 3 + 6, null)); assertTrue(groupByFilter.satisfy(8, null)); assertTrue(groupByFilter.satisfy(9, null)); assertTrue(groupByFilter.satisfy(11, null)); }