Skip to content

Commit ef9638b

Browse files
authored
Merge pull request #917 from conveyal/opportunity-density-fix
Prevent ArrayIndexOutOfBoundsException when recording TemporalDensityResult
2 parents 1b322b4 + e6ffda3 commit ef9638b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/com/conveyal/r5/analyst/TemporalDensityResult.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public class TemporalDensityResult {
3333

3434
/**
3535
* The temporal density of opportunities. For each destination set, for each percentile, for each minute of
36-
* travel from 0 to 120, the number of opportunities reached in travel times from i (inclusive) to i+1 (exclusive).
36+
* travel m from 0 to 119, the number of opportunities reached in travel times from m (inclusive) to m+1
37+
* (exclusive).
3738
*/
3839
public final double[][][] opportunitiesPerMinute;
3940

@@ -57,7 +58,7 @@ public void recordOneTarget (int target, int[] travelTimePercentilesSeconds) {
5758
break; // If any percentile is unreached, all higher ones are also unreached.
5859
}
5960
int m = travelTimePercentilesSeconds[p] / 60;
60-
if (m <= 120) {
61+
if (m < 120) {
6162
opportunitiesPerMinute[d][p][m] += dps.getOpportunityCount(target);
6263
}
6364
}

0 commit comments

Comments
 (0)