diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java index a3d2687..08739af 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java @@ -375,7 +375,7 @@ Map channelsIn = new HashMap<>(); Map channelsOut = new HashMap<>(); - Map resources = new HashMap<>(); + Map resources = new HashMap<>(); // create channel vertices for (ChannelNode c: dataFlowGraph.getRootChannelNodes()) { @@ -455,7 +455,7 @@ Object resource = graph.insertVertex(parent, null, res.getResourceName(), 20, 20, w, h, "shape=ellipse;perimeter=ellipsePerimeter"); // insert a resource as a vertex - resources.put(res, resource); + resources.put(System.identityHashCode(res), resource); getChildResource(resource, resNode, resources, w, h); } @@ -466,7 +466,7 @@ // output edge DataTransferChannel channel = ((ChannelNode) dfEdge.getSource()).getChannel(); ResourcePath dstRes = ((ResourceNode) dfEdge.getDestination()).getOutSideResource(); - graph.insertEdge(parent, null, new SrcDstAttribute(channel, dstRes), channelsOut.get(channel), resources.get(dstRes), "movable=false"); + graph.insertEdge(parent, null, new SrcDstAttribute(channel, dstRes), channelsOut.get(channel), resources.get(System.identityHashCode(dstRes)), "movable=false"); } else { // input edge ResourcePath srcRes = ((ResourceNode) dfEdge.getSource()).getOutSideResource(); @@ -474,10 +474,11 @@ Set> toRes = getResourceDependencyForChannel(channel, model, dataFlowGraph); for(Map.Entry RtoR : toRes) { graph.insertEdge(parent, null, null, - resources.get(RtoR.getValue().getOutSideResource()), resources.get(RtoR.getKey().getOutSideResource()), "dashed=true;movable=false"); + resources.get(System.identityHashCode(RtoR.getValue().getOutSideResource())), + resources.get(System.identityHashCode(RtoR.getKey().getOutSideResource())), "dashed=true;movable=false"); } - graph.insertEdge(parent, null, new SrcDstAttribute(srcRes, channel), resources.get(srcRes), channelsIn.get(channel), "movable=false"); + graph.insertEdge(parent, null, new SrcDstAttribute(srcRes, channel), resources.get(System.identityHashCode(srcRes)), channelsIn.get(channel), "movable=false"); } } @@ -485,19 +486,19 @@ // reference edges DataTransferChannel channel = (DataTransferChannel) ch; for (ResourcePath refRes: channel.getReferenceResources()) { - graph.insertEdge(parent, null, null, resources.get(refRes), channelsIn.get(channel), "dashed=true;movable=false"); + graph.insertEdge(parent, null, null, resources.get(System.identityHashCode(refRes)), channelsIn.get(channel), "dashed=true;movable=false"); } } } finally { graph.getModel().endUpdate(); } -// setTreeLayout(); + setDAGLayout(); bReflectingArchitectureModel = false; return graph; } - public void getChildResource(Object resource, ResourceNode resNode, Map resources, int w, int h) { + public void getChildResource(Object resource, ResourceNode resNode, Map resources, int w, int h) { for (ResourceNode c: resNode.getChildren()) { // w = w - 100; @@ -509,7 +510,7 @@ Object chResource = graph.insertVertex(resource, null, chRes.getName(), 0, 0, w, h, "shape=ellipse;perimeter=ellipsePerimeter"); // insert a resource as a vertex - resources.put(chRes, chResource); + resources.put(System.identityHashCode(chRes), chResource); getChildResource(chResource, c, resources, w, h); } } @@ -796,9 +797,11 @@ Map>> dependency = ch.fillOutsideResourcePaths(ch.getOutputChannelMembers().iterator().next(), JavaCodeGenerator.pullAccessor); for (ChannelMember srcMem: dependency.keySet()) { ResourceNode srcNode = dataFlowGraph.getResourceNode(srcMem.getResource()); - for (ChannelMember dstMem: dependency.get(srcMem).getValue()) { - ResourceNode dstNode = dataFlowGraph.getResourceNode(dstMem.getResource()); - resourceDpendency.add(new AbstractMap.SimpleEntry<>(srcNode, dstNode)); + if (srcNode != null) { + for (ChannelMember dstMem: dependency.get(srcMem).getValue()) { + ResourceNode dstNode = dataFlowGraph.getResourceNode(dstMem.getResource()); + resourceDpendency.add(new AbstractMap.SimpleEntry<>(srcNode, dstNode)); + } } } } catch (ParameterizedIdentifierIsFutureWork | ResolvingMultipleDefinitionIsFutureWork | InvalidMessage