Map<RawNode, List<Integer>> edges = forward ? node.getOutgoing()
: node.getIncoming();
for (RawNode edge : edges.keySet()) {
if (edge instanceof RawBerthNode) {
RawBerthNode berthNode = (RawBerthNode) edge;
BerthStepIdentifier id = berthNode.getId();
fromBerths.put(id.getFromBerthId(), berthNode);
toBerths.put(id.getToBerthId(), berthNode);
}
}
if (forward) {
fromBerths.keySet().retainAll(toBerths.keySet());
node.getOutgoing().keySet().removeAll(fromBerths.values());