use of org.onebusaway.transit_data_federation.impl.StopGraphComparator in project onebusaway-application-modules by camsys.
the class RouteBeanServiceImpl method getStopsInOrder.
private List<StopEntry> getStopsInOrder(StopSequenceCollection block) {
DirectedGraph<StopEntry> graph = new DirectedGraph<StopEntry>();
for (StopSequence sequence : block.getStopSequences()) {
StopEntry prev = null;
for (StopEntry stop : sequence.getStops()) {
if (prev != null) {
// We do this to avoid cycles
if (!graph.isConnected(stop, prev))
graph.addEdge(prev, stop);
}
prev = stop;
}
}
StopGraphComparator c = new StopGraphComparator(graph);
return graph.getTopologicalSort(c);
}
Aggregations