if (tripUpdate.getTrip().hasRouteId()) { if (tripUpdate.getTrip().hasRouteId()) { route.setId(new FeedScopedId(feedId, tripUpdate.getTrip().getRouteId())); } else {
if (!trip.hasRouteId() || !trip.hasDirectionId() || !trip.hasStartTime() || !trip.hasStartDate()) {
/** * 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); } } }
avlReport.setAssignment(tripDescriptor.getTripId(), AssignmentType.TRIP_ID); } else if (tripDescriptor.hasRouteId()) { avlReport.setAssignment(tripDescriptor.getRouteId(), AssignmentType.ROUTE_ID);
vpm.setTripId(td.getTripId()); if (td.hasRouteId()) { vpm.setRouteId(td.getRouteId()); if (entity.getVehicle().getTrip().hasRouteId()) { vpm.setRouteId(entity.getVehicle().getTrip().getRouteId());
if (t.hasRouteId()) { tu.setRouteId(t.getRouteId());
if (v.getTrip().hasRouteId()) { routeId = v.getTrip().getRouteId();
if (t.hasTripId()) esm.setTripId(t.getTripId()); if (t.hasRouteId()) { esm.setRouteId(t.getRouteId());
onChanged(); if (other.hasRouteId()) { bitField0_ |= 0x00000002; routeId_ = other.routeId_;
/** * Checks rule E033 - "Alert informed_entity does not have any specifiers" 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 to examine for specifiers * @param errors list to add any errors for E033 to */ private void checkE033(GtfsRealtime.FeedEntity entity, GtfsRealtime.EntitySelector entitySelector, List<OccurrenceModel> errors) { GtfsRealtime.TripDescriptor trip = null; if (entitySelector.hasTrip()) { trip = entitySelector.getTrip(); } if (!entitySelector.hasAgencyId() && !entitySelector.hasRouteId() && !entitySelector.hasRouteType() && !entitySelector.hasStopId()) { // informed_entity isn't populated - check TripDescriptor if (trip == null || (!trip.hasTripId() && !trip.hasRouteId())) { RuleUtils.addOccurrence(E033, "alert ID " + entity.getId() + " informed_entity and informed_entity.trip do not not reference any agency, route, trip, or stop", 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; }
/** * 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); } } }
onChanged(); if (other.hasRouteId()) { bitField0_ |= 0x00000002; routeId_ = other.routeId_;