From 2f767d80b03c88716d019bc2d657fb7bc4be8067 Mon Sep 17 00:00:00 2001 From: sharhio Date: Wed, 5 Jun 2024 12:19:08 +0300 Subject: [PATCH 1/2] Single route added to unpreferred routes --- .../routing/routepreferences/HSLRoutePreferencesSource.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/opentripplanner/routing/routepreferences/HSLRoutePreferencesSource.java b/src/main/java/org/opentripplanner/routing/routepreferences/HSLRoutePreferencesSource.java index 7cff0deb1e8..9af9a2f3c01 100644 --- a/src/main/java/org/opentripplanner/routing/routepreferences/HSLRoutePreferencesSource.java +++ b/src/main/java/org/opentripplanner/routing/routepreferences/HSLRoutePreferencesSource.java @@ -26,6 +26,7 @@ public class HSLRoutePreferencesSource implements RoutePreferencesSource { private static final String ESPOO_FAST_ROUTES_REGEX = "^HSL:21(4[3-9]|5[0-9]|6[0-5])(A|[B-Z]A).*$"; + private static final String SINGLE_ROUTES_REGEX = "^HSL:1008X$"; private static final Logger LOG = LoggerFactory.getLogger(HSLRoutePreferencesSource.class); /** @@ -35,7 +36,7 @@ public class HSLRoutePreferencesSource implements RoutePreferencesSource { public void setRoutePreferences(RoutingRequest routingRequest, Graph graph) { // Either U_ROUTE_REGEX or ESPOO_FAST_ROUTES_REGEX Pattern patternsCombined = Pattern.compile(String.format( - "(%s|%s)", U_ROUTE_REGEX, ESPOO_FAST_ROUTES_REGEX)); + "(%s|%s)", U_ROUTE_REGEX, ESPOO_FAST_ROUTES_REGEX, SINGLE_ROUTES_REGEX)); for (Route route : graph.index.routeForId.values()) { FeedScopedId routeId = route.getId(); Matcher matcher = patternsCombined.matcher(routeId.toString()); From 84fdf2a6503512cea529071a2623f428f0733ccd Mon Sep 17 00:00:00 2001 From: sharhio Date: Wed, 5 Jun 2024 13:13:27 +0300 Subject: [PATCH 2/2] format fixed --- .../routing/routepreferences/HSLRoutePreferencesSource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/opentripplanner/routing/routepreferences/HSLRoutePreferencesSource.java b/src/main/java/org/opentripplanner/routing/routepreferences/HSLRoutePreferencesSource.java index 9af9a2f3c01..060ed38c2b5 100644 --- a/src/main/java/org/opentripplanner/routing/routepreferences/HSLRoutePreferencesSource.java +++ b/src/main/java/org/opentripplanner/routing/routepreferences/HSLRoutePreferencesSource.java @@ -36,7 +36,7 @@ public class HSLRoutePreferencesSource implements RoutePreferencesSource { public void setRoutePreferences(RoutingRequest routingRequest, Graph graph) { // Either U_ROUTE_REGEX or ESPOO_FAST_ROUTES_REGEX Pattern patternsCombined = Pattern.compile(String.format( - "(%s|%s)", U_ROUTE_REGEX, ESPOO_FAST_ROUTES_REGEX, SINGLE_ROUTES_REGEX)); + "(%s|%s|%s)", U_ROUTE_REGEX, ESPOO_FAST_ROUTES_REGEX, SINGLE_ROUTES_REGEX)); for (Route route : graph.index.routeForId.values()) { FeedScopedId routeId = route.getId(); Matcher matcher = patternsCombined.matcher(routeId.toString());