}
@Override
public void buildGraph(Graph graph, HashMap<Class<?>, Object> extra) {
MultiCalendarServiceImpl service = new MultiCalendarServiceImpl();
GtfsStopContext stopContext = new GtfsStopContext();
try {
for (GtfsBundle gtfsBundle : _gtfsBundles.getBundles()) {
// apply global defaults to individual GTFSBundles (if globals have been set)
if (cacheDirectory != null && gtfsBundle.cacheDirectory == null)
gtfsBundle.cacheDirectory = cacheDirectory;
if (useCached != null && gtfsBundle.useCached == null)
gtfsBundle.useCached = useCached;
GtfsMutableRelationalDao dao = new GtfsRelationalDaoImpl();
GtfsContext context = GtfsLibrary.createContext(dao, service);
GTFSPatternHopFactory hf = new GTFSPatternHopFactory(context);
hf.setStopContext(stopContext);
hf.setFareServiceFactory(_fareServiceFactory);
hf.setMaxStopToShapeSnapDistance(gtfsBundle.getMaxStopToShapeSnapDistance());
loadBundle(gtfsBundle, graph, dao);
CalendarServiceDataFactoryImpl csfactory = new CalendarServiceDataFactoryImpl();
csfactory.setGtfsDao(dao);
CalendarServiceData data = csfactory.createData();
service.addData(data, dao);
hf.setDefaultStreetToStopTime(gtfsBundle.getDefaultStreetToStopTime());
hf.run(graph);
if (gtfsBundle.doesTransfersTxtDefineStationPaths()) {
hf.createTransfersTxtTransfers();
}
if (gtfsBundle.linkStopsToParentStations) {
hf.linkStopsToParentStations(graph);
}
if (gtfsBundle.parentStationTransfers) {
hf.createParentStationTransfers();
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
// We need to save the calendar service data so we can use it later
CalendarServiceData data = service.getData();
graph.putService(CalendarServiceData.class, data);
graph.updateTransitFeedValidity(data);
}