} else if (tripUpdate.getTrip().getScheduleRelationship() == GtfsRealtime.TripDescriptor.ScheduleRelationship.ADDED) { final StopTime stopTime = new StopTime(); stopTime.stop_sequence = stopTimeUpdate.getStopSequence();
.filter(GtfsRealtime.FeedEntity::hasTripUpdate) .map(GtfsRealtime.FeedEntity::getTripUpdate) .filter(tripUpdate -> tripUpdate.getTrip().getScheduleRelationship() == GtfsRealtime.TripDescriptor.ScheduleRelationship.SCHEDULED) .forEach(tripUpdate -> { Collection<Frequency> frequencies = feed.getFrequencies(tripUpdate.getTrip().getTripId()); .filter(GtfsRealtime.FeedEntity::hasTripUpdate) .map(GtfsRealtime.FeedEntity::getTripUpdate) .filter(tripUpdate -> tripUpdate.getTrip().getScheduleRelationship() == GtfsRealtime.TripDescriptor.ScheduleRelationship.ADDED) .forEach(tripUpdate -> { Trip trip = new Trip();
if (tripDescriptor.hasScheduleRelationship() && tripDescriptor.getScheduleRelationship() == TripDescriptor.ScheduleRelationship.CANCELED) { newTimes.cancel();
if (!(!tripUpdate.getTrip().hasScheduleRelationship() || tripUpdate.getTrip().getScheduleRelationship().equals(GtfsRealtime.TripDescriptor.ScheduleRelationship.UNSCHEDULED))) { RuleUtils.addOccurrence(E013, "trip_id " + tripUpdate.getTrip().getTripId() + " schedule_relationship " + tripUpdate.getTrip().getScheduleRelationship(), errorListE013, _log); if (!(!vehiclePosition.getTrip().hasScheduleRelationship() || vehiclePosition.getTrip().getScheduleRelationship().equals(GtfsRealtime.TripDescriptor.ScheduleRelationship.UNSCHEDULED))) { String prefix = "vehicle_id " + vehiclePosition.getVehicle().getId() + " trip_id " + vehiclePosition.getTrip().getTripId() + " schedule_relationship " + vehiclePosition.getTrip().getScheduleRelationship(); RuleUtils.addOccurrence(E013, prefix, errorListE013, _log);
blockDescriptor.setStartDate(serviceDate); if (trip.hasScheduleRelationship()) { blockDescriptor.setScheduleRelationshipValue(trip.getScheduleRelationship().toString());
setScheduleRelationship(other.getScheduleRelationship());
/** * Checks E041 "trip doesn't have any stop_time_updates", 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 errors the list to add the errors to */ private void checkE041(GtfsRealtime.FeedEntity entity, GtfsRealtime.TripUpdate tripUpdate, List<OccurrenceModel> errors) { if (tripUpdate.getStopTimeUpdateCount() < 1) { if (tripUpdate.hasTrip() && tripUpdate.getTrip().hasScheduleRelationship() && tripUpdate.getTrip().getScheduleRelationship().equals(GtfsRealtime.TripDescriptor.ScheduleRelationship.CANCELED)) { // No errors - the trip was canceled, so it doesn't need any stop_time_updates - return return; } RuleUtils.addOccurrence(ValidationRules.E041, GtfsUtils.getTripId(entity, tripUpdate), errors, _log); } }
private static int findRelationship(TripDescriptor t) { return t.getScheduleRelationship().getNumber(); }
/** * Returns true if this tripDescriptor has a schedule_relationship of ADDED, false if it does not * * @param tripDescriptor TripDescriptor to examine * @return true if this tripDescriptor has a schedule_relationship of ADDED, false if it does not */ public static boolean isAddedTrip(GtfsRealtime.TripDescriptor tripDescriptor) { return tripDescriptor.hasScheduleRelationship() && tripDescriptor.getScheduleRelationship() == GtfsRealtime.TripDescriptor.ScheduleRelationship.ADDED; }
tripScheduleRelationship = tripUpdate.getTrip().getScheduleRelationship();
setScheduleRelationship(other.getScheduleRelationship());