}
}
}
for (Vertex v : graph.getVertices()) {
Cluster c = v.getCluster();
assert c != null;
clusterNodes.get(c).addSubNode(v);
}
for (Link l : graph.getLinks()) {
Port fromPort = l.getFrom();
Port toPort = l.getTo();
Vertex fromVertex = fromPort.getVertex();
Vertex toVertex = toPort.getVertex();
Cluster fromCluster = fromVertex.getCluster();
Cluster toCluster = toVertex.getCluster();
Port samePort = null;
if (combine == OldHierarchicalLayoutManager.Combine.SAME_INPUTS) {
samePort = toPort;
} else if (combine == OldHierarchicalLayoutManager.Combine.SAME_OUTPUTS) {
samePort = fromPort;
}
assert listsConnection.containsKey(fromCluster);
assert listsConnection.containsKey(toCluster);
if (fromCluster == toCluster) {
listsConnection.get(fromCluster).add(l);
clusterNodes.get(fromCluster).addSubEdge(l);
} else {
ClusterInputSlotNode inputSlotNode = null;
ClusterOutputSlotNode outputSlotNode = null;
if (samePort != null) {
outputSlotNode = clusterOutputSlotHash.get(fromCluster).get(samePort);
inputSlotNode = clusterInputSlotHash.get(toCluster).get(samePort);
}
if (outputSlotNode == null) {
outputSlotNode = new ClusterOutputSlotNode(clusterNodes.get(fromCluster), "Out " + fromCluster.toString() + " " + samePort.toString());
clusterOutputSlotSet.get(fromCluster).add(outputSlotNode);
ClusterOutgoingConnection conn = new ClusterOutgoingConnection(outputSlotNode, l);
outputSlotNode.setOutgoingConnection(conn);
clusterNodes.get(fromCluster).addSubEdge(conn);
if (samePort != null) {
clusterOutputSlotHash.get(fromCluster).put(samePort, outputSlotNode);
}
linkClusterOutgoingConnection.put(l, conn);
} else {
linkClusterOutgoingConnection.put(l, outputSlotNode.getOutgoingConnection());
}
if (inputSlotNode == null) {
inputSlotNode = new ClusterInputSlotNode(clusterNodes.get(toCluster), "In " + toCluster.toString() + " " + samePort.toString());
clusterInputSlotSet.get(toCluster).add(inputSlotNode);
}
ClusterIngoingConnection conn = new ClusterIngoingConnection(inputSlotNode, l);
inputSlotNode.setIngoingConnection(conn);