AgencyAndId fromStopId = AgencyAndIdLibrary.convertFromString(transitLeg.getFromStop().getId());
StopEntry fromStop = _transitGraphDao.getStopEntryForId(fromStopId, true);
int fromStopSequence = transitLeg.getFromStopSequence();
ArrivalAndDepartureQuery query = new ArrivalAndDepartureQuery();
query.setStop(fromStop);
query.setStopSequence(fromStopSequence);
query.setTrip(trip);
query.setServiceDate(serviceDate);
query.setVehicleId(vehicleId);
query.setTime(options.currentTime);
ArrivalAndDepartureInstance instance = _arrivalAndDepartureService.getArrivalAndDepartureForStop(query);
b.setFromStop(instance);
b.setBlockTripInstanceFrom(instance.getBlockTripInstance());
b.setScheduledDepartureTime(instance.getScheduledDepartureTime());
b.setPredictedDepartureTime(instance.getPredictedDepartureTime());
}
if (transitLeg.getToStop() != null
&& transitLeg.getToStop().getId() != null) {
AgencyAndId toStopId = AgencyAndIdLibrary.convertFromString(transitLeg.getToStop().getId());
StopEntry toStop = _transitGraphDao.getStopEntryForId(toStopId, true);
int toStopSequence = transitLeg.getToStopSequence();
ArrivalAndDepartureQuery query = new ArrivalAndDepartureQuery();
query.setStop(toStop);
query.setStopSequence(toStopSequence);
query.setTrip(trip);
query.setServiceDate(serviceDate);
query.setVehicleId(vehicleId);
query.setTime(options.currentTime);
ArrivalAndDepartureInstance instance = _arrivalAndDepartureService.getArrivalAndDepartureForStop(query);
b.setToStop(instance);
b.setBlockTripInstanceTo(instance.getBlockTripInstance());