use of org.onebusaway.transit_data.model.StopTimeInstanceBean in project onebusaway-application-modules by camsys.
the class StopScheduleBeanServiceImpl method applyGroupIdForGroupKey.
private void applyGroupIdForGroupKey(StopTimeByDirectionEntry stopTimesForDirection, Object key, String groupId) {
List<StopTimeInstanceBean> stopTimesForGroup = stopTimesForDirection.getStopTimesForGroupKey(key);
for (StopTimeInstanceBean stiBean : stopTimesForGroup) {
List<String> groupIds = stiBean.getGroupIds();
if (groupIds == null) {
groupIds = new ArrayList<String>();
stiBean.setGroupIds(groupIds);
}
groupIds.add(groupId);
}
}
use of org.onebusaway.transit_data.model.StopTimeInstanceBean in project onebusaway-application-modules by camsys.
the class StopTimeBeanServiceImpl method getStopTimeInstanceAsBean.
@Override
public StopTimeInstanceBean getStopTimeInstanceAsBean(StopTimeInstance instance) {
StopTimeInstanceBean bean = new StopTimeInstanceBean();
bean.setArrivalTime(instance.getArrivalTime());
bean.setDepartureTime(instance.getDepartureTime());
bean.setServiceDate(instance.getServiceDate());
bean.setTripId(AgencyAndIdLibrary.convertToString(instance.getTrip().getTrip().getId()));
return bean;
}
use of org.onebusaway.transit_data.model.StopTimeInstanceBean in project onebusaway-application-modules by camsys.
the class ScheduleAction method getFilteredStopTimes.
private List<StopTimeInstanceBean> getFilteredStopTimes(StopRouteDirectionScheduleBean direction) {
List<StopTimeInstanceBean> stopTimes = direction.getStopTimes();
List<StopTimeInstanceBean> filteredStopTimes = new ArrayList<StopTimeInstanceBean>(stopTimes.size());
boolean showArrivals = (_showArrivals == null) ? !(directionHasDepartures(direction)) : _showArrivals;
for (StopTimeInstanceBean stopTime : stopTimes) {
if ((showArrivals && stopTime.isArrivalEnabled()) || (!showArrivals && stopTime.isDepartureEnabled()))
filteredStopTimes.add(stopTime);
}
return filteredStopTimes;
}
use of org.onebusaway.transit_data.model.StopTimeInstanceBean in project onebusaway-application-modules by camsys.
the class UserReportingServiceImpl method getRecordAsBean.
private TripProblemReportBean getRecordAsBean(TripProblemReportRecord record) {
AgencyAndId stopId = record.getStopId();
AgencyAndId tripId = record.getTripId();
TripProblemReportBean bean = new TripProblemReportBean();
bean.setCode(record.getCode());
bean.setId(record.getId());
bean.setServiceDate(record.getServiceDate());
bean.setStatus(record.getStatus());
bean.setLabel(record.getLabel());
bean.setStopId(AgencyAndIdLibrary.convertToString(stopId));
bean.setTime(record.getTime());
bean.setTripId(AgencyAndIdLibrary.convertToString(tripId));
bean.setUserComment(record.getUserComment());
bean.setUserLat(record.getUserLat());
bean.setUserLon(record.getUserLon());
bean.setUserLocationAccuracy(record.getUserLocationAccuracy());
bean.setUserOnVehicle(record.isUserOnVehicle());
bean.setUserVehicleNumber(record.getUserVehicleNumber());
bean.setPredicted(record.isPredicted());
bean.setVehicleId(AgencyAndIdLibrary.convertToString(record.getVehicleId()));
bean.setDistanceAlongBlock(record.getDistanceAlongBlock());
bean.setScheduleDeviation(record.getScheduleDeviation());
bean.setVehicleLat(record.getVehicleLat());
bean.setVehicleLon(record.getVehicleLon());
if (stopId != null) {
try {
bean.setStop(_stopBeanService.getStopForId(stopId));
} catch (NoSuchStopServiceException ex) {
}
}
if (tripId != null) {
bean.setTrip(_tripBeanService.getTripForId(tripId));
}
if (tripId != null && stopId != null) {
TripEntry trip = _graph.getTripEntryForId(tripId);
StopEntry stop = _graph.getStopEntryForId(stopId);
if (trip != null && stop != null) {
AgencyAndId vehicleId = record.getMatchedVehicleId();
if (vehicleId == null)
vehicleId = record.getVehicleId();
ArrivalAndDepartureQuery query = new ArrivalAndDepartureQuery();
query.setStop(stop);
query.setStopSequence(-1);
query.setTrip(trip);
query.setServiceDate(record.getServiceDate());
query.setVehicleId(vehicleId);
query.setTime(record.getTime());
ArrivalAndDepartureInstance instance = _arrivalAndDepartureService.getArrivalAndDepartureForStop(query);
if (instance != null) {
StopTimeInstance sti = instance.getStopTimeInstance();
StopTimeInstanceBean stopTimeBean = _stopTimeBeanService.getStopTimeInstanceAsBean(sti);
bean.setStopTime(stopTimeBean);
}
}
}
return bean;
}
use of org.onebusaway.transit_data.model.StopTimeInstanceBean in project onebusaway-application-modules by camsys.
the class ScheduleAction method filterResults.
/**
**
*
***
*/
private void filterResults() {
List<StopRouteScheduleBean> routes = _result.getRoutes();
List<StopRouteScheduleBean> filteredRoutes = new ArrayList<StopRouteScheduleBean>(routes.size());
for (StopRouteScheduleBean route : routes) {
List<StopRouteDirectionScheduleBean> directions = route.getDirections();
List<StopRouteDirectionScheduleBean> filteredDirections = new ArrayList<StopRouteDirectionScheduleBean>(directions.size());
for (StopRouteDirectionScheduleBean direction : directions) {
List<StopTimeInstanceBean> filteredStopTimes = getFilteredStopTimes(direction);
List<FrequencyInstanceBean> filteredFrequencies = getFilteredFrequencies(direction);
if (!(filteredStopTimes.isEmpty() && filteredFrequencies.isEmpty())) {
direction.setStopTimes(filteredStopTimes);
direction.setFrequencies(filteredFrequencies);
filteredDirections.add(direction);
}
}
if (!filteredDirections.isEmpty()) {
route.setDirections(filteredDirections);
filteredRoutes.add(route);
}
}
_result.setRoutes(filteredRoutes);
}
Aggregations