/** * 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 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 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); } } }
final StopTimeUpdate.ScheduleRelationship stopScheduleRelationship = stopTimeUpdate .getScheduleRelationship(); if (stopScheduleRelationship.equals(StopTimeUpdate.ScheduleRelationship.SKIPPED)
/** * 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; }