Skip to content

Commit

Permalink
Revert "Merge branch 'car-ferry-changes' into dev-2.x"
Browse files Browse the repository at this point in the history
This reverts commit 26e6141, reversing
changes made to fe845cc.
  • Loading branch information
optionsome committed Oct 21, 2024
1 parent 26e6141 commit d14e6af
Show file tree
Hide file tree
Showing 33 changed files with 318 additions and 1,371 deletions.
4 changes: 2 additions & 2 deletions application/src/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<link rel="icon" type="image/svg+xml" href="/img/otp-logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OTP Debug Client</title>
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/10/2024-10-17T07:45/assets/index-CZI6LO02.js"></script>
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/10/2024-10-17T07:45/assets/index-BqgnKsMX.css">
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/10/2024-10-16T19:58/assets/index-4w7I5Ind.js"></script>
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/10/2024-10-16T19:58/assets/index-BcsxnGE8.css">
</head>
<body>
<div id="root"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,6 @@ public enum GraphQLPlanAccessMode {
BICYCLE,
BICYCLE_PARKING,
BICYCLE_RENTAL,
CAR,
CAR_DROP_OFF,
CAR_PARKING,
CAR_RENTAL,
Expand Down Expand Up @@ -1576,7 +1575,6 @@ public enum GraphQLPlanDirectMode {
public enum GraphQLPlanEgressMode {
BICYCLE,
BICYCLE_RENTAL,
CAR,
CAR_PICKUP,
CAR_RENTAL,
FLEX,
Expand Down Expand Up @@ -1879,7 +1877,6 @@ public void setGraphQLWalk(GraphQLWalkPreferencesInput walk) {

public enum GraphQLPlanTransferMode {
BICYCLE,
CAR,
WALK,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public static StreetMode map(GraphQLTypes.GraphQLPlanAccessMode mode) {
case BICYCLE -> StreetMode.BIKE;
case BICYCLE_RENTAL -> StreetMode.BIKE_RENTAL;
case BICYCLE_PARKING -> StreetMode.BIKE_TO_PARK;
case CAR -> StreetMode.CAR;
case CAR_RENTAL -> StreetMode.CAR_RENTAL;
case CAR_PARKING -> StreetMode.CAR_TO_PARK;
case CAR_DROP_OFF -> StreetMode.CAR_PICKUP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public static StreetMode map(GraphQLTypes.GraphQLPlanEgressMode mode) {
return switch (mode) {
case BICYCLE -> StreetMode.BIKE;
case BICYCLE_RENTAL -> StreetMode.BIKE_RENTAL;
case CAR -> StreetMode.CAR;
case CAR_RENTAL -> StreetMode.CAR_RENTAL;
case CAR_PICKUP -> StreetMode.CAR_PICKUP;
case FLEX -> StreetMode.FLEXIBLE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,5 @@ private static void validateStreetModes(JourneyRequest journey) {
"If BICYCLE is used for access, egress or transfer, then it should be used for all."
);
}
if (modes.contains(StreetMode.CAR) && modes.size() != 1) {
throw new IllegalArgumentException(
"If CAR is used for access, egress or transfer, then it should be used for all."
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public class TransferModeMapper {

public static StreetMode map(GraphQLTypes.GraphQLPlanTransferMode mode) {
return switch (mode) {
case CAR -> StreetMode.CAR;
case BICYCLE -> StreetMode.BIKE;
case WALK -> StreetMode.WALK;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

class RequestModesMapper {

private static final Predicate<StreetMode> IS_BIKE_OR_CAR = m ->
m == StreetMode.BIKE || m == StreetMode.CAR;
private static final Predicate<StreetMode> IS_BIKE = m -> m == StreetMode.BIKE;
private static final String accessModeKey = "accessMode";
private static final String egressModeKey = "egressMode";
private static final String directModeKey = "directMode";
Expand All @@ -28,10 +27,7 @@ static RequestModes mapRequestModes(Map<String, ?> modesInput) {
ensureValueAndSet(accessMode, mBuilder::withAccessMode);
ensureValueAndSet((StreetMode) modesInput.get(egressModeKey), mBuilder::withEgressMode);
ensureValueAndSet((StreetMode) modesInput.get(directModeKey), mBuilder::withDirectMode);
// The only cases in which the transferMode isn't WALK are when the accessMode is either BIKE or CAR.
// In these cases, the transferMode is the same as the accessMode. This check is not strictly necessary
// if there is a need for more freedom for specifying the transferMode.
Optional.ofNullable(accessMode).filter(IS_BIKE_OR_CAR).ifPresent(mBuilder::withTransferMode);
Optional.ofNullable(accessMode).filter(IS_BIKE).ifPresent(mBuilder::withTransferMode);

return mBuilder.build();
}
Expand Down
Loading

0 comments on commit d14e6af

Please sign in to comment.