final StopTime stopTime = new StopTime(); stopTime.stop_sequence = stopTimeUpdate.getStopSequence(); stopTime.stop_id = stopTimeUpdate.getStopId(); stopTime.trip_id = trip.trip_id; final ZonedDateTime arrival_time = Instant.ofEpochSecond(stopTimeUpdate.getArrival().getTime()).atZone(timezone);
final StopTime stopTime = new StopTime(); stopTime.stop_sequence = stopTimeUpdate.getStopSequence(); stopTime.stop_id = stopTimeUpdate.getStopId(); stopTime.trip_id = trip.trip_id; final ZonedDateTime arrival_time = Instant.ofEpochSecond(stopTimeUpdate.getArrival().getTime()).atZone(timezone);
String previousDepartureTimeText = null; for (GtfsRealtime.TripUpdate.StopTimeUpdate stopTimeUpdate : stopTimeUpdates) { String stopDescription = stopTimeUpdate.hasStopSequence() ? " stop_sequence " + stopTimeUpdate.getStopSequence() : " stop_id " + stopTimeUpdate.getStopId(); Long arrivalTime = null; String arrivalTimeText;
+ "directionId={}, tripId={}, vehicleId={}, " + "stopId={}, prediction={}, isArrival={}", update.getTrip().getRouteId(), direction, update.getTrip().getTripId(), update.getVehicle().getId(), stopTime.getStopId(), new Date(stopTime.getArrival().getTime()*1000), true); update.getTrip().getRouteId(), direction, stopTime.getStopId(), update.getTrip().getTripId(), update.getVehicle().getId(), update.getTrip().getRouteId(), direction, stopTime.getStopId(), update.getTrip().getTripId(), update.getVehicle().getId(), logger.debug("No predictions for vehicleId={} for stop={}",update.getVehicle().getId(),stopTime.getStopId());
for (GtfsRealtime.TripUpdate.StopTimeUpdate stopTimeUpdate : stopTimeUpdateList) { if (stopTimeUpdate.hasStopId()) { String prefix = "trip_id " + tripUpdate.getTrip().getTripId() + " stop_id " + stopTimeUpdate.getStopId(); if (!gtfsMetadata.getStopIds().contains(stopTimeUpdate.getStopId())) { Integer locationType = gtfsMetadata.getStopToLocationTypeMap().get(stopTimeUpdate.getStopId()); if (locationType != null && locationType != 0) {
stum.setStopId(stu.getStopId());
/** * Checks E037 - if the provided previousStopId value is the same as the current stopTimeUpdate stop_id it adds * an error to the provided error list. * * @param entity entity that the stopTimeUpdate is from * @param previousStopId the stop_id for the previous StopTimeUpdate * @param stopTimeUpdate the current stopTimeUpdate * @param errors the list to add the errors to */ private void checkE037(GtfsRealtime.FeedEntity entity, String previousStopId, GtfsRealtime.TripUpdate.StopTimeUpdate stopTimeUpdate, List<OccurrenceModel> errors) { if (!previousStopId.isEmpty() && stopTimeUpdate.hasStopId() && previousStopId.equals(stopTimeUpdate.getStopId())) { String id = GtfsUtils.getTripId(entity, entity.getTripUpdate()); StringBuilder prefix = new StringBuilder(); prefix.append(id); prefix.append(" has repeating stop_id "); prefix.append(previousStopId); if (stopTimeUpdate.hasStopSequence()) { prefix.append(" at stop_sequence "); prefix.append(stopTimeUpdate.getStopSequence()); } RuleUtils.addOccurrence(ValidationRules.E037, prefix.toString(), errors, _log); } }
/** * Checks E045 "GTFS-rt stop_time_update stop_sequence and stop_id do not match GTFS", 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 gtfsStopSequence the stop_sequence from the GTFS stop_times.txt data * @param stop the GTFS stop that is paired with the provided gtfsStopSequence, using stop_id from the same record in stop_times.txt * @param errors the list to add the errors to */ private void checkE045(GtfsRealtime.FeedEntity entity, GtfsRealtime.TripUpdate tripUpdate, GtfsRealtime.TripUpdate.StopTimeUpdate stopTimeUpdate, int gtfsStopSequence, Stop stop, List<OccurrenceModel> errors) { if (stopTimeUpdate.hasStopId() && !stop.getId().getId().equals(stopTimeUpdate.getStopId())) { String tripId = "GTFS-rt " + GtfsUtils.getTripId(entity, tripUpdate) + " "; String stopSequence = "stop_sequence " + stopTimeUpdate.getStopSequence(); String stopId = "stop_id " + stopTimeUpdate.getStopId(); String gtfsSummary = " but GTFS stop_sequence " + gtfsStopSequence + " has stop_id " + stop.getId().getId(); RuleUtils.addOccurrence(ValidationRules.E045, tripId + stopSequence + " has " + stopId + gtfsSummary, errors, _log); } }
/** * Returns the stop_sequence for the given StopTimeUpdate if one exists, if not the stop_id is returned in the format * "stop_sequence 1234" or "stop_id 9876". * * @param stopTimeUpdate the stop_time_update to generate the stop_sequence or stop_id text from * @return the stop_sequence for the given StopTimeUpdate if one exists, if not the stop_id is returned in the format"stop_sequence 1234" or "stop_id 9876". */ public static String getStopTimeUpdateId(GtfsRealtime.TripUpdate.StopTimeUpdate stopTimeUpdate) { if (stopTimeUpdate.hasStopSequence()) { return "stop_sequence " + stopTimeUpdate.getStopSequence(); } else { return "stop_id " + stopTimeUpdate.getStopId(); } }
/** * <code>optional string stop_id = 4;</code> * * <pre> * Must be the same as in stops.txt in the corresponding GTFS feed. * </pre> */ public Builder clearStopId() { bitField0_ = (bitField0_ & ~0x00000002); stopId_ = getDefaultInstance().getStopId(); onChanged(); return this; } /**
match = update.getStopSequence() == newTimes.getStopSequence(i); } else if (update.hasStopId()) { match = pattern.getStop(i).getId().getId().equals(update.getStopId());
/** * <code>optional string stop_id = 4;</code> * * <pre> * Must be the same as in stops.txt in the corresponding GTFS feed. * </pre> */ public Builder clearStopId() { bitField0_ = (bitField0_ & ~0x00000002); stopId_ = getDefaultInstance().getStopId(); onChanged(); return this; } /**