@Test public void clearTaskChangeTimes() { List<Pair<Long, LocalDateTime>> taskChanges = Arrays.asList(Pair.of(TASK_ID1, LocalDateTime.now()), Pair.of(TASK_ID2, LocalDateTime.now()), Pair.of(TASK_ID3, LocalDateTime.now()), Pair.of(TASK_ID4, LocalDateTime.now())); taskChanges.forEach(taskChange -> context.setTaskChangeTime(taskChange.getLeft(), taskChange.getRight())); taskChanges.forEach(taskChange -> assertThat(context.isProcessedTaskChange(taskChange.getLeft(), taskChange.getRight())).isTrue()); context.clearTaskChangeTimes(); taskChanges.forEach(taskChange -> assertThat(context.isProcessedTaskChange(taskChange.getLeft(), taskChange.getRight())).isFalse()); }
public void clearTaskChangeTimes(LocalDateTime untilLocalDateTime) { if (untilLocalDateTime != null) { taskChangeTimes.entrySet().stream() .filter(entry -> untilLocalDateTime.compareTo(entry.getValue()) > 0) .map(Map.Entry::getKey) .collect(Collectors.toList()) .forEach(removableChange -> taskChangeTimes.remove(removableChange)); } }
SolverHandlerContext { public void clearTaskChangeTimes(LocalDateTime untilLocalDateTime) { if (untilLocalDateTime != null) { taskChangeTimes.entrySet().stream() .filter(entry -> untilLocalDateTime.compareTo(entry.getValue()) > 0) .map(Map.Entry::getKey) .collect(Collectors.toList()) .forEach(removableChange -> taskChangeTimes.remove(removableChange)); } } }
SolverHandlerContext { public void clearTaskChangeTimes(LocalDateTime untilLocalDateTime) { if (untilLocalDateTime != null) { taskChangeTimes.entrySet().stream() .filter(entry -> untilLocalDateTime.compareTo(entry.getValue()) > 0) .map(Map.Entry::getKey) .collect(Collectors.toList()) .forEach(removableChange -> taskChangeTimes.remove(removableChange)); } } SolverHandlerContext(Duration queryShift); }
SolverHandlerContext { public void clearTaskChangeTimes(LocalDateTime untilLocalDateTime) { if (untilLocalDateTime != null) { taskChangeTimes.entrySet().stream() .filter(entry -> untilLocalDateTime.compareTo(entry.getValue()) > 0) .map(Map.Entry::getKey) .collect(Collectors.toList()) .forEach(removableChange -> taskChangeTimes.remove(removableChange)); } } SolverHandlerContext(Duration queryShift); long getCurrentChangeSetId(); void setCurrentChangeSetId(long currentChangeSetId); long nextChangeSetId(); boolean isProcessedChangeSet(long changeSetId); boolean isCurrentChangeSetProcessed(); void setProcessedChangeSet(long changeSetId); void clearProcessedChangeSet(); void setTaskChangeTime(long taskId, LocalDateTime changeTime); boolean isProcessedTaskChange(long taskId, LocalDateTime changeTime); void clearTaskChangeTimes(LocalDateTime untilLocalDateTime); void clearTaskChangeTimes(); LocalDateTime getPreviousQueryTime(); void setPreviousQueryTime(LocalDateTime previousQueryTime); LocalDateTime getNextQueryTime(); void setNextQueryTime(LocalDateTime nextQueryTime); LocalDateTime shiftQueryTime(LocalDateTime queryTime); }
SolverHandlerContext { public void clearTaskChangeTimes(LocalDateTime untilLocalDateTime) { if (untilLocalDateTime != null) { taskChangeTimes.entrySet().stream() .filter(entry -> untilLocalDateTime.compareTo(entry.getValue()) > 0) .map(Map.Entry::getKey) .collect(Collectors.toList()) .forEach(removableChange -> taskChangeTimes.remove(removableChange)); } } SolverHandlerContext(Duration queryShift); long getCurrentChangeSetId(); void setCurrentChangeSetId(long currentChangeSetId); long nextChangeSetId(); boolean isProcessedChangeSet(long changeSetId); boolean isCurrentChangeSetProcessed(); void setProcessedChangeSet(long changeSetId); void clearProcessedChangeSet(); void setTaskChangeTime(long taskId, LocalDateTime changeTime); boolean isProcessedTaskChange(long taskId, LocalDateTime changeTime); void clearTaskChangeTimes(LocalDateTime untilLocalDateTime); void clearTaskChangeTimes(); LocalDateTime getPreviousQueryTime(); void setPreviousQueryTime(LocalDateTime previousQueryTime); LocalDateTime getNextQueryTime(); void setNextQueryTime(LocalDateTime nextQueryTime); LocalDateTime shiftQueryTime(LocalDateTime queryTime);  }