Search in sources :

Example 21 with ArrivalAndDepartureBean

use of org.onebusaway.transit_data.model.ArrivalAndDepartureBean in project onebusaway-application-modules by camsys.

the class StopWithArrivalsAndDeparturesBeanServiceImpl method getArrivalsAndDeparturesByStopId.

public StopWithArrivalsAndDeparturesBean getArrivalsAndDeparturesByStopId(AgencyAndId id, ArrivalsAndDeparturesQueryBean query) {
    StopBean stop = _stopBeanService.getStopForId(id);
    if (stop == null)
        return null;
    List<ArrivalAndDepartureBean> arrivalsAndDepartures = _arrivalsAndDeparturesBeanService.getArrivalsAndDeparturesByStopId(id, query);
    List<AgencyAndId> nearbyStopIds = _nearbyStopsBeanService.getNearbyStops(stop, 100);
    List<StopBean> nearbyStops = new ArrayList<StopBean>();
    for (AgencyAndId nearbyStopId : nearbyStopIds) nearbyStops.add(_stopBeanService.getStopForId(nearbyStopId));
    List<ServiceAlertBean> situations = _serviceAlertsBeanService.getServiceAlertsForStopId(query.getTime(), id);
    return new StopWithArrivalsAndDeparturesBean(stop, arrivalsAndDepartures, nearbyStops, situations);
}
Also used : StopWithArrivalsAndDeparturesBean(org.onebusaway.transit_data.model.StopWithArrivalsAndDeparturesBean) AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) ArrayList(java.util.ArrayList) StopBean(org.onebusaway.transit_data.model.StopBean) ServiceAlertBean(org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean) ArrivalAndDepartureBean(org.onebusaway.transit_data.model.ArrivalAndDepartureBean)

Aggregations

ArrivalAndDepartureBean (org.onebusaway.transit_data.model.ArrivalAndDepartureBean)21 ArrayList (java.util.ArrayList)14 StopBean (org.onebusaway.transit_data.model.StopBean)9 TripBean (org.onebusaway.transit_data.model.trips.TripBean)8 HashMap (java.util.HashMap)7 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)6 RouteBean (org.onebusaway.transit_data.model.RouteBean)6 HashSet (java.util.HashSet)4 AgencyBean (org.onebusaway.transit_data.model.AgencyBean)4 StopsWithArrivalsAndDeparturesBean (org.onebusaway.transit_data.model.StopsWithArrivalsAndDeparturesBean)4 Date (java.util.Date)3 ArrivalsAndDeparturesQueryBean (org.onebusaway.transit_data.model.ArrivalsAndDeparturesQueryBean)3 ServiceAlertBean (org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean)3 TripStatusBean (org.onebusaway.transit_data.model.trips.TripStatusBean)3 ArrivalAndDepartureInstance (org.onebusaway.transit_data_federation.services.realtime.ArrivalAndDepartureInstance)3 ArrivalAndDepartureComparator (org.onebusaway.presentation.impl.ArrivalAndDepartureComparator)2 TimepointPredictionRecord (org.onebusaway.realtime.api.TimepointPredictionRecord)2 StopWithArrivalsAndDeparturesBean (org.onebusaway.transit_data.model.StopWithArrivalsAndDeparturesBean)2 TargetTime (org.onebusaway.transit_data_federation.model.TargetTime)2 BlockStopTimeEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockStopTimeEntry)2