if (originalStopTime != null) { StopTime updatedStopTime = originalStopTime.clone(); if (stopTimeUpdate.getScheduleRelationship() == NO_DATA) { delay = 0; stopTimes.add(updatedStopTime); logger.trace("Number of stop times: {}", stopTimes.size()); if (stopTimeUpdate.getScheduleRelationship() == SKIPPED) { cancelledArrivals.add(stopTimeUpdate.getStopSequence()); cancelledDepartures.add(stopTimeUpdate.getStopSequence()); } else if (stopTimeUpdate.getScheduleRelationship() == NO_DATA) { } else if (tripUpdate.getTrip().getScheduleRelationship() == GtfsRealtime.TripDescriptor.ScheduleRelationship.ADDED) { final StopTime stopTime = new StopTime();
.filter(stopTimeUpdate -> stopTimeUpdate.getScheduleRelationship() == SKIPPED) .mapToInt(GtfsRealtime.TripUpdate.StopTimeUpdate::getStopSequence) .forEach(skippedStopSequenceNumber -> {
update.hasScheduleRelationship() ? update.getScheduleRelationship() : StopTimeUpdate.ScheduleRelationship.SCHEDULED; if (scheduleRelationship == StopTimeUpdate.ScheduleRelationship.SKIPPED) {
public Builder mergeFrom(com.google.transit.realtime.GtfsRealtime.TripUpdate.StopTimeUpdate other) { if (other == com.google.transit.realtime.GtfsRealtime.TripUpdate.StopTimeUpdate.getDefaultInstance()) return this; if (other.hasStopSequence()) { setStopSequence(other.getStopSequence()); } if (other.hasStopId()) { bitField0_ |= 0x00000002; stopId_ = other.stopId_; onChanged(); } if (other.hasArrival()) { mergeArrival(other.getArrival()); } if (other.hasDeparture()) { mergeDeparture(other.getDeparture()); } if (other.hasScheduleRelationship()) { setScheduleRelationship(other.getScheduleRelationship()); } this.mergeExtensionFields(other); this.mergeUnknownFields(other.getUnknownFields()); return this; }
/** * Checks E043 "stop_time_update doesn't have arrival or departure", and adds any errors to the provided error list. * * @param entity entity that the trip_update is from * @param tripUpdate the trip_update to examine * @param stopTimeUpdate the stop_time_update to examine * @param errors the list to add the errors to */ private void checkE043(GtfsRealtime.FeedEntity entity, GtfsRealtime.TripUpdate tripUpdate, GtfsRealtime.TripUpdate.StopTimeUpdate stopTimeUpdate, List<OccurrenceModel> errors) { if (!stopTimeUpdate.hasArrival() && !stopTimeUpdate.hasDeparture()) { if (stopTimeUpdate.hasScheduleRelationship() && (stopTimeUpdate.getScheduleRelationship().equals(SKIPPED) || stopTimeUpdate.getScheduleRelationship().equals(NO_DATA))) { // stop_time_updates with SKIPPED or NO_DATA aren't required to have arrival or departures - return return; } String id = GtfsUtils.getTripId(entity, tripUpdate) + " " + GtfsUtils.getStopTimeUpdateId(stopTimeUpdate); RuleUtils.addOccurrence(ValidationRules.E043, id, errors, _log); } }
/** * Checks E044 "stop_time_update arrival/departure doesn't have delay or time", and adds any errors to the provided error list. * * @param entity entity that the trip_update is from * @param tripUpdate the trip_update to examine * @param stopTimeUpdate the stop_time_update to examine * @param errors the list to add the errors to */ private void checkE044(GtfsRealtime.FeedEntity entity, GtfsRealtime.TripUpdate tripUpdate, GtfsRealtime.TripUpdate.StopTimeUpdate stopTimeUpdate, List<OccurrenceModel> errors) { if (stopTimeUpdate.hasScheduleRelationship() && stopTimeUpdate.getScheduleRelationship().equals(SKIPPED)) { // SKIPPED stop_time_updates aren't required to have delay or time (arrival/departure are optional) - see #243 return; } String id = GtfsUtils.getTripId(entity, tripUpdate) + " " + GtfsUtils.getStopTimeUpdateId(stopTimeUpdate); if (stopTimeUpdate.hasArrival()) { checkE044StopTimeEvent(stopTimeUpdate.getArrival(), id + " arrival", errors); } if (stopTimeUpdate.hasDeparture()) { checkE044StopTimeEvent(stopTimeUpdate.getDeparture(), id + " departure", errors); } }
/** * Checks E042 "arrival or departure provided for NO_DATA stop_time_update", and adds any errors to the provided error list. * * @param entity entity that the trip_update is from * @param tripUpdate the trip_update to examine * @param stopTimeUpdate the stop_time_update to examine * @param errors the list to add the errors to */ private void checkE042(GtfsRealtime.FeedEntity entity, GtfsRealtime.TripUpdate tripUpdate, GtfsRealtime.TripUpdate.StopTimeUpdate stopTimeUpdate, List<OccurrenceModel> errors) { if (stopTimeUpdate.hasScheduleRelationship() && stopTimeUpdate.getScheduleRelationship().equals(NO_DATA)) { String id = GtfsUtils.getTripId(entity, tripUpdate) + " " + GtfsUtils.getStopTimeUpdateId(stopTimeUpdate); if (stopTimeUpdate.hasArrival()) { RuleUtils.addOccurrence(ValidationRules.E042, id + " has arrival", errors, _log); } if (stopTimeUpdate.hasDeparture()) { RuleUtils.addOccurrence(ValidationRules.E042, id + " has departure", errors, _log); } } }
.getScheduleRelationship(); if (stopScheduleRelationship.equals(StopTimeUpdate.ScheduleRelationship.SKIPPED)
public Builder mergeFrom(com.google.transit.realtime.GtfsRealtime.TripUpdate.StopTimeUpdate other) { if (other == com.google.transit.realtime.GtfsRealtime.TripUpdate.StopTimeUpdate.getDefaultInstance()) return this; if (other.hasStopSequence()) { setStopSequence(other.getStopSequence()); } if (other.hasStopId()) { bitField0_ |= 0x00000002; stopId_ = other.stopId_; onChanged(); } if (other.hasArrival()) { mergeArrival(other.getArrival()); } if (other.hasDeparture()) { mergeDeparture(other.getDeparture()); } if (other.hasScheduleRelationship()) { setScheduleRelationship(other.getScheduleRelationship()); } this.mergeExtensionFields(other); this.mergeUnknownFields(other.getUnknownFields()); return this; }
/** * Determine whether stop time update represents a SKIPPED stop. * * @param stopTimeUpdate stop time update * @return true iff stop is SKIPPED; false otherwise */ private boolean isStopSkipped(final StopTimeUpdate stopTimeUpdate) { final boolean isSkipped = stopTimeUpdate.hasScheduleRelationship() && stopTimeUpdate.getScheduleRelationship().equals(StopTimeUpdate.ScheduleRelationship.SKIPPED); return isSkipped; }