Skip to content

Commit

Permalink
STYLE: NAV-181 - Unify naming, always assign mask postfix to marked s…
Browse files Browse the repository at this point in the history
…top arrays
  • Loading branch information
munterfi committed Sep 16, 2024
1 parent 67fb155 commit 1480946
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/main/java/ch/naviqore/raptor/router/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,19 @@ List<QueryState.Label[]> run() {
return queryState.getBestLabelsPerRound();
}

void doRangeRaptor(boolean[] markedStops) {
void doRangeRaptor(boolean[] markedStopsMask) {
// prepare range offsets
// get initial marked stops to reset after each range offset
List<Integer> initialMarkedStops = new ArrayList<>();
for (int stopIdx = 0; stopIdx < markedStops.length; stopIdx++) {
if (markedStops[stopIdx]) {
for (int stopIdx = 0; stopIdx < markedStopsMask.length; stopIdx++) {
if (markedStopsMask[stopIdx]) {
initialMarkedStops.add(stopIdx);
}
}
List<Integer> rangeOffsets = getRangeOffsets(initialMarkedStops, routeScanner);
HashMap<Integer, Integer> stopIdxSourceTimes = new HashMap<>();
for (int stopIdx = 0; stopIdx < markedStops.length; stopIdx++) {
if (!markedStops[stopIdx]) {
for (int stopIdx = 0; stopIdx < markedStopsMask.length; stopIdx++) {
if (!markedStopsMask[stopIdx]) {
continue;
}
stopIdxSourceTimes.put(stopIdx, queryState.getLabel(0, stopIdx).targetTime());
Expand All @@ -156,7 +156,7 @@ void doRangeRaptor(boolean[] markedStops) {
int targetTime = stopIdxSourceTimes.get(stopIdx) + timeFactor * rangeOffset;
queryState.setLabel(0, stopIdx, copyLabelWithNewTargetTime(label, targetTime));
}
doRounds(markedStops);
doRounds(markedStopsMask);
}
}

Expand Down Expand Up @@ -190,14 +190,14 @@ private void doRounds(boolean[] markedStopsMask) {
queryState.addNewRound();

// scan all routs and mark stops that have improved
boolean[] markedStopsNext = routeScanner.scan(round, markedStopsMask);
boolean[] nextMarkedStopsMask = routeScanner.scan(round, markedStopsMask);

// relax footpaths for all newly marked stops
footpathRelaxer.relax(round, markedStopsNext);
footpathRelaxer.relax(round, nextMarkedStopsMask);

// prepare next round
removeSuboptimalLabelsForRound(round, markedStopsNext);
markedStopsMask = markedStopsNext;
removeSuboptimalLabelsForRound(round, nextMarkedStopsMask);
markedStopsMask = nextMarkedStopsMask;
round++;
}
}
Expand Down

0 comments on commit 1480946

Please sign in to comment.