public class Timetable extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
List<FrequencyEntry> |
frequencyEntries
Contains one FrequencyEntry object for each block of frequency-based trips.
|
TripPattern |
pattern
A circular reference between TripPatterns and their scheduled (non-updated) timetables.
|
org.onebusaway.gtfs.model.calendar.ServiceDate |
serviceDate
The ServiceDate for which this (updated) timetable is valid.
|
List<TripTimes> |
tripTimes
Contains one TripTimes object for each scheduled trip (even cancelled ones) and possibly
additional TripTimes objects for unscheduled trips.
|
Constructor and Description |
---|
Timetable(TripPattern pattern)
Construct an empty Timetable.
|
Modifier and Type | Method and Description |
---|---|
void |
addFrequencyEntry(FrequencyEntry freq)
Add a frequency entry to this Timetable.
|
void |
addTripTimes(TripTimes tt)
Add a trip to this Timetable.
|
TripTimes |
createUpdatedTripTimes(GtfsRealtime.TripUpdate tripUpdate,
TimeZone timeZone,
org.onebusaway.gtfs.model.calendar.ServiceDate updateServiceDate)
Apply the TripUpdate to the appropriate TripTimes from this Timetable.
|
void |
finish()
Finish off a Timetable once all TripTimes have been added to it.
|
int |
getBestDwellTime(int stopIndex)
Returns the shortest possible dwell time at this stop
|
int |
getBestRunningTime(int stopIndex)
Returns the shortest possible running time for this stop
|
TripTimes |
getNextTrip(State s0,
ServiceDay serviceDay,
int stopIndex,
boolean boarding)
Get the next (previous) trip that departs (arrives) from the specified stop at or after
(before) the specified time.
|
int |
getTripIndex(org.onebusaway.gtfs.model.AgencyAndId tripId) |
int |
getTripIndex(String tripId) |
TripTimes |
getTripTimes(int tripIndex) |
TripTimes |
getTripTimes(org.onebusaway.gtfs.model.Trip trip) |
boolean |
isValidFor(org.onebusaway.gtfs.model.calendar.ServiceDate serviceDate) |
void |
setServiceCodes(Map<org.onebusaway.gtfs.model.AgencyAndId,Integer> serviceCodes)
Find and cache service codes.
|
TripTimes |
setTripTimes(int tripIndex,
TripTimes tt)
Set new trip times for trip given a trip index
|
boolean |
temporallyViable(ServiceDay sd,
long searchTime,
int bestWait,
boolean boarding)
Before performing the relatively expensive iteration over all the trips in this pattern, check whether it's even
possible to board any of them given the time at which we are searching, and whether it's possible that any of
them could improve on the best known time.
|
public final TripPattern pattern
public final List<TripTimes> tripTimes
public final List<FrequencyEntry> frequencyEntries
public final org.onebusaway.gtfs.model.calendar.ServiceDate serviceDate
public Timetable(TripPattern pattern)
public boolean temporallyViable(ServiceDay sd, long searchTime, int bestWait, boolean boarding)
bestWait
- -1 means there is not yet any best known time.public TripTimes getNextTrip(State s0, ServiceDay serviceDay, int stopIndex, boolean boarding)
public void finish()
public int getTripIndex(org.onebusaway.gtfs.model.AgencyAndId tripId)
public int getTripIndex(String tripId)
public TripTimes getTripTimes(int tripIndex)
public TripTimes getTripTimes(org.onebusaway.gtfs.model.Trip trip)
public TripTimes setTripTimes(int tripIndex, TripTimes tt)
tripIndex
- trip index of triptt
- new trip times for trippublic TripTimes createUpdatedTripTimes(GtfsRealtime.TripUpdate tripUpdate, TimeZone timeZone, org.onebusaway.gtfs.model.calendar.ServiceDate updateServiceDate)
TimetableSnapshot
performs the
protective copying of this Timetable. It is not done in this update method to avoid
repeatedly cloning the same Timetable when several updates are applied to it at once. We
assume here that all trips in a timetable are from the same feed, which should always be the
case.tripUpdate
- GTFS-RT trip updatetimeZone
- time zone of trip updateupdateServiceDate
- service date of trip updatepublic void addTripTimes(TripTimes tt)
public void addFrequencyEntry(FrequencyEntry freq)
public int getBestRunningTime(int stopIndex)
public int getBestDwellTime(int stopIndex)
public boolean isValidFor(org.onebusaway.gtfs.model.calendar.ServiceDate serviceDate)
Copyright © 2018. All rights reserved.