From 3d451420ca8ce9124db44bc6b3670d6444c665ff Mon Sep 17 00:00:00 2001 From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr> Date: Mon, 1 Sep 2014 15:03:40 +0000 Subject: [PATCH] Adding Avatar methodology --- executablecode/Makefile.src | 2 +- src/ui/AvatarMethodologyPanel.java | 59 +++++++++++++++---- .../AvatarMethodologyDiagramName.java | 4 +- .../AvatarMethodologyDiagramReference.java | 4 +- .../AvatarMethodologyReferenceToAnalysis.java | 7 ++- ...atarMethodologyReferenceToAssumptions.java | 4 +- .../AvatarMethodologyReferenceToDesign.java | 56 ++++++++++++++++-- ...vatarMethodologyReferenceToProperties.java | 6 +- ...AvatarMethodologyReferenceToPrototype.java | 25 ++++++-- ...atarMethodologyReferenceToRequirement.java | 8 ++- 10 files changed, 138 insertions(+), 37 deletions(-) diff --git a/executablecode/Makefile.src b/executablecode/Makefile.src index 164fead3d3..68a402ef14 100755 --- a/executablecode/Makefile.src +++ b/executablecode/Makefile.src @@ -1 +1 @@ -SRCS = generated_src/main.c generated_src/MicroWaveOven.c generated_src/Bell.c generated_src/ControlPanel.c generated_src/Controller.c generated_src/Magnetron.c generated_src/Door.c \ No newline at end of file +SRCS = generated_src/main.c generated_src/B2.c generated_src/B1.c generated_src/B0.c \ No newline at end of file diff --git a/src/ui/AvatarMethodologyPanel.java b/src/ui/AvatarMethodologyPanel.java index 7e4b5c5bf0..4be3fa7797 100755 --- a/src/ui/AvatarMethodologyPanel.java +++ b/src/ui/AvatarMethodologyPanel.java @@ -80,30 +80,69 @@ public class AvatarMethodologyPanel extends TURTLEPanel { public void initElements() { TGComponent tgc1 = dmd.addComponent(150, 100, TGComponentManager.AVATARMETHODOLOGY_REF_ASSUMPTIONS, false); TGComponent tgc2 = dmd.addComponent(250, 200, TGComponentManager.AVATARMETHODOLOGY_REF_REQUIREMENT, false); - TGComponent tgc3 = dmd.addComponent(350, 300, TGComponentManager.AVATARMETHODOLOGY_REF_ANALYSIS, false); + TGComponent tgc3 = dmd.addComponent(350, 300, TGComponentManager.AVATARMETHODOLOGY_REF_ANALYSIS, false); + TGComponent tgc4 = dmd.addComponent(450, 400, TGComponentManager.AVATARMETHODOLOGY_REF_DESIGN, false); + TGComponent tgc5 = dmd.addComponent(550, 500, TGComponentManager.AVATARMETHODOLOGY_REF_PROTOTYPE, false); + TGComponent tgc6 = dmd.addComponent(200, 400, TGComponentManager.AVATARMETHODOLOGY_REF_PROPERTIES, false); + //Connectors - // App -> mapping - /*TGConnectingPoint p1, p2; + // Assumptions -> reqs + TGConnectingPoint p1, p2; p1 = tgc1.getTGConnectingPointAtIndex(0); - p2 = tgc3.getTGConnectingPointAtIndex(0); + p2 = tgc2.getTGConnectingPointAtIndex(0); Vector listPoint = new Vector(); - TGConnector tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.DIPLODOCUSMETHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); + Point p = new Point(210, 235); + listPoint.add(p); + TGConnector tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.AVATARMETHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); p1.setFree(false); p2.setFree(false); dmd.getComponentList().add(0, tgco); - // Archi -> mapping - p1 = tgc2.getTGConnectingPointAtIndex(0); - p2 = tgc3.getTGConnectingPointAtIndex(1); + // Reqs -> Analysis + p1 = tgc2.getTGConnectingPointAtIndex(1); + p2 = tgc3.getTGConnectingPointAtIndex(0); listPoint = new Vector(); - tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.DIPLODOCUSMETHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); + p = new Point(310, 335); + listPoint.add(p); + tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.AVATARMETHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); + p1.setFree(false); + p2.setFree(false); + dmd.getComponentList().add(0, tgco); + + // Analysis -> Design + p1 = tgc3.getTGConnectingPointAtIndex(1); + p2 = tgc4.getTGConnectingPointAtIndex(0); + listPoint = new Vector(); + p = new Point(410, 435); + listPoint.add(p); + tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.AVATARMETHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); + p1.setFree(false); + p2.setFree(false); + dmd.getComponentList().add(0, tgco); + + // Design -> Prototyping + p1 = tgc4.getTGConnectingPointAtIndex(1); + p2 = tgc5.getTGConnectingPointAtIndex(0); + listPoint = new Vector(); + p = new Point(510, 535); + listPoint.add(p); + tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.AVATARMETHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); + p1.setFree(false); + p2.setFree(false); + dmd.getComponentList().add(0, tgco); + + // Reqs -> Prop + p1 = tgc2.getTGConnectingPointAtIndex(2); + p2 = tgc6.getTGConnectingPointAtIndex(0); + listPoint = new Vector(); + tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.AVATARMETHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); p1.setFree(false); p2.setFree(false); dmd.getComponentList().add(0, tgco); - dmd.addComponent(50, 150, TGComponentManager.DIPLODODUSMETHODOLOGY_REF_REQUIREMENT, false);*/ + } public void init() { diff --git a/src/ui/avatarmethodology/AvatarMethodologyDiagramName.java b/src/ui/avatarmethodology/AvatarMethodologyDiagramName.java index aec899baab..df2152490d 100755 --- a/src/ui/avatarmethodology/AvatarMethodologyDiagramName.java +++ b/src/ui/avatarmethodology/AvatarMethodologyDiagramName.java @@ -70,7 +70,7 @@ public class AvatarMethodologyDiagramName extends TGCScalableWithoutInternalComp protected final String[] SHORT_ACTION_NAMES = { "simu", "upp", "proverif", "inv", - "proto"}; + "code-gen"}; protected final String[] LONG_ACTION_NAMES = { /*0*/ "Simulation and animate the model", @@ -206,7 +206,7 @@ public class AvatarMethodologyDiagramName extends TGCScalableWithoutInternalComp } if (onMe) - g.drawRect(x-2, y-12, myWidth+4, 15); + g.drawRect(x-2, y-12, myWidth+6, 15); return; diff --git a/src/ui/avatarmethodology/AvatarMethodologyDiagramReference.java b/src/ui/avatarmethodology/AvatarMethodologyDiagramReference.java index 789d9e4f7d..149d886210 100755 --- a/src/ui/avatarmethodology/AvatarMethodologyDiagramReference.java +++ b/src/ui/avatarmethodology/AvatarMethodologyDiagramReference.java @@ -80,14 +80,14 @@ public abstract class AvatarMethodologyDiagramReference extends TGCScalableWithI protected int typeOfReference; protected final static String[] TYPE_STR = {"Assumptions", "Requirements", "Analysis", "Design", "Properties", "Prototyping"}; - protected final static int NB_TYPE = 3; + protected final static int NB_TYPE = 6; protected final static int ASSUMPTIONS = 0; protected final static int REQUIREMENT = 1; protected final static int ANALYSIS = 2; protected final static int DESIGN = 3; protected final static int PROPERTY = 4; - protected final static int PROTOTYPING = 4; + protected final static int PROTOTYPING = 5; protected JMenuItem diagramReference; diff --git a/src/ui/avatarmethodology/AvatarMethodologyReferenceToAnalysis.java b/src/ui/avatarmethodology/AvatarMethodologyReferenceToAnalysis.java index 47a56e093c..de24a4a4c4 100755 --- a/src/ui/avatarmethodology/AvatarMethodologyReferenceToAnalysis.java +++ b/src/ui/avatarmethodology/AvatarMethodologyReferenceToAnalysis.java @@ -64,11 +64,12 @@ public class AvatarMethodologyReferenceToAnalysis extends AvatarMethodologyDiagr public AvatarMethodologyReferenceToAnalysis(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); - initScaling(200, 120); + initScaling(200, 70); - nbConnectingPoint = 1; + nbConnectingPoint = 2; connectingPoint = new TGConnectingPoint[nbConnectingPoint]; - connectingPoint[0] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.5, 1.0, TGConnectingPoint.WEST); + connectingPoint[0] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.0, 0.5, TGConnectingPoint.WEST); + connectingPoint[1] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.3, 1.0, TGConnectingPoint.WEST); typeOfReference = ANALYSIS; diff --git a/src/ui/avatarmethodology/AvatarMethodologyReferenceToAssumptions.java b/src/ui/avatarmethodology/AvatarMethodologyReferenceToAssumptions.java index c056b47236..cd8e9f2d8c 100755 --- a/src/ui/avatarmethodology/AvatarMethodologyReferenceToAssumptions.java +++ b/src/ui/avatarmethodology/AvatarMethodologyReferenceToAssumptions.java @@ -64,11 +64,11 @@ public class AvatarMethodologyReferenceToAssumptions extends AvatarMethodologyDi public AvatarMethodologyReferenceToAssumptions(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); - initScaling(200, 120); + initScaling(200, 70); nbConnectingPoint = 1; connectingPoint = new TGConnectingPoint[nbConnectingPoint]; - connectingPoint[0] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.5, 1.0, TGConnectingPoint.WEST); + connectingPoint[0] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.30, 1.0, TGConnectingPoint.WEST); typeOfReference = ASSUMPTIONS; diff --git a/src/ui/avatarmethodology/AvatarMethodologyReferenceToDesign.java b/src/ui/avatarmethodology/AvatarMethodologyReferenceToDesign.java index 07c230f6ed..a5e6ca989b 100755 --- a/src/ui/avatarmethodology/AvatarMethodologyReferenceToDesign.java +++ b/src/ui/avatarmethodology/AvatarMethodologyReferenceToDesign.java @@ -64,13 +64,14 @@ public class AvatarMethodologyReferenceToDesign extends AvatarMethodologyDiagram public AvatarMethodologyReferenceToDesign(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); - initScaling(200, 120); + initScaling(300, 70); - nbConnectingPoint = 1; + nbConnectingPoint = 2; connectingPoint = new TGConnectingPoint[nbConnectingPoint]; - connectingPoint[0] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.5, 1.0, TGConnectingPoint.WEST); + connectingPoint[0] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.0, 0.5, TGConnectingPoint.WEST); + connectingPoint[1] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.20, 1.0, TGConnectingPoint.WEST); - typeOfReference = PROTOTYPING; + typeOfReference = DESIGN; addTGConnectingPointsCommentTop(); @@ -81,7 +82,7 @@ public class AvatarMethodologyReferenceToDesign extends AvatarMethodologyDiagram } public boolean isAValidPanelType(TURTLEPanel panel) { - if (panel instanceof AvatarRequirementPanel) { + if (panel instanceof AvatarDesignPanel) { return true; } @@ -97,7 +98,50 @@ public class AvatarMethodologyReferenceToDesign extends AvatarMethodologyDiagram } public boolean makeCall(String diagramName, int index) { - return true; + String tmp; + + switch(index) { + case 0: + if (!openDiagram(diagramName)) { + return false; + } + if (tdp.getMGUI().checkModelingSyntax(diagramName, true)) { + tdp.getMGUI().avatarSimulation(); + return true; + } + return false; + case 1: + if (!openDiagram(diagramName)) { + return false; + } + if (tdp.getMGUI().checkModelingSyntax(diagramName, true)) { + tdp.getMGUI().avatarUPPAALVerification(); + return true; + } + return false; + case 2: + if (!openDiagram(diagramName)) { + return false; + } + if (tdp.getMGUI().checkModelingSyntax(diagramName, true)) { + tdp.getMGUI().avatarProVerifVerification(); + return true; + } + return false; + case 3: + if (!openDiagram(diagramName)) { + return false; + } + if (tdp.getMGUI().checkModelingSyntax(diagramName, true)) { + tdp.getMGUI().avatarStaticAnalysis(); + return true; + } + return false; + + default: + return false; + } + } } diff --git a/src/ui/avatarmethodology/AvatarMethodologyReferenceToProperties.java b/src/ui/avatarmethodology/AvatarMethodologyReferenceToProperties.java index 45da7a2d6c..f7bdc9557a 100755 --- a/src/ui/avatarmethodology/AvatarMethodologyReferenceToProperties.java +++ b/src/ui/avatarmethodology/AvatarMethodologyReferenceToProperties.java @@ -64,13 +64,13 @@ public class AvatarMethodologyReferenceToProperties extends AvatarMethodologyDia public AvatarMethodologyReferenceToProperties(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); - initScaling(200, 120); + initScaling(180, 70); nbConnectingPoint = 1; connectingPoint = new TGConnectingPoint[nbConnectingPoint]; - connectingPoint[0] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.5, 1.0, TGConnectingPoint.WEST); + connectingPoint[0] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.2, 0.0, TGConnectingPoint.WEST); - typeOfReference = REQUIREMENT; + typeOfReference = PROPERTY; addTGConnectingPointsCommentTop(); diff --git a/src/ui/avatarmethodology/AvatarMethodologyReferenceToPrototype.java b/src/ui/avatarmethodology/AvatarMethodologyReferenceToPrototype.java index 6c5cb3b2dd..79908b115b 100755 --- a/src/ui/avatarmethodology/AvatarMethodologyReferenceToPrototype.java +++ b/src/ui/avatarmethodology/AvatarMethodologyReferenceToPrototype.java @@ -64,11 +64,11 @@ public class AvatarMethodologyReferenceToPrototype extends AvatarMethodologyDiag public AvatarMethodologyReferenceToPrototype(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); - initScaling(200, 120); + initScaling(300, 70); nbConnectingPoint = 1; connectingPoint = new TGConnectingPoint[nbConnectingPoint]; - connectingPoint[0] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.5, 1.0, TGConnectingPoint.WEST); + connectingPoint[0] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.0, 0.5, TGConnectingPoint.WEST); typeOfReference = PROTOTYPING; @@ -81,7 +81,7 @@ public class AvatarMethodologyReferenceToPrototype extends AvatarMethodologyDiag } public boolean isAValidPanelType(TURTLEPanel panel) { - if (panel instanceof AvatarRequirementPanel) { + if (panel instanceof AvatarDesignPanel) { return true; } @@ -89,11 +89,26 @@ public class AvatarMethodologyReferenceToPrototype extends AvatarMethodologyDiag } public void makeValidationInfos(AvatarMethodologyDiagramName dn) { - dn.setValidationsNumber(0); + dn.setValidationsNumber(1); + + dn.setValidationsInfo(0, AvatarMethodologyDiagramName.PROTO); } public boolean makeCall(String diagramName, int index) { - return true; + switch(index) { + case 0: + if (!openDiagram(diagramName)) { + return false; + } + if (tdp.getMGUI().checkModelingSyntax(diagramName, true)) { + tdp.getMGUI().avatarExecutableCodeGeneration(); + return true; + } + return false; + default: + return false; + } + } } diff --git a/src/ui/avatarmethodology/AvatarMethodologyReferenceToRequirement.java b/src/ui/avatarmethodology/AvatarMethodologyReferenceToRequirement.java index e83b8d2db4..c5b99a6b7e 100755 --- a/src/ui/avatarmethodology/AvatarMethodologyReferenceToRequirement.java +++ b/src/ui/avatarmethodology/AvatarMethodologyReferenceToRequirement.java @@ -64,11 +64,13 @@ public class AvatarMethodologyReferenceToRequirement extends AvatarMethodologyDi public AvatarMethodologyReferenceToRequirement(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); - initScaling(200, 120); + initScaling(200, 70); - nbConnectingPoint = 1; + nbConnectingPoint = 3; connectingPoint = new TGConnectingPoint[nbConnectingPoint]; - connectingPoint[0] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.5, 1.0, TGConnectingPoint.WEST); + connectingPoint[0] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.0, 0.5, TGConnectingPoint.WEST); + connectingPoint[1] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.3, 1.0, TGConnectingPoint.WEST); + connectingPoint[2] = new AvatarMethodologyConnectingPoint(this, 0, 0, false, true, 0.1, 1.0, TGConnectingPoint.WEST); typeOfReference = REQUIREMENT; -- GitLab