@Override public List<Trip> getTripsForShapeId(AgencyAndId shapeId) { if (_tripsByShapeId == null) { _tripsByShapeId = mapToValueList(getAllTrips(), "shapeId", AgencyAndId.class); } return list(_tripsByShapeId.get(shapeId)); }
@Override public List<Trip> getTripsForRoute(Route route) { if (_tripsByRoute == null) _tripsByRoute = mapToValueList(getAllTrips(), "route", Route.class); return list(_tripsByRoute.get(route)); }
@Override public List<Trip> getTripsForServiceId(AgencyAndId serviceId) { if (_tripsByServiceId == null) { _tripsByServiceId = mapToValueList(getAllTrips(), "serviceId", AgencyAndId.class); } return list(_tripsByServiceId.get(serviceId)); }
@Override public List<Trip> getTripsForRoute(Route route) { if (_tripsByRoute == null) _tripsByRoute = mapToValueList(getAllTrips(), "route", Route.class); return list(_tripsByRoute.get(route)); }
@Override public List<Trip> getTripsForServiceId(AgencyAndId serviceId) { if (_tripsByServiceId == null) { _tripsByServiceId = mapToValueList(getAllTrips(), "serviceId", AgencyAndId.class); } return list(_tripsByServiceId.get(serviceId)); }
@Override public List<Trip> getTripsForShapeId(AgencyAndId shapeId) { if (_tripsByShapeId == null) { _tripsByShapeId = mapToValueList(getAllTrips(), "shapeId", AgencyAndId.class); } return list(_tripsByShapeId.get(shapeId)); }
@Override public List<String> getTripAgencyIdsReferencingServiceId(AgencyAndId serviceId) { if (_tripAgencyIdsByServiceId == null) { Map<AgencyAndId, Set<String>> agencyIdsByServiceIds = new HashMap<AgencyAndId, Set<String>>(); for (Trip trip : getAllTrips()) { AgencyAndId tripId = trip.getId(); String tripAgencyId = tripId.getAgencyId(); AgencyAndId tripServiceId = trip.getServiceId(); Set<String> agencyIds = agencyIdsByServiceIds.get(tripServiceId); if (agencyIds == null) { agencyIds = new HashSet<String>(); agencyIdsByServiceIds.put(tripServiceId, agencyIds); } agencyIds.add(tripAgencyId); } _tripAgencyIdsByServiceId = new HashMap<AgencyAndId, List<String>>(); for (Map.Entry<AgencyAndId, Set<String>> entry : agencyIdsByServiceIds.entrySet()) { AgencyAndId tripServiceId = entry.getKey(); List<String> agencyIds = new ArrayList<String>(entry.getValue()); Collections.sort(agencyIds); _tripAgencyIdsByServiceId.put(tripServiceId, agencyIds); } } List<String> agencyIds = _tripAgencyIdsByServiceId.get(serviceId); if (agencyIds == null) agencyIds = new ArrayList<String>(); return agencyIds; }
@Override public List<String> getTripAgencyIdsReferencingServiceId(AgencyAndId serviceId) { if (_tripAgencyIdsByServiceId == null) { Map<AgencyAndId, Set<String>> agencyIdsByServiceIds = new HashMap<AgencyAndId, Set<String>>(); for (Trip trip : getAllTrips()) { AgencyAndId tripId = trip.getId(); String tripAgencyId = tripId.getAgencyId(); AgencyAndId tripServiceId = trip.getServiceId(); Set<String> agencyIds = agencyIdsByServiceIds.get(tripServiceId); if (agencyIds == null) { agencyIds = new HashSet<String>(); agencyIdsByServiceIds.put(tripServiceId, agencyIds); } agencyIds.add(tripAgencyId); } _tripAgencyIdsByServiceId = new HashMap<AgencyAndId, List<String>>(); for (Map.Entry<AgencyAndId, Set<String>> entry : agencyIdsByServiceIds.entrySet()) { AgencyAndId tripServiceId = entry.getKey(); List<String> agencyIds = new ArrayList<String>(entry.getValue()); Collections.sort(agencyIds); _tripAgencyIdsByServiceId.put(tripServiceId, agencyIds); } } List<String> agencyIds = _tripAgencyIdsByServiceId.get(serviceId); if (agencyIds == null) agencyIds = new ArrayList<String>(); return agencyIds; }
@Override public List<Trip> getTripsForBlockId(AgencyAndId blockId) { if (_tripsByBlockId == null) { _tripsByBlockId = new HashMap<AgencyAndId, List<Trip>>(); for (Trip trip : getAllTrips()) { if (trip.getBlockId() != null) { AgencyAndId bid = new AgencyAndId(trip.getId().getAgencyId(), trip.getBlockId()); List<Trip> trips = _tripsByBlockId.get(bid); if (trips == null) { trips = new ArrayList<Trip>(); _tripsByBlockId.put(bid, trips); } trips.add(trip); } } } return list(_tripsByBlockId.get(blockId)); }
@Override public List<Trip> getTripsForBlockId(AgencyAndId blockId) { if (_tripsByBlockId == null) { _tripsByBlockId = new HashMap<AgencyAndId, List<Trip>>(); for (Trip trip : getAllTrips()) { if (trip.getBlockId() != null) { AgencyAndId bid = new AgencyAndId(trip.getId().getAgencyId(), trip.getBlockId()); List<Trip> trips = _tripsByBlockId.get(bid); if (trips == null) { trips = new ArrayList<Trip>(); _tripsByBlockId.put(bid, trips); } trips.add(trip); } } } return list(_tripsByBlockId.get(blockId)); }