int uIndex = 0; for (TripUpdate tripUpdate : updates) { if (fuzzyTripMatcher != null && tripUpdate.hasTrip()) { final TripDescriptor trip = fuzzyTripMatcher.match(feedId, tripUpdate.getTrip()); tripUpdate = tripUpdate.toBuilder().setTrip(trip).build(); if (!tripUpdate.hasTrip()) { LOG.warn("Missing TripDescriptor in gtfs-rt trip update: \n{}", tripUpdate); continue;
public Builder mergeFrom(com.google.transit.realtime.GtfsRealtime.TripUpdate other) { if (other == com.google.transit.realtime.GtfsRealtime.TripUpdate.getDefaultInstance()) return this; if (other.hasTrip()) { mergeTrip(other.getTrip());
if (!tripUpdate.hasTrip()) { LOG.error("TripUpdate object has no TripDescriptor field."); return null;
int gtfsStopTimeIndex = 0; String tripId = null; if (tripUpdate.hasTrip() && tripUpdate.getTrip().hasTripId()) { tripId = tripUpdate.getTrip().getTripId(); gtfsStopTimes = gtfsMetadata.getTripStopTimes().get(tripId);
if (tripUpdate.hasTrip()) { checkW009(entity, tripUpdate.getTrip(), errorListW009);
public Builder mergeFrom(com.google.transit.realtime.GtfsRealtime.TripUpdate other) { if (other == com.google.transit.realtime.GtfsRealtime.TripUpdate.getDefaultInstance()) return this; if (other.hasTrip()) { mergeTrip(other.getTrip());
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTrip()) { memoizedIsInitialized = 0; return false; } if (!getTrip().isInitialized()) { memoizedIsInitialized = 0; return false; } if (hasVehicle()) { if (!getVehicle().isInitialized()) { memoizedIsInitialized = 0; return false; } } for (int i = 0; i < getStopTimeUpdateCount(); i++) { if (!getStopTimeUpdate(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } if (!extensionsAreInitialized()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; }
/** * 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); } }
/** * Returns the trip_id for the given TripUpdate if one exists, if not the entity ID is returned in the format * "trip_id 1234" or "entity ID 4321". * * @param entity the entity that the TripUpdate belongs to * @param tripUpdate the tripUpdate to get the ID for * @return the trip_id for the given TripUpdate if one exists, if not the entity ID is returned in the format "trip_id 1234" or "entity ID 4321". */ public static String getTripId(GtfsRealtime.FeedEntity entity, GtfsRealtime.TripUpdate tripUpdate) { if (!tripUpdate.hasTrip()) { return "entity ID " + entity.getId(); } return getTripId(entity, tripUpdate.getTrip()); }
/** * Returns true if this tripUpdate has a trip_id, false if it does not * * @param tripUpdate to examine * @return true if this tripUpdate has a trip_id, false if it does not */ private boolean hasTripId(GtfsRealtime.TripUpdate tripUpdate) { return tripUpdate.hasTrip() && tripUpdate.getTrip().hasTripId(); }
if (tripUpdate.hasTrip() && tripUpdate.getTrip().hasScheduleRelationship()) { tripScheduleRelationship = tripUpdate.getTrip().getScheduleRelationship();
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTrip()) { memoizedIsInitialized = 0; return false; } if (!getTrip().isInitialized()) { memoizedIsInitialized = 0; return false; } if (hasVehicle()) { if (!getVehicle().isInitialized()) { memoizedIsInitialized = 0; return false; } } for (int i = 0; i < getStopTimeUpdateCount(); i++) { if (!getStopTimeUpdate(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } if (!extensionsAreInitialized()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; }