Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public final class ScheduledTripTimes implements TripTimes {
private static final int MAX_TIME = DurationUtils.durationInSeconds("20d");

/**
* Implementation notes: This allows re-using the same scheduled arrival and departure time
* arrays for many ScheduledTripTimes. It is also used in materializing frequency-based
* Implementation notes: This timeShift allows re-using the same scheduled arrival and departure
* time arrays for many ScheduledTripTimes. It is also used in materializing frequency-based
* ScheduledTripTimes.
*/
private final int timeShift;
Expand All @@ -53,18 +53,28 @@ public final class ScheduledTripTimes implements TripTimes {
private final List<BookingInfo> dropOffBookingInfos;
private final List<BookingInfo> pickupBookingInfos;

/**
* The headsign displayed by the vehicle at each stop along this trip. The array index is the
* stop index within this trip's TripPattern. Any number of array elements may point to the same
* I18NString instance if the headsign remains unchanged between stops.
*/
@Nullable
private final I18NString[] headsigns;

/**
* Implementation notes: This is 2D array since there can be more than one via name/stop per each
* record in stop sequence). Outer array may be null if there are no vias in stop sequence. Inner
* array may be null if there are no vias for particular stop. This is done in order to save
* space.
* A 2D array of String containing zero or more Via messages displayed at each stop in the
* stop sequence. A Via is an additional intermediate destination that is displayed alongside the
* terminus headsign, but will usually change or only be displayed at certain stops along the way.
* While the concept of Headsigns exists in both GTFS (Headsign) and Netex (DestinationDisplay),
* the Via concept is only present in Transmodel. This reference be null if no stop in the entire
* sequence of stops has any via strings. Any subarray may also be null or empty if no Via strings
* are displayed at that particular stop. These nulls are allowed to conserve memory in the common
* case where there are few or no via messages.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All domain specific info should be moved to and merged with the TripTimes#getHeadsignVias(int stop). Only implementation details should be here.

Copy link
Member Author

@abyrd abyrd Jul 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved that information to the getter ScheduledTripTimes#getHeadsignVias. The question then arises how far up the chain of accessors the information should be placed, and whether it is acceptable for it to be replicated.

It turns out similar information was already available on RealTimeTripTimes#getHeadsignVias and in the interface declaration TripTimes#getHeadsignVias, but I somehow didn't spot or understand these when working on ScheduledTripTimes. No such explanation is present on TripTimeOnDate#getHeadsignVias which reads through to the same data, but the Javadoc is readily found by following the method call.

In the end I consolidated information from the various Javadoc on the interface (overridden) method declaration.

*/
@Nullable
private final String[][] headsignVias;

/** TODO RT_AB: document, what is this for? */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for matching stops with external services, like in the realtime-updaters.

private final int[] originalGtfsStopSequence;

ScheduledTripTimes(ScheduledTripTimesBuilder builder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ private I18NString[] makeHeadsignsArray(final Collection<StopTime> stopTimes) {
}

/**
* Create 2D String array for via names for each stop in sequence.
*
* @return May be null if no vias are present in stop sequence.
* Create 2D array of String containing zero or more Via messages displayed at each stop in the
* stop sequence.
* @return May be null if no stop in the entire sequence of stops has any via strings. Any
* subarray may also be null or empty if no Via strings are displayed at that particular stop.
* @see org.opentripplanner.transit.model.timetable.ScheduledTripTimes#headsignVias
*/
private String[][] makeHeadsignViasArray(final Collection<StopTime> stopTimes) {
if (
Expand Down
Loading