use of org.onebusaway.transit_data.model.TripStopTimeBean in project onebusaway-application-modules by camsys.
the class TripStopTimesBeanServiceImpl method getStopTimesForTrip.
/**
**
* Private Methods
***
*/
private TripStopTimesBean getStopTimesForTrip(TripEntry trip) {
AgencyAndId tripId = trip.getId();
TripStopTimesBean bean = new TripStopTimesBean();
TimeZone tz = _agencyService.getTimeZoneForAgencyId(tripId.getAgencyId());
bean.setTimeZone(tz.getID());
for (StopTimeEntry stopTime : trip.getStopTimes()) {
TripStopTimeBean stBean = new TripStopTimeBean();
stBean.setArrivalTime(stopTime.getArrivalTime());
stBean.setDepartureTime(stopTime.getDepartureTime());
StopEntry stopEntry = stopTime.getStop();
StopBean stopBean = _stopBeanService.getStopForId(stopEntry.getId());
stBean.setStop(stopBean);
stBean.setDistanceAlongTrip(stopTime.getShapeDistTraveled());
bean.addStopTime(stBean);
}
return bean;
}
use of org.onebusaway.transit_data.model.TripStopTimeBean in project onebusaway-application-modules by camsys.
the class BeanFactoryV2 method getTripStopTimes.
public TripStopTimesV2Bean getTripStopTimes(TripStopTimesBean tripStopTimes) {
TripStopTimesV2Bean bean = new TripStopTimesV2Bean();
bean.setTimeZone(tripStopTimes.getTimeZone());
List<TripStopTimeV2Bean> instances = new ArrayList<TripStopTimeV2Bean>();
for (TripStopTimeBean sti : tripStopTimes.getStopTimes()) {
TripStopTimeV2Bean stiBean = new TripStopTimeV2Bean();
stiBean.setArrivalTime(sti.getArrivalTime());
stiBean.setDepartureTime(sti.getDepartureTime());
stiBean.setStopHeadsign(sti.getStopHeadsign());
stiBean.setDistanceAlongTrip(sti.getDistanceAlongTrip());
stiBean.setStopId(sti.getStop().getId());
addToReferences(sti.getStop());
instances.add(stiBean);
}
bean.setStopTimes(instances);
TripBean nextTrip = tripStopTimes.getNextTrip();
if (nextTrip != null) {
bean.setNextTripId(nextTrip.getId());
addToReferences(nextTrip);
}
TripBean prevTrip = tripStopTimes.getPreviousTrip();
if (prevTrip != null) {
bean.setPreviousTripId(prevTrip.getId());
addToReferences(prevTrip);
}
FrequencyBean freq = tripStopTimes.getFrequency();
if (freq != null)
bean.setFrequency(getFrequency(freq));
return bean;
}
Aggregations