Skip to content

Commit 24b48ad

Browse files
committed
Move SEARCH_WINDOW_END_EXCLUSIVITY_TIME_ADDITION into PageCursorFactory.
1 parent db1f945 commit 24b48ad

2 files changed

Lines changed: 13 additions & 17 deletions

File tree

application/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorConstants.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

application/src/main/java/org/opentripplanner/model/plan/paging/cursor/PageCursorFactory.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ public class PageCursorFactory {
2626
private PageCursor nextCursor = null;
2727
private PageCursor prevCursor = null;
2828

29+
/**
30+
* The search-window start and end is [inclusive, exclusive], so to calculate the start of the
31+
* search-window from the last time included in the search window we need to include one extra
32+
* minute at the end.
33+
* <p>
34+
* The value is set to 60 seconds because raptor operates in one minute increments.
35+
*/
36+
private static final Duration SEARCH_WINDOW_END_EXCLUSIVITY_TIME_ADDITION = Duration.ofSeconds(
37+
60
38+
);
39+
2940
public PageCursorFactory(SortOrder sortOrder, Duration newSearchWindow) {
3041
this.sortOrder = sortOrder;
3142
this.newSearchWindow = newSearchWindow;
@@ -140,7 +151,7 @@ private void createPageCursors() {
140151
prevEdt = pageCursorInput
141152
.latestRemovedDeparture()
142153
.minus(newSearchWindow)
143-
.plus(PageCursorConstants.SEARCH_WINDOW_END_EXCLUSIVITY_TIME_ADDITION);
154+
.plus(SEARCH_WINDOW_END_EXCLUSIVITY_TIME_ADDITION);
144155
nextEdt = edtAfterUsedSw();
145156
}
146157
}
@@ -174,7 +185,7 @@ private Instant edtAfterUsedSw() {
174185
Instant defaultEdt = currentEdt.plus(currentSearchWindow);
175186
if (firstSearchLatestItineraryDeparture != null) {
176187
Instant edtFromLatestItineraryDeparture = firstSearchLatestItineraryDeparture.plus(
177-
PageCursorConstants.SEARCH_WINDOW_END_EXCLUSIVITY_TIME_ADDITION
188+
SEARCH_WINDOW_END_EXCLUSIVITY_TIME_ADDITION
178189
);
179190
if (edtFromLatestItineraryDeparture.isBefore(defaultEdt)) {
180191
return edtFromLatestItineraryDeparture;

0 commit comments

Comments
 (0)