Skip to content

Commit bb67e86

Browse files
committed
Fix DefaultAccessEgress constructor.
1 parent ddaf0d4 commit bb67e86

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultAccessEgress.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,21 @@ public DefaultAccessEgress(int stop, State finalState) {
6666
this(stop, List.of(Objects.requireNonNull(finalState)));
6767
}
6868

69-
protected DefaultAccessEgress(int stop, State finalState, int boardCost) {
69+
protected DefaultAccessEgress(int stop, List<State> finalStates, int boardCost) {
7070
this(
7171
stop,
72-
(int) finalState.getElapsedTimeSeconds(),
73-
RaptorCostConverter.toRaptorCost(finalState.getWeight()) +
72+
(int) finalStates.stream().mapToLong(State::getElapsedTimeSeconds).sum(),
73+
RaptorCostConverter.toRaptorCost(finalStates.stream().mapToDouble(State::getWeight).sum()) +
7474
RaptorCostConverter.toRaptorCost(boardCost),
7575
TimeAndCost.ZERO,
76-
finalState
76+
finalStates
7777
);
7878
}
7979

80+
protected DefaultAccessEgress(int stop, State finalState, int boardCost) {
81+
this(stop, List.of(Objects.requireNonNull(finalState)), boardCost);
82+
}
83+
8084
protected DefaultAccessEgress(RoutingAccessEgress other, TimeAndCost penalty) {
8185
// In the API we have a cost associated with the time-penalty. In Raptor, there is no
8286
// association between the time-penalty and the cost. So, we add the time-penalty cost to

0 commit comments

Comments
 (0)