Why the termination condition is 'start > valueTime - sizeInterval' instead of 'start >= valueTime - sizeInterval' ?
starmilkxin opened this issue · 1 comments
starmilkxin commented
protected List<Window> calculateWindow(WindowInfo windowInfo, long valueTime) {
long sizeInterval = windowInfo.getWindowSize().toMillSecond();
long slideInterval = windowInfo.getWindowSlide().toMillSecond();
List<Window> result = new ArrayList<>((int) (sizeInterval / slideInterval));
long lastStart = valueTime - (valueTime + slideInterval) % slideInterval;
for (long start = lastStart; start > valueTime - sizeInterval; start -= slideInterval) {
long end = start + sizeInterval;
Window window = new Window(start, end);
result.add(window);
}
return result;
}
ni-ze commented