diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingStage.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingStage.java index 335fa7f..e118527 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingStage.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingStage.java @@ -398,54 +398,17 @@ continue; } - mxCell parent = getLCA(sourceNodeCell, destinationNodeCell); - if (parent == null || parent == graph.getDefaultParent()) { - parent = layerCell; - } - CallEdgeAttribute callEdgeAttr = new CallEdgeAttribute(callEdge, (ObjectNode) callEdge.getSource(), sourceNodeCell, destinationNodeCell); if (sourceNode instanceof StatefulObjectNode) { - graph.insertEdge(parent, null, callEdgeAttr, sourceNodeCell, destinationNodeCell, "movable=false;"); + graph.insertEdge(layerCell, null, callEdgeAttr, sourceNodeCell, destinationNodeCell, "movable=false;"); } else { - graph.insertEdge(parent, null, callEdgeAttr, srcOutputPortCell, destinationNodeCell, "movable=false;"); + graph.insertEdge(layerCell, null, callEdgeAttr, srcOutputPortCell, destinationNodeCell, "movable=false;"); } } return graph; } /** - * Find the Lowest Common Ancestor of two cells. - * - * @param c1 First cell - * @param c2 Second cell - * @return The LCA cell or null - */ - private mxCell getLCA(mxCell c1, mxCell c2) { - List path0 = getPathToRoot(c1); - List path1 = getPathToRoot(c2); - for (mxCell path : path0) { - if (path1.contains(path)) return path; - } - return null; - } - - /** - * Get the path from the cell to the layer root. - * - * @param cell The start cell - * @return List of cells in the path - */ - private List getPathToRoot(mxCell cell) { - List path = new ArrayList<>(); - while (cell != null) { - path.add(cell); - if (cell.getParent() == graph.getDefaultParent()) break; - cell = (mxCell) cell.getParent(); - } - return path; - } - - /** * Retrieves the call graph associated with the specified control flow layer. * * @param layer The layer identifier. It determines whether to retrieve the PUSH or PULL call graph.