From c3399d8b0d19007687680885c9ef0f6d758f77ca Mon Sep 17 00:00:00 2001 From: Stefano Puri <stefano.puri@intecs.it> Date: Wed, 25 Mar 2020 17:48:59 +0100 Subject: [PATCH] Update SAN model and QVT transformation Moved child properties from Rep and Join to CompositeNode. The QVT-O transformation now considers 1-1 decomposition. Mapping of shared variables has been improved. Signed-off-by: Stefano Puri <stefano.puri@intecs.it> --- .../CreateComposedNode_child_AtomicNode.gif | Bin 0 -> 223 bytes .../ctool16/CreateComposedNode_child_Join.gif | Bin 0 -> 223 bytes .../ctool16/CreateComposedNode_child_Rep.gif | Bin 0 -> 223 bytes .../plugin.properties | 1 + .../provider/ComposedNodeItemProvider.java | 17 +++ .../model/SAN/provider/JoinItemProvider.java | 58 --------- .../model/SAN/provider/RepItemProvider.java | 52 -------- .../model/SAN.ecore | 9 +- .../model/SAN.genmodel | 6 +- .../chess/mobius/model/SAN/ComposedNode.java | 17 +++ .../polarsys/chess/mobius/model/SAN/Join.java | 23 ---- .../polarsys/chess/mobius/model/SAN/Rep.java | 27 ---- .../mobius/model/SAN/SANModelPackage.java | 80 +++++------- .../model/SAN/impl/ComposedNodeImpl.java | 37 ++++++ .../chess/mobius/model/SAN/impl/JoinImpl.java | 114 ----------------- .../chess/mobius/model/SAN/impl/RepImpl.java | 84 ------------ .../mobius/model/SAN/impl/SANModelImpl.java | 2 +- .../model/SAN/impl/SANModelPackageImpl.java | 35 ++--- .../AtomicComponentTemplate_sanmodel.java | 3 + .../ComposedComponentTemplate_sanmodel.java | 3 + .../ProjectFileTemplate_sanmodel.java | 3 + .../composedComponentTemplate_sanmodel.mtl | 10 +- .../tasks/atomicComponentTemplate.xml | 4 +- .../atomicComponentTemplate_sanmodel.xml | 4 +- .../tasks/attackScenarioTemplate.xml | 4 +- .../tasks/composedComponentTemplate.xml | 4 +- .../composedComponentTemplate_sanmodel.xml | 4 +- .../tasks/projectFileTemplate.xml | 4 +- .../tasks/projectFileTemplate_sanmodel.xml | 4 +- .../tasks/vulnerableComponentsTemplate.xml | 4 +- .../transformations/CHESS2SAN.qvto | 121 ++++++++++++------ 31 files changed, 241 insertions(+), 493 deletions(-) create mode 100644 plugins/mobius/org.polarsys.chess.mobius.model.edit/icons/full/ctool16/CreateComposedNode_child_AtomicNode.gif create mode 100644 plugins/mobius/org.polarsys.chess.mobius.model.edit/icons/full/ctool16/CreateComposedNode_child_Join.gif create mode 100644 plugins/mobius/org.polarsys.chess.mobius.model.edit/icons/full/ctool16/CreateComposedNode_child_Rep.gif diff --git a/plugins/mobius/org.polarsys.chess.mobius.model.edit/icons/full/ctool16/CreateComposedNode_child_AtomicNode.gif b/plugins/mobius/org.polarsys.chess.mobius.model.edit/icons/full/ctool16/CreateComposedNode_child_AtomicNode.gif new file mode 100644 index 0000000000000000000000000000000000000000..e02bf00af5bbcc870566eb3e5e82fba41b129db8 GIT binary patch literal 223 zcmZ?wbhEHb6krfwIKsg2|NsB{_xIb|$1^Z6G_AQ7+;hybc#TeE+yDRZ^W*LR-?wjQ zXgF}-z??aA92^cfI5_N@t_DO~Cn>M%l3&^+HLp@^W{L2>zwd$Q@8|PC^ym5F-*=mV zra^$>PZmZHO9w=N>||h#QBdehiL_H=n0fZ_lnYxY^*8rTD)BV_Y|?Wrdy=M@dcRb1 zrgNai?ByreMf$YnoI2@d#h{~h-`mAPAgE#Xi-Zr0PPQ{GOmLIG(Nc3eSL^i4^n8Y# Onx@porfgM325SH}7hj$L literal 0 HcmV?d00001 diff --git a/plugins/mobius/org.polarsys.chess.mobius.model.edit/icons/full/ctool16/CreateComposedNode_child_Join.gif b/plugins/mobius/org.polarsys.chess.mobius.model.edit/icons/full/ctool16/CreateComposedNode_child_Join.gif new file mode 100644 index 0000000000000000000000000000000000000000..0aa23c2e565e235d6dec3a421a64e8c32485dbf2 GIT binary patch literal 223 zcmZ?wbhEHb6krfwIKsg2|NsB{_xIb|$1^Z6eEsqJ=#4k?_usEvcIp5B`1$en|L@y3 zG&CGIaA3}yISvj792^{WO;-b=t&^13b;&PnlA2d3HnT+d-{1E@^!M|5Ao}xs@$b9M zK+_;V@h1x-h@}G}Kz1^)#waNCr9|4PG0Z%Bc*=#Xllq(cCY5*^e>Um4mOV*ROub(! zIny~%WA^eB>>_<yb55OfvtrOuyYKB{ArRCs`$fWsMJL;t7ACmK-)O11ovU^FWqLkC PPEAv4V^g-OB7-#m=mKLg literal 0 HcmV?d00001 diff --git a/plugins/mobius/org.polarsys.chess.mobius.model.edit/icons/full/ctool16/CreateComposedNode_child_Rep.gif b/plugins/mobius/org.polarsys.chess.mobius.model.edit/icons/full/ctool16/CreateComposedNode_child_Rep.gif new file mode 100644 index 0000000000000000000000000000000000000000..47209bab6d2c564148af5c8c3bf17d91e68d0f2a GIT binary patch literal 223 zcmZ?wbhEHb6krfwIKsg2|NsB{_xIb|$1^Z6?78%!XVcBJnP(gt4*dTgKR@37|9$(0 zhK2(N4$PS|$HC!%gM-7a>1sf<b&~SBF8QTRQu8XsW|j#5`}-b<{(e3WM1P(y{(ZL@ zXc`14{$ybUv2;KL$W8{<7zKsClt?=@hM8v%Pr0ylQh#&bq!Lf#&n7+BvL|VZsrO4I zXF3OJ%wB$iU8GNI&Z(1bRt!37_q|;#1cDl7zexD7=wv(7!UQ+@8!a`rbG1&tOwVV? PscA}WY|2(uWUvMRkuqUw literal 0 HcmV?d00001 diff --git a/plugins/mobius/org.polarsys.chess.mobius.model.edit/plugin.properties b/plugins/mobius/org.polarsys.chess.mobius.model.edit/plugin.properties index d84f8bb5e..812be579f 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model.edit/plugin.properties +++ b/plugins/mobius/org.polarsys.chess.mobius.model.edit/plugin.properties @@ -77,3 +77,4 @@ _UI_GraphicalElement_x_feature = X _UI_GraphicalElement_y_feature = Y _UI_Primitive_type = Primitive _UI_Node_globalVariable_feature = Global Variable +_UI_ComposedNode_child_feature = Child diff --git a/plugins/mobius/org.polarsys.chess.mobius.model.edit/src/org/polarsys/chess/mobius/model/SAN/provider/ComposedNodeItemProvider.java b/plugins/mobius/org.polarsys.chess.mobius.model.edit/src/org/polarsys/chess/mobius/model/SAN/provider/ComposedNodeItemProvider.java index 51c8d4d7e..274e6c4e8 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model.edit/src/org/polarsys/chess/mobius/model/SAN/provider/ComposedNodeItemProvider.java +++ b/plugins/mobius/org.polarsys.chess.mobius.model.edit/src/org/polarsys/chess/mobius/model/SAN/provider/ComposedNodeItemProvider.java @@ -63,6 +63,7 @@ public class ComposedNodeItemProvider extends NodeItemProvider { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(SANModelPackage.Literals.COMPOSED_NODE__STATE_VARIABLES); + childrenFeatures.add(SANModelPackage.Literals.COMPOSED_NODE__CHILD); } return childrenFeatures; } @@ -108,6 +109,7 @@ public class ComposedNodeItemProvider extends NodeItemProvider { switch (notification.getFeatureID(ComposedNode.class)) { case SANModelPackage.COMPOSED_NODE__STATE_VARIABLES: + case SANModelPackage.COMPOSED_NODE__CHILD: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } @@ -129,6 +131,21 @@ public class ComposedNodeItemProvider extends NodeItemProvider { (createChildParameter (SANModelPackage.Literals.COMPOSED_NODE__STATE_VARIABLES, SANModelFactory.eINSTANCE.createSharedState())); + + newChildDescriptors.add + (createChildParameter + (SANModelPackage.Literals.COMPOSED_NODE__CHILD, + SANModelFactory.eINSTANCE.createJoin())); + + newChildDescriptors.add + (createChildParameter + (SANModelPackage.Literals.COMPOSED_NODE__CHILD, + SANModelFactory.eINSTANCE.createRep())); + + newChildDescriptors.add + (createChildParameter + (SANModelPackage.Literals.COMPOSED_NODE__CHILD, + SANModelFactory.eINSTANCE.createAtomicNode())); } } diff --git a/plugins/mobius/org.polarsys.chess.mobius.model.edit/src/org/polarsys/chess/mobius/model/SAN/provider/JoinItemProvider.java b/plugins/mobius/org.polarsys.chess.mobius.model.edit/src/org/polarsys/chess/mobius/model/SAN/provider/JoinItemProvider.java index 79fa94bec..c03b0120e 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model.edit/src/org/polarsys/chess/mobius/model/SAN/provider/JoinItemProvider.java +++ b/plugins/mobius/org.polarsys.chess.mobius.model.edit/src/org/polarsys/chess/mobius/model/SAN/provider/JoinItemProvider.java @@ -8,15 +8,8 @@ import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EStructuralFeature; - import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ViewerNotification; - import org.polarsys.chess.mobius.model.SAN.Join; -import org.polarsys.chess.mobius.model.SAN.SANModelFactory; -import org.polarsys.chess.mobius.model.SAN.SANModelPackage; /** * This is the item provider adapter for a {@link org.polarsys.chess.mobius.model.SAN.Join} object. @@ -50,36 +43,6 @@ public class JoinItemProvider extends ComposedNodeItemProvider { return itemPropertyDescriptors; } - /** - * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an - * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or - * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { - if (childrenFeatures == null) { - super.getChildrenFeatures(object); - childrenFeatures.add(SANModelPackage.Literals.JOIN__CHILD); - } - return childrenFeatures; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EStructuralFeature getChildFeature(Object object, Object child) { - // Check the type of the specified child object and return the proper feature to use for - // adding (see {@link AddCommand}) it as a child. - - return super.getChildFeature(object, child); - } - /** * This returns Join.gif. * <!-- begin-user-doc --> @@ -116,12 +79,6 @@ public class JoinItemProvider extends ComposedNodeItemProvider { @Override public void notifyChanged(Notification notification) { updateChildren(notification); - - switch (notification.getFeatureID(Join.class)) { - case SANModelPackage.JOIN__CHILD: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); - return; - } super.notifyChanged(notification); } @@ -135,21 +92,6 @@ public class JoinItemProvider extends ComposedNodeItemProvider { @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add - (createChildParameter - (SANModelPackage.Literals.JOIN__CHILD, - SANModelFactory.eINSTANCE.createJoin())); - - newChildDescriptors.add - (createChildParameter - (SANModelPackage.Literals.JOIN__CHILD, - SANModelFactory.eINSTANCE.createRep())); - - newChildDescriptors.add - (createChildParameter - (SANModelPackage.Literals.JOIN__CHILD, - SANModelFactory.eINSTANCE.createAtomicNode())); } } diff --git a/plugins/mobius/org.polarsys.chess.mobius.model.edit/src/org/polarsys/chess/mobius/model/SAN/provider/RepItemProvider.java b/plugins/mobius/org.polarsys.chess.mobius.model.edit/src/org/polarsys/chess/mobius/model/SAN/provider/RepItemProvider.java index 35d0a9627..cbc92f2f7 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model.edit/src/org/polarsys/chess/mobius/model/SAN/provider/RepItemProvider.java +++ b/plugins/mobius/org.polarsys.chess.mobius.model.edit/src/org/polarsys/chess/mobius/model/SAN/provider/RepItemProvider.java @@ -8,16 +8,12 @@ import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EStructuralFeature; - import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ViewerNotification; import org.polarsys.chess.mobius.model.SAN.Rep; -import org.polarsys.chess.mobius.model.SAN.SANModelFactory; import org.polarsys.chess.mobius.model.SAN.SANModelPackage; /** @@ -75,36 +71,6 @@ public class RepItemProvider extends ComposedNodeItemProvider { null)); } - /** - * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an - * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or - * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { - if (childrenFeatures == null) { - super.getChildrenFeatures(object); - childrenFeatures.add(SANModelPackage.Literals.REP__CHILD); - } - return childrenFeatures; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EStructuralFeature getChildFeature(Object object, Object child) { - // Check the type of the specified child object and return the proper feature to use for - // adding (see {@link AddCommand}) it as a child. - - return super.getChildFeature(object, child); - } - /** * This returns Rep.gif. * <!-- begin-user-doc --> @@ -146,9 +112,6 @@ public class RepItemProvider extends ComposedNodeItemProvider { case SANModelPackage.REP__NUMB_OF_REPS: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; - case SANModelPackage.REP__CHILD: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); - return; } super.notifyChanged(notification); } @@ -163,21 +126,6 @@ public class RepItemProvider extends ComposedNodeItemProvider { @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add - (createChildParameter - (SANModelPackage.Literals.REP__CHILD, - SANModelFactory.eINSTANCE.createJoin())); - - newChildDescriptors.add - (createChildParameter - (SANModelPackage.Literals.REP__CHILD, - SANModelFactory.eINSTANCE.createRep())); - - newChildDescriptors.add - (createChildParameter - (SANModelPackage.Literals.REP__CHILD, - SANModelFactory.eINSTANCE.createAtomicNode())); } } diff --git a/plugins/mobius/org.polarsys.chess.mobius.model/model/SAN.ecore b/plugins/mobius/org.polarsys.chess.mobius.model/model/SAN.ecore index cfe273418..be63e6cd8 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model/model/SAN.ecore +++ b/plugins/mobius/org.polarsys.chess.mobius.model/model/SAN.ecore @@ -25,6 +25,8 @@ <eClassifiers xsi:type="ecore:EClass" name="ComposedNode" abstract="true" eSuperTypes="#//Node"> <eStructuralFeatures xsi:type="ecore:EReference" name="stateVariables" upperBound="-1" eType="#//SharedState" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="child" lowerBound="2" upperBound="-1" + eType="#//Node" containment="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="SharedState" eSuperTypes="#//NamedElement"> <eStructuralFeatures xsi:type="ecore:EReference" name="place" upperBound="-1" @@ -32,13 +34,8 @@ <eStructuralFeatures xsi:type="ecore:EReference" name="sharedStates" upperBound="-1" eType="#//SharedState"/> </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Join" eSuperTypes="#//ComposedNode"> - <eStructuralFeatures xsi:type="ecore:EReference" name="child" lowerBound="2" upperBound="-1" - eType="#//Node" containment="true"/> - </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Join" eSuperTypes="#//ComposedNode"/> <eClassifiers xsi:type="ecore:EClass" name="Rep" eSuperTypes="#//ComposedNode"> - <eStructuralFeatures xsi:type="ecore:EReference" name="child" lowerBound="1" eType="#//Node" - containment="true"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="numbOfReps" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" defaultValueLiteral=""/> </eClassifiers> diff --git a/plugins/mobius/org.polarsys.chess.mobius.model/model/SAN.genmodel b/plugins/mobius/org.polarsys.chess.mobius.model/model/SAN.genmodel index 65dd9aaba..c0bedf006 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model/model/SAN.genmodel +++ b/plugins/mobius/org.polarsys.chess.mobius.model/model/SAN.genmodel @@ -23,16 +23,14 @@ </genClasses> <genClasses image="false" ecoreClass="SAN.ecore#//ComposedNode"> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference SAN.ecore#//ComposedNode/stateVariables"/> + <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference SAN.ecore#//ComposedNode/child"/> </genClasses> <genClasses ecoreClass="SAN.ecore#//SharedState"> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference SAN.ecore#//SharedState/place"/> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference SAN.ecore#//SharedState/sharedStates"/> </genClasses> - <genClasses ecoreClass="SAN.ecore#//Join"> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference SAN.ecore#//Join/child"/> - </genClasses> + <genClasses ecoreClass="SAN.ecore#//Join"/> <genClasses ecoreClass="SAN.ecore#//Rep"> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference SAN.ecore#//Rep/child"/> <genFeatures createChild="false" ecoreFeature="ecore:EAttribute SAN.ecore#//Rep/numbOfReps"/> </genClasses> <genClasses ecoreClass="SAN.ecore#//AtomicNode"> diff --git a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/ComposedNode.java b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/ComposedNode.java index 7c3f21b3e..3f922e6a9 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/ComposedNode.java +++ b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/ComposedNode.java @@ -14,6 +14,7 @@ import org.eclipse.emf.common.util.EList; * </p> * <ul> * <li>{@link org.polarsys.chess.mobius.model.SAN.ComposedNode#getStateVariables <em>State Variables</em>}</li> + * <li>{@link org.polarsys.chess.mobius.model.SAN.ComposedNode#getChild <em>Child</em>}</li> * </ul> * * @see org.polarsys.chess.mobius.model.SAN.SANModelPackage#getComposedNode() @@ -37,4 +38,20 @@ public interface ComposedNode extends Node { */ EList<SharedState> getStateVariables(); + /** + * Returns the value of the '<em><b>Child</b></em>' containment reference list. + * The list contents are of type {@link org.polarsys.chess.mobius.model.SAN.Node}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Child</em>' containment reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Child</em>' containment reference list. + * @see org.polarsys.chess.mobius.model.SAN.SANModelPackage#getComposedNode_Child() + * @model containment="true" lower="2" + * @generated + */ + EList<Node> getChild(); + } // ComposedNode diff --git a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/Join.java b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/Join.java index 44a03c2a7..f152317d1 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/Join.java +++ b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/Join.java @@ -2,39 +2,16 @@ */ package org.polarsys.chess.mobius.model.SAN; -import org.eclipse.emf.common.util.EList; - /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Join</b></em>'. * <!-- end-user-doc --> * - * <p> - * The following features are supported: - * </p> - * <ul> - * <li>{@link org.polarsys.chess.mobius.model.SAN.Join#getChild <em>Child</em>}</li> - * </ul> * * @see org.polarsys.chess.mobius.model.SAN.SANModelPackage#getJoin() * @model * @generated */ public interface Join extends ComposedNode { - /** - * Returns the value of the '<em><b>Child</b></em>' containment reference list. - * The list contents are of type {@link org.polarsys.chess.mobius.model.SAN.Node}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Child</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Child</em>' containment reference list. - * @see org.polarsys.chess.mobius.model.SAN.SANModelPackage#getJoin_Child() - * @model containment="true" lower="2" - * @generated - */ - EList<Node> getChild(); } // Join diff --git a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/Rep.java b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/Rep.java index a46df4993..30a6fee6b 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/Rep.java +++ b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/Rep.java @@ -12,7 +12,6 @@ package org.polarsys.chess.mobius.model.SAN; * The following features are supported: * </p> * <ul> - * <li>{@link org.polarsys.chess.mobius.model.SAN.Rep#getChild <em>Child</em>}</li> * <li>{@link org.polarsys.chess.mobius.model.SAN.Rep#getNumbOfReps <em>Numb Of Reps</em>}</li> * </ul> * @@ -21,32 +20,6 @@ package org.polarsys.chess.mobius.model.SAN; * @generated */ public interface Rep extends ComposedNode { - /** - * Returns the value of the '<em><b>Child</b></em>' containment reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Child</em>' containment reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Child</em>' containment reference. - * @see #setChild(Node) - * @see org.polarsys.chess.mobius.model.SAN.SANModelPackage#getRep_Child() - * @model containment="true" required="true" - * @generated - */ - Node getChild(); - - /** - * Sets the value of the '{@link org.polarsys.chess.mobius.model.SAN.Rep#getChild <em>Child</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Child</em>' containment reference. - * @see #getChild() - * @generated - */ - void setChild(Node value); - /** * Returns the value of the '<em><b>Numb Of Reps</b></em>' attribute. * The default value is <code>""</code>. diff --git a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/SANModelPackage.java b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/SANModelPackage.java index 37eba0345..c3a73d7f7 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/SANModelPackage.java +++ b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/SANModelPackage.java @@ -377,6 +377,15 @@ public interface SANModelPackage extends EPackage { */ int COMPOSED_NODE__STATE_VARIABLES = NODE_FEATURE_COUNT + 0; + /** + * The feature id for the '<em><b>Child</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int COMPOSED_NODE__CHILD = NODE_FEATURE_COUNT + 1; + /** * The number of structural features of the '<em>Composed Node</em>' class. * <!-- begin-user-doc --> @@ -384,7 +393,7 @@ public interface SANModelPackage extends EPackage { * @generated * @ordered */ - int COMPOSED_NODE_FEATURE_COUNT = NODE_FEATURE_COUNT + 1; + int COMPOSED_NODE_FEATURE_COUNT = NODE_FEATURE_COUNT + 2; /** * The operation id for the '<em>Validate</em>' operation. @@ -548,7 +557,7 @@ public interface SANModelPackage extends EPackage { * @generated * @ordered */ - int JOIN__CHILD = COMPOSED_NODE_FEATURE_COUNT + 0; + int JOIN__CHILD = COMPOSED_NODE__CHILD; /** * The number of structural features of the '<em>Join</em>' class. @@ -557,7 +566,7 @@ public interface SANModelPackage extends EPackage { * @generated * @ordered */ - int JOIN_FEATURE_COUNT = COMPOSED_NODE_FEATURE_COUNT + 1; + int JOIN_FEATURE_COUNT = COMPOSED_NODE_FEATURE_COUNT + 0; /** * The operation id for the '<em>Validate</em>' operation. @@ -633,13 +642,13 @@ public interface SANModelPackage extends EPackage { int REP__STATE_VARIABLES = COMPOSED_NODE__STATE_VARIABLES; /** - * The feature id for the '<em><b>Child</b></em>' containment reference. + * The feature id for the '<em><b>Child</b></em>' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int REP__CHILD = COMPOSED_NODE_FEATURE_COUNT + 0; + int REP__CHILD = COMPOSED_NODE__CHILD; /** * The feature id for the '<em><b>Numb Of Reps</b></em>' attribute. @@ -648,7 +657,7 @@ public interface SANModelPackage extends EPackage { * @generated * @ordered */ - int REP__NUMB_OF_REPS = COMPOSED_NODE_FEATURE_COUNT + 1; + int REP__NUMB_OF_REPS = COMPOSED_NODE_FEATURE_COUNT + 0; /** * The number of structural features of the '<em>Rep</em>' class. @@ -657,7 +666,7 @@ public interface SANModelPackage extends EPackage { * @generated * @ordered */ - int REP_FEATURE_COUNT = COMPOSED_NODE_FEATURE_COUNT + 2; + int REP_FEATURE_COUNT = COMPOSED_NODE_FEATURE_COUNT + 1; /** * The operation id for the '<em>Validate</em>' operation. @@ -1785,6 +1794,17 @@ public interface SANModelPackage extends EPackage { */ EReference getComposedNode_StateVariables(); + /** + * Returns the meta object for the containment reference list '{@link org.polarsys.chess.mobius.model.SAN.ComposedNode#getChild <em>Child</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference list '<em>Child</em>'. + * @see org.polarsys.chess.mobius.model.SAN.ComposedNode#getChild() + * @see #getComposedNode() + * @generated + */ + EReference getComposedNode_Child(); + /** * Returns the meta object for class '{@link org.polarsys.chess.mobius.model.SAN.SharedState <em>Shared State</em>}'. * <!-- begin-user-doc --> @@ -1827,17 +1847,6 @@ public interface SANModelPackage extends EPackage { */ EClass getJoin(); - /** - * Returns the meta object for the containment reference list '{@link org.polarsys.chess.mobius.model.SAN.Join#getChild <em>Child</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Child</em>'. - * @see org.polarsys.chess.mobius.model.SAN.Join#getChild() - * @see #getJoin() - * @generated - */ - EReference getJoin_Child(); - /** * Returns the meta object for class '{@link org.polarsys.chess.mobius.model.SAN.Rep <em>Rep</em>}'. * <!-- begin-user-doc --> @@ -1848,17 +1857,6 @@ public interface SANModelPackage extends EPackage { */ EClass getRep(); - /** - * Returns the meta object for the containment reference '{@link org.polarsys.chess.mobius.model.SAN.Rep#getChild <em>Child</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference '<em>Child</em>'. - * @see org.polarsys.chess.mobius.model.SAN.Rep#getChild() - * @see #getRep() - * @generated - */ - EReference getRep_Child(); - /** * Returns the meta object for the attribute '{@link org.polarsys.chess.mobius.model.SAN.Rep#getNumbOfReps <em>Numb Of Reps</em>}'. * <!-- begin-user-doc --> @@ -2376,6 +2374,14 @@ public interface SANModelPackage extends EPackage { */ EReference COMPOSED_NODE__STATE_VARIABLES = eINSTANCE.getComposedNode_StateVariables(); + /** + * The meta object literal for the '<em><b>Child</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference COMPOSED_NODE__CHILD = eINSTANCE.getComposedNode_Child(); + /** * The meta object literal for the '{@link org.polarsys.chess.mobius.model.SAN.impl.SharedStateImpl <em>Shared State</em>}' class. * <!-- begin-user-doc --> @@ -2412,14 +2418,6 @@ public interface SANModelPackage extends EPackage { */ EClass JOIN = eINSTANCE.getJoin(); - /** - * The meta object literal for the '<em><b>Child</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference JOIN__CHILD = eINSTANCE.getJoin_Child(); - /** * The meta object literal for the '{@link org.polarsys.chess.mobius.model.SAN.impl.RepImpl <em>Rep</em>}' class. * <!-- begin-user-doc --> @@ -2430,14 +2428,6 @@ public interface SANModelPackage extends EPackage { */ EClass REP = eINSTANCE.getRep(); - /** - * The meta object literal for the '<em><b>Child</b></em>' containment reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference REP__CHILD = eINSTANCE.getRep_Child(); - /** * The meta object literal for the '<em><b>Numb Of Reps</b></em>' attribute feature. * <!-- begin-user-doc --> diff --git a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/ComposedNodeImpl.java b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/ComposedNodeImpl.java index 67faef4e7..402495dda 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/ComposedNodeImpl.java +++ b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/ComposedNodeImpl.java @@ -15,6 +15,7 @@ import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.polarsys.chess.mobius.model.SAN.ComposedNode; +import org.polarsys.chess.mobius.model.SAN.Node; import org.polarsys.chess.mobius.model.SAN.SANModelPackage; import org.polarsys.chess.mobius.model.SAN.SharedState; @@ -27,6 +28,7 @@ import org.polarsys.chess.mobius.model.SAN.SharedState; * </p> * <ul> * <li>{@link org.polarsys.chess.mobius.model.SAN.impl.ComposedNodeImpl#getStateVariables <em>State Variables</em>}</li> + * <li>{@link org.polarsys.chess.mobius.model.SAN.impl.ComposedNodeImpl#getChild <em>Child</em>}</li> * </ul> * * @generated @@ -42,6 +44,16 @@ public abstract class ComposedNodeImpl extends NodeImpl implements ComposedNode */ protected EList<SharedState> stateVariables; + /** + * The cached value of the '{@link #getChild() <em>Child</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getChild() + * @generated + * @ordered + */ + protected EList<Node> child; + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -73,6 +85,18 @@ public abstract class ComposedNodeImpl extends NodeImpl implements ComposedNode return stateVariables; } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<Node> getChild() { + if (child == null) { + child = new EObjectContainmentEList<Node>(Node.class, this, SANModelPackage.COMPOSED_NODE__CHILD); + } + return child; + } + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -83,6 +107,8 @@ public abstract class ComposedNodeImpl extends NodeImpl implements ComposedNode switch (featureID) { case SANModelPackage.COMPOSED_NODE__STATE_VARIABLES: return ((InternalEList<?>)getStateVariables()).basicRemove(otherEnd, msgs); + case SANModelPackage.COMPOSED_NODE__CHILD: + return ((InternalEList<?>)getChild()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } @@ -97,6 +123,8 @@ public abstract class ComposedNodeImpl extends NodeImpl implements ComposedNode switch (featureID) { case SANModelPackage.COMPOSED_NODE__STATE_VARIABLES: return getStateVariables(); + case SANModelPackage.COMPOSED_NODE__CHILD: + return getChild(); } return super.eGet(featureID, resolve, coreType); } @@ -114,6 +142,10 @@ public abstract class ComposedNodeImpl extends NodeImpl implements ComposedNode getStateVariables().clear(); getStateVariables().addAll((Collection<? extends SharedState>)newValue); return; + case SANModelPackage.COMPOSED_NODE__CHILD: + getChild().clear(); + getChild().addAll((Collection<? extends Node>)newValue); + return; } super.eSet(featureID, newValue); } @@ -129,6 +161,9 @@ public abstract class ComposedNodeImpl extends NodeImpl implements ComposedNode case SANModelPackage.COMPOSED_NODE__STATE_VARIABLES: getStateVariables().clear(); return; + case SANModelPackage.COMPOSED_NODE__CHILD: + getChild().clear(); + return; } super.eUnset(featureID); } @@ -143,6 +178,8 @@ public abstract class ComposedNodeImpl extends NodeImpl implements ComposedNode switch (featureID) { case SANModelPackage.COMPOSED_NODE__STATE_VARIABLES: return stateVariables != null && !stateVariables.isEmpty(); + case SANModelPackage.COMPOSED_NODE__CHILD: + return child != null && !child.isEmpty(); } return super.eIsSet(featureID); } diff --git a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/JoinImpl.java b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/JoinImpl.java index 198d29e86..327998ee4 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/JoinImpl.java +++ b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/JoinImpl.java @@ -2,46 +2,18 @@ */ package org.polarsys.chess.mobius.model.SAN.impl; -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; - import org.polarsys.chess.mobius.model.SAN.Join; -import org.polarsys.chess.mobius.model.SAN.Node; import org.polarsys.chess.mobius.model.SAN.SANModelPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Join</b></em>'. * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * </p> - * <ul> - * <li>{@link org.polarsys.chess.mobius.model.SAN.impl.JoinImpl#getChild <em>Child</em>}</li> - * </ul> * * @generated */ public class JoinImpl extends ComposedNodeImpl implements Join { - /** - * The cached value of the '{@link #getChild() <em>Child</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getChild() - * @generated - * @ordered - */ - protected EList<Node> child; - /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -61,90 +33,4 @@ public class JoinImpl extends ComposedNodeImpl implements Join { return SANModelPackage.Literals.JOIN; } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<Node> getChild() { - if (child == null) { - child = new EObjectContainmentEList<Node>(Node.class, this, SANModelPackage.JOIN__CHILD); - } - return child; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case SANModelPackage.JOIN__CHILD: - return ((InternalEList<?>)getChild()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SANModelPackage.JOIN__CHILD: - return getChild(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case SANModelPackage.JOIN__CHILD: - getChild().clear(); - getChild().addAll((Collection<? extends Node>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case SANModelPackage.JOIN__CHILD: - getChild().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case SANModelPackage.JOIN__CHILD: - return child != null && !child.isEmpty(); - } - return super.eIsSet(featureID); - } - } //JoinImpl diff --git a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/RepImpl.java b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/RepImpl.java index e9375cb63..e5281875c 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/RepImpl.java +++ b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/RepImpl.java @@ -3,14 +3,8 @@ package org.polarsys.chess.mobius.model.SAN.impl; import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; - import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.polarsys.chess.mobius.model.SAN.Node; import org.polarsys.chess.mobius.model.SAN.Rep; import org.polarsys.chess.mobius.model.SAN.SANModelPackage; @@ -22,23 +16,12 @@ import org.polarsys.chess.mobius.model.SAN.SANModelPackage; * The following features are implemented: * </p> * <ul> - * <li>{@link org.polarsys.chess.mobius.model.SAN.impl.RepImpl#getChild <em>Child</em>}</li> * <li>{@link org.polarsys.chess.mobius.model.SAN.impl.RepImpl#getNumbOfReps <em>Numb Of Reps</em>}</li> * </ul> * * @generated */ public class RepImpl extends ComposedNodeImpl implements Rep { - /** - * The cached value of the '{@link #getChild() <em>Child</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getChild() - * @generated - * @ordered - */ - protected Node child; - /** * The default value of the '{@link #getNumbOfReps() <em>Numb Of Reps</em>}' attribute. * <!-- begin-user-doc --> @@ -78,49 +61,6 @@ public class RepImpl extends ComposedNodeImpl implements Rep { return SANModelPackage.Literals.REP; } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Node getChild() { - return child; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetChild(Node newChild, NotificationChain msgs) { - Node oldChild = child; - child = newChild; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SANModelPackage.REP__CHILD, oldChild, newChild); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setChild(Node newChild) { - if (newChild != child) { - NotificationChain msgs = null; - if (child != null) - msgs = ((InternalEObject)child).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SANModelPackage.REP__CHILD, null, msgs); - if (newChild != null) - msgs = ((InternalEObject)newChild).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SANModelPackage.REP__CHILD, null, msgs); - msgs = basicSetChild(newChild, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SANModelPackage.REP__CHILD, newChild, newChild)); - } - /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -142,20 +82,6 @@ public class RepImpl extends ComposedNodeImpl implements Rep { eNotify(new ENotificationImpl(this, Notification.SET, SANModelPackage.REP__NUMB_OF_REPS, oldNumbOfReps, numbOfReps)); } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case SANModelPackage.REP__CHILD: - return basicSetChild(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -164,8 +90,6 @@ public class RepImpl extends ComposedNodeImpl implements Rep { @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { - case SANModelPackage.REP__CHILD: - return getChild(); case SANModelPackage.REP__NUMB_OF_REPS: return getNumbOfReps(); } @@ -180,9 +104,6 @@ public class RepImpl extends ComposedNodeImpl implements Rep { @Override public void eSet(int featureID, Object newValue) { switch (featureID) { - case SANModelPackage.REP__CHILD: - setChild((Node)newValue); - return; case SANModelPackage.REP__NUMB_OF_REPS: setNumbOfReps((String)newValue); return; @@ -198,9 +119,6 @@ public class RepImpl extends ComposedNodeImpl implements Rep { @Override public void eUnset(int featureID) { switch (featureID) { - case SANModelPackage.REP__CHILD: - setChild((Node)null); - return; case SANModelPackage.REP__NUMB_OF_REPS: setNumbOfReps(NUMB_OF_REPS_EDEFAULT); return; @@ -216,8 +134,6 @@ public class RepImpl extends ComposedNodeImpl implements Rep { @Override public boolean eIsSet(int featureID) { switch (featureID) { - case SANModelPackage.REP__CHILD: - return child != null; case SANModelPackage.REP__NUMB_OF_REPS: return NUMB_OF_REPS_EDEFAULT == null ? numbOfReps != null : !NUMB_OF_REPS_EDEFAULT.equals(numbOfReps); } diff --git a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/SANModelImpl.java b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/SANModelImpl.java index bc84f0c01..14816e8cd 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/SANModelImpl.java +++ b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/SANModelImpl.java @@ -127,7 +127,7 @@ public class SANModelImpl extends NamedElementImpl implements SANModel { } } else if (node instanceof Rep){ - Node child = ((Rep) node).getChild(); + Node child = ((Rep) node).getChild().get(0); EList<Node> nodes2= getAllNodes(child); nodes.addAll(nodes2); nodes.add(child); diff --git a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/SANModelPackageImpl.java b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/SANModelPackageImpl.java index 501cdf3b4..0419db260 100644 --- a/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/SANModelPackageImpl.java +++ b/plugins/mobius/org.polarsys.chess.mobius.model/src/org/polarsys/chess/mobius/model/SAN/impl/SANModelPackageImpl.java @@ -335,6 +335,15 @@ public class SANModelPackageImpl extends EPackageImpl implements SANModelPackage return (EReference)composedNodeEClass.getEStructuralFeatures().get(0); } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getComposedNode_Child() { + return (EReference)composedNodeEClass.getEStructuralFeatures().get(1); + } + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -371,15 +380,6 @@ public class SANModelPackageImpl extends EPackageImpl implements SANModelPackage return joinEClass; } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getJoin_Child() { - return (EReference)joinEClass.getEStructuralFeatures().get(0); - } - /** * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -389,22 +389,13 @@ public class SANModelPackageImpl extends EPackageImpl implements SANModelPackage return repEClass; } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getRep_Child() { - return (EReference)repEClass.getEStructuralFeatures().get(0); - } - /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getRep_NumbOfReps() { - return (EAttribute)repEClass.getEStructuralFeatures().get(1); + return (EAttribute)repEClass.getEStructuralFeatures().get(0); } /** @@ -781,16 +772,15 @@ public class SANModelPackageImpl extends EPackageImpl implements SANModelPackage composedNodeEClass = createEClass(COMPOSED_NODE); createEReference(composedNodeEClass, COMPOSED_NODE__STATE_VARIABLES); + createEReference(composedNodeEClass, COMPOSED_NODE__CHILD); sharedStateEClass = createEClass(SHARED_STATE); createEReference(sharedStateEClass, SHARED_STATE__PLACE); createEReference(sharedStateEClass, SHARED_STATE__SHARED_STATES); joinEClass = createEClass(JOIN); - createEReference(joinEClass, JOIN__CHILD); repEClass = createEClass(REP); - createEReference(repEClass, REP__CHILD); createEAttribute(repEClass, REP__NUMB_OF_REPS); atomicNodeEClass = createEClass(ATOMIC_NODE); @@ -913,16 +903,15 @@ public class SANModelPackageImpl extends EPackageImpl implements SANModelPackage initEClass(composedNodeEClass, ComposedNode.class, "ComposedNode", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getComposedNode_StateVariables(), this.getSharedState(), null, "stateVariables", null, 0, -1, ComposedNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getComposedNode_Child(), this.getNode(), null, "child", null, 2, -1, ComposedNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(sharedStateEClass, SharedState.class, "SharedState", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getSharedState_Place(), this.getPlace(), null, "place", null, 0, -1, SharedState.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getSharedState_SharedStates(), this.getSharedState(), null, "sharedStates", null, 0, -1, SharedState.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(joinEClass, Join.class, "Join", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getJoin_Child(), this.getNode(), null, "child", null, 2, -1, Join.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(repEClass, Rep.class, "Rep", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getRep_Child(), this.getNode(), null, "child", null, 1, 1, Rep.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getRep_NumbOfReps(), ecorePackage.getEString(), "numbOfReps", "", 0, 1, Rep.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(atomicNodeEClass, AtomicNode.class, "AtomicNode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); diff --git a/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/AtomicComponentTemplate_sanmodel.java b/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/AtomicComponentTemplate_sanmodel.java index a3a1557c0..b651c90fb 100644 --- a/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/AtomicComponentTemplate_sanmodel.java +++ b/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/AtomicComponentTemplate_sanmodel.java @@ -340,6 +340,9 @@ public class AtomicComponentTemplate_sanmodel extends AbstractAcceleoGenerator { @Override public void registerPackages(ResourceSet resourceSet) { super.registerPackages(resourceSet); + if (!isInWorkspace(org.polarsys.chess.mobius.model.SAN.SANModelPackage.class)) { + resourceSet.getPackageRegistry().put(org.polarsys.chess.mobius.model.SAN.SANModelPackage.eINSTANCE.getNsURI(), org.polarsys.chess.mobius.model.SAN.SANModelPackage.eINSTANCE); + } /* * If you want to change the content of this method, do NOT forget to change the "@generated" diff --git a/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/ComposedComponentTemplate_sanmodel.java b/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/ComposedComponentTemplate_sanmodel.java index fc804c775..f74dab35b 100644 --- a/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/ComposedComponentTemplate_sanmodel.java +++ b/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/ComposedComponentTemplate_sanmodel.java @@ -340,6 +340,9 @@ public class ComposedComponentTemplate_sanmodel extends AbstractAcceleoGenerator @Override public void registerPackages(ResourceSet resourceSet) { super.registerPackages(resourceSet); + if (!isInWorkspace(org.polarsys.chess.mobius.model.SAN.SANModelPackage.class)) { + resourceSet.getPackageRegistry().put(org.polarsys.chess.mobius.model.SAN.SANModelPackage.eINSTANCE.getNsURI(), org.polarsys.chess.mobius.model.SAN.SANModelPackage.eINSTANCE); + } /* * If you want to change the content of this method, do NOT forget to change the "@generated" diff --git a/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/ProjectFileTemplate_sanmodel.java b/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/ProjectFileTemplate_sanmodel.java index 5cc8e47d6..b44f69cb0 100644 --- a/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/ProjectFileTemplate_sanmodel.java +++ b/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/ProjectFileTemplate_sanmodel.java @@ -340,6 +340,9 @@ public class ProjectFileTemplate_sanmodel extends AbstractAcceleoGenerator { @Override public void registerPackages(ResourceSet resourceSet) { super.registerPackages(resourceSet); + if (!isInWorkspace(org.polarsys.chess.mobius.model.SAN.SANModelPackage.class)) { + resourceSet.getPackageRegistry().put(org.polarsys.chess.mobius.model.SAN.SANModelPackage.eINSTANCE.getNsURI(), org.polarsys.chess.mobius.model.SAN.SANModelPackage.eINSTANCE); + } /* * If you want to change the content of this method, do NOT forget to change the "@generated" diff --git a/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/composedComponentTemplate_sanmodel.mtl b/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/composedComponentTemplate_sanmodel.mtl index 5d478d58a..2ba67e2d4 100644 --- a/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/composedComponentTemplate_sanmodel.mtl +++ b/plugins/mobius/org.polarsys.chess.mobius/src/org/polarsys/chess/mobius/templates/composedComponentTemplate_sanmodel.mtl @@ -138,7 +138,11 @@ <int id="y">[node.y/]</int> </point> </class> + [if node.oclAsType(Rep).numbOfReps='-1'] <string id="RepCount">Num[node.name.replaceAll('\\.', '_')/]</string> + [else] + <string id="RepCount">[node.oclAsType(Rep).numbOfReps/]</string> + [/if] [if node.oclAsType(Rep).stateVariables->size() = 0] <int id="SharingInfoSize">0</int> [else] @@ -156,12 +160,16 @@ </class> [comment addToGlobalVars('Num'.concat(node.name.replaceAll('\\.', '_')), globalvars)/] [/if] + [for (var : GlobalVariable | node.globalVariable)] + [addToGlobalVars(var.name.replaceAll('\\.', '_'), globalvars)/] + [/for] + [/for] [comment links /] [for (node : Node | sanModel.getAllNodes())] [if(node.oclIsKindOf(Rep))] [comment link join to rep /] - [let child : Node = node.oclAsType(Rep).child] + [let child : Node = node.oclAsType(Rep).child->first()] <class id="Mobius.BaseClasses.BaseEdgeClass"> <int id="ClassVersion">3</int> <int id="LineType">0</int> diff --git a/plugins/mobius/org.polarsys.chess.mobius/tasks/atomicComponentTemplate.xml b/plugins/mobius/org.polarsys.chess.mobius/tasks/atomicComponentTemplate.xml index fc6ea16a1..618c9ab76 100644 --- a/plugins/mobius/org.polarsys.chess.mobius/tasks/atomicComponentTemplate.xml +++ b/plugins/mobius/org.polarsys.chess.mobius/tasks/atomicComponentTemplate.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project default="atomicComponentTemplate" name="org.polarsys.chess.mobius"> - <property name="ECLIPSE_HOME" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> - <property name="ECLIPSE_WORKSPACE" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/workspace_san3"/> + <property name="ECLIPSE_HOME" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> + <property name="ECLIPSE_WORKSPACE" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/runtime-New_configuration_3"/> <!-- The classpath with only the dependencies used by the project --> <path id="org.polarsys.chess.mobius.libraryclasspath"> diff --git a/plugins/mobius/org.polarsys.chess.mobius/tasks/atomicComponentTemplate_sanmodel.xml b/plugins/mobius/org.polarsys.chess.mobius/tasks/atomicComponentTemplate_sanmodel.xml index bbe468cde..c88ba2281 100644 --- a/plugins/mobius/org.polarsys.chess.mobius/tasks/atomicComponentTemplate_sanmodel.xml +++ b/plugins/mobius/org.polarsys.chess.mobius/tasks/atomicComponentTemplate_sanmodel.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project default="atomicComponentTemplate_sanmodel" name="org.polarsys.chess.mobius"> - <property name="ECLIPSE_HOME" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> - <property name="ECLIPSE_WORKSPACE" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/workspace_san3"/> + <property name="ECLIPSE_HOME" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> + <property name="ECLIPSE_WORKSPACE" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/runtime-New_configuration_3"/> <!-- The classpath with only the dependencies used by the project --> <path id="org.polarsys.chess.mobius.libraryclasspath"> diff --git a/plugins/mobius/org.polarsys.chess.mobius/tasks/attackScenarioTemplate.xml b/plugins/mobius/org.polarsys.chess.mobius/tasks/attackScenarioTemplate.xml index 8767334e3..2e9560703 100644 --- a/plugins/mobius/org.polarsys.chess.mobius/tasks/attackScenarioTemplate.xml +++ b/plugins/mobius/org.polarsys.chess.mobius/tasks/attackScenarioTemplate.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project default="AttackScenarioTemplate" name="org.polarsys.chess.mobius"> - <property name="ECLIPSE_HOME" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> - <property name="ECLIPSE_WORKSPACE" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/workspace_san3"/> + <property name="ECLIPSE_HOME" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> + <property name="ECLIPSE_WORKSPACE" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/runtime-New_configuration_3"/> <!-- The classpath with only the dependencies used by the project --> <path id="org.polarsys.chess.mobius.libraryclasspath"> diff --git a/plugins/mobius/org.polarsys.chess.mobius/tasks/composedComponentTemplate.xml b/plugins/mobius/org.polarsys.chess.mobius/tasks/composedComponentTemplate.xml index 56dcd7b12..747b250da 100644 --- a/plugins/mobius/org.polarsys.chess.mobius/tasks/composedComponentTemplate.xml +++ b/plugins/mobius/org.polarsys.chess.mobius/tasks/composedComponentTemplate.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project default="composedComponentTemplate" name="org.polarsys.chess.mobius"> - <property name="ECLIPSE_HOME" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> - <property name="ECLIPSE_WORKSPACE" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/workspace_san3"/> + <property name="ECLIPSE_HOME" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> + <property name="ECLIPSE_WORKSPACE" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/runtime-New_configuration_3"/> <!-- The classpath with only the dependencies used by the project --> <path id="org.polarsys.chess.mobius.libraryclasspath"> diff --git a/plugins/mobius/org.polarsys.chess.mobius/tasks/composedComponentTemplate_sanmodel.xml b/plugins/mobius/org.polarsys.chess.mobius/tasks/composedComponentTemplate_sanmodel.xml index a13c3ad24..4fb71225d 100644 --- a/plugins/mobius/org.polarsys.chess.mobius/tasks/composedComponentTemplate_sanmodel.xml +++ b/plugins/mobius/org.polarsys.chess.mobius/tasks/composedComponentTemplate_sanmodel.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project default="composedComponentTemplate_sanmodel" name="org.polarsys.chess.mobius"> - <property name="ECLIPSE_HOME" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> - <property name="ECLIPSE_WORKSPACE" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/workspace_san3"/> + <property name="ECLIPSE_HOME" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> + <property name="ECLIPSE_WORKSPACE" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/runtime-New_configuration_3"/> <!-- The classpath with only the dependencies used by the project --> <path id="org.polarsys.chess.mobius.libraryclasspath"> diff --git a/plugins/mobius/org.polarsys.chess.mobius/tasks/projectFileTemplate.xml b/plugins/mobius/org.polarsys.chess.mobius/tasks/projectFileTemplate.xml index a748e9fbf..62521fa6e 100644 --- a/plugins/mobius/org.polarsys.chess.mobius/tasks/projectFileTemplate.xml +++ b/plugins/mobius/org.polarsys.chess.mobius/tasks/projectFileTemplate.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project default="projectFileTemplate" name="org.polarsys.chess.mobius"> - <property name="ECLIPSE_HOME" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> - <property name="ECLIPSE_WORKSPACE" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/workspace_san3"/> + <property name="ECLIPSE_HOME" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> + <property name="ECLIPSE_WORKSPACE" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/runtime-New_configuration_3"/> <!-- The classpath with only the dependencies used by the project --> <path id="org.polarsys.chess.mobius.libraryclasspath"> diff --git a/plugins/mobius/org.polarsys.chess.mobius/tasks/projectFileTemplate_sanmodel.xml b/plugins/mobius/org.polarsys.chess.mobius/tasks/projectFileTemplate_sanmodel.xml index 55c3f299a..90e4732b5 100644 --- a/plugins/mobius/org.polarsys.chess.mobius/tasks/projectFileTemplate_sanmodel.xml +++ b/plugins/mobius/org.polarsys.chess.mobius/tasks/projectFileTemplate_sanmodel.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project default="projectFileTemplate_sanmodel" name="org.polarsys.chess.mobius"> - <property name="ECLIPSE_HOME" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> - <property name="ECLIPSE_WORKSPACE" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/workspace_san3"/> + <property name="ECLIPSE_HOME" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> + <property name="ECLIPSE_WORKSPACE" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/runtime-New_configuration_3"/> <!-- The classpath with only the dependencies used by the project --> <path id="org.polarsys.chess.mobius.libraryclasspath"> diff --git a/plugins/mobius/org.polarsys.chess.mobius/tasks/vulnerableComponentsTemplate.xml b/plugins/mobius/org.polarsys.chess.mobius/tasks/vulnerableComponentsTemplate.xml index d77c0458e..7cb818263 100644 --- a/plugins/mobius/org.polarsys.chess.mobius/tasks/vulnerableComponentsTemplate.xml +++ b/plugins/mobius/org.polarsys.chess.mobius/tasks/vulnerableComponentsTemplate.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project default="vulnerableComponentsTemplate" name="org.polarsys.chess.mobius"> - <property name="ECLIPSE_HOME" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> - <property name="ECLIPSE_WORKSPACE" value="../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/workspace_san3"/> + <property name="ECLIPSE_HOME" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515"/> + <property name="ECLIPSE_WORKSPACE" value="../../../../../../Programmi/PolarsysCHESS-Neon-win32-x86_64_20190515/runtime-New_configuration_3"/> <!-- The classpath with only the dependencies used by the project --> <path id="org.polarsys.chess.mobius.libraryclasspath"> diff --git a/plugins/mobius/org.polarsys.chess.mobius/transformations/CHESS2SAN.qvto b/plugins/mobius/org.polarsys.chess.mobius/transformations/CHESS2SAN.qvto index 4180cc751..7cc8e0a61 100644 --- a/plugins/mobius/org.polarsys.chess.mobius/transformations/CHESS2SAN.qvto +++ b/plugins/mobius/org.polarsys.chess.mobius/transformations/CHESS2SAN.qvto @@ -289,14 +289,30 @@ query SAN::ComposedNode::getParentShared(inout composed : SAN::ComposedNode, chi mapping UML::InstanceSpecification::UMLInstance2SANModel() : SAN::SANModel { var sanNode : SAN::Node; - sanNode := self.map UMLInstance2Join(true, 50); + //the case of just a single terminal node seems unreasonable... + sanNode := self.map UMLInstance2ComposedNode(true, 50); result.node := sanNode; result.name := self.name; } -mapping UML::InstanceSpecification::UMLInstance2Join(isRootJoin : Boolean, y : Integer) : SAN::Join { +mapping UML::InstanceSpecification::UMLInstance2ComposedNode(isRootJoin : Boolean, y : Integer) : SAN::ComposedNode { + + init{ + //A Join in SAN cannot have one child + //TODO actually I should not use getSubInstances() but check the number of ErrorModelBehaviour instances, indeed the one with no ErrorModel are not mapped to SAN + //E.g. in case of A decomposed by B and C, both terminals, if B has ErrorModelBehaviour and C no, then A should be map to Rep + //so the assumption here is that a child has always an error model; it can be the child itself or a part internal to the child + if (self.getSubInstances()->size() >1){ + result:= object SAN::Join{}; + } + else{ + result := object SAN::Rep{}; + result.oclAsType(SAN::Rep).numbOfReps:="1"; + }; + } + var node : SAN::Node; var subInstance : UML::InstanceSpecification; var prop : UML::Property; @@ -305,8 +321,7 @@ mapping UML::InstanceSpecification::UMLInstance2Join(isRootJoin : Boolean, y : I var deltax : Integer := 150; var deltay : Integer := 100; - - if (self.isComposite()) { + if (self.isComposite()) { //this should be always true //var subInsts = self.getSubInstances(); var subInstSlots = self.getSubInstanceSlots(); subInstSlots->forEach(instSlot){ @@ -314,6 +329,7 @@ mapping UML::InstanceSpecification::UMLInstance2Join(isRootJoin : Boolean, y : I prop := instSlot.definingFeature.oclAsType(UML::Property); subInstance := instSlot.value->first().oclAsType(UML::InstanceValue).instance; + //Multiplicity > 1 is mapped to a Rep //TODO use mapping to create Rep???? if (prop.getUpper()!=1){ rep := object SAN::Rep {}; @@ -327,33 +343,55 @@ mapping UML::InstanceSpecification::UMLInstance2Join(isRootJoin : Boolean, y : I result.addDoubleGlobalVariable('Num'.concat(rep.name), result); }; - log("**************************11111111111111111111111111111111"); - //TODO: curently if a component has errorModel attached than it is considered terminal: we should also support internal components with error model if (subInstance.isComposite() and (subInstance.getErrorModel()->oclIsUndefined() or subInstance.getErrorModel() = null)){ - log("**************************DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"); - var childJoin : SAN::Join := subInstance.map UMLInstance2Join(false, y1+deltay); + var childComposite : SAN::ComposedNode := subInstance.map UMLInstance2ComposedNode(false, y1+deltay); if (not rep.oclIsUndefined()){ - rep.child := childJoin; + rep.child := childComposite; }else{ - result.child += childJoin; + result.child += childComposite; }; - childJoin.x := x1; + childComposite.x := x1; x1:=x1+deltax; - childJoin.y := y1; - - + childComposite.y := y1; if (not isRootJoin){ + log("-------------------------------------"); //propagate shared states up in the hierarchy - childJoin.oclAsType(Join).stateVariables -> forEach (stateVariable){ - var shared := stateVariable.map shared2Shared(); + childComposite.stateVariables -> forEach (stateVariable){ + var shared := stateVariable.map shared2Shared(); if (not rep.oclIsUndefined()){ + //TODO if childComposite is kinf of Rep: case RepFather->Rep child composite: if RepChild share a place, then RepFather has to share the place as well + //the six lines below should work, I cannot test them now... +// if (childComposite.oclIsTypeOf(Rep) and stateVariable.place->notEmpty() ){ +// shared.place->includesAll(stateVariable.place) ; +// shared.sharedStates:= Sequence {}; +// }; rep.stateVariables += shared; - shared := shared.map shared2Shared(); + shared := shared.map shared2Shared(); //this is the shared for the parent of Rep + //check case result(Rep)->rep +// if (childComposite.oclIsTypeOf(Rep) and stateVariable.place->notEmpty() and result.oclIsTypeOf(Rep)){ +// shared.place->includesAll(stateVariable.place) ; +// shared.sharedStates:= Sequence {}; +// }; + }; result.stateVariables += shared; } - } + }else{ + if (not rep.oclIsUndefined()){ + //case of rootJoin->Rep + childComposite.stateVariables -> forEach (stateVariable){ + var shared := stateVariable.map shared2Shared(); + //TODO if childComposite is kinf of Rep: case RepFather->Rep child composite: if RepChild share a place, then RepFather has to share the place as well + //the three lines below should work, I cannot test them now... +// if (childComposite.oclIsTypeOf(Rep) and stateVariable.place->notEmpty() ){ +// shared.place->includesAll(stateVariable.place) ; +// shared.sharedStates:= Sequence {}; +// }; + rep.stateVariables += shared; + } + } + }; }else{ //atomic node @@ -388,6 +426,11 @@ mapping UML::InstanceSpecification::UMLInstance2Join(isRootJoin : Boolean, y : I if (not isRootJoin){ var newShared := shared.map shared2Shared(); result.stateVariables += newShared; + //case Rep1->Rep2->Atomiic: if Rep2 share a place, then Rep1 has to share the same place + if (result.oclIsTypeOf(SAN::Rep)){ + newShared.place += rewardPlace; + newShared.sharedStates:= Sequence {}; + }; } }else if (not isRootJoin){ @@ -424,6 +467,7 @@ mapping UML::InstanceSpecification::UMLInstance2Join(isRootJoin : Boolean, y : I result.name := self.name; if (isRootJoin){ + //assumoption: the root system is composed at least of two parts if (not rewardStates->isEmpty()){ //Create Reward Atomic Model var rewardModel : SAN::AtomicNode := this.analysisContext.map analysisContext2RewardAtomicModel(); @@ -433,7 +477,7 @@ mapping UML::InstanceSpecification::UMLInstance2Join(isRootJoin : Boolean, y : I rewardModel.y := y1; //Create Join State Variable rewardModel.place -> forEach (rewardPlace){ - result.stateVariables += this.analysisContext.map analysisContext2JoinStateVariable(result, rewardPlace); + result.stateVariables += this.analysisContext.map analysisContext2JoinStateVariable(result.oclAsType(SAN::Join), rewardPlace); }; }; @@ -449,7 +493,7 @@ mapping UML::InstanceSpecification::UMLInstance2Join(isRootJoin : Boolean, y : I this.attackScenarios -> forEach(scenario){ var msgs := scenario.getAttackMessages(); msgs ->forEach (message){ - result.stateVariables += message.map Message2JoinStateVariable(result); + result.stateVariables += message.map Message2JoinStateVariable(result.oclAsType(SAN::Join)); } }; @@ -459,24 +503,24 @@ mapping UML::InstanceSpecification::UMLInstance2Join(isRootJoin : Boolean, y : I } } -//TODO: in case the rule is applied to the same failure transition it returns the same target object... currently I have trasformed this mappnig in query below -mapping UML::Transition::Failure2PropagationAtomicModelXXX(sourcePlace : SAN::Place, targetPlace : SAN::Place, failureTrans : UML::Transition, internalProp: UML::Transition) : SAN::AtomicNode{ - result.name :=sourcePlace.name+"__"+targetPlace.name; - result.model :=sourcePlace.name+"__"+targetPlace.name; - var s := failureTrans.map FailureToPropagationPlace(sourcePlace.name); - var t := internalProp.map FailureToPropagationPlace(targetPlace.name); - - //TODO - var tim : SAN::TimedActivity := object SAN::TimedActivity{}; - result.timedActivity += tim; - s.activity += tim; - tim.place += t; - result.place += s; - result.place += t; - -} +////TODO: in case the rule is applied to the same failure transition it returns the same target object... currently I have trasformed this mappnig in query below +//mapping UML::Transition::Failure2PropagationAtomicModelXXX(sourcePlace : SAN::Place, targetPlace : SAN::Place, failureTrans : UML::Transition, internalProp: UML::Transition) : SAN::AtomicNode{ +// result.name :=sourcePlace.name+"__"+targetPlace.name; +// result.model :=sourcePlace.name+"__"+targetPlace.name; +// var s := failureTrans.map FailureToPropagationPlace(sourcePlace.name); +// var t := internalProp.map FailureToPropagationPlace(targetPlace.name); +// +// //TODO +// var tim : SAN::TimedActivity := object SAN::TimedActivity{}; +// result.timedActivity += tim; +// s.activity += tim; +// tim.place += t; +// result.place += s; +// result.place += t; +// +//} -//TODO this query currently replaces the mapping above +// this query replaces the mapping above query UML::Transition::Failure2PropagationAtomicModel(sourcePlace : SAN::Place, targetPlace : SAN::Place, failureTrans : UML::Transition, internalProp: UML::Transition) : SAN::AtomicNode{ var res : SAN::AtomicNode = object SAN::AtomicNode{}; @@ -495,7 +539,6 @@ query UML::Transition::Failure2PropagationAtomicModel(sourcePlace : SAN::Place, res.place += s; res.place += t; return res; - } @@ -1628,7 +1671,7 @@ query UML::InstanceSpecification::getSubInstances() : Set(UML::InstanceSpecifica slots -> forEach(slot){ instances += slot.value.oclAsType(UML::InstanceValue).instance; }; - log("subinstances of "+self.name+" = "+instances->size().toString()); + --log("subinstances of "+self.name+" = "+instances->size().toString()); return instances; } -- GitLab