-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix missing transfers #7042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,784
−1,310
Merged
Fix missing transfers #7042
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
5129f9f
refactor: Enable injecting stops in GraphRoutingTest
t2gran c71079e
refactor: Split DirectTransferGeneratorTest, extract CAR cases
t2gran 35fb6ff
feat: add support for real-time used stops in transfer generation
t2gran b27bac7
refactor: Improve assertions in DirectTransferGeneratorTest
t2gran 36e8853
refactor: Rename ts1 to stop PatternConsideringNearbyStopFinder
t2gran 765b529
refactor: cleanup DirectTransferGeneratorTest
t2gran 72bbd0b
refactor: improve comments and test names in DirectTransferGenerator …
t2gran 397ecc6
refactor: Split PatternConsideringNearbyStopFinder into classes with …
t2gran b3cb1d7
refactor: Move DirectTransferGenerator(++) into o.o.graph_builder.mo…
t2gran 626b07c
fix: Nearby-stops with transfers-not-allowed are removed after filter…
t2gran 37cf8b9
fix: Critical error in StopPattern#canAlight(StopLocation), allways r…
t2gran e7be5cb
refactor: Simplify DirectTransferGenerator tests and introduce PathTr…
t2gran 9700789
refactor: Sort OTPFeature alphabetically
t2gran f80117b
refactor: Correct spelling of CompositeNearbyStopFilter
t2gran 4a4c785
refactor: Cleanup MinMap and add unit test
t2gran 694710f
feat: Filter unused from stops in Transfers generation
t2gran 32d09bc
refactor: Rename canBoard/Alight(StopLocation) to boarding/alightingE…
t2gran 3df0b60
review: Fix spelling and other documentation issues
t2gran 954ba62
Merge remote-tracking branch 'otp/dev-2.x' into fix-missing-tx
t2gran 8dadd0b
test: Add unit tests for StopMapper functionality
t2gran 5822cdd
feat: Enhance StopMapper to include sometimes-used-realtime-stops in …
t2gran bbadd27
review: Fix spelling errors and add JavaDoc comments for NearbyStopFi…
t2gran 73a22ad
refactor: Correct spelling of 'Realtime' in IncludeStopsUsedRealTimeI…
t2gran c6f8673
Merge remote-tracking branch 'otp/dev-2.x' into fix-missing-tx
t2gran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/MinMap.java
This file was deleted.
Oops, something went wrong.
103 changes: 0 additions & 103 deletions
103
.../opentripplanner/graph_builder/module/nearbystops/PatternConsideringNearbyStopFinder.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...a/org/opentripplanner/graph_builder/module/transfer/filter/CompositeNearbyStopFilter.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| package org.opentripplanner.graph_builder.module.transfer.filter; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Collection; | ||
| import java.util.HashSet; | ||
| import java.util.List; | ||
| import java.util.Set; | ||
| import org.opentripplanner.routing.graphfinder.NearbyStop; | ||
| import org.opentripplanner.transit.model.framework.FeedScopedId; | ||
|
|
||
| /** | ||
| * Combines multiple {@link NearbyStopFilter}s into a single filter. | ||
| * <p> | ||
| * This filter applies all configured filters and returns the union of their results. A stop is | ||
| * included if ANY of the component filters include it (OR logic for from-stops, union for | ||
| * to-stops). | ||
| */ | ||
| class CompositeNearbyStopFilter implements NearbyStopFilter { | ||
|
|
||
| private final List<NearbyStopFilter> filters; | ||
|
|
||
| private CompositeNearbyStopFilter(List<NearbyStopFilter> filters) { | ||
| this.filters = filters; | ||
| } | ||
|
|
||
| static Builder of() { | ||
| return new Builder(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean includeFromStop(FeedScopedId id, boolean reverseDirection) { | ||
| for (NearbyStopFilter filter : filters) { | ||
| if (filter.includeFromStop(id, reverseDirection)) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public Collection<NearbyStop> filterToStops( | ||
| Collection<NearbyStop> nearbyStops, | ||
| boolean reverseDirection | ||
| ) { | ||
| Set<NearbyStop> result = new HashSet<>(); | ||
|
|
||
| for (NearbyStopFilter it : filters) { | ||
| result.addAll(it.filterToStops(nearbyStops, reverseDirection)); | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| static class Builder { | ||
|
|
||
| List<NearbyStopFilter> filters = new ArrayList<>(); | ||
|
|
||
| Builder add(NearbyStopFilter filter) { | ||
| filters.add(filter); | ||
| return this; | ||
| } | ||
|
|
||
| NearbyStopFilter build() { | ||
| if (filters.size() == 1) { | ||
| return filters.getFirst(); | ||
| } | ||
| return new CompositeNearbyStopFilter(filters); | ||
| } | ||
| } | ||
| } | ||
48 changes: 48 additions & 0 deletions
48
...va/org/opentripplanner/graph_builder/module/transfer/filter/FlexTripNearbyStopFilter.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| package org.opentripplanner.graph_builder.module.transfer.filter; | ||
|
|
||
| import java.util.Collection; | ||
| import org.opentripplanner.ext.flex.trip.FlexTrip; | ||
| import org.opentripplanner.routing.graphfinder.NearbyStop; | ||
| import org.opentripplanner.transit.model.framework.FeedScopedId; | ||
| import org.opentripplanner.transit.service.TransitService; | ||
|
|
||
| /** | ||
| * Filters nearby stops based on flex trip availability. | ||
| * <p> | ||
| * This filter ensures that transfers are generated for stops used by flex trips. For each flex | ||
| * trip, it keeps only the closest stop where the flex trip can board or alight (depending on | ||
| * direction). | ||
| */ | ||
| class FlexTripNearbyStopFilter implements NearbyStopFilter { | ||
t2gran marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| private final TransitService transitService; | ||
|
|
||
| FlexTripNearbyStopFilter(TransitService transitService) { | ||
| this.transitService = transitService; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean includeFromStop(FeedScopedId id, boolean reverseDirection) { | ||
| var stop = transitService.getStopLocation(id); | ||
| return !transitService.getFlexIndex().getFlexTripsByStop(stop).isEmpty(); | ||
| } | ||
|
|
||
| @Override | ||
| public Collection<NearbyStop> filterToStops( | ||
| Collection<NearbyStop> nearbyStops, | ||
| boolean reverseDirection | ||
| ) { | ||
| MinMap<FlexTrip<?, ?>, NearbyStop> closestStopForFlexTrip = new MinMap<>(); | ||
| for (var it : nearbyStops) { | ||
| var stop = it.stop; | ||
| var flexTrips = transitService.getFlexIndex().getFlexTripsByStop(stop); | ||
|
|
||
| for (FlexTrip<?, ?> trip : flexTrips) { | ||
| if (reverseDirection ? trip.isAlightingPossible(stop) : trip.isBoardingPossible(stop)) { | ||
| closestStopForFlexTrip.putMin(trip, it); | ||
| } | ||
| } | ||
| } | ||
| return closestStopForFlexTrip.values(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.