public Optional<GtfsReader.TripWithStopTimes> getTripUpdate(GTFSFeed staticFeed, GtfsRealtime.TripDescriptor tripDescriptor, Label.Transition boardEdge, Instant boardTime) { logger.trace("getTripUpdate {}", tripDescriptor); if (!isThisRealtimeUpdateAboutThisLineRun(boardEdge.edge.edgeIteratorState, boardTime)) { return Optional.empty(); } else { GtfsRealtime.TripDescriptor normalizedTripDescriptor = normalize(tripDescriptor); return feedMessages.values().stream().flatMap(feedMessage -> feedMessage.getEntityList().stream() .filter(e -> e.hasTripUpdate()) .map(e -> e.getTripUpdate()) .filter(tu -> normalize(tu.getTrip()).equals(normalizedTripDescriptor)) .map(tu -> toTripWithStopTimes(staticFeed, tu))) .findFirst(); } }
if (feedEntity.hasTripUpdate()) updates.add(feedEntity.getTripUpdate());
if (feedEntity.hasTripUpdate()) updates.add(feedEntity.getTripUpdate());
GtfsRealtime.TripUpdate tripUpdate = entity.getTripUpdate(); if (!tripUpdate.getTrip().hasTripId()) { checkW006(entity, tripUpdate.getTrip(), errorListW006);
if (entity.hasTripUpdate() && hasTripId(entity.getTripUpdate())) { tripUpdateCount++; String tripId = entity.getTripUpdate().getTrip().getTripId(); String vehicleId = ""; if (entity.getTripUpdate().hasVehicle() && entity.getTripUpdate().getVehicle().hasId()) { vehicleId = entity.getTripUpdate().getVehicle().getId();
TripUpdate tu = fe.getTripUpdate();
GtfsRealtime.TripUpdate tripUpdate = entity.getTripUpdate();
GtfsRealtime.TripUpdate tripUpdate = entity.getTripUpdate();
TripUpdate update = entity.getTripUpdate(); List<StopTimeUpdate> stopTimes = update.getStopTimeUpdateList(); for(StopTimeUpdate stopTime : stopTimes)
GtfsRealtime.TripUpdate tripUpdate = entity.getTripUpdate();
String entityId = entity.getId(); if (entity.hasTripUpdate()) { GtfsRealtime.TripUpdate tripUpdate = entity.getTripUpdate(); List<GtfsRealtime.TripUpdate.StopTimeUpdate> stopTimeUpdateList = tripUpdate.getStopTimeUpdateList(); for (GtfsRealtime.TripUpdate.StopTimeUpdate stopTimeUpdate : stopTimeUpdateList) {
if (entity.hasTripUpdate()) { TripUpdateModel tu = new TripUpdateModel(); TripDescriptor t = entity.getTripUpdate().getTrip(); if (entity.getTripUpdate().hasTimestamp()) { timestamp = entity.getTripUpdate().getTimestamp() * 1000; if (entity.getTripUpdate().hasDelay()) { tu.setDelay(entity.getTripUpdate().getDelay()); VehicleDescriptor vehicle = entity.getTripUpdate().getVehicle(); if (vehicle != null) { tu.setVehicleId(vehicle.getId()); for (StopTimeUpdate stu : entity.getTripUpdate().getStopTimeUpdateList()) { StopTimeUpdateModel stopTimeUpdate = readStopTimeUpdate(stu, tu.getScheduleRelationship());
if (!getTripUpdate().isInitialized()) { memoizedIsInitialized = 0; return false;
/** * 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); } }
public Builder mergeFrom(com.google.transit.realtime.GtfsRealtime.FeedEntity other) { if (other == com.google.transit.realtime.GtfsRealtime.FeedEntity.getDefaultInstance()) return this; if (other.hasId()) { bitField0_ |= 0x00000001; id_ = other.id_; onChanged(); } if (other.hasIsDeleted()) { setIsDeleted(other.getIsDeleted()); } if (other.hasTripUpdate()) { mergeTripUpdate(other.getTripUpdate()); } if (other.hasVehicle()) { mergeVehicle(other.getVehicle()); } if (other.hasAlert()) { mergeAlert(other.getAlert()); } this.mergeExtensionFields(other); this.mergeUnknownFields(other.getUnknownFields()); return this; }
/** * Checks E036 - if the provided previousStopSequence value is the same as the current stopTimeUpdate stop_sequence * it adds an error to the provided error list. * * @param entity entity that the stopTimeUpdate is from * @param previousStopSequence the stop_sequence for the previous StopTimeUpdate * @param stopTimeUpdate the current stopTimeUpdate * @param errors the list to add the errors to */ private void checkE036(GtfsRealtime.FeedEntity entity, Integer previousStopSequence, GtfsRealtime.TripUpdate.StopTimeUpdate stopTimeUpdate, List<OccurrenceModel> errors) { if (stopTimeUpdate.hasStopSequence() && previousStopSequence == stopTimeUpdate.getStopSequence()) { String id = GtfsUtils.getTripId(entity, entity.getTripUpdate()); RuleUtils.addOccurrence(ValidationRules.E036, id + " has repeating stop_sequence " + previousStopSequence, errors, _log); } }
/** * Checks rule W009 - "schedule_relationship not populated", and adds any warnings that are found to the provided warning list * * @param entity entity which contains the specified trip.stop_time_update * @param stopTimeUpdate stop_time_update to examine to see if it has a schedule_relationship * @param warnings list to add any warnings for W009 to */ private void checkW009(GtfsRealtime.FeedEntity entity, GtfsRealtime.TripUpdate.StopTimeUpdate stopTimeUpdate, List<OccurrenceModel> warnings) { if (stopTimeUpdate != null && !stopTimeUpdate.hasScheduleRelationship()) { RuleUtils.addOccurrence(W009, GtfsUtils.getTripId(entity, entity.getTripUpdate().getTrip()) + " " + GtfsUtils.getStopTimeUpdateId(stopTimeUpdate) + " (and potentially more for this trip)", warnings, _log); } } }
for (FeedEntity feedEntity : feedEntityList) { if (feedEntity.hasTripUpdate()) { updates.add(feedEntity.getTripUpdate());
if (!getTripUpdate().isInitialized()) { memoizedIsInitialized = 0; return false;
public Builder mergeFrom(com.google.transit.realtime.GtfsRealtime.FeedEntity other) { if (other == com.google.transit.realtime.GtfsRealtime.FeedEntity.getDefaultInstance()) return this; if (other.hasId()) { bitField0_ |= 0x00000001; id_ = other.id_; onChanged(); } if (other.hasIsDeleted()) { setIsDeleted(other.getIsDeleted()); } if (other.hasTripUpdate()) { mergeTripUpdate(other.getTripUpdate()); } if (other.hasVehicle()) { mergeVehicle(other.getVehicle()); } if (other.hasAlert()) { mergeAlert(other.getAlert()); } this.mergeExtensionFields(other); this.mergeUnknownFields(other.getUnknownFields()); return this; }