From 1e61ccd1d182bc6783b59ab5d845d3b23836ab07 Mon Sep 17 00:00:00 2001 From: Thomas Gran Date: Fri, 13 Dec 2024 13:49:40 +0100 Subject: [PATCH] review: Apply fixes from review --- .../api/request/preference/AccessEgressPreferences.java | 8 ++++---- .../api/request/preference/StreetPreferencesTest.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/routing/api/request/preference/AccessEgressPreferences.java b/application/src/main/java/org/opentripplanner/routing/api/request/preference/AccessEgressPreferences.java index 635c4c6c7b0..289e06e6e02 100644 --- a/application/src/main/java/org/opentripplanner/routing/api/request/preference/AccessEgressPreferences.java +++ b/application/src/main/java/org/opentripplanner/routing/api/request/preference/AccessEgressPreferences.java @@ -147,19 +147,19 @@ private static DurationForEnum durationForStreetModeOf(Duration defa } private static TimeAndCostPenaltyForEnum createDefaultCarPenalty() { - var penaltyrBuilder = TimeAndCostPenaltyForEnum.of(StreetMode.class); + var penaltyBuilder = TimeAndCostPenaltyForEnum.of(StreetMode.class); var flexDefaultPenalty = TimeAndCostPenalty.of(TimePenalty.of(ofMinutes(10), 1.3f), 1.3); - penaltyrBuilder.with(StreetMode.FLEXIBLE, flexDefaultPenalty); + penaltyBuilder.with(StreetMode.FLEXIBLE, flexDefaultPenalty); // Add penalty to all car variants with access and/or egress. var carPenalty = TimeAndCostPenalty.of(TimePenalty.of(ofMinutes(20), 2f), 1.5); for (var it : StreetMode.values()) { if (it.includesDriving() && (it.accessAllowed() || it.egressAllowed())) { - penaltyrBuilder.with(it, carPenalty); + penaltyBuilder.with(it, carPenalty); } } - return penaltyrBuilder.build(); + return penaltyBuilder.build(); } } diff --git a/application/src/test/java/org/opentripplanner/routing/api/request/preference/StreetPreferencesTest.java b/application/src/test/java/org/opentripplanner/routing/api/request/preference/StreetPreferencesTest.java index 77875c44fa1..a2f50e70bb6 100644 --- a/application/src/test/java/org/opentripplanner/routing/api/request/preference/StreetPreferencesTest.java +++ b/application/src/test/java/org/opentripplanner/routing/api/request/preference/StreetPreferencesTest.java @@ -23,7 +23,7 @@ class StreetPreferencesTest { private static final int ELEVATOR_BOARD_TIME = (int) Duration.ofMinutes(2).toSeconds(); private static final IntersectionTraversalModel INTERSECTION_TRAVERSAL_MODEL = IntersectionTraversalModel.CONSTANT; - private static final TimeAndCostPenalty CAR_PENALTY = TimeAndCostPenalty.of( + private static final TimeAndCostPenalty CAR_TO_PARK_PENALTY = TimeAndCostPenalty.of( TimePenalty.of("2m + 1.5t"), 3.5 ); @@ -34,7 +34,7 @@ class StreetPreferencesTest { .withTurnReluctance(TURN_RELUCTANCE) .withElevator(it -> it.withBoardTime(ELEVATOR_BOARD_TIME)) .withIntersectionTraversalModel(INTERSECTION_TRAVERSAL_MODEL) - .withAccessEgress(it -> it.withPenalty(Map.of(StreetMode.CAR_TO_PARK, CAR_PENALTY))) + .withAccessEgress(it -> it.withPenalty(Map.of(StreetMode.CAR_TO_PARK, CAR_TO_PARK_PENALTY))) .withAccessEgress(it -> it.withMaxDuration(MAX_ACCESS_EGRESS, Map.of())) .withMaxDirectDuration(MAX_DIRECT, Map.of()) .withRoutingTimeout(ROUTING_TIMEOUT) @@ -56,7 +56,7 @@ void accessEgressPenalty() { TimeAndCostPenalty.ZERO, subject.accessEgress().penalty().valueOf(StreetMode.WALK) ); - assertEquals(CAR_PENALTY, subject.accessEgress().penalty().valueOf(StreetMode.CAR_TO_PARK)); + assertEquals(CAR_TO_PARK_PENALTY, subject.accessEgress().penalty().valueOf(StreetMode.CAR_TO_PARK)); } @Test @@ -112,7 +112,7 @@ void testToString() { "accessEgress: AccessEgressPreferences{penalty: TimeAndCostPenaltyForEnum{" + "CAR: (timePenalty: 20m + 2.0 t, costFactor: 1.50), " + "CAR_TO_PARK: " + - CAR_PENALTY + + CAR_TO_PARK_PENALTY + ", " + "CAR_PICKUP: (timePenalty: 20m + 2.0 t, costFactor: 1.50), " + "CAR_RENTAL: (timePenalty: 20m + 2.0 t, costFactor: 1.50), " +