Collection<TopologyEdge> edges = all.getEdges().values();
for (TopologyEdge edge : edges) {
String self = edge.getSelf();
String target = edge.getTarget();
TopologyEdge cloneEdge = m_graphBuilder.cloneEdge(edge);
if (self.equals(domain)) {
TopologyNode other = all.findTopologyNode(target);
if (other != null) {
topylogyGraph.addTopologyNode(m_graphBuilder.cloneNode(other));
} else {
topylogyGraph.addTopologyNode(m_graphBuilder.createNode(target));
}
edge.setOpposite(false);
topylogyGraph.addTopologyEdge(cloneEdge);
} else if (target.equals(domain)) {
TopologyNode other = all.findTopologyNode(self);
if (other != null) {
topylogyGraph.addTopologyNode(m_graphBuilder.cloneNode(other));
} else {
topylogyGraph.addTopologyNode(m_graphBuilder.createNode(target));
}
cloneEdge.setTarget(edge.getSelf());
cloneEdge.setSelf(edge.getTarget());
cloneEdge.setOpposite(true);
topylogyGraph.addTopologyEdge(cloneEdge);
}
}
}
return topylogyGraph;