Search in sources :

Example 1 with AbstractBlockTripIndex

use of org.onebusaway.transit_data_federation.services.blocks.AbstractBlockTripIndex in project onebusaway-application-modules by camsys.

the class RouteBeanServiceImpl method getBlockTripsForIndicesMatchingRouteCollection.

/**
 * A block index potentially includes trips with different routes. We only
 * want the trips matching our route collection.
 *
 * @param <T>
 * @param blockIndices
 * @param routeCollectionId
 * @param resultingTrips
 */
private <T extends AbstractBlockTripIndex> void getBlockTripsForIndicesMatchingRouteCollection(List<T> blockIndices, AgencyAndId routeCollectionId, List<BlockTripEntry> resultingTrips) {
    for (AbstractBlockTripIndex blockIndex : blockIndices) {
        for (BlockTripEntry blockTrip : blockIndex.getTrips()) {
            TripEntry trip = blockTrip.getTrip();
            AgencyAndId rcId = trip.getRouteCollection().getId();
            if (!rcId.equals(routeCollectionId))
                continue;
            resultingTrips.add(blockTrip);
        }
    }
}
Also used : AbstractBlockTripIndex(org.onebusaway.transit_data_federation.services.blocks.AbstractBlockTripIndex) AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) BlockTripEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry) TripEntry(org.onebusaway.transit_data_federation.services.transit_graph.TripEntry) BlockTripEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry)

Aggregations

AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)1 AbstractBlockTripIndex (org.onebusaway.transit_data_federation.services.blocks.AbstractBlockTripIndex)1 BlockTripEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockTripEntry)1 TripEntry (org.onebusaway.transit_data_federation.services.transit_graph.TripEntry)1