diff --git a/src/tmltranslator/TMLCP.java b/src/tmltranslator/TMLCP.java index 02dd44cf3d74a5a4d7c0f14924fb2651e4aa753b..7051c2c3e77c0ca1c13b74cd41ca88d6d82fcc4c 100755 --- a/src/tmltranslator/TMLCP.java +++ b/src/tmltranslator/TMLCP.java @@ -326,6 +326,14 @@ public class TMLCP extends TMLElement { } } + public void splitADs() { + ArrayList<TMLCPActivityDiagram> all = new ArrayList<TMLCPActivityDiagram>(); + all.addAll(mainCP.splitADs()); + for(TMLCPActivityDiagram diag: otherCPs) { + all.addAll(diag.splitADs()); + } + } + public void printDataStructure() { ArrayList<TMLCPActivityDiagram> CPlist = new ArrayList<TMLCPActivityDiagram>(); diff --git a/src/tmltranslator/tmlcp/TMLCPActivityDiagram.java b/src/tmltranslator/tmlcp/TMLCPActivityDiagram.java index 2712d54cf00607b826a2125bb90241ba2494cd1f..4cf7b52d41ccc1c8d21fbe1707c49e587d52b0f2 100755 --- a/src/tmltranslator/tmlcp/TMLCPActivityDiagram.java +++ b/src/tmltranslator/tmlcp/TMLCPActivityDiagram.java @@ -285,4 +285,29 @@ public class TMLCPActivityDiagram extends TMLElement { } } + // The splitting works only if there is no other operations than sequences and references to ADs/SDs + // between forks and joins + // The function removes junctions, and creates one new AD per junction + public Collection<TMLCPActivityDiagram> splitADs() { + int id = 0; + // For each junction, we create a new AD + ArrayList<TMLCPJunction> junctions = new ArrayList<TMLCPJunction>(); + HashMap<TMLCPJunction, TMLCPActivityDiagram> refs = new HashMap<TMLCPJunction, TMLCPActivityDiagram>(); + + for(TMLCPElement elt: elements) { + if (elt instanceof TMLCPJunction) { + junctions.add((TMLCPJunction)elt); + TMLCPActivityDiagram diag = new TMLCPActivityDiagram(getName() + "_" + id, referenceObject); + refs.put((TMLCPJunction)elt, diag); + } + } + + // Updating references to junctions + + + // Returns new elements + return refs.values(); + + } + } //End of class diff --git a/src/ui/GTMLModeling.java b/src/ui/GTMLModeling.java index 24d1149f330ff653433c0440b22f72f4aa278d70..bf0c41ea6250c58e78c1999180df63405ff9c3d8 100755 --- a/src/ui/GTMLModeling.java +++ b/src/ui/GTMLModeling.java @@ -1954,6 +1954,11 @@ public class GTMLModeling { //makeCPMapping(); //Inspect the architecture Deployment Diagram to retrieve mapping information, that is now located in one //place only: the architecture DD + // Syntax has been checked -> splitting ads + // The splitting works only if there is no other operations than sequences and references to ADs/SDs + // between forks and joins + tmlcp.splitADs(); + TraceManager.addDev("<--- TMLCP modeling:"); TraceManager.addDev("TMLCP: " + tmlcp.toString()); TraceManager.addDev("End of TMLCP modeling --->"); @@ -2199,7 +2204,7 @@ public class GTMLModeling { tmlcp.correctReferences(); tmlcp.generateNexts(); tmlcp.removeADConnectors(); - //tmlcp.splitADs(); + } //End of method