private TransferParent getTransferPatternsForStopsInternal(
TransferPatternData transferPatternData, StopEntry stopFrom,
List<StopEntry> stopsTo) {
TransferParent root = new TransferParent(transferPatternData);
TransferPattern pattern = _transferPatternsByStop.get(stopFrom);
if (pattern == null)
return root;
pattern.getTransfersForStops(root, stopsTo);
Map<StopEntry, List<TransferParent>> hubParentsByStop = pattern.getTransfersForHubStops(root);
for (Map.Entry<StopEntry, List<TransferParent>> entry : hubParentsByStop.entrySet()) {
StopEntry hubStop = entry.getKey();
List<TransferParent> parents = entry.getValue();
TransferParent nodes = transferPatternData.getNodesForHubStop(hubStop);
if (nodes == null) {
nodes = getTransferPatternsForStopsInternal(transferPatternData,
hubStop, stopsTo);
transferPatternData.setNodesForHubStop(hubStop, nodes);
}
for (TransferParent parent : parents) {
for (TransferNode node : nodes.getTransfers()) {
parent.addTransferNode(node);
}
}
}