Cancel individual stop on StopPattern instead of TripTimes - #3575
Conversation
|
A question @abyrd raised was whether we should change the names of the following fields on TripTimes to something that is more correct in English.
|
To clarify - it's not so much that they're incorrect, more that because they are unconventional ways of saying something, they can confuse or create doubt for a native English speaker. These terms may be standardized terms from a specification, in which case we may want to keep them but just add documentation. Otherwise we may want to change the variable names. In either case they will require a little documentation. The essence of The actual meaning of |
There was a problem hiding this comment.
We have discussed this several times and gone into details on the realtime handling, so I think this is ready for merge. I'm just requesting a couple of additions to Javadoc to make it easier to understand in the future. We can write this documentation together at today's meeting to ensure it's correct.
I believe this PR also leaves some cancellation logic unspecified - this should also be stated in the PR description.
| * This is stop-specific, so the index i is a stop index, not a hop index. | ||
| */ | ||
| public TripTimeOnDate(TripTimes tripTimes, int stopIndex, Stop stop, ServiceDay serviceDay) { | ||
| public TripTimeOnDate(TripTimes tripTimes, int stopIndex, TripPattern tripPattern, ServiceDay serviceDay) { |
There was a problem hiding this comment.
This could use a little more documentation. At first I didn't understand "stop-specific" and thought the name of this class should be plural: TripTimesOnDate. A "tripTime" could be understood to be a single row of GTFS stop_times.txt associated with a trip; the plural TripTimes is supposed to mean the sequence of stop_times for a single trip. Here we are indeed referencing a single trip time, not the whole sequence. The reference to TripPattern seems surprisingly "heavy" for something representing a single time, but if I understand correctly this is a throwaway object used in API translation. Putting all this info in Javadoc makes it easier to understand.
There was a problem hiding this comment.
Looking at this again I see that some of the info is already in the class javadoc, and this comment is on the constructor javadoc. It's also obsolete in that it mentions index i, but the parameter name is now clearly stopIndex. We decided the javadoc on this constructor is just not necessary.
| * | ||
| * Non-final to allow updates. | ||
| */ | ||
| private boolean[] cancelledStops; |
There was a problem hiding this comment.
I think this field was the root of our recent realtime discussions. Canceling a stop changes the pattern of visited stops (StopPattern), and each TripTimes is within a single TripPattern (via a Timetable), with a single StopPattern. The trip must then be moved to a different pattern. But when displaying the original unmodified (non-realtime) data (e.g. on a sign board) we still want to reveal that a stop has been canceled. This needs to be clarified somewhat in this Javadoc.
abyrd
left a comment
There was a problem hiding this comment.
Javadoc and comments have been updated. I see there's now a clear TODO about how boolean[] cancelledStops works and how it could be revised.
Summary
This build on top of #3571.
Because Raptor only checks whether stops can be boarded/alighted on the
TripPatternlevel, we need to do the actual cancellations in theStopPatterninstead of theTripTimes.This PR does the following:
Stopfield on TripTimeOnDate toTripPattern. This allows checks for cancellations on thePatternlevel.StopPatternlevel. This will make the Siri implementation create a newTripPatternfor thatTrip.TripPatternlevel is missing.forBoardingandforAlightingby replacing the more complex logic with a call toPickUpType.isRouteable().TripTimesclass. These are only for API-purposes and do not affect routing. This is documented with javadoc. The only reason these exist is that the current realtime model does not allow navigating to the updated version of theTripTimesobject. This is duplicated information.Issue
#3119
Unit tests
No new unit tests
Changelog
Changelog added