-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Cleanup raptor on trip access #7485
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
t2gran
merged 16 commits into
opentripplanner:dev-2.x
from
entur:cleanup-raptor-on-trip-access
Apr 14, 2026
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
476672b
refactor: Move on-board trip arrivals down into McStopArrivals
t2gran 6ef2c68
refator: Use RaptorTripScheduleStopPosition DTO in api access, and ad…
t2gran 51246e2
refactor: Move private methods down
t2gran 33306aa
refactor: Add JavaDoc to BitSetIterator
t2gran 7f16b87
refactor: Extract boarding and alighting logic into separate method i…
t2gran cabe572
refactor: Remove iterationDepartureTime parameter from applyOnBoardTr…
t2gran f9a6b14
refactor: Integrate on-board trip access boarding into the regular tr…
t2gran 99d90b8
refactor: JavaDoc on ParetoSetEventListener
t2gran 1223e42
refactor: Add test-case to IntIteratorsTest
t2gran 567cf81
refactor: Rename boarding search methods and add java doc
t2gran 75e777c
refactor: Rename tripIndex() methods to tripScheduleIndex()
t2gran c1c0abe
refactor: Add tripScheduleIndex() method to TripSchedule interface
t2gran f59a2bb
refactor: Introduce RaptorTripScheduleReference for fetching trips
t2gran bd1a2f0
refactor: Rename RaptorOnBoardAccess to RaptorStartOnBoardAccess
t2gran 7231a22
review: Correct spelling errors in configuration and documentation
t2gran a0216a4
Apply suggestions from code review
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
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
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
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
26 changes: 7 additions & 19 deletions
26
...raptor/api/model/RaptorOnBoardAccess.java → ...r/api/model/RaptorStartOnBoardAccess.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
71 changes: 71 additions & 0 deletions
71
...or/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripScheduleStopPosition.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,71 @@ | ||
| package org.opentripplanner.raptor.api.model; | ||
|
|
||
| import java.util.Objects; | ||
| import org.opentripplanner.utils.tostring.ToStringBuilder; | ||
|
|
||
| /** | ||
| * This class contains information to identify a given stop in a stop pattern for a given trip | ||
| * schedule in a route. This can for example be used to identify where a bording or alighting | ||
| * happens. | ||
| */ | ||
| public final class RaptorTripScheduleStopPosition { | ||
|
|
||
| private final int routeIndex; | ||
| private final int tripScheduleIndex; | ||
| private final int stopPositionInPattern; | ||
|
|
||
| public RaptorTripScheduleStopPosition( | ||
| int routeIndex, | ||
| int tripScheduleIndex, | ||
| int stopPositionInPattern | ||
| ) { | ||
| this.routeIndex = routeIndex; | ||
| this.tripScheduleIndex = tripScheduleIndex; | ||
| this.stopPositionInPattern = stopPositionInPattern; | ||
| } | ||
|
|
||
| /// The index of the boarded route | ||
| public int routeIndex() { | ||
| return routeIndex; | ||
| } | ||
|
|
||
| /// The index of the boarded trip within the route | ||
| public int tripScheduleIndex() { | ||
| return tripScheduleIndex; | ||
| } | ||
|
|
||
| /// The stop position in the route stop-pattern. Knowing the stop index is not enough to identify | ||
| /// a stop, a stop may occour multiple times in a stop pattern, in other words a circular stop | ||
| /// pattern visits some of the same stops multiple times. | ||
| public int stopPositionInPattern() { | ||
| return stopPositionInPattern; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (o == null || getClass() != o.getClass()) { | ||
| return false; | ||
| } | ||
| RaptorTripScheduleStopPosition that = (RaptorTripScheduleStopPosition) o; | ||
| return ( | ||
| routeIndex == that.routeIndex && | ||
| tripScheduleIndex == that.tripScheduleIndex && | ||
| stopPositionInPattern == that.stopPositionInPattern | ||
| ); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(routeIndex, tripScheduleIndex, stopPositionInPattern); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| // The field labels are shortened to improve reading - should be easy to get in the context | ||
| return ToStringBuilder.of(RaptorTripScheduleStopPosition.class) | ||
| .addNum("route", routeIndex) | ||
| .addNum("tripSchedule", tripScheduleIndex) | ||
| .addNum("stopPosition", stopPositionInPattern) | ||
| .toString(); | ||
| } | ||
| } |
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
17 changes: 0 additions & 17 deletions
17
raptor/src/main/java/org/opentripplanner/raptor/api/view/TripScheduleStopPosition.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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be here when it only depends on the trip?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand, can you explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing from the
RaptorRoutingRequestTransitDataclass or instance is actually needed to do the work. Only the trip itself, that's why I question the location of the method. For example, might it make more sense to put it in theTripScheduleitself?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will be on vacation next week, so I approve this for now so that you are not blocked. But I would like you to think of a good justification for where this method should be and maybe change it's location in one of your next PRs. (If there is a good reason for it being here, that might be fine, I would just like that choice to have been made consciously)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, now I understand. This i s the implementation of the
RaptorTransitDataProvider. So the reason for this is the following:In the Raptor SPI we try to avoid enforcing dependencies onto the model, especially from the leafs(ScheduledTripSchedule) and up (Route/TripPattern). We want to keep the ScheduledTripSchedule as small and compact as possible for the best possible performance. The bigger it is the more memory we need to scan - this apply to the logic in the hot loop. But in this case we need to look ut the route using the ScheduledTripSchedule utside the hot loop - then it make sense to just have an index for this.
When designing the Raptor SPI/API we design for want we think is an open less restrictive model - we do not look to much on the implementation. This should actually apply to all api design. Having an API with less restrictions make it easier to change the implementation in the future. An I think we should remove the reference to Route/TripPattern to make the memory footprint smaller.
Does this make sense?