diff --git a/executablecode/Makefile.src b/executablecode/Makefile.src index 164fead3d37bfd02e8a604f83e92744ac0f8a53c..68a402ef14c63d174ace5b24c57983139b5690df 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 7e4b5c5bf0e6cee6b583e65789d49eb8bbf9fb7c..4be3fa7797271e8fa7f7cfdc9cd45687b6474b2e 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 aec899baabf20d48805a1166444d143ca327aee9..df2152490d8bd1136eb0f5f666fcb501530d0f04 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 789d9e4f7dc18807099167a080cc9e5bf7ab9c0a..149d886210efea4147665d423d245c957ae952dd 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 47a56e093ccae32d0f21b3e71cb6b2da5d09aa56..de24a4a4c45c2a49ed0fdf0cdc410e871f096cf2 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 c056b47236649b5debfe710b78b24298034920dc..cd8e9f2d8cbf055ab20d43e1892558c7e5795ed6 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 07c230f6edc13db049c6dddb61d1ff994c1463db..a5e6ca989b0dea8909d46651cc8abd916ab9b97a 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 45da7a2d6c3cea10da6cde77e9d4b5d41bd62f4c..f7bdc9557a9a7e4e302ccf6cec0cd8afe970e388 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 6c5cb3b2ddccbdc1496f81dcb125eaed54f786b6..79908b115bb580cbe48062b594a5bce2fc491f8e 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 e83b8d2db49c8ca4b2be5cb0ff28ac5b838cdf6c..c5b99a6b7e78aab76cdb5e3044e6ba1b677118ba 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;