GroupByFilter implements Filter, Serializable { @Override public boolean containStartEndTime(long startTime, long endTime) { if (startTime >= this.startTime && endTime <= this.endTime) { long minTime = startTime - this.startTime; long maxTime = endTime - this.startTime; long count = minTime / slidingStep; return minTime <= interval + count * slidingStep && maxTime <= interval + count * slidingStep; } return false; } 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 TestContainStartEndTime() { assertTrue(groupByFilter.containStartEndTime(8, 9)); assertFalse(groupByFilter.containStartEndTime(8, 13)); assertFalse(groupByFilter.containStartEndTime(0, 3)); assertFalse(groupByFilter.containStartEndTime(0, 9)); assertFalse(groupByFilter.containStartEndTime(7, 8 + 30 * 24 + 3 + 6 + 1)); assertFalse(groupByFilter.containStartEndTime(8 + 30 * 24 + 3 + 6 + 1, 8 + 30 * 24 + 3 + 6 + 2)); }