feedIdWithTimezone.feedId, partition.get(0).edge.nTransfers == 0, tripDescriptor.getTripId(), tripDescriptor.getRouteId(), edges(partition).map(edgeLabel -> edgeLabel.edgeIteratorState).collect(Collectors.toList()).get(0).getName(), stops,
} else { trip.trip_id = tripUpdate.getTrip().getTripId(); trip.route_id = tripUpdate.getTrip().getRouteId();
Trip trip = new Trip(); trip.trip_id = tripUpdate.getTrip().getTripId(); trip.route_id = tripUpdate.getTrip().getRouteId(); final List<StopTime> stopTimes = tripUpdate.getStopTimeUpdateList().stream() .map(stopTimeUpdate -> {
AssignmentType.TRIP_ID); } else if (tripDescriptor.hasRouteId()) { avlReport.setAssignment(tripDescriptor.getRouteId(), AssignmentType.ROUTE_ID);
+ "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().getRouteId(), direction, stopTime.getStopId(),
vpm.setRouteId(td.getRouteId()); vpm.setRouteId(entity.getVehicle().getTrip().getRouteId());
tu.setTripId(t.getTripId()); if (t.hasRouteId()) { tu.setRouteId(t.getRouteId());
String routeId = null; if (v.getTrip().hasRouteId()) { routeId = v.getTrip().getRouteId();
if (routeId != null && routeId.equals(entitySelector.getTrip().getRouteId())) {
esm.setTripId(t.getTripId()); if (t.hasRouteId()) { esm.setRouteId(t.getRouteId());
/** * Checks rule E035 - "GTFS-rt trip.trip_id does not belong to GTFS-rt trip.route_id in GTFS trips.txt", and adds any errors that are found to the provided error list * * @param entity entity which contains the specified trip * @param trip trip to examine to see if the trip_id belongs to the route_id * @param gtfsMetadata information about the GTFS dataset * @param errors list to add any errors for E034 to */ private void checkE035(GtfsRealtime.FeedEntity entity, GtfsRealtime.TripDescriptor trip, GtfsMetadata gtfsMetadata, List<OccurrenceModel> errors) { if (trip.hasTripId() && trip.hasRouteId()) { if (!gtfsMetadata.getRouteIds().contains(trip.getRouteId())) { // route_id isn't in GTFS data (which will be caught by E004) - return; return; } Trip gtfsTrip = gtfsMetadata.getTrips().get(trip.getTripId()); if (gtfsTrip == null) { // trip_id isn't in GTFS data (which will be caught by E003) - return; return; } String gtfsRouteId = gtfsTrip.getRoute().getId().getId(); if (!gtfsRouteId.equals(trip.getRouteId())) { RuleUtils.addOccurrence(E035, "GTFS-rt entity ID " + entity.getId() + " trip_id " + trip.getTripId() + " has route_id " + trip.getRouteId() + " but belongs to GTFS route_id " + gtfsRouteId, errors, _log); } } }
private Affects.Builder getEntitySelectorAsAffects(EntitySelector selector, Map agencyIdMap) { Affects.Builder affects = Affects.newBuilder(); if (selector.hasAgencyId()) { String agencyId = selector.getAgencyId(); if (agencyIdMap != null && agencyIdMap.get(agencyId) != null) { agencyId = (String) agencyIdMap.get(agencyId); } affects.setAgencyId(agencyId); } if (selector.hasRouteId()) { Id routeId = _entitySource.getRouteId(selector.getRouteId()); affects.setRouteId(routeId); } if (selector.hasStopId()) { Id stopId = _entitySource.getStopId(selector.getStopId()); affects.setStopId(stopId); } if (selector.hasTrip()) { TripDescriptor trip = selector.getTrip(); if (trip.hasTripId()) affects.setTripId(_entitySource.getTripId(trip.getTripId())); else if (trip.hasRouteId()) affects.setRouteId(_entitySource.getRouteId(trip.getRouteId())); } return affects; }
/** * Returns vehicle and route IDs text (vehicle_id X route_id = Y) for the given entity if the entity is a VehiclePosition, or the route ID text (route_id = Y) for the given entity if the entity is a TripUpdate * * @param entity Either the VehiclePosition or TripUpdate for which to generate the ID text * @return vehicle and route IDs text (vehicle_id X route_id = Y) for the given entity if the entity is a VehiclePosition, or the route ID text (route_id = Y) for the given entity if the entity is a TripUpdate */ public static String getVehicleAndRouteId(Object entity) { if (!(entity instanceof GtfsRealtime.VehiclePosition || entity instanceof GtfsRealtime.TripUpdate)) { throw new IllegalArgumentException("entity must be instance of VehiclePosition or TripUpdate"); } String ids = null; if (entity instanceof GtfsRealtime.VehiclePosition) { GtfsRealtime.VehiclePosition vp = (GtfsRealtime.VehiclePosition) entity; ids = "vehicle_id " + vp.getVehicle().getId() + " route_id " + vp.getTrip().getRouteId(); } else if (entity instanceof GtfsRealtime.TripUpdate) { GtfsRealtime.TripUpdate tu = (GtfsRealtime.TripUpdate) entity; ids = "route_id " + tu.getTrip().getRouteId(); } return ids; }
/** * Checks rule E031 - "Alert informed_entity.route_id does not match informed_entity.trip.route_id" and adds * any errors that are found to the provided errors list * * @param entity feed entity to examine that contains an alert * @param entitySelector EntitySelector that has both a routeId and a tripDescriptor * @param errors list to add any errors for E031 to */ private void checkE031(GtfsRealtime.FeedEntity entity, GtfsRealtime.EntitySelector entitySelector, List<OccurrenceModel> errors) { if (entitySelector.getTrip().hasRouteId()) { String routeId = entitySelector.getRouteId(); if (!entitySelector.getTrip().getRouteId().equals(routeId)) { RuleUtils.addOccurrence(E031, "alert ID " + entity.getId() + " informed_entity.route_id " + routeId + " does not equal informed_entity.trip.route_id " + entitySelector.getTrip().getRouteId(), errors, _log); } } }
/** * Checks rule E004 - "All route_ids provided in the GTFS-rt feed must appear in the GTFS data", and adds any errors * that are found to the provided error list * * @param entity The VehiclePosition or TripUpdate that contains the data to be evaluated for rule E004 * @param trip The TripDescriptor be evaluated for rule E004 * @param gtfsMetadata metadata for the static GTFS data * @param errors list to add any errors for E004 to */ private void checkE004(Object entity, GtfsRealtime.TripDescriptor trip, GtfsMetadata gtfsMetadata, List<OccurrenceModel> errors) { String routeId = trip.getRouteId(); if (!StringUtils.isEmpty(routeId) && !gtfsMetadata.getRouteIds().contains(routeId)) { RuleUtils.addOccurrence(E004, GtfsUtils.getVehicleAndRouteId(entity), errors, _log); } }
/** * <code>optional string route_id = 5;</code> * * <pre> * The route_id from the GTFS that this selector refers to. * </pre> */ public Builder clearRouteId() { bitField0_ = (bitField0_ & ~0x00000002); routeId_ = getDefaultInstance().getRouteId(); onChanged(); return this; } /**
if (tripUpdate.getTrip().hasRouteId()) { route = getRouteForRouteId(feedId, tripUpdate.getTrip().getRouteId()); route.setId(new FeedScopedId(feedId, tripUpdate.getTrip().getRouteId())); } else { route.setId(new FeedScopedId(feedId, tripId));
FeedScopedId routeId = new FeedScopedId(feedId, trip.getRouteId()); int time = TimeToStringConverter.parseHH_MM_SS(trip.getStartTime()); ServiceDate date;
/** * <code>optional string route_id = 5;</code> * * <pre> * The route_id from the GTFS that this selector refers to. * </pre> */ public Builder clearRouteId() { bitField0_ = (bitField0_ & ~0x00000002); routeId_ = getDefaultInstance().getRouteId(); onChanged(); return this; } /**