From 004d58fdd869d94c20753994da70c939cb36918f Mon Sep 17 00:00:00 2001 From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr> Date: Thu, 6 Nov 2014 15:14:59 +0000 Subject: [PATCH] Update on Makefile and splitting --- src/tmltranslator/TMLCP.java | 8 ++++++ .../tmlcp/TMLCPActivityDiagram.java | 25 +++++++++++++++++++ src/ui/GTMLModeling.java | 7 +++++- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/tmltranslator/TMLCP.java b/src/tmltranslator/TMLCP.java index 02dd44cf3d..7051c2c3e7 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 2712d54cf0..4cf7b52d41 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 24d1149f33..bf0c41ea62 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 -- GitLab