From e934e2c8db91b3b571f1e4144818b2d5da8067d9 Mon Sep 17 00:00:00 2001 From: Evan Siroky Date: Thu, 21 May 2020 20:02:01 -0700 Subject: [PATCH] Properly set the backMode after car and vehicle rentals are ended Fixes https://github.com/ibi-group/trimet-mod-otp/issues/262 --- .../java/org/opentripplanner/routing/core/StateData.java | 6 +++++- .../java/org/opentripplanner/routing/core/StateEditor.java | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/opentripplanner/routing/core/StateData.java b/src/main/java/org/opentripplanner/routing/core/StateData.java index f2d6d627531..aad3e8229f2 100644 --- a/src/main/java/org/opentripplanner/routing/core/StateData.java +++ b/src/main/java/org/opentripplanner/routing/core/StateData.java @@ -76,6 +76,10 @@ public class StateData implements Cloneable { protected ServiceDay serviceDay; + /** + * The mode of transit to use when not traveling on transit. This should be updated each time transitions happen to + * other modes such as during parking a car at a park and ride or dropping off a bike rental. + */ protected TraverseMode nonTransitMode; /** @@ -93,7 +97,7 @@ public class StateData implements Cloneable { protected int lastNextArrivalDelta; /** - * The mode that was used to traverse the backEdge + * The mode that was used to traverse the state's backEdge */ protected TraverseMode backMode; diff --git a/src/main/java/org/opentripplanner/routing/core/StateEditor.java b/src/main/java/org/opentripplanner/routing/core/StateEditor.java index 164578e55b5..56b234a1305 100644 --- a/src/main/java/org/opentripplanner/routing/core/StateEditor.java +++ b/src/main/java/org/opentripplanner/routing/core/StateEditor.java @@ -593,6 +593,7 @@ public void boardHailedCar(double initialEdgeDistance) { public void endCarRenting() { cloneStateDataAsNeeded(); child.stateData.usingRentedCar = false; + child.stateData.backMode = TraverseMode.WALK; child.stateData.nonTransitMode = TraverseMode.WALK; } @@ -636,6 +637,7 @@ public void addRentedCar(String carId) { public void endVehicleRenting() { cloneStateDataAsNeeded(); child.stateData.usingRentedVehicle = false; + child.stateData.backMode = TraverseMode.WALK; child.stateData.nonTransitMode = TraverseMode.WALK; }