diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java index d947583..3ea8a48 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java @@ -381,12 +381,12 @@ for (ResourceNode resNode: dataFlowGraph.getRootResourceNodes()) { int w = 80; int h = 30; - ResourcePath res = resNode.getOutSideResources().iterator().next(); + ResourcePath res = resNode.getPrimaryResourcePath(); Object resource = graph.insertVertex(parent, null, res.getResourceName(), 20, 20, w, h, "shape=ellipse;perimeter=ellipsePerimeter"); // insert a resource as a vertex resources.put(resNode, resource); - getChildResource(resource, resNode, resources, w, h); + createChildResourceVerticies(resource, resNode, resources, w, h); } // create channel vertices @@ -426,7 +426,7 @@ } else { // I/O channel if (channelsOut.get(channel) == null) { - if(channel.getSelectors().toString() == "[]") { + if (channel.getSelectors().toString() == "[]") { Object chCell = graph.insertVertex(parent, null, channel.getChannelName(), 150, 20, 30, 30); // insert a channel as a vertex mxCell port_in = new mxCell(null, geo1, "shape=ellipse;perimter=ellipsePerimeter"); port_in.setVertex(true); @@ -436,8 +436,7 @@ graph.addCell(port_out, chCell); // insert the output port of a channel channelsIn.put(channel, port_in); channelsOut.put(channel, port_out); - }else { - + } else { for (Selector s: channel.getSelectors()) { Expression exp = s.getExpression(); String selName = exp.toString(); @@ -464,7 +463,7 @@ if (dfEdge.isChannelToResource()) { // output edge DataTransferChannel channel = ((ChannelNode) dfEdge.getSource()).getChannel(); - ResourcePath dstRes = ((ResourceNode) dfEdge.getDestination()).getOutSideResource(channel); + ResourcePath dstRes = ((ResourceNode) dfEdge.getDestination()).getInSideResource(channel); graph.insertEdge(parent, null, new SrcDstAttribute(channel, dstRes), channelsOut.get(channel), resources.get((ResourceNode) dfEdge.getDestination()), "movable=false"); } else { // input edge @@ -497,15 +496,15 @@ return graph; } - public void getChildResource(Object resource, ResourceNode resNode, Map resources, int w, int h) { + public void createChildResourceVerticies(Object resource, ResourceNode resNode, Map resources, int w, int h) { - for (ResourceNode c: resNode.getChildren()) { - ResourcePath chRes = c.getOutSideResources().iterator().next(); - Object chResource = graph.insertVertex(resource, null, - chRes.getName(), 0, 0, w, h, + for (ResourceNode childNode: resNode.getChildren()) { + ResourcePath childRes = childNode.getPrimaryResourcePath(); + Object childResource = graph.insertVertex(resource, null, + childRes.getName(), 0, 0, w, h, "shape=ellipse;perimeter=ellipsePerimeter"); // insert a resource as a vertex - resources.put(c, chResource); - getChildResource(chResource, c, resources, w, h); + resources.put(childNode, childResource); + createChildResourceVerticies(childResource, childNode, resources, w, h); } } @@ -536,7 +535,7 @@ mxCell edgeCell = (mxCell) edge; if (edgeCell.getValue() instanceof SrcDstAttribute) { SrcDstAttribute edgeAttr = (SrcDstAttribute) edgeCell.getValue(); - if (srcRes.getOutSideResources().iterator().next().equals(edgeAttr.getSource()) && channel.equals(edgeAttr.getDestination())) { + if (srcRes.getPrimaryResourcePath().equals(edgeAttr.getSource()) && channel.equals(edgeAttr.getDestination())) { edgeCell.setValue(dataFlow.getAttribute()); break; } @@ -794,6 +793,9 @@ if (srcNode != null) { for (ChannelMember dstMem: dependency.get(srcMem).getValue()) { ResourceNode dstNode = dataFlowGraph.getResourceNode(dstMem.getResource()); + while (srcNode.getResourceHierarchy().getNumParameters() == 0 && srcNode.getParent() != null) { + srcNode = srcNode.getParent(); + } resourceDpendency.add(new AbstractMap.SimpleEntry<>(srcNode, dstNode)); } }