Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2015-04-13 13:57:27 +0000
committerAnsgar Radermacher2015-04-13 14:01:22 +0000
commitbdb97f8a7fda42c8eb38eb25156ff82758bdd540 (patch)
tree7d5cf91cfd19d472b3a733169ec934adcda2b25b /extraplugins/qompass-designer
parent9d154a3522b72ea3e1a2f5ec87dbba800603c079 (diff)
downloadorg.eclipse.papyrus-bdb97f8a7fda42c8eb38eb25156ff82758bdd540.tar.gz
org.eclipse.papyrus-bdb97f8a7fda42c8eb38eb25156ff82758bdd540.tar.xz
org.eclipse.papyrus-bdb97f8a7fda42c8eb38eb25156ff82758bdd540.zip
464517 - [QDesigner] State machines code generation should support signal events and hierarchical state machines
Diffstat (limited to 'extraplugins/qompass-designer')
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/InterfaceSync.java140
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ExecuteOOTrafo.java108
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterStateMachines.java11
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.cpp/xtend-gen/.gitignore2
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/.gitignore2
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/org/eclipse/papyrus/qompass/designer/java/xtend/.JavaToOO.xtendbinbin14387 -> 0 bytes
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/org/eclipse/papyrus/qompass/designer/java/xtend/.gitignore2
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/org/eclipse/papyrus/qompass/designer/java/xtend/JavaToOO.java761
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConfigureInstanceDialog.java3
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/SyncHandler.java20
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/models/library/statemachine.notation3
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/models/library/statemachine.uml216
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/AMIPull.xtend34
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/AsyncCalls.xtend57
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/BehaviorUtil.java111
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/CppUtils.xtend81
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/FIFO.xtend13
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/GlobalConstants.xtend56
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/Marshalling.xtend51
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/MultipleReceptacle.xtend14
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/StateMachineGen.xtend379
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/StateMachineUtil.java257
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/StructBasedMarshalling.xtend25
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/SyncCalls.xtend13
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLAction.xtend58
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLChain.xtend91
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLFlatModel2Cpp.xtend667
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLFlattener.xtend556
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/xtend-gen/.gitignore2
29 files changed, 2815 insertions, 918 deletions
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/InterfaceSync.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/InterfaceSync.java
new file mode 100644
index 00000000000..ee2967d02e8
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/InterfaceSync.java
@@ -0,0 +1,140 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher ansgar.radermacher@cea.fr
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.qompass.designer.core.sync;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.papyrus.FCM.DerivedElement;
+import org.eclipse.papyrus.qompass.designer.core.OperationUtils;
+import org.eclipse.papyrus.qompass.designer.core.Utils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Generalization;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Parameter;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Reception;
+import org.eclipse.uml2.uml.Signal;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+/**
+ * Synchronize the use of a common superclass for signal reception with the
+ * question whether an interface has at least one owned reception.
+ */
+public class InterfaceSync {
+
+ public static final String SIG_PREFIX = "SIG_"; //$NON-NLS-1$
+
+ /**
+ * Name of an interface for generic reception support within the Qompass
+ * sysinterfaces modeling library
+ */
+ private static final String SIGNAL_RECEPTION_QN = "sysinterfaces::SignalReception"; //$NON-NLS-1$
+
+ protected static boolean useGenericSigInterface = false;
+
+ public static void syncSignalReceptionSupport(Interface intf) {
+ if (useGenericSigInterface) {
+ syncGenericSignalReceptionSupport(intf);
+ } else {
+ syncSpecificSignalReceptionSupport(intf);
+ }
+ }
+
+ public static void syncSpecificSignalReceptionSupport(Interface intf) {
+ for (Reception reception : intf.getOwnedReceptions()) {
+ Signal signal = reception.getSignal();
+ if (signal != null) {
+ String opName = SIG_PREFIX + signal.getName();
+ Operation existingOperation = intf.getOwnedOperation(opName, null, null);
+ Operation newOperation = UMLFactory.eINSTANCE.createOperation();
+ newOperation.setName(opName);
+ for (Property attribute : signal.getAttributes()) {
+ Parameter parameter = newOperation.createOwnedParameter(attribute.getName(), attribute.getType());
+ parameter.setLower(attribute.getLower());
+ parameter.setUpper(attribute.getUpper());
+ }
+ if (existingOperation == null) {
+ intf.getOwnedOperations().add(newOperation);
+ } else if (!OperationUtils.isSameOperation(existingOperation, newOperation)) {
+ OperationUtils.syncOperation(newOperation, existingOperation);
+ }
+ DerivedElement de = StereotypeUtil.applyApp(newOperation, DerivedElement.class);
+ if (de != null) {
+ de.setSource(reception);
+ }
+ }
+ }
+ // now remove derived operations that are no longer needed.
+ EList<Operation> ownedOperations = new BasicEList<Operation>();
+ ownedOperations.addAll(intf.getOwnedOperations());
+ for (Operation operation : ownedOperations) {
+ DerivedElement de = UMLUtil.getStereotypeApplication(operation, DerivedElement.class);
+ if (de != null) {
+ if (de.getSource() instanceof Reception) {
+ Reception reception = (Reception) de.getSource();
+ Signal signal = reception.getSignal();
+ if ((signal == null) || !(SIG_PREFIX + signal.getName()).equals(operation.getName())) {
+ // reception exists, but has no signal or another signal
+ operation.destroy();
+ }
+ } else {
+ // reception does not exist any more
+ operation.destroy();
+ }
+ }
+ }
+ }
+
+ public static void syncGenericSignalReceptionSupport(Interface intf) {
+
+ NamedElement genericReceptionNE = Utils.getQualifiedElement(Utils.getTop(intf), SIGNAL_RECEPTION_QN);
+ if (genericReceptionNE instanceof Interface) {
+ Interface genericReceptionIntf = (Interface) genericReceptionNE;
+ if (intf.getOwnedReceptions().size() > 0) {
+ if (!hasReceptionSupport(intf, genericReceptionIntf)) {
+ addReceptionSupport(intf, genericReceptionIntf);
+ }
+ } else if (hasReceptionSupport(intf, genericReceptionIntf)) {
+ removeReceptionSupport(intf, genericReceptionIntf);
+ }
+ }
+ }
+
+ public static boolean hasReceptionSupport(Interface intf, Interface genericReceptionIntf) {
+ // TODO: does it find an indirect reception?
+ for (Classifier general : intf.getGenerals()) {
+ if (general == genericReceptionIntf) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static void addReceptionSupport(Interface intf, Interface genericReceptionIntf) {
+ intf.createGeneralization(genericReceptionIntf);
+ }
+
+ public static void removeReceptionSupport(Interface intf, Interface genericReceptionIntf) {
+ for (Generalization generalization : intf.getGeneralizations()) {
+ if (generalization.getGeneral() == genericReceptionIntf) {
+ generalization.destroy();
+ }
+ }
+ }
+}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ExecuteOOTrafo.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ExecuteOOTrafo.java
index b31ffb72734..e0dff3396c6 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ExecuteOOTrafo.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ExecuteOOTrafo.java
@@ -1,9 +1,22 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher ansgar.radermacher@cea.fr
+ *
+ *****************************************************************************/
+
package org.eclipse.papyrus.qompass.designer.core.transformations;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.papyrus.FCM.PortKind;
-import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.papyrus.qompass.designer.core.deployment.DepUtils;
import org.eclipse.papyrus.qompass.designer.core.extensions.IOOTrafo;
import org.eclipse.papyrus.qompass.designer.core.extensions.OOTrafo;
@@ -19,56 +32,81 @@ import org.eclipse.uml2.uml.StructuralFeature;
import org.eclipse.uml2.uml.StructuredClassifier;
public class ExecuteOOTrafo {
-
+
IOOTrafo ooTrafo;
-
+
ExecuteOOTrafo(IOOTrafo ooTrafo) {
this.ooTrafo = ooTrafo;
}
-
+
/**
- * Why is pkg a parameter ?? [wait: the transformation should rather have a
- * component as this parameter]
- * Need to take traversal of components out of transformation [btw. shouldn't
- * the transformation be instance based]
+ * Execute the OO transformation for a package, include removal of connectors
*
* @param pkg
* @throws TransformationException
*/
public void transformPackage(Package pkg) throws TransformationException {
+ recursiveOOTransformation(pkg);
+ // transformation and removal is not done in same loop. Otherwise it would be possible
+ // that inherited ports have already been removed.
+ recursiveRemoval(pkg);
+ }
+
+ /**
+ * Execute the OO transformation for a package
+ *
+ * @param pkg
+ * @throws TransformationException
+ */
+ public void recursiveOOTransformation(Package pkg) throws TransformationException {
EList<PackageableElement> peList = new BasicEList<PackageableElement>();
peList.addAll(pkg.getPackagedElements());
for (PackageableElement element : peList) {
if (element instanceof Package) {
- transformPackage((Package) element);
- }
- else if (element instanceof Class) {
+ recursiveOOTransformation((Package) element);
+ } else if (element instanceof Class) {
Class implementation = (Class) element;
- // we may not apply the transformation to the boot-loader
- // itself, in particular it would transform
- // singletons into pointers.
- if (Utils.isCompImpl(implementation)
- // && (implementation != bootloader)
- && !StereotypeUtil.isApplied(implementation, PortKind.class)) {
+ // do not apply transformation to port-kinds
+ if (!StereotypeUtil.isApplied(implementation, PortKind.class)) {
ooTrafo.addPortOperations(implementation);
ooTrafo.addConnectionOperation(implementation);
ooTrafo.transformParts(implementation);
}
}
- // now delete connectors
- if (element instanceof StructuredClassifier) {
- removeConnectors((StructuredClassifier) element);
+ }
+ }
+
+ /**
+ * Remove connectors and ports from elements within a package
+ *
+ * @param pkg
+ * @throws TransformationException
+ */
+ public void recursiveRemoval(Package pkg) throws TransformationException {
+ EList<PackageableElement> peList = new BasicEList<PackageableElement>();
+ peList.addAll(pkg.getPackagedElements());
+ for (PackageableElement element : peList) {
+ if (element instanceof Package) {
+ recursiveRemoval((Package) element);
}
- if (element instanceof EncapsulatedClassifier) {
- removePorts((EncapsulatedClassifier) element);
+ else {
+ // delete connectors and ports
+ if (element instanceof StructuredClassifier) {
+ removeConnectors((StructuredClassifier) element);
+ }
+ if (element instanceof EncapsulatedClassifier) {
+ removePorts((EncapsulatedClassifier) element);
+ }
}
}
}
-
+
/**
- * Helper: remove connectors from a structured classifier (in most cases a class)
+ * Helper: remove connectors from a structured classifier (in most cases a
+ * class)
*
- * @param implementation A component
+ * @param implementation
+ * A component
*/
public void removeConnectors(StructuredClassifier implementation) {
EList<Connector> connectors = new BasicEList<Connector>();
@@ -79,9 +117,11 @@ public class ExecuteOOTrafo {
}
/**
- * Helper: remove ports from a from an encapsulated classifier (in most cases a class)
+ * Helper: remove ports from a from an encapsulated classifier (in most
+ * cases a class)
*
- * @param implementation A component
+ * @param implementation
+ * A component
*/
public void removePorts(EncapsulatedClassifier implementation) {
EList<Port> portListCopy = new BasicEList<Port>();
@@ -89,10 +129,11 @@ public class ExecuteOOTrafo {
// avoid dangling references by calling destroy on the port list
for (Port port : portListCopy) {
port.destroy();
- }
+ }
}
-
- public static void transform(LazyCopier copier, Class bootloader, Model genModel, boolean OOmodel) throws TransformationException {
+
+ public static void transform(LazyCopier copier, Class bootloader, Model genModel, boolean OOmodel)
+ throws TransformationException {
String ooTransformation = DepUtils.getOOTransformationFromPackage(genModel);
if (ooTransformation == null) {
// default OO transformation
@@ -102,16 +143,17 @@ public class ExecuteOOTrafo {
ooTrafo.init(copier, bootloader);
ExecuteOOTrafo executeOOTrafo = new ExecuteOOTrafo(ooTrafo);
executeOOTrafo.transformPackage(genModel);
-
+
// complete access operations?
}
- // TODO: always false. Is it really task of OO trafo to decide whether something is
+ // TODO: always false. Is it really task of OO trafo to decide whether
+ // something is
// instantiated by bootloader or not?
public static boolean instantiateViaBootloader(StructuralFeature slot) {
return false;
}
-
+
// TODO: currently used by BOOTLOADER generator. Why needed?
public static final String CREATE_CONNECTIONS = "createConnections"; //$NON-NLS-1$
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterStateMachines.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterStateMachines.java
index b12b472905f..afcb3708291 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterStateMachines.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterStateMachines.java
@@ -31,6 +31,8 @@ import org.eclipse.uml2.uml.Transition;
public class FilterStateMachines implements PreCopyListener {
+ private static final String UML_PRIMITIVE_TYPES_BOOLEAN = "PrimitiveTypes::Boolean"; //$NON-NLS-1$
+
public static FilterStateMachines getInstance() {
if (instance == null) {
instance = new FilterStateMachines();
@@ -50,9 +52,9 @@ public class FilterStateMachines implements PreCopyListener {
Behavior effect = transition.getEffect();
if (effect != null) {
if (tmClass != null) {
- String newName = sm.getName() + "_" + transition.getName() //$NON-NLS-1$
- + "_" + effect.getName(); //$NON-NLS-1$
- moveBehavior(newName, tmClass, effect);
+ // String newName = sm.getName() + "_" + transition.getName() //$NON-NLS-1$
+ // + "_" + effect.getName(); //$NON-NLS-1$
+ moveBehavior(effect.getName(), tmClass, effect);
}
}
}
@@ -87,8 +89,7 @@ public class FilterStateMachines implements PreCopyListener {
copiedEffect.setSpecification(operation);
copiedEffect.setName(newName);
tmClass.getOwnedBehaviors().add(copiedEffect);
-
}
-
+
private static FilterStateMachines instance = null;
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.cpp/xtend-gen/.gitignore b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.cpp/xtend-gen/.gitignore
new file mode 100644
index 00000000000..c96a04f008e
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.cpp/xtend-gen/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore \ No newline at end of file
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/.gitignore b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/.gitignore
new file mode 100644
index 00000000000..c96a04f008e
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore \ No newline at end of file
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/org/eclipse/papyrus/qompass/designer/java/xtend/.JavaToOO.xtendbin b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/org/eclipse/papyrus/qompass/designer/java/xtend/.JavaToOO.xtendbin
deleted file mode 100644
index 0bd8c7af5b6..00000000000
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/org/eclipse/papyrus/qompass/designer/java/xtend/.JavaToOO.xtendbin
+++ /dev/null
Binary files differ
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/org/eclipse/papyrus/qompass/designer/java/xtend/.gitignore b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/org/eclipse/papyrus/qompass/designer/java/xtend/.gitignore
deleted file mode 100644
index d9f2cb76de8..00000000000
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/org/eclipse/papyrus/qompass/designer/java/xtend/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/JavaCompToOO.java
-/.JavaToOO.java._trace
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/org/eclipse/papyrus/qompass/designer/java/xtend/JavaToOO.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/org/eclipse/papyrus/qompass/designer/java/xtend/JavaToOO.java
deleted file mode 100644
index 62f063cbff7..00000000000
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.java/xtend-gen/org/eclipse/papyrus/qompass/designer/java/xtend/JavaToOO.java
+++ /dev/null
@@ -1,761 +0,0 @@
-/**
- * Copyright (c) 2015 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ansgar Radermacher ansgar.radermacher@cea.fr
- */
-package org.eclipse.papyrus.qompass.designer.java.xtend;
-
-import com.google.common.base.Objects;
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.papyrus.qompass.designer.core.PortInfo;
-import org.eclipse.papyrus.qompass.designer.core.PortUtils;
-import org.eclipse.papyrus.qompass.designer.core.Utils;
-import org.eclipse.papyrus.qompass.designer.core.extensions.IOOTrafo;
-import org.eclipse.papyrus.qompass.designer.core.transformations.CompTypeTrafos;
-import org.eclipse.papyrus.qompass.designer.core.transformations.LazyCopier;
-import org.eclipse.papyrus.qompass.designer.core.transformations.PrefixConstants;
-import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationException;
-import org.eclipse.papyrus.qompass.designer.java.Messages;
-import org.eclipse.papyrus.uml.tools.utils.ConnectorUtil;
-import org.eclipse.uml2.uml.AggregationKind;
-import org.eclipse.uml2.uml.Association;
-import org.eclipse.uml2.uml.Behavior;
-import org.eclipse.uml2.uml.ConnectableElement;
-import org.eclipse.uml2.uml.Connector;
-import org.eclipse.uml2.uml.ConnectorEnd;
-import org.eclipse.uml2.uml.Interface;
-import org.eclipse.uml2.uml.InterfaceRealization;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.OpaqueBehavior;
-import org.eclipse.uml2.uml.Operation;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.Port;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.StructuralFeature;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.xtend2.lib.StringConcatenation;
-
-/**
- * This class realizes the transformation from component-based to object-oriented
- * models. It includes the replacement of ports and connectors. Ports are
- * replaced with attributes and access operations, connectors within a composite
- * by an operation that creates the initial setup.
- *
- * 1. add an operation that allows to retrieve the reference to an interface provided
- * by a port. This operation has a mapping specific name, e.g. get_<port_name>
- * 2. add an operation that allows to connect a specific port.
- * the connect_q operation (*including a
- * storage attribute*) for a port with a required interface
- * 3. add an implementation for the getcnx_q operation for a port
- * with a required interface (the operation itself has been added before)
- *
- * TODO: C++ specific, support different "component to OO" mappings
- *
- * Problems: need to align bootloader creation with this mapping, since
- * the bootloader may be responsible for instantiation
- *
- * Caveat: Assure that the folder derivedInterfaces already exists in a model.
- * Otherwise the call to getProvided/getRequired interface might trigger its
- * creation resulting in the corruption of list iterators (ConcurrentAccess
- * exception)
- */
-@SuppressWarnings("all")
-public class JavaToOO implements IOOTrafo {
- public final static String CREATE_CONNECTIONS = "createConnections";
-
- protected LazyCopier copier;
-
- protected org.eclipse.uml2.uml.Class bootloader;
-
- @Override
- public void init(final LazyCopier copier, final org.eclipse.uml2.uml.Class bootloader) {
- this.copier = copier;
- this.bootloader = bootloader;
- }
-
- public final static String retParamName = "ret";
-
- public final static String progLang = "JAVA";
-
- @Override
- public void addPortOperations(final org.eclipse.uml2.uml.Class implementation) {
- this.addGetPortOperation(implementation);
- JavaToOO.addConnectPortOperation(implementation);
- }
-
- /**
- * Add the get_p operation for each port with a provided interface. It also
- * adds a suitable implementation that evaluates delegation connectors from
- * the port to a property within the composite. The delegation target could
- * either be a normal class (no port) or an inner component.
- *
- * @param implementation
- */
- public void addGetPortOperation(final org.eclipse.uml2.uml.Class implementation) {
- EList<Port> _allPorts2 = PortUtils.getAllPorts2(implementation);
- EList<PortInfo> _flattenExtendedPorts = PortUtils.flattenExtendedPorts(_allPorts2);
- for (final PortInfo portInfo : _flattenExtendedPorts) {
- {
- final Interface providedIntf = portInfo.getProvided();
- boolean _notEquals = (!Objects.equal(providedIntf, null));
- if (_notEquals) {
- String _name = portInfo.getName();
- final String opName = (PrefixConstants.getP_Prefix + _name);
- Operation op = implementation.getOwnedOperation(opName, null, null);
- boolean _notEquals_1 = (!Objects.equal(op, null));
- if (_notEquals_1) {
- Type _type = op.getType();
- boolean _notEquals_2 = (!Objects.equal(_type, providedIntf));
- if (_notEquals_2) {
- op.createOwnedParameter(JavaToOO.retParamName, providedIntf);
- }
- } else {
- Operation _createOwnedOperation = implementation.createOwnedOperation(opName, null, null, providedIntf);
- op = _createOwnedOperation;
- EList<Parameter> _ownedParameters = op.getOwnedParameters();
- final Parameter retParam = _ownedParameters.get(0);
- retParam.setName(JavaToOO.retParamName);
- EClass _opaqueBehavior = UMLPackage.eINSTANCE.getOpaqueBehavior();
- Behavior _createOwnedBehavior = implementation.createOwnedBehavior(opName, _opaqueBehavior);
- final OpaqueBehavior behavior = ((OpaqueBehavior) _createOwnedBehavior);
- EList<Behavior> _methods = op.getMethods();
- _methods.add(behavior);
- Port _modelPort = portInfo.getModelPort();
- final ConnectorEnd ce = ConnectorUtil.getDelegation(implementation, _modelPort);
- String body = null;
- boolean _notEquals_3 = (!Objects.equal(ce, null));
- if (_notEquals_3) {
- final Property part = ce.getPartWithPort();
- final ConnectableElement role = ce.getRole();
- body = "return ";
- if ((role instanceof Port)) {
- String _body = body;
- StringConcatenation _builder = new StringConcatenation();
- String _name_1 = part.getName();
- _builder.append(_name_1, "");
- _builder.append(".");
- _builder.append(PrefixConstants.getP_Prefix, "");
- String _name_2 = ((Port)role).getName();
- _builder.append(_name_2, "");
- _builder.append("();");
- body = (_body + _builder);
- } else {
- String _body_1 = body;
- String _name_3 = role.getName();
- body = (_body_1 + _name_3);
- }
- } else {
- InterfaceRealization _interfaceRealization = implementation.getInterfaceRealization(null, providedIntf);
- boolean implementsIntf = (!Objects.equal(_interfaceRealization, null));
- if ((!implementsIntf)) {
- final Interface providedIntfInCopy = this.copier.<Interface>getCopy(providedIntf);
- InterfaceRealization _interfaceRealization_1 = implementation.getInterfaceRealization(null, providedIntfInCopy);
- boolean _notEquals_4 = (!Objects.equal(_interfaceRealization_1, null));
- implementsIntf = _notEquals_4;
- }
- if (implementsIntf) {
- body = "return this;";
- } else {
- String _name_4 = providedIntf.getName();
- Port _port = portInfo.getPort();
- String _name_5 = _port.getName();
- String _name_6 = implementation.getName();
- String _format = String.format(Messages.CompImplTrafos_IntfNotImplemented, _name_4, _name_5, _name_6);
- throw new RuntimeException(_format);
- }
- }
- EList<String> _languages = behavior.getLanguages();
- _languages.add(JavaToOO.progLang);
- EList<String> _bodies = behavior.getBodies();
- _bodies.add(body);
- }
- }
- }
- }
- }
-
- /**
- * Add a connect_<portName> operation for ports with a required interface.
- * Whereas operation and a behavior is added for each owned port, a behavior
- * (method) is needed for ports inherited from a component type (the
- * behavior is implementation specific, as it needs to take delegation to
- * parts into account)
- *
- * @param implementation
- */
- public static void addConnectPortOperation(final org.eclipse.uml2.uml.Class implementation) {
- EList<Port> _allPorts2 = PortUtils.getAllPorts2(implementation);
- EList<PortInfo> _flattenExtendedPorts = PortUtils.flattenExtendedPorts(_allPorts2);
- for (final PortInfo portInfo : _flattenExtendedPorts) {
- {
- final Interface requiredIntf = portInfo.getRequired();
- boolean _notEquals = (!Objects.equal(requiredIntf, null));
- if (_notEquals) {
- String _name = portInfo.getName();
- final String opName = (PrefixConstants.connectQ_Prefix + _name);
- Operation _ownedOperation = implementation.getOwnedOperation(opName, null, null);
- boolean _notEquals_1 = (!Objects.equal(_ownedOperation, null));
- if (_notEquals_1) {
- } else {
- Operation op = implementation.createOwnedOperation(opName, null, null);
- boolean _or = false;
- int _upper = portInfo.getUpper();
- boolean _greaterThan = (_upper > 1);
- if (_greaterThan) {
- _or = true;
- } else {
- int _upper_1 = portInfo.getUpper();
- boolean _equals = (_upper_1 == (-1));
- _or = _equals;
- }
- final boolean multiPort = _or;
- if (multiPort) {
- org.eclipse.uml2.uml.Package _top = Utils.getTop(implementation);
- final NamedElement eLong = Utils.getQualifiedElement(_top,
- CompTypeTrafos.INDEX_TYPE_FOR_MULTI_RECEPTACLE);
- if ((eLong instanceof Type)) {
- op.createOwnedParameter("index", ((Type) eLong));
- } else {
- String _format = String.format(Messages.CompImplTrafos_CannotFindType,
- CompTypeTrafos.INDEX_TYPE_FOR_MULTI_RECEPTACLE);
- throw new RuntimeException(_format);
- }
- }
- final Parameter refParam = op.createOwnedParameter("ref", requiredIntf);
- EClass _opaqueBehavior = UMLPackage.eINSTANCE.getOpaqueBehavior();
- Behavior _createOwnedBehavior = implementation.createOwnedBehavior(opName, _opaqueBehavior);
- final OpaqueBehavior behavior = ((OpaqueBehavior) _createOwnedBehavior);
- EList<Behavior> _methods = op.getMethods();
- _methods.add(behavior);
- Port _modelPort = portInfo.getModelPort();
- final ConnectorEnd ce = ConnectorUtil.getDelegation(implementation, _modelPort);
- String body = null;
- boolean _notEquals_2 = (!Objects.equal(ce, null));
- if (_notEquals_2) {
- final Property part = ce.getPartWithPort();
- String _name_1 = part.getName();
- body = _name_1;
- final ConnectableElement role = ce.getRole();
- if ((role instanceof Port)) {
- String _name_2 = ((Port)role).getName();
- final String targetOpName = (PrefixConstants.connectQ_Prefix + _name_2);
- StringConcatenation _builder = new StringConcatenation();
- String _name_3 = part.getName();
- _builder.append(_name_3, "");
- _builder.append(".");
- _builder.append(targetOpName, "");
- body = _builder.toString();
- boolean _or_1 = false;
- int _upper_2 = portInfo.getUpper();
- boolean _greaterThan_1 = (_upper_2 > 1);
- if (_greaterThan_1) {
- _or_1 = true;
- } else {
- int _upper_3 = portInfo.getUpper();
- boolean _equals_1 = (_upper_3 == (-1));
- _or_1 = _equals_1;
- }
- if (_or_1) {
- String _body = body;
- body = (_body + "(index, ref);");
- } else {
- String _body_1 = body;
- body = (_body_1 + "(ref);");
- }
- } else {
- String _body_2 = body;
- StringConcatenation _builder_1 = new StringConcatenation();
- String _name_4 = part.getName();
- _builder_1.append(_name_4, "");
- _builder_1.append(";");
- body = (_body_2 + _builder_1);
- }
- } else {
- String _name_5 = portInfo.getName();
- final String attributeName = (PrefixConstants.attributePrefix + _name_5);
- boolean _hasNonPortOwnedAttribute = Utils.hasNonPortOwnedAttribute(implementation, attributeName);
- boolean _not = (!_hasNonPortOwnedAttribute);
- if (_not) {
- final Property attr = implementation.createOwnedAttribute(attributeName, requiredIntf);
- Port _port = portInfo.getPort();
- LazyCopier.copyMultElemModifiers(_port, attr);
- attr.setAggregation(AggregationKind.SHARED_LITERAL);
- }
- body = attributeName;
- if (multiPort) {
- String _body_3 = body;
- body = (_body_3 + "[index]");
- }
- String _body_4 = body;
- body = (_body_4 + " = ref");
- }
- EList<String> _languages = behavior.getLanguages();
- _languages.add(JavaToOO.progLang);
- EList<String> _bodies = behavior.getBodies();
- _bodies.add(body);
- boolean _and = false;
- int _length = PrefixConstants.getConnQ_Prefix.length();
- boolean _greaterThan_2 = (_length > 0);
- if (!_greaterThan_2) {
- _and = false;
- } else {
- boolean _notEquals_3 = (!Objects.equal(ce, null));
- _and = _notEquals_3;
- }
- if (_and) {
- String _name_6 = portInfo.getName();
- final String getConnOpName = (PrefixConstants.getConnQ_Prefix + _name_6);
- Operation getConnOp = implementation.getOwnedOperation(getConnOpName, null, null);
- boolean _equals_2 = Objects.equal(getConnOp, null);
- if (_equals_2) {
- Operation _createOwnedOperation = implementation.createOwnedOperation(getConnOpName, null, null, requiredIntf);
- getConnOp = _createOwnedOperation;
- EList<Parameter> _ownedParameters = op.getOwnedParameters();
- final Parameter retParam = _ownedParameters.get(0);
- retParam.setName(JavaToOO.retParamName);
- }
- EClass _opaqueBehavior_1 = UMLPackage.eINSTANCE.getOpaqueBehavior();
- Behavior _createOwnedBehavior_1 = implementation.createOwnedBehavior(getConnOpName, _opaqueBehavior_1);
- final OpaqueBehavior getConnBehavior = ((OpaqueBehavior) _createOwnedBehavior_1);
- EList<Behavior> _methods_1 = getConnOp.getMethods();
- _methods_1.add(getConnBehavior);
- String _name_7 = portInfo.getName();
- final String name = (PrefixConstants.attributePrefix + _name_7);
- StringConcatenation _builder_2 = new StringConcatenation();
- _builder_2.append("return ");
- _builder_2.append(name, "");
- _builder_2.append(";");
- body = _builder_2.toString();
- EList<String> _languages_1 = behavior.getLanguages();
- _languages_1.add(JavaToOO.progLang);
- EList<String> _bodies_1 = behavior.getBodies();
- _bodies_1.add(body);
- }
- }
- }
- }
- }
- }
-
- /**
- * Add an operation "createConnections" that implements the connections
- * between composite parts. It only takes the assembly connections into
- * account, since delegation connectors are handled by the get_ and connect_
- * port operations above.
- *
- * @param implementation
- */
- @Override
- public void addConnectionOperation(final org.eclipse.uml2.uml.Class compositeImplementation) throws TransformationException {
- String createConnBody = "";
- final Map<ConnectorEnd, Integer> indexMap = new HashMap<ConnectorEnd, Integer>();
- EList<Connector> _ownedConnectors = compositeImplementation.getOwnedConnectors();
- for (final Connector connector : _ownedConnectors) {
- boolean _isAssembly = ConnectorUtil.isAssembly(connector);
- if (_isAssembly) {
- EList<ConnectorEnd> _ends = connector.getEnds();
- int _size = _ends.size();
- boolean _notEquals = (_size != 2);
- if (_notEquals) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("Connector <");
- String _name = connector.getName();
- _builder.append(_name, "");
- _builder.append("> does not have two ends. This is currently not supported");
- throw new TransformationException(_builder.toString());
- }
- EList<ConnectorEnd> _ends_1 = connector.getEnds();
- final ConnectorEnd end1 = _ends_1.get(0);
- EList<ConnectorEnd> _ends_2 = connector.getEnds();
- final ConnectorEnd end2 = _ends_2.get(1);
- StringConcatenation _builder_1 = new StringConcatenation();
- _builder_1.append("// realization of connector <");
- String _name_1 = connector.getName();
- _builder_1.append(_name_1, "");
- _builder_1.append(">\\n");
- String cmd = _builder_1.toString();
- boolean _and = false;
- ConnectableElement _role = end1.getRole();
- if (!(_role instanceof Port)) {
- _and = false;
- } else {
- ConnectableElement _role_1 = end1.getRole();
- boolean _isExtendedPort = PortUtils.isExtendedPort(((Port) _role_1));
- _and = _isExtendedPort;
- }
- if (_and) {
- ConnectableElement _role_2 = end1.getRole();
- final Port port = ((Port) _role_2);
- final EList<PortInfo> subPorts = PortUtils.flattenExtendedPort(port);
- for (final PortInfo subPort : subPorts) {
- {
- String _cmd = cmd;
- StringConcatenation _builder_2 = new StringConcatenation();
- _builder_2.append(" ");
- _builder_2.append("// realization of connection for sub-port ");
- Port _port = subPort.getPort();
- String _name_2 = _port.getName();
- _builder_2.append(_name_2, " ");
- _builder_2.append("\\n");
- cmd = (_cmd + _builder_2);
- String _cmd_1 = cmd;
- Port _port_1 = subPort.getPort();
- String _connectPorts = JavaToOO.connectPorts(indexMap, connector, end1, end2, _port_1);
- cmd = (_cmd_1 + _connectPorts);
- String _cmd_2 = cmd;
- Port _port_2 = subPort.getPort();
- String _connectPorts_1 = JavaToOO.connectPorts(indexMap, connector, end2, end1, _port_2);
- cmd = (_cmd_2 + _connectPorts_1);
- }
- }
- } else {
- String _cmd = cmd;
- String _connectPorts = JavaToOO.connectPorts(indexMap, connector, end1, end2, null);
- cmd = (_cmd + _connectPorts);
- String _cmd_1 = cmd;
- String _connectPorts_1 = JavaToOO.connectPorts(indexMap, connector, end2, end1, null);
- cmd = (_cmd_1 + _connectPorts_1);
- }
- String _createConnBody = createConnBody;
- createConnBody = (_createConnBody + (cmd + "\n"));
- }
- }
- int _length = createConnBody.length();
- boolean _greaterThan = (_length > 0);
- if (_greaterThan) {
- final Operation operation = compositeImplementation.createOwnedOperation(JavaToOO.CREATE_CONNECTIONS, null, null);
- String _name_2 = operation.getName();
- String _plus = ("b:" + _name_2);
- EClass _opaqueBehavior = UMLPackage.eINSTANCE.getOpaqueBehavior();
- Behavior _createOwnedBehavior = compositeImplementation.createOwnedBehavior(_plus, _opaqueBehavior);
- final OpaqueBehavior behavior = ((OpaqueBehavior) _createOwnedBehavior);
- EList<String> _languages = behavior.getLanguages();
- _languages.add(JavaToOO.progLang);
- EList<String> _bodies = behavior.getBodies();
- _bodies.add(createConnBody);
- behavior.setSpecification(operation);
- }
- }
-
- /**
- * Create the body C++ code code that creates a connection between the two ends
- * of a connector. This function checks whether the first end really is a receptacle
- * and the second really is a facet.
- * TODO: cleaner rewrite in xtend
- *
- * @param indexMap
- * a map of indices that are used in case of multiplex
- * receptacles
- * @param connector
- * a connector
- * @param receptacleEnd
- * an end of the connector that may point to a receptacle port
- * @param facetEnd
- * an end of the connector that may point to a facet port
- * @param subPort
- * a sub-port in case of extended ports
- * @return
- * @throws TransformationException
- */
- public static String connectPorts(final Map<ConnectorEnd, Integer> indexMap, final Connector connector, final ConnectorEnd receptacleEnd, final ConnectorEnd facetEnd, final Port subPort) throws TransformationException {
- final Association association = connector.getType();
- boolean _and = false;
- ConnectableElement _role = receptacleEnd.getRole();
- if (!(_role instanceof Port)) {
- _and = false;
- } else {
- ConnectableElement _role_1 = facetEnd.getRole();
- _and = (_role_1 instanceof Port);
- }
- if (_and) {
- ConnectableElement _role_2 = facetEnd.getRole();
- final Port facetPort = ((Port) _role_2);
- ConnectableElement _role_3 = receptacleEnd.getRole();
- final Port receptaclePort = ((Port) _role_3);
- final PortInfo facetPI = PortInfo.fromSubPort(facetPort, subPort);
- final PortInfo receptaclePI = PortInfo.fromSubPort(receptaclePort, subPort);
- boolean _and_1 = false;
- Interface _provided = facetPI.getProvided();
- boolean _notEquals = (!Objects.equal(_provided, null));
- if (!_notEquals) {
- _and_1 = false;
- } else {
- Interface _required = receptaclePI.getRequired();
- boolean _notEquals_1 = (!Objects.equal(_required, null));
- _and_1 = _notEquals_1;
- }
- if (_and_1) {
- final Property facetPart = facetEnd.getPartWithPort();
- final Property receptaclePart = receptacleEnd.getPartWithPort();
- String subPortName = "";
- boolean _notEquals_2 = (!Objects.equal(subPort, null));
- if (_notEquals_2) {
- String _subPortName = subPortName;
- String _name = subPort.getName();
- String _plus = ("_" + _name);
- subPortName = (_subPortName + _plus);
- }
- final String indexName = JavaToOO.getIndexName(indexMap, receptaclePort, receptacleEnd);
- StringConcatenation _builder = new StringConcatenation();
- String _name_1 = receptaclePart.getName();
- _builder.append(_name_1, "");
- _builder.append(".connect_");
- String _name_2 = receptaclePort.getName();
- _builder.append(_name_2, "");
- _builder.append(" ");
- _builder.append(subPortName, "");
- _builder.append(";");
- final String setter = _builder.toString();
- StringConcatenation _builder_1 = new StringConcatenation();
- String _name_3 = facetPart.getName();
- _builder_1.append(_name_3, "");
- _builder_1.append(".get_");
- String _name_4 = facetPort.getName();
- _builder_1.append(_name_4, "");
- _builder_1.append(" ");
- _builder_1.append(subPortName, "");
- _builder_1.append("()");
- final String getter = _builder_1.toString();
- StringConcatenation _builder_2 = new StringConcatenation();
- _builder_2.append(setter, "");
- _builder_2.append("(");
- _builder_2.append(indexName, "");
- _builder_2.append(getter, "");
- _builder_2.append(");\\n");
- return _builder_2.toString();
- }
- } else {
- ConnectableElement _role_4 = receptacleEnd.getRole();
- if ((_role_4 instanceof Port)) {
- ConnectableElement _role_5 = receptacleEnd.getRole();
- final Port receptaclePort_1 = ((Port) _role_5);
- Interface _required_1 = PortUtils.getRequired(receptaclePort_1);
- boolean _notEquals_3 = (!Objects.equal(_required_1, null));
- if (_notEquals_3) {
- ConnectableElement _role_6 = facetEnd.getRole();
- final Property facetPart_1 = ((Property) _role_6);
- final Property receptaclePart_1 = facetEnd.getPartWithPort();
- final String indexName_1 = JavaToOO.getIndexName(indexMap, receptaclePort_1, receptacleEnd);
- StringConcatenation _builder_3 = new StringConcatenation();
- String _name_5 = receptaclePart_1.getName();
- _builder_3.append(_name_5, "");
- _builder_3.append(".connect_");
- String _name_6 = receptaclePort_1.getName();
- _builder_3.append(_name_6, "");
- final String setter_1 = _builder_3.toString();
- StringConcatenation _builder_4 = new StringConcatenation();
- _builder_4.append("&");
- String _name_7 = facetPart_1.getName();
- _builder_4.append(_name_7, "");
- final String getter_1 = _builder_4.toString();
- StringConcatenation _builder_5 = new StringConcatenation();
- _builder_5.append(setter_1, "");
- _builder_5.append("(");
- _builder_5.append(indexName_1, "");
- _builder_5.append(getter_1, "");
- _builder_5.append(");\\n");
- return _builder_5.toString();
- }
- } else {
- ConnectableElement _role_7 = facetEnd.getRole();
- if ((_role_7 instanceof Port)) {
- ConnectableElement _role_8 = facetEnd.getRole();
- final Port facetPort_1 = ((Port) _role_8);
- Interface _provided_1 = PortUtils.getProvided(facetPort_1);
- boolean _notEquals_4 = (!Objects.equal(_provided_1, null));
- if (_notEquals_4) {
- final Property facetPart_2 = facetEnd.getPartWithPort();
- ConnectableElement _role_9 = facetEnd.getRole();
- final Property receptaclePart_2 = ((Property) _role_9);
- final String setter_2 = receptaclePart_2.getName();
- StringConcatenation _builder_6 = new StringConcatenation();
- String _name_8 = facetPart_2.getName();
- _builder_6.append(_name_8, "");
- _builder_6.append(".get_");
- String _name_9 = facetPort_1.getName();
- _builder_6.append(_name_9, "");
- _builder_6.append("();");
- final String getter_2 = _builder_6.toString();
- StringConcatenation _builder_7 = new StringConcatenation();
- _builder_7.append(setter_2, "");
- _builder_7.append(" = ");
- _builder_7.append(getter_2, "");
- _builder_7.append(";\\n");
- return _builder_7.toString();
- }
- } else {
- boolean _notEquals_5 = (!Objects.equal(association, null));
- if (_notEquals_5) {
- ConnectableElement _role_10 = facetEnd.getRole();
- final Property facetPart_3 = ((Property) _role_10);
- ConnectableElement _role_11 = receptacleEnd.getRole();
- final Property receptaclePart_3 = ((Property) _role_11);
- Type _type = facetPart_3.getType();
- final Property assocProp1 = association.getMemberEnd(null, _type);
- boolean _and_2 = false;
- boolean _notEquals_6 = (!Objects.equal(assocProp1, null));
- if (!_notEquals_6) {
- _and_2 = false;
- } else {
- boolean _isNavigable = assocProp1.isNavigable();
- _and_2 = _isNavigable;
- }
- if (_and_2) {
- StringConcatenation _builder_8 = new StringConcatenation();
- String _name_10 = receptaclePart_3.getName();
- _builder_8.append(_name_10, "");
- _builder_8.append(".");
- String _name_11 = assocProp1.getName();
- _builder_8.append(_name_11, "");
- final String setter_3 = _builder_8.toString();
- StringConcatenation _builder_9 = new StringConcatenation();
- _builder_9.append("&");
- String _name_12 = facetPart_3.getName();
- _builder_9.append(_name_12, "");
- final String getter_3 = _builder_9.toString();
- StringConcatenation _builder_10 = new StringConcatenation();
- _builder_10.append(setter_3, "");
- _builder_10.append(" = ");
- _builder_10.append(getter_3, "");
- _builder_10.append(";\\n");
- return _builder_10.toString();
- }
- } else {
- String _name_13 = connector.getName();
- String _plus_1 = ("Connector <" + _name_13);
- String _plus_2 = (_plus_1 +
- "> does not use ports, but it is not typed (only connectors between ports should not be typed)");
- throw new TransformationException(_plus_2);
- }
- }
- }
- }
- return "";
- }
-
- /**
- * Handle ports with multiplicity > 1. The idea is that we could have
- * multiple connections targeting a receptacle. The first connection would
- * start with index 0. Implementations can make no assumption which
- * connection is associated with a certain index. [want to avoid associative
- * array in runtime].
- *
- * @param port
- * @param end
- * @return
- */
- public static String getIndexName(final Map<ConnectorEnd, Integer> indexMap, final Port port, final ConnectorEnd end) {
- boolean _or = false;
- int _upper = port.getUpper();
- boolean _greaterThan = (_upper > 1);
- if (_greaterThan) {
- _or = true;
- } else {
- int _upper_1 = port.getUpper();
- boolean _equals = (_upper_1 == (-1));
- _or = _equals;
- }
- if (_or) {
- Integer indexValue = indexMap.get(end);
- boolean _equals_1 = Objects.equal(indexValue, null);
- if (_equals_1) {
- indexValue = Integer.valueOf(0);
- indexMap.put(end, indexValue);
- }
- String index = (indexValue + ", ");
- indexValue++;
- indexMap.put(end, indexValue);
- return index;
- }
- return "";
- }
-
- /**
- * Return true, if the bootloader is responsible for the instantiation of a
- * part. [Structual difference: bootloader can decide instance based - and
- * instances are deployed]
- *
- * If a part is a component type or an abstract implementation, it cannot be
- * instantiated. Thus, a heir has to be selected in the deployment plan.
- * Since the selection might be different for different instances of the
- * composite, the instantiation is not done by the component itself, but by
- * the bootloader. The bootloader also has to instantiate, if different
- * allocation variants are required. (this is for instance the case for
- * distribution connectors and for the system itself)
- *
- * If possible, we want to let composites instantiate sub-components, since
- * this eases the transition to systems which support reconfiguration.
- *
- * [TODO: optimization: analyze whether the deployment plan selects a single
- * implementation. If yes, let the composite instantiate]
- *
- * [TODO: elements within an assembly need to be instantiated by composite -
- * if System - by bootloader. assembly also need to be instantiated by
- * composite!!
- *
- * @param implementation
- * @return
- */
- public static boolean instantiateViaBootloader(final org.eclipse.uml2.uml.Class implementation) {
- boolean _or = false;
- boolean _isAbstract = implementation.isAbstract();
- if (_isAbstract) {
- _or = true;
- } else {
- boolean _isAssembly = Utils.isAssembly(implementation);
- _or = _isAssembly;
- }
- return _or;
- }
-
- /**
- * Return whether a part needs to be instantiated by the bootloader instead
- * by the composite in which it is contained. The criteria is based on the
- * question whether the containing composite is flattened, as it is the case
- * for the system component and the interaction components for distribution.
- *
- * @param part
- * @return
- */
- public static boolean instantiateViaBootloader(final StructuralFeature part) {
- boolean _notEquals = (!Objects.equal(part, null));
- if (_notEquals) {
- Type _type = part.getType();
- if ((_type instanceof org.eclipse.uml2.uml.Class)) {
- Type _type_1 = part.getType();
- final org.eclipse.uml2.uml.Class implementation = ((org.eclipse.uml2.uml.Class) _type_1);
- return JavaToOO.instantiateViaBootloader(implementation);
- } else {
- return false;
- }
- }
- return false;
- }
-
- /**
- * Transform parts if necessary.
- *
- * If the bootloader is responsible for creating an instance (if it is a
- * abstract type), mark the associated part as a C++ pointer. We do not want
- * to change the aggregation kind, since it remains logically a composition,
- * it is merely an implementation issue that it must be a pointer for C++ if
- * the concrete type is not yet known.
- *
- * @param compositeImplementation
- * a (composite) component
- */
- @Override
- public void transformParts(final org.eclipse.uml2.uml.Class compositeImplementation) {
- }
-}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConfigureInstanceDialog.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConfigureInstanceDialog.java
index 1d0269a818d..c93b9940571 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConfigureInstanceDialog.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/dialogs/ConfigureInstanceDialog.java
@@ -139,6 +139,9 @@ public class ConfigureInstanceDialog extends SelectionStatusDialog {
// visitedPackages = new BasicEList<Package> ();
m_feature = feature;
m_model = PackageUtil.getUserModel(from);
+ if (m_model == null) {
+ m_model = Utils.getTop(feature);
+ }
m_instance = null;
if (feature instanceof Connector) {
org.eclipse.papyrus.FCM.Connector fcmConn = UMLUtil.getStereotypeApplication(feature,
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/SyncHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/SyncHandler.java
index bcb92f41843..60d361f6007 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/SyncHandler.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/SyncHandler.java
@@ -24,11 +24,13 @@ import org.eclipse.papyrus.qompass.designer.core.RunnableWithResult;
import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.papyrus.qompass.designer.core.sync.CompImplSync;
import org.eclipse.papyrus.qompass.designer.core.sync.DepPlanSync;
+import org.eclipse.papyrus.qompass.designer.core.sync.InterfaceSync;
import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationRTException;
import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler;
import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Property;
@@ -48,7 +50,10 @@ public class SyncHandler extends CmdHandler {
if (selectedEObject instanceof Property) {
selectedEObject = ((Property) selectedEObject).getType();
}
-
+
+ if (selectedEObject instanceof Interface) {
+ return true;
+ }
if (selectedEObject instanceof Class) {
if (Utils.isComponent((Class) selectedEObject)) {
return true;
@@ -72,7 +77,18 @@ public class SyncHandler extends CmdHandler {
selectedEObject = ((Property) selectedEObject).getType();
}
- if (selectedEObject instanceof Class) {
+ if (selectedEObject instanceof Interface) {
+ final Interface selectedIntf = (Interface) selectedEObject;
+ CommandSupport.exec("Synchronize interface", event, new Runnable() {
+
+ @Override
+ public void run() {
+ InterfaceSync.syncSignalReceptionSupport(selectedIntf);
+ }
+ });
+ }
+
+ else if (selectedEObject instanceof Class) {
final Class selectedClass = (Class) selectedEObject;
if (Utils.isCompImpl(selectedClass)) {
CommandSupport.exec("Synchronize component via implementation", event, new RunnableWithResult() {
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/models/library/statemachine.notation b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/models/library/statemachine.notation
index 3083be6a696..d1f24d74606 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/models/library/statemachine.notation
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/models/library/statemachine.notation
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:C_Cpp="http://www.eclipse.org/papyrus/C_Cpp/1" xmlns:FCM="http://www.eclipse.org/papyrus/FCM/1" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML">
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:C_Cpp="http://www.eclipse.org/papyrus/C_Cpp/1" xmlns:FCM="http://www.eclipse.org/papyrus/FCM/1" xmlns:css="http://www.eclipse.org/papyrus/infra/gmfdiag/css" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML">
<notation:Diagram xmi:id="_deScIOUTEd-P08Bciq_LqQ" type="CompositeStructure" name="StateMachines" measurementUnit="Pixel">
<children xmi:type="notation:Shape" xmi:id="_en03EOUTEd-P08Bciq_LqQ" type="2073" fontName="" fontHeight="10" lineColor="0">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_en1eIOUTEd-P08Bciq_LqQ" source="ShadowFigure">
@@ -1887,4 +1887,5 @@
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_G967QF82EeGbQoflzrdx0g" id="(0.15,0.25)"/>
</edges>
</notation:Diagram>
+ <css:ModelStyleSheets xmi:id="_mhg4sMmbEeS0_bFth_90hQ"/>
</xmi:XMI>
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/models/library/statemachine.uml b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/models/library/statemachine.uml
index 070c060dbf6..6ae6df329fe 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/models/library/statemachine.uml
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/models/library/statemachine.uml
@@ -1,33 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:C_Cpp="http://www.eclipse.org/papyrus/C_Cpp/1" xmlns:FCM="http://www.eclipse.org/papyrus/FCM/1" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML">
<uml:Model xmi:id="_ago_QOUTEd-P08Bciq_LqQ" name="statemachine">
- <ownedComment xmi:id="_9BpKIOuLEeCTfOY57pgE3w" annotatedElement="_u-qioOUTEd-P08Bciq_LqQ">
+ <ownedComment xmi:type="uml:Comment" xmi:id="_9BpKIOuLEeCTfOY57pgE3w" annotatedElement="_u-qioOUTEd-P08Bciq_LqQ">
<body>Call event interceptor, interacts with state-machine. It will handle in particular call events that are intercepted by the port operations</body>
</ownedComment>
- <ownedComment xmi:id="_LuBKcDeoEeGPyrZ5I3hMlA" annotatedElement="_18qdsO67EeCZ9MjsZTV1zw">
+ <ownedComment xmi:type="uml:Comment" xmi:id="_LuBKcDeoEeGPyrZ5I3hMlA" annotatedElement="_18qdsO67EeCZ9MjsZTV1zw">
<body>Container rule for state machine realization. It consists of a collaboration of a call event interceptor, an event pool, the state-machine itself and a thread for this state-machine. The latter means that the state-machine will execute in its own thread and poll the pool for new events.</body>
</ownedComment>
- <packageImport xmi:id="_e8dN0OUUEd-P08Bciq_LqQ">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_e8dN0OUUEd-P08Bciq_LqQ">
<importedPackage xmi:type="uml:Model" href="pathmap://QML_CORE/core.uml#_O6TiIDLUEd26WNosUASSSw"/>
</packageImport>
- <packageImport xmi:id="_76Rc8OuMEeCTfOY57pgE3w">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_76Rc8OuMEeCTfOY57pgE3w">
<importedPackage xmi:type="uml:Model" href="pathmap://QML_CORE/corba.uml#_DtQEwDLdEd2_U4efLnjQIw"/>
</packageImport>
- <packageImport xmi:id="_guUMgOuNEeCTfOY57pgE3w">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_guUMgOuNEeCTfOY57pgE3w">
<importedPackage xmi:type="uml:Model" href="pathmap://Papyrus_Alf_LIBRARIES/alflibrary.uml#_0bBI4Hy5EeCKy5kSqd4eVw"/>
</packageImport>
- <packageImport xmi:id="_Ov3NkF82EeGbQoflzrdx0g">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_Ov3NkF82EeGbQoflzrdx0g">
<importedPackage xmi:type="uml:Model" href="pathmap://QML_DISTRIBUTION/distribution.uml#_O6TiIDLUEd26WNosUASSSw"/>
</packageImport>
<packagedElement xmi:type="uml:Package" xmi:id="_i9AuoOUTEd-P08Bciq_LqQ" name="SMInterceptor">
- <packageImport xmi:id="_q2WCYOUTEd-P08Bciq_LqQ">
- <importedPackage href="pathmap://QML_CORE/core.uml#_mMCK8PiPEd2UhpY2Y3WUyg"/>
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_q2WCYOUTEd-P08Bciq_LqQ">
+ <importedPackage xmi:type="uml:Package" href="pathmap://QML_CORE/core.uml#_mMCK8PiPEd2UhpY2Y3WUyg"/>
</packageImport>
- <packageMerge xmi:id="_ttDuoP3HEeC1YdT2qA0bjA">
- <mergedPackage href="pathmap://QML_CORE/core.uml#_mMCK8PiPEd2UhpY2Y3WUyg"/>
+ <packageMerge xmi:type="uml:PackageMerge" xmi:id="_ttDuoP3HEeC1YdT2qA0bjA">
+ <mergedPackage xmi:type="uml:Package" href="pathmap://QML_CORE/core.uml#_mMCK8PiPEd2UhpY2Y3WUyg"/>
</packageMerge>
<packagedElement xmi:type="uml:Class" xmi:id="_u-qioOUTEd-P08Bciq_LqQ" name="CI_CallEvent">
- <generalization xmi:id="_3LpLIOUTEd-P08Bciq_LqQ">
+ <generalization xmi:type="uml:Generalization" xmi:id="_3LpLIOUTEd-P08Bciq_LqQ">
<general xmi:type="uml:Class" href="pathmap://QML_CORE/core.uml#_Zx2ZUA1jEd6tvthBDl600Q"/>
</generalization>
<ownedAttribute xmi:type="uml:Port" xmi:id="_a4NKMOuMEeCTfOY57pgE3w" name="out" visibility="public" aggregation="composite">
@@ -38,44 +38,34 @@
<value xsi:nil="true"/>
</defaultValue>
</ownedAttribute>
- <ownedAttribute xmi:id="_bL0sACVvEeGaL60JjVj19Q" name="portID">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_bL0sACVvEeGaL60JjVj19Q" name="portID">
<type xmi:type="uml:PrimitiveType" href="pathmap://QML_CORE/corba.uml#_9XvcQB6REd6ITtm_FH3jRw"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_bMjEwCVvEeGaL60JjVj19Q" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_bMjr0CVvEeGaL60JjVj19Q" value="1"/>
</ownedAttribute>
- <interfaceRealization xmi:id="_qJxa0OUUEd-P08Bciq_LqQ" name="derived realization of I" client="_u-qioOUTEd-P08Bciq_LqQ">
+ <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_qJxa0OUUEd-P08Bciq_LqQ" name="derived realization of I" client="_u-qioOUTEd-P08Bciq_LqQ">
<supplier xmi:type="uml:Interface" href="pathmap://QML_CORE/core.uml#_ZzlzMPfBEd2TbIfwytOyPA"/>
- <contract href="pathmap://QML_CORE/core.uml#_ZzlzMPfBEd2TbIfwytOyPA"/>
+ <contract xmi:type="uml:Interface" href="pathmap://QML_CORE/core.uml#_ZzlzMPfBEd2TbIfwytOyPA"/>
</interfaceRealization>
- <ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_mlIZ8OUVEd-P08Bciq_LqQ" name="&lt;%name%>" specification="_2qJyMOUUEd-P08Bciq_LqQ">
+ <ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_mlIZ8OUVEd-P08Bciq_LqQ" name="[name/]" specification="_2qJyMOUUEd-P08Bciq_LqQ">
<language>C/C++</language>
- <body>[import org::eclipse::papyrus::qompass::designer::core::acceleo::utils_cpp/]
-
-[template public multiply(operation : Operation)]
-
-// create event with operationID/portID and pass call
-core::ContainerServices::CallEvent_ event;
-event.operationID = ID_[operation.name/];
-event.portID = portID;
-out->writeEvent (event);
-[if not (type = null)]return [/if]rconn->[operation.cppCall()/];
-[/template]</body>
+ <body>!xtend StateMachineGen.eventInterceptor</body>
</ownedBehavior>
- <ownedOperation xmi:id="_2qJyMOUUEd-P08Bciq_LqQ" name="[name/]" method="_mlIZ8OUVEd-P08Bciq_LqQ"/>
+ <ownedOperation xmi:type="uml:Operation" xmi:id="_2qJyMOUUEd-P08Bciq_LqQ" name="[name/]" method="_mlIZ8OUVEd-P08Bciq_LqQ"/>
</packagedElement>
<packagedElement xmi:type="uml:Dependency" xmi:id="_d3GdYOUWEd-P08Bciq_LqQ" name="Dependency0" client="_u-qioOUTEd-P08Bciq_LqQ">
<supplier xmi:type="uml:Enumeration" href="pathmap://QML_CORE/core.uml#_2oxDIPiPEd2UhpY2Y3WUyg"/>
</packagedElement>
</packagedElement>
<packagedElement xmi:type="uml:Package" xmi:id="_9J39cOupEeCTfOY57pgE3w" name="StateMachine">
- <packageMerge xmi:id="_lvUcAP3HEeC1YdT2qA0bjA">
- <mergedPackage href="pathmap://QML_CORE/core.uml#_m7SIwOUYEd-P08Bciq_LqQ"/>
+ <packageMerge xmi:type="uml:PackageMerge" xmi:id="_lvUcAP3HEeC1YdT2qA0bjA">
+ <mergedPackage xmi:type="uml:Package" href="pathmap://QML_CORE/core.uml#_m7SIwOUYEd-P08Bciq_LqQ"/>
</packageMerge>
<packagedElement xmi:type="uml:Class" xmi:id="_ens7QOUTEd-P08Bciq_LqQ" name="StateMachine">
- <generalization xmi:id="_ar4sECWNEeGB3KV6qwTHBw">
+ <generalization xmi:type="uml:Generalization" xmi:id="_ar4sECWNEeGB3KV6qwTHBw">
<general xmi:type="uml:Class" href="pathmap://QML_CORE/core.uml#_-WNegNtxEd6nqsBVkgJEEA"/>
</generalization>
- <ownedAttribute xmi:id="_dFBg4OupEeCTfOY57pgE3w" name="m_currentState" visibility="public">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_dFBg4OupEeCTfOY57pgE3w" name="m_currentState" visibility="public">
<type xmi:type="uml:PrimitiveType" href="pathmap://QML_CORE/corba.uml#_FxVBkB6LEd6Nj_33Eb_pxw"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_dFurgOupEeCTfOY57pgE3w" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_dFurgeupEeCTfOY57pgE3w" value="1"/>
@@ -83,7 +73,7 @@ out->writeEvent (event);
<value xsi:nil="true"/>
</defaultValue>
</ownedAttribute>
- <ownedAttribute xmi:id="_S9FLsO3GEeCHv5BGhoZ8CA" name="executor" aggregation="shared" association="_S99VcO3GEeCHv5BGhoZ8CA">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_S9FLsO3GEeCHv5BGhoZ8CA" name="executor" aggregation="shared" association="_S99VcO3GEeCHv5BGhoZ8CA">
<type xmi:type="uml:Class" href="pathmap://QML_CORE/core.uml#_6uRBMOuqEeCTfOY57pgE3w"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_S9FLsu3GEeCHv5BGhoZ8CA" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_S9FLse3GEeCHv5BGhoZ8CA" value="1"/>
@@ -103,32 +93,27 @@ out->writeEvent (event);
<value xsi:nil="true"/>
</defaultValue>
</ownedAttribute>
- <interfaceRealization xmi:id="_3GXWYCWSEeGB3KV6qwTHBw" name="derived realization of ILifeCycle" client="_ens7QOUTEd-P08Bciq_LqQ">
+ <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_3GXWYCWSEeGB3KV6qwTHBw" name="derived realization of ILifeCycle" client="_ens7QOUTEd-P08Bciq_LqQ">
<supplier xmi:type="uml:Interface" href="pathmap://QML_CORE/sysinterfaces.uml#_T3li0Dz6Ed-v9PxuTj6Elw"/>
- <contract href="pathmap://QML_CORE/sysinterfaces.uml#_T3li0Dz6Ed-v9PxuTj6Elw"/>
+ <contract xmi:type="uml:Interface" href="pathmap://QML_CORE/sysinterfaces.uml#_T3li0Dz6Ed-v9PxuTj6Elw"/>
</interfaceRealization>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_rglykOupEeCTfOY57pgE3w" name="processEvents" visibility="package" specification="_b5mYgCaiEeGRo-gX9igNzw">
<language>C/C++</language>
- <body>[import org::eclipse::papyrus::qompass::modellibs::core::acceleo::StateMachine/]
+ <body>!xtend StateMachineGen.processEvents
-[template public stateMachineD(clazz : Class)]
-[clazz.StateMachine()/]
-[/template]
</body>
</ownedBehavior>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_p_0sUCaiEeGRo-gX9igNzw" name="activate" specification="_3GbAwCWSEeGB3KV6qwTHBw">
<language>C/C++</language>
- <body>for (;;) {
- processEvents();
-}</body>
+ <body>!xtend StateMachineGen.activate</body>
</ownedBehavior>
- <ownedOperation xmi:id="_3GbAwCWSEeGB3KV6qwTHBw" name="activate" method="_p_0sUCaiEeGRo-gX9igNzw"/>
- <ownedOperation xmi:id="_3G6I8CWSEeGB3KV6qwTHBw" name="deactivate"/>
- <ownedOperation xmi:id="_b5mYgCaiEeGRo-gX9igNzw" name="processEvents" method="_rglykOupEeCTfOY57pgE3w"/>
- <ownedOperation xmi:id="_MYPEcHk6EeOph7IIHUnNoA" name="configuration_complete"/>
+ <ownedOperation xmi:type="uml:Operation" xmi:id="_3GbAwCWSEeGB3KV6qwTHBw" name="activate" method="_p_0sUCaiEeGRo-gX9igNzw"/>
+ <ownedOperation xmi:type="uml:Operation" xmi:id="_3G6I8CWSEeGB3KV6qwTHBw" name="deactivate"/>
+ <ownedOperation xmi:type="uml:Operation" xmi:id="_b5mYgCaiEeGRo-gX9igNzw" name="processEvents" method="_rglykOupEeCTfOY57pgE3w"/>
+ <ownedOperation xmi:type="uml:Operation" xmi:id="_MYPEcHk6EeOph7IIHUnNoA" name="configuration_complete"/>
</packagedElement>
<packagedElement xmi:type="uml:Association" xmi:id="_S99VcO3GEeCHv5BGhoZ8CA" name="stateMachine_executor" memberEnd="_S99Vce3GEeCHv5BGhoZ8CA _S9FLsO3GEeCHv5BGhoZ8CA">
- <ownedEnd xmi:id="_S99Vce3GEeCHv5BGhoZ8CA" name="stateMachine" type="_ens7QOUTEd-P08Bciq_LqQ" association="_S99VcO3GEeCHv5BGhoZ8CA">
+ <ownedEnd xmi:type="uml:Property" xmi:id="_S99Vce3GEeCHv5BGhoZ8CA" name="stateMachine" type="_ens7QOUTEd-P08Bciq_LqQ" association="_S99VcO3GEeCHv5BGhoZ8CA">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_S998ge3GEeCHv5BGhoZ8CA" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_S998gO3GEeCHv5BGhoZ8CA" value="1"/>
</ownedEnd>
@@ -146,7 +131,7 @@ out->writeEvent (event);
<packagedElement xmi:type="uml:Class" xmi:id="_CV_x4O68EeCZ9MjsZTV1zw" name="CallEvents"/>
<packagedElement xmi:type="uml:Class" xmi:id="_KEMp0CNYEeGj_4swHBbKwg" name="CallEventConfigurator"/>
<packagedElement xmi:type="uml:Package" xmi:id="_F5DMoF8wEeGerN33d-RdRg" name="Animation">
- <ownedComment xmi:id="_BLcrgHhAEeOejZqJpKQeww">
+ <ownedComment xmi:type="uml:Comment" xmi:id="_BLcrgHhAEeOejZqJpKQeww">
<body>Animation service configurator takes care of allocating the RemoveAnimService on the &quot;right&quot; node and to connect local and remote service configurators.</body>
</ownedComment>
<packagedElement xmi:type="uml:Class" xmi:id="_xELAwF81EeGbQoflzrdx0g" name="LocalAnimService">
@@ -158,7 +143,7 @@ out->writeEvent (event);
</defaultValue>
</ownedAttribute>
<ownedAttribute xmi:type="uml:Port" xmi:id="_ZXYggHg_EeOejZqJpKQeww" name="outAnimSvc" type="_L-I7kF8wEeGerN33d-RdRg" aggregation="composite"/>
- <interfaceRealization xmi:id="_bmInQF_4EeGbQoflzrdx0g" name="derived realization of IAnimation" client="_xELAwF81EeGbQoflzrdx0g" supplier="_L-I7kF8wEeGerN33d-RdRg" contract="_L-I7kF8wEeGerN33d-RdRg"/>
+ <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_bmInQF_4EeGbQoflzrdx0g" name="derived realization of IAnimation" client="_xELAwF81EeGbQoflzrdx0g" supplier="_L-I7kF8wEeGerN33d-RdRg" contract="_L-I7kF8wEeGerN33d-RdRg"/>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_r5ewgHnxEeOfttgBwSq-Ig" name="leaveState" specification="_bmo9kF_4EeGbQoflzrdx0g">
<language>C/C++</language>
<body>if (outAnimSvc != 0) {
@@ -173,25 +158,25 @@ out->writeEvent (event);
}
</body>
</ownedBehavior>
- <ownedOperation xmi:id="_bmbiMF_4EeGbQoflzrdx0g" name="enterState" method="_tczkcHnxEeOfttgBwSq-Ig">
- <ownedParameter xmi:id="_OJXykGEpEeGzd_21sXyuog" name="stateEnum">
+ <ownedOperation xmi:type="uml:Operation" xmi:id="_bmbiMF_4EeGbQoflzrdx0g" name="enterState" method="_tczkcHnxEeOfttgBwSq-Ig">
+ <ownedParameter xmi:type="uml:Parameter" xmi:id="_OJXykGEpEeGzd_21sXyuog" name="stateEnum">
<type xmi:type="uml:PrimitiveType" href="pathmap://QML_CORE/corba.uml#_9XvcQB6REd6ITtm_FH3jRw"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_OJZAsGEpEeGzd_21sXyuog" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_OJZAsWEpEeGzd_21sXyuog" value="1"/>
</ownedParameter>
- <ownedParameter xmi:id="_OJZnwGEpEeGzd_21sXyuog" name="eInstance">
+ <ownedParameter xmi:type="uml:Parameter" xmi:id="_OJZnwGEpEeGzd_21sXyuog" name="eInstance">
<type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_OJa14GEpEeGzd_21sXyuog" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_OJbc8GEpEeGzd_21sXyuog" value="1"/>
</ownedParameter>
</ownedOperation>
- <ownedOperation xmi:id="_bmo9kF_4EeGbQoflzrdx0g" name="leaveState" method="_r5ewgHnxEeOfttgBwSq-Ig">
- <ownedParameter xmi:id="_OKJOoGEpEeGzd_21sXyuog" name="stateEnum">
+ <ownedOperation xmi:type="uml:Operation" xmi:id="_bmo9kF_4EeGbQoflzrdx0g" name="leaveState" method="_r5ewgHnxEeOfttgBwSq-Ig">
+ <ownedParameter xmi:type="uml:Parameter" xmi:id="_OKJOoGEpEeGzd_21sXyuog" name="stateEnum">
<type xmi:type="uml:PrimitiveType" href="pathmap://QML_CORE/corba.uml#_9XvcQB6REd6ITtm_FH3jRw"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_OKKcwGEpEeGzd_21sXyuog" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_OKLD0GEpEeGzd_21sXyuog" value="1"/>
</ownedParameter>
- <ownedParameter xmi:id="_OKLD0WEpEeGzd_21sXyuog" name="eInstance">
+ <ownedParameter xmi:type="uml:Parameter" xmi:id="_OKLD0WEpEeGzd_21sXyuog" name="eInstance">
<type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_OKMR8GEpEeGzd_21sXyuog" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_OKM5AGEpEeGzd_21sXyuog"/>
@@ -199,31 +184,31 @@ out->writeEvent (event);
</ownedOperation>
</packagedElement>
<packagedElement xmi:type="uml:Interface" xmi:id="_L-I7kF8wEeGerN33d-RdRg" name="IAnimation">
- <ownedOperation xmi:id="_N3m-oF8wEeGerN33d-RdRg" name="enterState" visibility="public" isAbstract="true">
- <ownedComment xmi:id="_YmEFYV8wEeGerN33d-RdRg">
+ <ownedOperation xmi:type="uml:Operation" xmi:id="_N3m-oF8wEeGerN33d-RdRg" name="enterState" visibility="public" isAbstract="true">
+ <ownedComment xmi:type="uml:Comment" xmi:id="_YmEFYV8wEeGerN33d-RdRg">
<body>&lt;&lt;TextualRepresentation>>public abstract enterState (in stateEnum : StateMachine::Short, in eInstance : String) ;</body>
</ownedComment>
- <ownedParameter xmi:id="_NbPhQGEpEeGzd_21sXyuog" name="stateEnum">
+ <ownedParameter xmi:type="uml:Parameter" xmi:id="_NbPhQGEpEeGzd_21sXyuog" name="stateEnum">
<type xmi:type="uml:PrimitiveType" href="pathmap://QML_CORE/corba.uml#_9XvcQB6REd6ITtm_FH3jRw"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_NbYEIGEpEeGzd_21sXyuog" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_NbbHcGEpEeGzd_21sXyuog" value="1"/>
</ownedParameter>
- <ownedParameter xmi:id="_NbdjsGEpEeGzd_21sXyuog" name="eInstance">
+ <ownedParameter xmi:type="uml:Parameter" xmi:id="_NbdjsGEpEeGzd_21sXyuog" name="eInstance">
<type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_NbupcGEpEeGzd_21sXyuog" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_Nb2lQGEpEeGzd_21sXyuog" value="1"/>
</ownedParameter>
</ownedOperation>
- <ownedOperation xmi:id="_ZgY_oF8wEeGerN33d-RdRg" name="leaveState" visibility="public" isAbstract="true">
- <ownedComment xmi:id="_df_owF8wEeGerN33d-RdRg">
+ <ownedOperation xmi:type="uml:Operation" xmi:id="_ZgY_oF8wEeGerN33d-RdRg" name="leaveState" visibility="public" isAbstract="true">
+ <ownedComment xmi:type="uml:Comment" xmi:id="_df_owF8wEeGerN33d-RdRg">
<body>&lt;&lt;TextualRepresentation>>public abstract leaveState(in eState : StateMachine::Short, in eInstance : String) ;</body>
</ownedComment>
- <ownedParameter xmi:id="_OJfHUGEpEeGzd_21sXyuog" name="eState">
+ <ownedParameter xmi:type="uml:Parameter" xmi:id="_OJfHUGEpEeGzd_21sXyuog" name="eState">
<type xmi:type="uml:PrimitiveType" href="pathmap://QML_CORE/corba.uml#_9XvcQB6REd6ITtm_FH3jRw"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_OJr7oGEpEeGzd_21sXyuog" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_OJwNEGEpEeGzd_21sXyuog" value="1"/>
</ownedParameter>
- <ownedParameter xmi:id="_OJ0egGEpEeGzd_21sXyuog" name="eInstance">
+ <ownedParameter xmi:type="uml:Parameter" xmi:id="_OJ0egGEpEeGzd_21sXyuog" name="eInstance">
<type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_OKCg8GEpEeGzd_21sXyuog" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_OKHZcGEpEeGzd_21sXyuog" value="1"/>
@@ -233,26 +218,26 @@ out->writeEvent (event);
<packagedElement xmi:type="uml:Class" xmi:id="_QH7R8GGDEeO2F4QRMDSOXg" name="AnimServiceConfigurator"/>
<packagedElement xmi:type="uml:Class" xmi:id="_B0gFAHg_EeOejZqJpKQeww" name="RemoteAnimService">
<ownedAttribute xmi:type="uml:Port" xmi:id="_MLu-kHg_EeOejZqJpKQeww" name="animSvc" type="_L-I7kF8wEeGerN33d-RdRg" aggregation="composite"/>
- <interfaceRealization xmi:id="_hQFyMHk8EeOh_8tymvdOOg" name="derived realization of IAnimation" client="_B0gFAHg_EeOejZqJpKQeww" supplier="_L-I7kF8wEeGerN33d-RdRg" contract="_L-I7kF8wEeGerN33d-RdRg"/>
- <ownedOperation xmi:id="_hQJckHk8EeOh_8tymvdOOg" name="enterState">
- <ownedParameter xmi:id="_hQLRwHk8EeOh_8tymvdOOg" name="stateEnum">
+ <interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_hQFyMHk8EeOh_8tymvdOOg" name="derived realization of IAnimation" client="_B0gFAHg_EeOejZqJpKQeww" supplier="_L-I7kF8wEeGerN33d-RdRg" contract="_L-I7kF8wEeGerN33d-RdRg"/>
+ <ownedOperation xmi:type="uml:Operation" xmi:id="_hQJckHk8EeOh_8tymvdOOg" name="enterState">
+ <ownedParameter xmi:type="uml:Parameter" xmi:id="_hQLRwHk8EeOh_8tymvdOOg" name="stateEnum">
<type xmi:type="uml:PrimitiveType" href="pathmap://QML_CORE/corba.uml#_9XvcQB6REd6ITtm_FH3jRw"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_hQL40Hk8EeOh_8tymvdOOg" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_hQMf4Hk8EeOh_8tymvdOOg" value="1"/>
</ownedParameter>
- <ownedParameter xmi:id="_hQMf4Xk8EeOh_8tymvdOOg" name="eInstance">
+ <ownedParameter xmi:type="uml:Parameter" xmi:id="_hQMf4Xk8EeOh_8tymvdOOg" name="eInstance">
<type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_hQNG8Hk8EeOh_8tymvdOOg" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_hQNG8Xk8EeOh_8tymvdOOg" value="1"/>
</ownedParameter>
</ownedOperation>
- <ownedOperation xmi:id="_hQSmgHk8EeOh_8tymvdOOg" name="leaveState">
- <ownedParameter xmi:id="_hQTNkHk8EeOh_8tymvdOOg" name="eState">
+ <ownedOperation xmi:type="uml:Operation" xmi:id="_hQSmgHk8EeOh_8tymvdOOg" name="leaveState">
+ <ownedParameter xmi:type="uml:Parameter" xmi:id="_hQTNkHk8EeOh_8tymvdOOg" name="eState">
<type xmi:type="uml:PrimitiveType" href="pathmap://QML_CORE/corba.uml#_9XvcQB6REd6ITtm_FH3jRw"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_hQTNkXk8EeOh_8tymvdOOg" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_hQT0oHk8EeOh_8tymvdOOg" value="1"/>
</ownedParameter>
- <ownedParameter xmi:id="_hQT0oXk8EeOh_8tymvdOOg" name="eInstance">
+ <ownedParameter xmi:type="uml:Parameter" xmi:id="_hQT0oXk8EeOh_8tymvdOOg" name="eInstance">
<type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_hQUbsHk8EeOh_8tymvdOOg" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_hQUbsXk8EeOh_8tymvdOOg" value="1"/>
@@ -262,14 +247,14 @@ out->writeEvent (event);
</packagedElement>
<packagedElement xmi:type="uml:Package" xmi:id="_DEJCwF81EeGbQoflzrdx0g" name="rules">
<packagedElement xmi:type="uml:Class" xmi:id="_18qdsO67EeCZ9MjsZTV1zw" name="StateMachineWCallEvents">
- <ownedAttribute xmi:id="_LyxAEPTXEeCn1-FCrfecFg" name="callEventInterceptor" visibility="public" type="_u-qioOUTEd-P08Bciq_LqQ" aggregation="composite">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_LyxAEPTXEeCn1-FCrfecFg" name="callEventInterceptor" visibility="public" type="_u-qioOUTEd-P08Bciq_LqQ" aggregation="composite">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_MGWDYPTXEeCn1-FCrfecFg" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_MGfNUPTXEeCn1-FCrfecFg" value="1"/>
<defaultValue xmi:type="uml:LiteralString" xmi:id="_MGz9cPTXEeCn1-FCrfecFg">
<value xsi:nil="true"/>
</defaultValue>
</ownedAttribute>
- <ownedAttribute xmi:id="_jXX54PTXEeCn1-FCrfecFg" name="eventPool" visibility="public" aggregation="composite">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_jXX54PTXEeCn1-FCrfecFg" name="eventPool" visibility="public" aggregation="composite">
<type xmi:type="uml:Class" href="pathmap://QML_CORE/core.uml#_JRmo0PNAEeCovO8AYZymZQ"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_l6kPYPTXEeCn1-FCrfecFg" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_l6k2cPTXEeCn1-FCrfecFg" value="1"/>
@@ -277,14 +262,14 @@ out->writeEvent (event);
<value xsi:nil="true"/>
</defaultValue>
</ownedAttribute>
- <ownedAttribute xmi:id="_mv6jAPTXEeCn1-FCrfecFg" name="stateMachine" visibility="public" type="_ens7QOUTEd-P08Bciq_LqQ" aggregation="composite">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_mv6jAPTXEeCn1-FCrfecFg" name="stateMachine" visibility="public" type="_ens7QOUTEd-P08Bciq_LqQ" aggregation="composite">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_ocG_EPTXEeCn1-FCrfecFg" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_ocHmIPTXEeCn1-FCrfecFg" value="1"/>
<defaultValue xmi:type="uml:LiteralString" xmi:id="_ocI0QPTXEeCn1-FCrfecFg">
<value xsi:nil="true"/>
</defaultValue>
</ownedAttribute>
- <ownedAttribute xmi:id="_vcPiUCWdEeGX6PuSE-DJlQ" name="thread" visibility="public" aggregation="composite">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_vcPiUCWdEeGX6PuSE-DJlQ" name="thread" visibility="public" aggregation="composite">
<type xmi:type="uml:Class" href="pathmap://QML_CORE/core.uml#_SiY_AP-EEd6628OhKk_dpg"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_yS4YQCWdEeGX6PuSE-DJlQ" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_yS4_UCWdEeGX6PuSE-DJlQ" value="1"/>
@@ -292,35 +277,35 @@ out->writeEvent (event);
<value xsi:nil="true"/>
</defaultValue>
</ownedAttribute>
- <ownedConnector xmi:id="_-DJY8PTXEeCn1-FCrfecFg" name="Connector-SM-Pool">
- <end xmi:id="_-DKnEPTXEeCn1-FCrfecFg" partWithPort="_mv6jAPTXEeCn1-FCrfecFg" role="_u7pk4PRUEeCKVJwdD4MMsg">
+ <ownedConnector xmi:type="uml:Connector" xmi:id="_-DJY8PTXEeCn1-FCrfecFg" name="Connector-SM-Pool">
+ <end xmi:type="uml:ConnectorEnd" xmi:id="_-DKnEPTXEeCn1-FCrfecFg" partWithPort="_mv6jAPTXEeCn1-FCrfecFg" role="_u7pk4PRUEeCKVJwdD4MMsg">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_-DKnEvTXEeCn1-FCrfecFg" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_-DKnEfTXEeCn1-FCrfecFg" value="1"/>
</end>
- <end xmi:id="_-DL1MPTXEeCn1-FCrfecFg" partWithPort="_jXX54PTXEeCn1-FCrfecFg">
+ <end xmi:type="uml:ConnectorEnd" xmi:id="_-DL1MPTXEeCn1-FCrfecFg" partWithPort="_jXX54PTXEeCn1-FCrfecFg">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_-DL1MvTXEeCn1-FCrfecFg" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_-DL1MfTXEeCn1-FCrfecFg" value="1"/>
<role xmi:type="uml:Port" href="pathmap://QML_CORE/core.uml#_MzO8gPNAEeCovO8AYZymZQ"/>
</end>
</ownedConnector>
- <ownedConnector xmi:id="_nILRMPUHEeCn1-FCrfecFg" name="connector-CallEvent-Pool">
- <end xmi:id="_nIL4QPUHEeCn1-FCrfecFg" partWithPort="_LyxAEPTXEeCn1-FCrfecFg" role="_a4NKMOuMEeCTfOY57pgE3w">
+ <ownedConnector xmi:type="uml:Connector" xmi:id="_nILRMPUHEeCn1-FCrfecFg" name="connector-CallEvent-Pool">
+ <end xmi:type="uml:ConnectorEnd" xmi:id="_nIL4QPUHEeCn1-FCrfecFg" partWithPort="_LyxAEPTXEeCn1-FCrfecFg" role="_a4NKMOuMEeCTfOY57pgE3w">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_nIL4QvUHEeCn1-FCrfecFg" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_nIL4QfUHEeCn1-FCrfecFg" value="1"/>
</end>
- <end xmi:id="_nIMfUPUHEeCn1-FCrfecFg" partWithPort="_jXX54PTXEeCn1-FCrfecFg">
+ <end xmi:type="uml:ConnectorEnd" xmi:id="_nIMfUPUHEeCn1-FCrfecFg" partWithPort="_jXX54PTXEeCn1-FCrfecFg">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_nIMfUvUHEeCn1-FCrfecFg" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_nIMfUfUHEeCn1-FCrfecFg" value="1"/>
<role xmi:type="uml:Port" href="pathmap://QML_CORE/core.uml#_MzO8gPNAEeCovO8AYZymZQ"/>
</end>
</ownedConnector>
- <ownedConnector xmi:id="__zI4QCWdEeGX6PuSE-DJlQ" name="connector-SM-thread">
- <end xmi:id="__zI4QSWdEeGX6PuSE-DJlQ" partWithPort="_mv6jAPTXEeCn1-FCrfecFg">
+ <ownedConnector xmi:type="uml:Connector" xmi:id="__zI4QCWdEeGX6PuSE-DJlQ" name="connector-SM-thread">
+ <end xmi:type="uml:ConnectorEnd" xmi:id="__zI4QSWdEeGX6PuSE-DJlQ" partWithPort="_mv6jAPTXEeCn1-FCrfecFg">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="__zI4QyWdEeGX6PuSE-DJlQ" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="__zI4QiWdEeGX6PuSE-DJlQ" value="1"/>
<role xmi:type="uml:Port" href="pathmap://QML_CORE/core.uml#__SLXgNtxEd6nqsBVkgJEEA"/>
</end>
- <end xmi:id="__zJfUCWdEeGX6PuSE-DJlQ" partWithPort="_vcPiUCWdEeGX6PuSE-DJlQ">
+ <end xmi:type="uml:ConnectorEnd" xmi:id="__zJfUCWdEeGX6PuSE-DJlQ" partWithPort="_vcPiUCWdEeGX6PuSE-DJlQ">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="__zJfUiWdEeGX6PuSE-DJlQ" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="__zJfUSWdEeGX6PuSE-DJlQ" value="1"/>
<role xmi:type="uml:Port" href="pathmap://QML_CORE/core.uml#_ZjdOAP-EEd6628OhKk_dpg"/>
@@ -329,14 +314,14 @@ out->writeEvent (event);
</packagedElement>
<packagedElement xmi:type="uml:Class" xmi:id="_b1zNUOusEeCTfOY57pgE3w" name="StateMachine"/>
<packagedElement xmi:type="uml:Class" xmi:id="_IeWosF81EeGbQoflzrdx0g" name="StateMachineWCallEventsAndAnim">
- <ownedAttribute xmi:id="_IeWosV81EeGbQoflzrdx0g" name="callEventInterceptor" visibility="public" type="_u-qioOUTEd-P08Bciq_LqQ" aggregation="composite">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_IeWosV81EeGbQoflzrdx0g" name="callEventInterceptor" visibility="public" type="_u-qioOUTEd-P08Bciq_LqQ" aggregation="composite">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_IeWos181EeGbQoflzrdx0g" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_IeWosl81EeGbQoflzrdx0g" value="1"/>
<defaultValue xmi:type="uml:LiteralString" xmi:id="_IeWotF81EeGbQoflzrdx0g">
<value xsi:nil="true"/>
</defaultValue>
</ownedAttribute>
- <ownedAttribute xmi:id="_IeWotV81EeGbQoflzrdx0g" name="eventPool" visibility="public" aggregation="composite">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_IeWotV81EeGbQoflzrdx0g" name="eventPool" visibility="public" aggregation="composite">
<type xmi:type="uml:Class" href="pathmap://QML_CORE/core.uml#_JRmo0PNAEeCovO8AYZymZQ"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_IeWot181EeGbQoflzrdx0g" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_IeWotl81EeGbQoflzrdx0g" value="1"/>
@@ -344,14 +329,14 @@ out->writeEvent (event);
<value xsi:nil="true"/>
</defaultValue>
</ownedAttribute>
- <ownedAttribute xmi:id="_IeXPwV81EeGbQoflzrdx0g" name="stateMachine" visibility="public" type="_ens7QOUTEd-P08Bciq_LqQ" aggregation="composite">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_IeXPwV81EeGbQoflzrdx0g" name="stateMachine" visibility="public" type="_ens7QOUTEd-P08Bciq_LqQ" aggregation="composite">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_IeXPw181EeGbQoflzrdx0g" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_IeXPwl81EeGbQoflzrdx0g" value="1"/>
<defaultValue xmi:type="uml:LiteralString" xmi:id="_IeXPxF81EeGbQoflzrdx0g">
<value xsi:nil="true"/>
</defaultValue>
</ownedAttribute>
- <ownedAttribute xmi:id="_IeXPxV81EeGbQoflzrdx0g" name="thread" visibility="public" aggregation="composite">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_IeXPxV81EeGbQoflzrdx0g" name="thread" visibility="public" aggregation="composite">
<type xmi:type="uml:Class" href="pathmap://QML_CORE/core.uml#_SiY_AP-EEd6628OhKk_dpg"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_IeXPx181EeGbQoflzrdx0g" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_IeXPxl81EeGbQoflzrdx0g" value="1"/>
@@ -359,87 +344,87 @@ out->writeEvent (event);
<value xsi:nil="true"/>
</defaultValue>
</ownedAttribute>
- <ownedAttribute xmi:id="_pTD04F81EeGbQoflzrdx0g" name="eclipseServer" visibility="public" type="_xELAwF81EeGbQoflzrdx0g" aggregation="shared">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_pTD04F81EeGbQoflzrdx0g" name="eclipseServer" visibility="public" type="_xELAwF81EeGbQoflzrdx0g" aggregation="shared">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_rhbJ4F81EeGbQoflzrdx0g" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_rhpMUF81EeGbQoflzrdx0g" value="1"/>
<defaultValue xmi:type="uml:LiteralString" xmi:id="_rhtdwF81EeGbQoflzrdx0g">
<value xsi:nil="true"/>
</defaultValue>
</ownedAttribute>
- <ownedConnector xmi:id="_IeXPyV81EeGbQoflzrdx0g" name="Connector-SM-Pool">
- <end xmi:id="_IeXPyl81EeGbQoflzrdx0g" partWithPort="_IeXPwV81EeGbQoflzrdx0g" role="_u7pk4PRUEeCKVJwdD4MMsg">
+ <ownedConnector xmi:type="uml:Connector" xmi:id="_IeXPyV81EeGbQoflzrdx0g" name="Connector-SM-Pool">
+ <end xmi:type="uml:ConnectorEnd" xmi:id="_IeXPyl81EeGbQoflzrdx0g" partWithPort="_IeXPwV81EeGbQoflzrdx0g" role="_u7pk4PRUEeCKVJwdD4MMsg">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_IeXPzF81EeGbQoflzrdx0g" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_IeXPy181EeGbQoflzrdx0g" value="1"/>
</end>
- <end xmi:id="_IeXPzV81EeGbQoflzrdx0g" partWithPort="_IeWotV81EeGbQoflzrdx0g">
+ <end xmi:type="uml:ConnectorEnd" xmi:id="_IeXPzV81EeGbQoflzrdx0g" partWithPort="_IeWotV81EeGbQoflzrdx0g">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_IeXPz181EeGbQoflzrdx0g" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_IeXPzl81EeGbQoflzrdx0g" value="1"/>
<role xmi:type="uml:Port" href="pathmap://QML_CORE/core.uml#_MzO8gPNAEeCovO8AYZymZQ"/>
</end>
</ownedConnector>
- <ownedConnector xmi:id="_IeXP0F81EeGbQoflzrdx0g" name="connector-CallEvent-Pool">
- <end xmi:id="_IeXP0V81EeGbQoflzrdx0g" partWithPort="_IeWosV81EeGbQoflzrdx0g" role="_a4NKMOuMEeCTfOY57pgE3w">
+ <ownedConnector xmi:type="uml:Connector" xmi:id="_IeXP0F81EeGbQoflzrdx0g" name="connector-CallEvent-Pool">
+ <end xmi:type="uml:ConnectorEnd" xmi:id="_IeXP0V81EeGbQoflzrdx0g" partWithPort="_IeWosV81EeGbQoflzrdx0g" role="_a4NKMOuMEeCTfOY57pgE3w">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_IeXP0181EeGbQoflzrdx0g" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_IeXP0l81EeGbQoflzrdx0g" value="1"/>
</end>
- <end xmi:id="_IeXP1F81EeGbQoflzrdx0g" partWithPort="_IeWotV81EeGbQoflzrdx0g">
+ <end xmi:type="uml:ConnectorEnd" xmi:id="_IeXP1F81EeGbQoflzrdx0g" partWithPort="_IeWotV81EeGbQoflzrdx0g">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_IeXP1l81EeGbQoflzrdx0g" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_IeXP1V81EeGbQoflzrdx0g" value="1"/>
<role xmi:type="uml:Port" href="pathmap://QML_CORE/core.uml#_MzO8gPNAEeCovO8AYZymZQ"/>
</end>
</ownedConnector>
- <ownedConnector xmi:id="_IeXP1181EeGbQoflzrdx0g" name="connector-SM-thread">
- <end xmi:id="_IeXP2F81EeGbQoflzrdx0g" partWithPort="_IeXPwV81EeGbQoflzrdx0g">
+ <ownedConnector xmi:type="uml:Connector" xmi:id="_IeXP1181EeGbQoflzrdx0g" name="connector-SM-thread">
+ <end xmi:type="uml:ConnectorEnd" xmi:id="_IeXP2F81EeGbQoflzrdx0g" partWithPort="_IeXPwV81EeGbQoflzrdx0g">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_IeXP2l81EeGbQoflzrdx0g" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_IeXP2V81EeGbQoflzrdx0g" value="1"/>
<role xmi:type="uml:Port" href="pathmap://QML_CORE/core.uml#__SLXgNtxEd6nqsBVkgJEEA"/>
</end>
- <end xmi:id="_IeXP2181EeGbQoflzrdx0g" partWithPort="_IeXPxV81EeGbQoflzrdx0g">
+ <end xmi:type="uml:ConnectorEnd" xmi:id="_IeXP2181EeGbQoflzrdx0g" partWithPort="_IeXPxV81EeGbQoflzrdx0g">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_IeXP3V81EeGbQoflzrdx0g" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_IeXP3F81EeGbQoflzrdx0g" value="1"/>
<role xmi:type="uml:Port" href="pathmap://QML_CORE/core.uml#_ZjdOAP-EEd6628OhKk_dpg"/>
</end>
</ownedConnector>
- <ownedConnector xmi:id="_G9Gb4F82EeGbQoflzrdx0g" name="Connector1">
- <end xmi:id="_G9HC8F82EeGbQoflzrdx0g" partWithPort="_IeXPwV81EeGbQoflzrdx0g" role="_xUE3QF8wEeGerN33d-RdRg">
+ <ownedConnector xmi:type="uml:Connector" xmi:id="_G9Gb4F82EeGbQoflzrdx0g" name="Connector1">
+ <end xmi:type="uml:ConnectorEnd" xmi:id="_G9HC8F82EeGbQoflzrdx0g" partWithPort="_IeXPwV81EeGbQoflzrdx0g" role="_xUE3QF8wEeGerN33d-RdRg">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_G9HC8l82EeGbQoflzrdx0g" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_G9HC8V82EeGbQoflzrdx0g" value="1"/>
</end>
- <end xmi:id="_G9HqAF82EeGbQoflzrdx0g" partWithPort="_pTD04F81EeGbQoflzrdx0g" role="_z94Y0F81EeGbQoflzrdx0g">
+ <end xmi:type="uml:ConnectorEnd" xmi:id="_G9HqAF82EeGbQoflzrdx0g" partWithPort="_pTD04F81EeGbQoflzrdx0g" role="_z94Y0F81EeGbQoflzrdx0g">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_G9HqAl82EeGbQoflzrdx0g" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_G9HqAV82EeGbQoflzrdx0g" value="1"/>
</end>
</ownedConnector>
</packagedElement>
</packagedElement>
- <profileApplication xmi:id="_e8kikOUUEd-P08Bciq_LqQ">
- <eAnnotations xmi:id="_fAD7cOUUEd-P08Bciq_LqQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_e8kikOUUEd-P08Bciq_LqQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_fAD7cOUUEd-P08Bciq_LqQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/FCM/1#/"/>
</eAnnotations>
- <appliedProfile href="pathmap://FCM_PROFILES/FCM.profile.uml#_5mvT0MtjEd2H_o0jIC6qDQ"/>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://FCM_PROFILES/FCM.profile.uml#_5mvT0MtjEd2H_o0jIC6qDQ"/>
</profileApplication>
- <profileApplication xmi:id="_cnmBUBE1EeG3cfLoiI6G7g">
- <eAnnotations xmi:id="_cz4J0BE1EeG3cfLoiI6G7g" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_cnmBUBE1EeG3cfLoiI6G7g">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_cz4J0BE1EeG3cfLoiI6G7g" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/C_Cpp/1#/"/>
</eAnnotations>
- <appliedProfile href="pathmap://PapyrusC_Cpp_PROFILES/C_Cpp.profile.uml#_j9REUByGEduN1bTiWJ0lyw"/>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://PapyrusC_Cpp_PROFILES/C_Cpp.profile.uml#_j9REUByGEduN1bTiWJ0lyw"/>
</profileApplication>
</uml:Model>
<FCM:InteractionComponent xmi:id="_hanSUOUUEd-P08Bciq_LqQ" base_Class="_u-qioOUTEd-P08Bciq_LqQ"/>
<FCM:Template xmi:id="_9E8EUOUUEd-P08Bciq_LqQ" base_Element="_2qJyMOUUEd-P08Bciq_LqQ" kind="LoopOperations">
- <helper href="pathmap://QML_CORE/core.uml#_nLe_sHJDEeOMF7YEvnQt5g"/>
+ <helper xmi:type="FCM:BindingHelper" href="pathmap://QML_CORE/core.uml#_nLe_sHJDEeOMF7YEvnQt5g"/>
</FCM:Template>
<FCM:Port xmi:id="_a45twOuMEeCTfOY57pgE3w" base_Port="_a4NKMOuMEeCTfOY57pgE3w">
- <kind href="pathmap://QML_CORE/core.uml#_9Fif4FRxEd6GqrP6fkWBoQ"/>
+ <kind xmi:type="FCM:PortKind" href="pathmap://QML_CORE/core.uml#_9Fif4FRxEd6GqrP6fkWBoQ"/>
</FCM:Port>
<FCM:ContainerRule xmi:id="_gsWFgOusEeCTfOY57pgE3w" base_Class="_b1zNUOusEeCTfOY57pgE3w" extensionKind="Aggregation" extension="_uC4BwOusEeCTfOY57pgE3w"/>
<FCM:ContainerRule xmi:id="_IDtioO68EeCZ9MjsZTV1zw" base_Class="_CV_x4O68EeCZ9MjsZTV1zw" extensionKind="InterceptAllPorts" interceptor="_hanSUOUUEd-P08Bciq_LqQ"/>
<FCM:Port xmi:id="_u7qzAPRUEeCKVJwdD4MMsg" base_Port="_u7pk4PRUEeCKVJwdD4MMsg">
- <kind href="pathmap://QML_CORE/core.uml#_9Fif4FRxEd6GqrP6fkWBoQ"/>
+ <kind xmi:type="FCM:PortKind" href="pathmap://QML_CORE/core.uml#_9Fif4FRxEd6GqrP6fkWBoQ"/>
</FCM:Port>
<FCM:ContainerRule xmi:id="_RmD0YPTXEeCn1-FCrfecFg" base_Class="_18qdsO67EeCZ9MjsZTV1zw"/>
<FCM:InterceptionRule xmi:id="_Z5CnUPUQEeCn1-FCrfecFg" interceptionKind="InterceptAllIn" base_Property="_LyxAEPTXEeCn1-FCrfecFg"/>
- <C_Cpp:Include xmi:id="_eGpZQBE1EeG3cfLoiI6G7g" body="#include &lt;OS_AL/Tracing/Trace.h>&#xA;" base_class="_ens7QOUTEd-P08Bciq_LqQ"/>
+ <C_Cpp:Include xmi:id="_eGpZQBE1EeG3cfLoiI6G7g" body="#include &lt;OS_AL/Tracing/Trace.h>&#xA;&#xA;#ifdef SM_VERBOSE&#xA;#include &lt;iostream>&#xA;using namespace std;&#xA;#endif&#xA;" base_class="_ens7QOUTEd-P08Bciq_LqQ"/>
<FCM:InstanceConfigurator xmi:id="_QQYfQCNYEeGj_4swHBbKwg" base_Class="_KEMp0CNYEeGj_4swHBbKwg"/>
<FCM:UseInstanceConfigurator xmi:id="_StgB8CNYEeGj_4swHBbKwg" base_Class="_u-qioOUTEd-P08Bciq_LqQ" configurator="_QQYfQCNYEeGj_4swHBbKwg"/>
<FCM:ConfigurationProperty xmi:id="_uhdD8CVvEeGaL60JjVj19Q" base_Property="_bL0sACVvEeGaL60JjVj19Q"/>
@@ -450,15 +435,15 @@ out->writeEvent (event);
<source xmi:type="uml:Operation" href="pathmap://QML_CORE/sysinterfaces.uml#_W7YrADz6Ed-v9PxuTj6Elw"/>
</FCM:DerivedElement>
<FCM:Template xmi:id="_nngKECaiEeGRo-gX9igNzw" base_Element="_b5mYgCaiEeGRo-gX9igNzw">
- <helper href="pathmap://QML_CORE/core.uml#_7qhTUHkgEeOCpqruXGWNPw"/>
+ <helper xmi:type="FCM:BindingHelper" href="pathmap://QML_CORE/core.uml#_7qhTUHkgEeOCpqruXGWNPw"/>
</FCM:Template>
<FCM:Port xmi:id="_JZGWgF8xEeGerN33d-RdRg" base_Port="_xUE3QF8wEeGerN33d-RdRg">
- <kind href="pathmap://QML_CORE/core.uml#_9Fif4FRxEd6GqrP6fkWBoQ"/>
+ <kind xmi:type="FCM:PortKind" href="pathmap://QML_CORE/core.uml#_9Fif4FRxEd6GqrP6fkWBoQ"/>
</FCM:Port>
<FCM:ContainerRule xmi:id="_IeZE8F81EeGbQoflzrdx0g" base_Class="_IeWosF81EeGbQoflzrdx0g"/>
<FCM:InterceptionRule xmi:id="_IeaTEF81EeGbQoflzrdx0g" interceptionKind="InterceptAllIn" base_Property="_IeWosV81EeGbQoflzrdx0g"/>
<FCM:Port xmi:id="_5cn5cF81EeGbQoflzrdx0g" base_Port="_z94Y0F81EeGbQoflzrdx0g">
- <kind href="pathmap://QML_CORE/core.uml#_wySlkFRxEd6GqrP6fkWBoQ"/>
+ <kind xmi:type="FCM:PortKind" href="pathmap://QML_CORE/core.uml#_wySlkFRxEd6GqrP6fkWBoQ"/>
</FCM:Port>
<FCM:Singleton xmi:id="_uqa34F_1EeGbQoflzrdx0g" base_Class="_xELAwF81EeGbQoflzrdx0g"/>
<FCM:DerivedElement xmi:id="_bmnIYF_4EeGbQoflzrdx0g" base_Element="_bmbiMF_4EeGbQoflzrdx0g" source="_N3m-oF8wEeGerN33d-RdRg"/>
@@ -467,10 +452,10 @@ out->writeEvent (event);
<FCM:UseInstanceConfigurator xmi:id="_VnhuMGGDEeO2F4QRMDSOXg" base_Class="_xELAwF81EeGbQoflzrdx0g" configurator="_SdiecGGDEeO2F4QRMDSOXg"/>
<FCM:Singleton xmi:id="_JOwQEHg_EeOejZqJpKQeww" base_Class="_B0gFAHg_EeOejZqJpKQeww"/>
<FCM:Port xmi:id="_hw3T8Hg_EeOejZqJpKQeww" base_Port="_ZXYggHg_EeOejZqJpKQeww">
- <kind href="pathmap://QML_CORE/core.uml#_9Fif4FRxEd6GqrP6fkWBoQ"/>
+ <kind xmi:type="FCM:PortKind" href="pathmap://QML_CORE/core.uml#_9Fif4FRxEd6GqrP6fkWBoQ"/>
</FCM:Port>
<FCM:Port xmi:id="_ncWQEHg_EeOejZqJpKQeww" base_Port="_MLu-kHg_EeOejZqJpKQeww">
- <kind href="pathmap://QML_CORE/core.uml#_wySlkFRxEd6GqrP6fkWBoQ"/>
+ <kind xmi:type="FCM:PortKind" href="pathmap://QML_CORE/core.uml#_wySlkFRxEd6GqrP6fkWBoQ"/>
</FCM:Port>
<FCM:UseInstanceConfigurator xmi:id="_4HKnkHg_EeOejZqJpKQeww" base_Class="_B0gFAHg_EeOejZqJpKQeww" configurator="_SdiecGGDEeO2F4QRMDSOXg"/>
<FCM:DerivedElement xmi:id="_MYSHwHk6EeOph7IIHUnNoA" base_Element="_MYPEcHk6EeOph7IIHUnNoA">
@@ -478,4 +463,7 @@ out->writeEvent (event);
</FCM:DerivedElement>
<FCM:DerivedElement xmi:id="_hQPjMHk8EeOh_8tymvdOOg" base_Element="_hQJckHk8EeOh_8tymvdOOg" source="_N3m-oF8wEeGerN33d-RdRg"/>
<FCM:DerivedElement xmi:id="_hQW38Hk8EeOh_8tymvdOOg" base_Element="_hQSmgHk8EeOh_8tymvdOOg" source="_ZgY_oF8wEeGerN33d-RdRg"/>
+ <FCM:Template xmi:id="_9beBINnwEeS6rKPQ4VNKkA" base_Element="_3GbAwCWSEeGB3KV6qwTHBw">
+ <helper xmi:type="FCM:BindingHelper" href="pathmap://QML_CORE/core.uml#_7qhTUHkgEeOCpqruXGWNPw"/>
+ </FCM:Template>
</xmi:XMI>
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/AMIPull.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/AMIPull.xtend
new file mode 100644
index 00000000000..d1e1fb28303
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/AMIPull.xtend
@@ -0,0 +1,34 @@
+package org.eclipse.papyrus.qompass.modellibs.core.xtend
+
+import org.eclipse.uml2.uml.Operation
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.Marshalling.*
+
+class AMIPull {
+ def operation_(Operation operation) '''
+ «IF operation.name.endsWith("Poll")»
+ // comment polling function
+ if (!resultArrived) {
+ // wait for result, condition will be fired upon arrival
+ TimeVal timeVal = TimeVal::current () + timeout;
+ m_cond.waitUpto (timeout);
+ }
+ «operation.unmarshall»
+ }
+ «IF operation.type != null»return retValue;«ENDIF»
+ «ELSE»
+ // TODO: need suitable constant dimensioning
+ pBuffer = &buffer[500]; // grows backwards
+ int operationID = ID_[operation.name/];
+
+ // now marshall in and inout parameters via ASN.1
+ «operation.marshall»
+ BEncAsnContent (&amp;pBuffer, &amp;operationID);
+
+ pthread_t pt;
+ pthread_create (&amp;pt, NULL, staticDispatch, (void *) this);
+ // TODO: add semaphore which assures that subsequent calls to [operation.name/] are not executed before dispatch
+ // has removed the parameters from the pBuffer stack (pBuffer can be corrupted).
+ // even worse: buffer will be deallocated even without a 2nd call!
+ «ENDIF»
+ '''
+} \ No newline at end of file
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/AsyncCalls.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/AsyncCalls.xtend
new file mode 100644
index 00000000000..fa7cb846212
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/AsyncCalls.xtend
@@ -0,0 +1,57 @@
+package org.eclipse.papyrus.qompass.modellibs.core.xtend
+
+import org.eclipse.uml2.uml.Operation
+import org.eclipse.uml2.uml.Class
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.CppUtils.*
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.Marshalling.*
+
+class AsyncCalls {
+ def asyncCall(Operation operation) '''
+ // TODO: need suitable constant dimensioning
+ pBuffer = &buffer[500]; // grows backwards
+ «operation.marshall»
+ int operationID = ID_[operation.name/];
+ BEncAsnContent (&amp;pBuffer, &amp;operationID);
+
+ pthread_t pt;
+ pthread_create (&amp;pt, NULL, staticDispatch, (void *) this);
+ // TODO: add semaphore which assures that subsequent calls to «operation.name» are not executed before dispatch
+ // has removed the parameters from the pBuffer stack (pBuffer can be corrupted).
+ '''
+
+ def dispatch_(Class clazz) '''
+ int operationID;
+ BDecAsnContent (&pBuffer, operationID);
+ switch (operationID) {
+ «FOR operation : clazz.ownedOperations»
+ case ID_«operation.name»
+ {
+
+ // delegate call to executor
+ rconn->«operation.cppCall»;
+ break;
+ }
+ «ENDFOR»
+ }
+ '''
+
+ def dispatchWithThreadPool(Class clazz) '''
+ int operationID;
+ BDecAsnContent (&pBuffer, operationID);
+ switch (operationID) {
+ «FOR operation : clazz.ownedOperations»
+ case ID_«operation.name»
+ {
+ «operation.unmarshall»
+ // delegate call to executor
+ rconn->«operation.cppCall»;
+ «IF operation.type != null»«operation.type.cppType» ret = «ENDIF»rconn->«operation.cppCall»;
+ «operation.marshallOutInout»
+ resultsReady = 1;
+ break;
+ }
+ «ENDFOR»
+ }
+ }
+ '''
+} \ No newline at end of file
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/BehaviorUtil.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/BehaviorUtil.java
new file mode 100644
index 00000000000..e815c2c332b
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/BehaviorUtil.java
@@ -0,0 +1,111 @@
+package org.eclipse.papyrus.qompass.modellibs.core.xtend;
+
+import org.eclipse.uml2.uml.Behavior;
+import org.eclipse.uml2.uml.BehavioredClassifier;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.OpaqueBehavior;
+import org.eclipse.uml2.uml.OpaqueExpression;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Parameter;
+import org.eclipse.uml2.uml.ParameterDirectionKind;
+import org.eclipse.uml2.uml.Transition;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLPackage;
+
+public class BehaviorUtil {
+ private static final String DEFAULT_LANGUAGE = "C++"; //$NON-NLS-1$
+
+ public static void set(Behavior behavior, String selectLanguage, String textblock) {
+ if (behavior instanceof OpaqueBehavior) {
+ OpaqueBehavior ob = (OpaqueBehavior) behavior;
+ if (ob.getLanguages().size() == 0) {
+ ob.getLanguages().add(DEFAULT_LANGUAGE);
+ ob.getBodies().add(textblock);
+ }
+ else {
+ int i = 0;
+ for (String language : ob.getLanguages()) {
+ if (selectLanguage.equals(language)) {
+ if (i < ob.getBodies().size()) {
+ ob.getBodies().set(i, textblock);
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ public static void set(Behavior behavior, String textblock) {
+ set(behavior, DEFAULT_LANGUAGE, textblock);
+ }
+
+ public static OpaqueBehavior createOpaqueBehavior(BehavioredClassifier clazz, Operation operation) {
+ OpaqueBehavior ob = (OpaqueBehavior)
+ clazz.createOwnedBehavior(operation.getName(), UMLPackage.eINSTANCE.getOpaqueBehavior());
+ ob.setSpecification(operation);
+ return ob;
+ }
+
+ public static OpaqueBehavior createOpaqueEffect(Transition transition) {
+ OpaqueBehavior ob = (OpaqueBehavior)
+ transition.createEffect("", UMLPackage.eINSTANCE.getOpaqueBehavior()); //$NON-NLS-1$
+ return ob;
+ }
+
+ public static OpaqueExpression createOpaqueExpression(Constraint constraint, String guardCode) {
+ OpaqueExpression oe = (OpaqueExpression)
+ constraint.createSpecification("", null, UMLPackage.eINSTANCE.getOpaqueExpression()); //$NON-NLS-1$
+ oe.getLanguages().add(DEFAULT_LANGUAGE);
+ oe.getBodies().add(guardCode);
+ return oe;
+ }
+
+ public static String body(Constraint constraint) {
+ if (constraint.getSpecification() instanceof OpaqueExpression) {
+ OpaqueExpression oe = (OpaqueExpression) constraint.getSpecification();
+ if (oe.getBodies().size() > 0) {
+ return oe.getBodies().get(0);
+ }
+ }
+ return constraint.getSpecification().stringValue();
+ }
+
+ /**
+ * Create an operation with an operation return type
+ *
+ * @param clazz
+ * @param name
+ * @param retType
+ * @return
+ */
+ public static Operation createOperation(Class clazz, String name, Type retType) {
+ Operation operation = clazz.createOwnedOperation(name, null, null);
+ if (retType != null) {
+ Parameter parameter = operation.createOwnedParameter("ret", retType); //$NON-NLS-1$
+ parameter.setDirection(ParameterDirectionKind.RETURN_LITERAL);
+ }
+ return operation;
+ }
+
+ public static String body(Behavior behavior) {
+ return body(behavior, DEFAULT_LANGUAGE);
+ }
+
+ public static String body(Behavior behavior, String selectLanguage) {
+ if (behavior instanceof OpaqueBehavior) {
+ OpaqueBehavior ob = (OpaqueBehavior) behavior;
+ int i = 0;
+ for (String language : ob.getLanguages()) {
+ if (selectLanguage.equals(language)) {
+ if (i < ob.getBodies().size()) {
+ return ob.getBodies().get(i);
+ }
+ break;
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/CppUtils.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/CppUtils.xtend
new file mode 100644
index 00000000000..fb028cc5f16
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/CppUtils.xtend
@@ -0,0 +1,81 @@
+package org.eclipse.papyrus.qompass.modellibs.core.xtend
+
+import org.eclipse.papyrus.qompass.designer.core.UMLTool
+import org.eclipse.uml2.uml.NamedElement
+import org.eclipse.uml2.uml.Operation
+import org.eclipse.uml2.uml.Parameter
+import org.eclipse.uml2.uml.ParameterDirectionKind
+import org.eclipse.uml2.uml.Type
+
+class CppUtils {
+
+ /**
+ * create the C++ signature for an operation (including parenthesis)
+ */
+ public static def cppSignature(Operation operation) '''
+ «operation.name»(«FOR parameter : operation.ownedParameters SEPARATOR(', ')»
+ «parameter.cppParameter»
+ «ENDFOR»
+ '''
+
+
+ /**
+ * make a C++ call, pass all parameters except the return parameter
+ */
+ public static def cppCall(Operation operation) '''
+ «operation.name»(«FOR parameter : UMLTool.parametersNonRet(operation) SEPARATOR(', ')»
+ «parameter.name»
+ «ENDFOR»)
+ '''
+
+ /**
+ * make a C++ call, pass all parameters except the return parameter, prefix with "return",
+ * if there is a return type in the operations declaration
+ */
+ public static def returnCppCall(Operation operation) '''
+ «IF (operation.type != null)»return «ENDIF»«operation.cppCall»
+ '''
+
+ public static def cppParameter(Parameter parameter) '''
+ «parameter.type»«IF (parameter.direction == ParameterDirectionKind.OUT)»_out«ENDIF» «parameter.name»
+ '''
+
+ public static def cppType(Type type) '''
+ «IF (type.qualifiedName == 'UMLPrimitiveTypes::Boolean')»
+ bool
+ «ELSEIF (type.qualifiedName == 'UMLPrimitiveTypes::Integer')»
+ int
+ «ELSE»
+ «UMLTool.dereferenceTypedef(type)»
+ «ENDIF»
+ '''
+
+
+ public static def cppRetType(Operation operation) '''
+ «IF (operation.type == null)»
+ void
+ «ELSE»
+ «operation.type.cppType»
+ «ENDIF»
+ '''
+
+ /**
+ * Open a set of C++ namespaces associated with the packages of of the passed named element
+ * TODO: use indentTab? => requires making this script recursive
+ * Need to include referenced types (assuming a naming convention?
+ */
+ public static def openNamespace(NamedElement namedElement) '''
+ «FOR ns : UMLTool.usedNamespaces(namedElement).reverse»
+ namespace «ns.name»
+ «ENDFOR»
+ '''
+
+ /**
+ * Close a set of C++ namespaces associated with the packages of of the passed named element
+ */
+ public static def closeNamespace(NamedElement namedElement) '''
+ «FOR ns : UMLTool.usedNamespaces(namedElement)»
+ }; // of namespace [ns.name/]
+ «ENDFOR»
+ '''
+} \ No newline at end of file
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/FIFO.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/FIFO.xtend
new file mode 100644
index 00000000000..59440deec7b
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/FIFO.xtend
@@ -0,0 +1,13 @@
+package org.eclipse.papyrus.qompass.modellibs.core.xtend
+
+import org.eclipse.uml2.uml.DataType
+import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationContext
+
+class FIFO {
+ def activate(DataType datatype) '''
+ if (m_size == 0) {
+ cerr << "Warning: size of FIFO is not properly configured (size = 0)" << endl;
+ }
+ m_fifo = new «TransformationContext.pkgTemplateParameter("T")»[m_size];
+ '''
+} \ No newline at end of file
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/GlobalConstants.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/GlobalConstants.xtend
new file mode 100644
index 00000000000..b2a19cce408
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/GlobalConstants.xtend
@@ -0,0 +1,56 @@
+/*******************************************************************************
+* Copyright (c) 2014 Zeligsoft (2009) Limited and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package org.eclipse.papyrus.qompass.modellibs.core.xtend
+
+class GlobalConstants {
+ public static val QUAL_NAME_SEP = "."
+ public static val FUNC_NAME_QUAL_NAME_SEP = "__"
+ public static val FUNC_NAME_PART_SEP = "____"
+ public static val INJECT_FUNC_NAME = "inject"
+ public static val INITIALIZE_FUNC_NAME = "initialize"
+ public static val STATE_FUNC_PREFIX = "state_"
+ public static val JUNCTION_FUNC_PREFIX = "junction_"
+ public static val CHOICE_FUNC_PREFIX = "choice_"
+ public static val ACTION_CHAIN_FUNC_PREFIX = "actionchain_"
+ public static val ACTION_FUNC_PREFIX = "action_"
+ public static val GUARD_FUNC_PREFIX = "guard_"
+ public static val USER_ACTION_FUNC_PREFIX = "useraction_"
+ public static val USER_GUARD_FUNC_PREFIX = "userguard_"
+ public static val EXIT_ACTION_FUNC_PREFIX = "exitaction_"
+ public static val ENTRY_ACTION_FUNC_PREFIX = "entryaction_"
+ public static val TRANS_ACTION_FUNC_PREFIX = "transitionaction_"
+ public static val SAVE_HISTORY_FUNC_NAME = "save_history"
+ public static val CHECK_HISTORY_FUNC_NAME = "check_history"
+ public static val CHECK_HISTORY_FUNC_PREFIX = "checkhistory_"
+ public static val CURRENT_STATE_FIELD_NAME = "currentState"
+ public static val HISTORY_TABLE_NAME = "history"
+ public static val UNDEFINED = "SPECIAL_INTERNAL_STATE_UNDEFINED"
+ public static val UNVISITED = "SPECIAL_INTERNAL_STATE_UNVISITED"
+ public static val STATE_TYPE_NAME = "State"
+ public static val PORT_TYPE_NAME = "Port"
+ public static val SIGNAL_TYPE_NAME = "Signal"
+ public static val INJECT_FUNC_PARAM = "msg"
+ public static val INITIALIZE_FUNC_PARAM = "msg"
+ public static val STATE_FUNC_PARAM = "msg"
+ public static val JUNC_FUNC_PARAM = "msg"
+ public static val CHOICE_FUNC_PARAM = "msg"
+ public static val CHAIN_FUNC_PARAM = "msg"
+ public static val ACTION_FUNC_PARAM = "msg"
+ public static val ACTION_DATA_VARIABLE = "rtdata"
+ public static val EMPTY_ACTION_COMMENT = "// (Automatically generated stub for an empty action)"
+ public static val MISSING_CODE_COMMENT = "// (No C++ code found for this action)"
+ public static val MISSING_CONSTRAINT_BODY = "false"
+ public static val FRESH_NAME_PREFIX = "new_"
+ public static val FRESH_ENTRYPOINT_NAME_PREFIX = "new_entrypoint_"
+ public static val FRESH_EXITPOINT_NAME_PREFIX = "new_exitpoint_"
+ public static val FRESH_CHOICEPOINT_NAME_PREFIX = "new_choice_"
+ public static val FRESH_JUNCTIONPOINT_NAME_PREFIX = "new_junction_"
+ public static var FRESH_TRANSITION_NAME_PREFIX = "new_transition_"
+
+} \ No newline at end of file
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/Marshalling.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/Marshalling.xtend
new file mode 100644
index 00000000000..02d93031b6a
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/Marshalling.xtend
@@ -0,0 +1,51 @@
+package org.eclipse.papyrus.qompass.modellibs.core.xtend
+
+import org.eclipse.uml2.uml.Operation
+import static extension org.eclipse.papyrus.qompass.designer.core.UMLTool.*
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.CppUtils.cppType
+import org.eclipse.uml2.uml.Parameter
+
+class Marshalling {
+ def static marshall(Operation operation) '''
+ // now marshall in and inout parameters via ASN.1
+ «FOR parameter : operation.parametersInInout»
+ «parameter.marshall»
+ «ENDFOR»
+ '''
+
+ def static marshallOutInout(Operation operation) '''
+ // now marshall out and inout parameters via ASN.1
+ «FOR parameter : operation.parametersOutInout»
+ «parameter.marshall»
+ «ENDFOR»
+ '''
+
+ def static marshall(Parameter parameter) '''
+ {
+ «parameter.type.cppType» varName_ASN = «parameter.name»;
+ BEncAsnContent (&pBuffer, &varName_ASN);
+ }
+ '''
+
+ def static unmarshall(Operation operation) '''
+ «FOR parameter : operation.parametersInInout.reverse»
+ «parameter.unmarshall»
+ «ENDFOR»
+ '''
+
+ def static unmarshallOutInout(Operation operation) '''
+ «FOR parameter : operation.parametersOutInout.reverse»
+ «parameter.unmarshall»
+ «ENDFOR»
+ '''
+
+ def static unmarshall(Parameter parameter) '''
+ «parameter.type.cppType» «parameter.name»
+ {
+ «parameter.type.cppType» varName_ASN;
+ BDecAsnContent (&pBuffer, &varName_ASN);
+ «parameter.name» = varName_ASN;
+ }
+ '''
+
+} \ No newline at end of file
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/MultipleReceptacle.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/MultipleReceptacle.xtend
new file mode 100644
index 00000000000..0f73ff273e2
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/MultipleReceptacle.xtend
@@ -0,0 +1,14 @@
+package org.eclipse.papyrus.qompass.modellibs.core.xtend
+
+import org.eclipse.uml2.uml.Operation
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.CppUtils.cppCall
+
+class MultipleReceptacle {
+ def operation_(Operation operation) '''
+ for (int i=0; i&lt;9; i++) {
+ if (rconn[i] != 0) {
+ rconn[i]->«operation.cppCall»;
+ }
+ }
+ '''
+} \ No newline at end of file
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/StateMachineGen.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/StateMachineGen.xtend
new file mode 100644
index 00000000000..3f3feae273d
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/StateMachineGen.xtend
@@ -0,0 +1,379 @@
+package org.eclipse.papyrus.qompass.modellibs.core.xtend
+
+import org.eclipse.emf.common.util.BasicEList
+import org.eclipse.emf.common.util.EList
+import org.eclipse.emf.ecore.util.EcoreUtil
+import org.eclipse.papyrus.C_Cpp.Ptr
+import org.eclipse.papyrus.FCM.DerivedElement
+import org.eclipse.papyrus.qompass.designer.core.StUtils
+import org.eclipse.papyrus.qompass.designer.core.Utils
+import org.eclipse.papyrus.qompass.designer.core.UMLTool
+import org.eclipse.papyrus.qompass.designer.core.extensions.IXtend
+import org.eclipse.papyrus.qompass.designer.core.sync.InterfaceSync
+import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationContext
+import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationException
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil
+import org.eclipse.uml2.uml.Behavior
+import org.eclipse.uml2.uml.BehavioredClassifier
+import org.eclipse.uml2.uml.CallEvent
+import org.eclipse.uml2.uml.Class
+import org.eclipse.uml2.uml.OpaqueExpression
+import org.eclipse.uml2.uml.Operation
+import org.eclipse.uml2.uml.Pseudostate
+import org.eclipse.uml2.uml.PseudostateKind
+import org.eclipse.uml2.uml.Reception
+import org.eclipse.uml2.uml.Signal
+import org.eclipse.uml2.uml.SignalEvent
+import org.eclipse.uml2.uml.State
+import org.eclipse.uml2.uml.StateMachine
+import org.eclipse.uml2.uml.TimeEvent
+import org.eclipse.uml2.uml.Transition
+import org.eclipse.uml2.uml.Trigger
+import org.eclipse.uml2.uml.Type
+import org.eclipse.uml2.uml.ValueSpecification
+import org.eclipse.uml2.uml.Vertex
+import org.eclipse.uml2.uml.util.UMLUtil
+
+import static org.eclipse.papyrus.qompass.designer.core.EnumService.*
+import static org.eclipse.papyrus.qompass.designer.vsl.ParseVSL.*
+
+import static extension org.eclipse.papyrus.qompass.designer.core.UMLTool.*
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.BehaviorUtil.*
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.CppUtils.cppCall
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.StateMachineUtil.*
+
+class StateMachineGen implements IXtend {
+
+ Class clazz
+
+ def getStateMachine(Class clazz) {
+ // organized in a loop. But effectively supports single state machine
+ for (smBehavior : (clazz as BehavioredClassifier).ownedBehaviors.filter[it instanceof StateMachine]) {
+ return smBehavior as StateMachine
+ }
+ return null
+ }
+
+ def activate(Class clazz) {
+ val sm = clazz.stateMachine
+ val flattener = new UMLFlattener
+ flattener.transform(sm)
+ activate(clazz, sm)
+ }
+
+ def activate(Class clazz, StateMachine sm) '''
+ m_currentState = STATE_«sm.region.initialState.name»;
+#ifdef SM_VERBOSE
+ cout << "SM «clazz.name»: in state «sm.region.initialState.name»" << endl;
+#endif
+ for (;;) {
+ processEvents();
+ }
+ '''
+
+ def processEvents(Class clazz) {
+ val sm = clazz.stateMachine
+ // - Option to put processElements into original class (but, would need to copy dependencies & attributes)
+ // create new operation in class owning the state machine.
+ // val operation = clazz.createOperation("processEvents", null)
+ // val ob = clazz.createOpaqueBehavior(operation)
+ // ob.set(clazz.processEventsSM(sm).toString)
+ // return "executor->processEvents();"
+ this.clazz = clazz
+ return clazz.processEventsSM(sm)
+ }
+
+ def eventInterceptor(Operation operation) '''
+ «/*TODO: need better way to detect signal*/»
+ «val derivedElement = UMLUtil.getStereotypeApplication(operation, DerivedElement)»
+ «IF derivedElement.source instanceof Reception»
+ «val signal = (derivedElement.source as Reception).signal»
+ // create event with global signal ID
+ core::ContainerServices::CallEvent_ event;
+ event.operationID = «literal(SIGNAL_ENUM, operation.name)»;
+ // map signal into value-buffer and copy attributes
+ ::«signal.qualifiedName» * signal = (::«signal.qualifiedName» *) &event.params;
+ «FOR attribute : signal.ownedAttributes»
+ signal->«attribute.name» = «attribute.name»;
+ «ENDFOR»
+ «Utils.getTop(operation).declareDependencyToSignalIDs»
+ «UMLTool.declareDependency(TransformationContext.classifier, signal)»
+ «ELSE»
+ // create event with operationID/portID and pass call
+ core::ContainerServices::CallEvent_ event;
+ event.operationID = ID_«operation.name»;
+ «ENDIF»
+ event.portID = portID;
+ out->writeEvent(event);
+
+ «IF (operation.type != null)»return «ENDIF»rconn->«operation.cppCall»;
+ '''
+
+ def processEventsSM(BehavioredClassifier clazz, StateMachine sm) '''
+ // processEvents body - generated by Qompass
+ //
+ // supports ports «FOR port : (clazz as Class).ownedPorts» «literal('PortEnum_'+clazz.name, 'port_'+clazz.name+'_'+port.name)»«ENDFOR»
+
+ core::ContainerServices::CallEvent_ event;
+ int timeout;
+ int newState;
+ bool needsTrigger;
+
+ switch(m_currentState) {
+ «FOR state : sm.region.subvertices»
+ case «literal('LStateIDs_'+clazz.name, 'STATE_'+state.name)»:
+ // -------- treatment of accepted events
+ «state.acceptableEvents»
+ break;
+ «ENDFOR»
+ default:
+ OSAL_ERROR ("Inconsistent state");
+ break;
+ }
+ if (animOut != 0) {
+ animOut->enterState(newState, «clazz.fragment»);
+ }
+ '''
+
+ /*
+ * Pass the actual to which the port is bound. In case of a CallEvent, pass the implemented interface
+ * (Not the class to which the state machine is bound)
+ */
+ def cetrigger(Operation operation) {
+ val packageRef = operation.implementsInterface.boundPackageRef
+ // declare dependency to OperationIDs enumeration
+ packageRef.declareDependencyToOperationIDs
+ '''«packageRef.qualifiedName»::ID_«operation.name»'''
+ }
+
+ // Use service for global enumerations
+ def setrigger(Trigger trigger) {
+ val se = trigger.event as SignalEvent
+ literal(SIGNAL_ENUM, InterfaceSync.SIG_PREFIX + se.signal.name)
+ }
+
+ /**
+ * create code for acceptable events
+ *
+ * big restriction: will only analyse first of possibly multiple triggers
+ */
+ def acceptableEvents(Vertex state) '''
+ // loop on state
+ // execute action ...
+ timeout = -1; // no timeout by default
+ «FOR transition : state.outgoings»
+ «IF transition.triggers.size > 0»
+ «val trigger = transition.triggers.get(0)»
+ «IF (trigger.event instanceof TimeEvent)»
+ «val timeEvent = trigger.event as TimeEvent»
+ // transition «transition.name» - trigger: TimeEvent, expression «(timeEvent.when.expr as OpaqueExpression).bodies.get(0)».
+ timeout = «getDurationFromVSL((timeEvent.when.expr as OpaqueExpression).bodies.get(0))»/1000;
+ «ENDIF»
+ «ENDIF»
+ «ENDFOR»
+
+ «IF ((state instanceof State) && (state as State).entry != null)»
+ // execute entry action
+ executor->«(state as State).entry.name»();
+ «ENDIF»
+
+ needsTrigger = true;
+
+ «IF hasTransitionWithoutTrigger(state)»
+ «FOR transition : state.outgoings»
+ «IF transition.triggers.size == 0»
+ «IF transition.guard != null»
+ «transition.guard.specification.createGuardFct(null)»
+ if (executor->«transition.guard.specification.name»()) {
+ «ENDIF»
+ newState = STATE_«transition.target.name»;
+#ifdef SM_VERBOSE
+ cout << "SM «clazz.name»: transition to state «transition.target.name»" << endl;
+#endif
+ «IF (transition.effect != null)»
+ executor->«effectName(transition)»();
+ «ENDIF»
+ needsTrigger = false;
+ «IF transition.guard != null»
+ }
+ «ENDIF»
+ «ENDIF»
+ «ENDFOR»
+ «ENDIF»
+
+ if (needsTrigger) {
+ // get an event from the pool.
+ event = ep->readEvent(timeout);
+ }
+ else {
+ event.operationID = -1;
+ }
+
+ «val allOutgoings = state.outgoings»
+ «FOR transition : allOutgoings»
+ «IF transition.triggers.size > 0»
+ // has «transition.triggers.size» outgoing transitions
+ «val trigger = transition.triggers.get(0)»
+ «IF (trigger.event instanceof TimeEvent)»
+ // transition «transition.name» - trigger: TimeEvent (there should be at most one outgoing timed transition per state).
+ if (event.operationID == core::ContainerServices::EventPool::ID_TIMEOUT) {
+ «IF transition.guard != null»
+ «transition.guard.specification.createGuardFct(null)»
+ if (executor->«transition.guard.specification.name»()) {
+ «ENDIF»
+ newState = STATE_«transition.target.name»;
+#ifdef SM_VERBOSE
+ cout << "SM «clazz.name»: transition to state «transition.target.name»" << endl;
+#endif
+ «IF (transition.effect != null)»
+ executor->«effectName(transition)»();
+ «ENDIF»
+ «IF transition.guard != null»
+ }
+ «ENDIF»
+ }
+ «ENDIF»
+ «IF (trigger.event instanceof CallEvent)»
+ // transition «trigger.name» - trigger: CallEvent («trigger.event.name»), operation «(trigger.event as CallEvent).operation.name»
+ if (event.operationID == «cetrigger((trigger.event as CallEvent).operation)») {
+ newState = STATE_«transition.target.name»;
+#ifdef SM_VERBOSE
+ cout << "SM «clazz.name»: transition to state «transition.target.name»" << endl;
+#endif
+ «IF (transition.effect != null)»
+ executor->«effectName(transition)»();
+ «ENDIF»
+ }
+ «ENDIF»
+ «IF (trigger.event instanceof SignalEvent)»
+ «val signalEvent = trigger.event as SignalEvent»
+ // transition «trigger.name» - trigger: SignalEvent («signalEvent.name»), signal «signalEvent.signal.name»
+ if (event.operationID == «setrigger(trigger)») {
+ «IF (transition.effect != null) || (transition.guard != null)»
+ // map signal to parameter section
+ ::«signalEvent.signal.qualifiedName» * signal = (::«signalEvent.signal.qualifiedName» *) &event.params;
+ «ENDIF»
+ «IF transition.guard != null»
+ «transition.guard.specification.createGuardFct(signalEvent)»
+ if (executor->«transition.guard.specification.name»(signal)) {
+ «ENDIF»
+ newState = STATE_«transition.target.name»;
+#ifdef SM_VERBOSE
+ cout << "SM «clazz.name»: transition to state «transition.target.name» (due to signal «signalEvent.signal.name»)" << endl;
+#endif
+ «IF (transition.effect != null)»
+ «transition.effect.addSignalParameter(signalEvent.signal)»
+ executor->«effectName(transition)»(«IF signalEvent.signal.attributes.size > 0»signal«ENDIF»);
+ «ENDIF»
+ // ok = EvQUEUE ;
+ «IF transition.guard != null»
+ }
+ «ENDIF»
+ }
+ «ENDIF»
+ «ENDIF»
+ «ENDFOR»
+
+ if (newState != m_currentState) {
+ m_currentState = newState;
+ «IF ((state instanceof State) && (state as State).exit != null)»
+ // execute exit action
+ executor->«(state as State).exit.name»();
+ «ENDIF»
+
+
+ }
+ '''
+
+ def boolean hasTransitionWithoutTrigger(Vertex state) {
+ for (transition : state.outgoings) {
+ if (transition.triggers.size == 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ def EList<Transition> calculateTransitions(Vertex state) {
+ val allOutgoings = new BasicEList<Transition>
+ allOutgoings.addAll(state.outgoings)
+ for (transition : state.outgoings) {
+ if (transition.target instanceof Pseudostate) {
+ val ps = transition.target as Pseudostate
+ if (ps.kind == PseudostateKind.JUNCTION_LITERAL) {
+ allOutgoings.addAll(ps.outgoings.clone)
+ }
+ }
+ }
+ return allOutgoings
+ }
+
+ /**
+ * Effects are moved from behaviors embedded into transitions towards behaviors of the class. Calculate the name of these
+ * effects. The class FilterStateMachines moves the effects (TODO: single name calculation)
+ */
+ def effectName(Transition transition) {
+ // transition.containingStateMachine.name + "_" + transition.effect.name
+ if (transition.effect.name == null) {
+ throw new TransformationException(
+ String.format("effect of transition has no name (in SM %s)", transition.containingStateMachine.name))
+ }
+ transition.effect.name
+ }
+
+ def void addSignalParameter(Behavior behavior, Signal signal) {
+ if (behavior.ownedParameters.size == 0) {
+ val parameter = behavior.createOwnedParameter("signal", signal)
+ StereotypeUtil.apply(parameter, Ptr)
+ }
+ }
+
+ def void moveBehavior(String newName, Class tmClass, Behavior effect) {
+ val copiedEffect = EcoreUtil.copy(effect)
+ if (tmClass.getOwnedOperation(newName, null, null) != null) {
+ // has already been added
+ return;
+ }
+ val operation = tmClass.createOwnedOperation(newName, null, null);
+ for (parameter : effect.getOwnedParameters()) {
+ val newParameter = EcoreUtil.copy(parameter);
+ operation.getOwnedParameters().add(newParameter);
+ StUtils.copyStereotypes(parameter, newParameter);
+ }
+ copiedEffect.setSpecification(operation);
+ copiedEffect.setName(newName);
+ tmClass.getOwnedBehaviors().add(copiedEffect);
+ }
+
+ static final String CLIB_BOOL = "AnsiCLibrary::bool"
+
+ def void createGuardFct(ValueSpecification specification, SignalEvent event) {
+ val name = specification.getName()
+
+ if (clazz.getOwnedBehavior(name) != null) {
+ return
+ }
+ var booleanNamedElement = Utils.getQualifiedElement(TransformationContext.sourceRoot, CLIB_BOOL);
+
+ if (booleanNamedElement instanceof Type) {
+ val booleanType = TransformationContext.copier.getCopy(booleanNamedElement) as Type
+ val operation = clazz.createOperation(name, booleanType as Type)
+ if (event != null) {
+ val sigParam = operation.createOwnedParameter("signal", event.signal)
+ StereotypeUtil.apply(sigParam, Ptr)
+ }
+ val ob = clazz.createOpaqueBehavior(operation)
+ if (specification instanceof OpaqueExpression) {
+ ob.getLanguages().addAll(specification.getLanguages());
+ for (String body : specification.getBodies()) {
+ ob.getBodies().add("return " + body + ";");
+ }
+ }
+ }
+ else {
+ System.out.println("was");
+ }
+ // if (tmClass.getOwnedOperation(newName, null, null) != null) {
+ // copiedEffect.setSpecification(operation);
+ }
+} \ No newline at end of file
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/StateMachineUtil.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/StateMachineUtil.java
new file mode 100644
index 00000000000..76818d91231
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/StateMachineUtil.java
@@ -0,0 +1,257 @@
+package org.eclipse.papyrus.qompass.modellibs.core.xtend;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.papyrus.qompass.designer.core.UMLTool;
+import org.eclipse.papyrus.qompass.designer.core.Utils;
+import org.eclipse.papyrus.qompass.designer.core.templates.TemplateUtils;
+import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationContext;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PackageableElement;
+import org.eclipse.uml2.uml.Pseudostate;
+import org.eclipse.uml2.uml.PseudostateKind;
+import org.eclipse.uml2.uml.Region;
+import org.eclipse.uml2.uml.State;
+import org.eclipse.uml2.uml.StateMachine;
+import org.eclipse.uml2.uml.TemplateBinding;
+import org.eclipse.uml2.uml.Transition;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.Vertex;
+
+
+public class StateMachineUtil {
+ public static Region region(State state) {
+ EList<Region> regions = state.getRegions();
+ if (regions.size() > 0) {
+ return regions.get(0);
+ }
+ return null;
+ }
+
+ public static Region region(StateMachine stateMachine) {
+ EList<Region> regions = stateMachine.getRegions();
+ if (regions.size() > 0) {
+ return regions.get(0);
+ }
+ return null;
+ }
+
+ public static EList<State> subStates(State state) {
+ Region region = region(state);
+ return (region != null) ? states(region) : new BasicEList<State>();
+ }
+
+ public static EList<State> states(StateMachine stateMachine) {
+ Region region = region(stateMachine);
+ return (region != null) ? states(region) : new BasicEList<State>();
+ }
+
+ public static EList<State> states(Region region) {
+ EList<State> states = new BasicEList<State>();
+ for (org.eclipse.uml2.uml.Vertex vertex : region.getSubvertices()) {
+ if (vertex instanceof State) {
+ states.add((State) vertex);
+ }
+ }
+ return states;
+ }
+
+ public static EList<Pseudostate> entryPoints(State state) {
+ EList<Pseudostate> pseudoStates = new BasicEList<Pseudostate>();
+ for (Pseudostate pseudoState : state.getConnectionPoints()) {
+ if (pseudoState.getKind() == PseudostateKind.ENTRY_POINT_LITERAL) {
+ pseudoStates.add(pseudoState);
+ }
+ }
+ return pseudoStates;
+ }
+
+ public static EList<Pseudostate> exitPoints(State state) {
+ EList<Pseudostate> pseudoStates = new BasicEList<Pseudostate>();
+ for (Pseudostate pseudoState : state.getConnectionPoints()) {
+ if (pseudoState.getKind() == PseudostateKind.EXIT_POINT_LITERAL) {
+ pseudoStates.add(pseudoState);
+ }
+ }
+ return pseudoStates;
+ }
+
+ public static EList<Pseudostate> junctionPoints(Region region) {
+ return filteredPseudoStates(region, PseudostateKind.JUNCTION_LITERAL);
+ }
+
+ public static EList<Pseudostate> choicePoints(Region region) {
+ return filteredPseudoStates(region, PseudostateKind.CHOICE_LITERAL);
+ }
+
+ public static EList<Pseudostate> filteredPseudoStates(Region region, PseudostateKind kind) {
+ EList<Pseudostate> pseudoStates = new BasicEList<Pseudostate>();
+ for (Vertex vertex : region.getSubvertices()) {
+ if (vertex instanceof Pseudostate) {
+ Pseudostate pseudoState = (Pseudostate) vertex;
+ if (pseudoState.getKind() == kind) {
+ pseudoStates.add(pseudoState);
+ }
+ }
+ }
+ return pseudoStates;
+ }
+
+ public static Pseudostate firstPseudoState(Region region, PseudostateKind kind) {
+ for (Vertex vertex : region.getSubvertices()) {
+ if (vertex instanceof Pseudostate) {
+ Pseudostate pseudoState = (Pseudostate) vertex;
+ if (pseudoState.getKind() == kind) {
+ return pseudoState;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return The set of all transitions ending indirectly on the state.
+ * This is, those which end on one of the state's entry points.
+ */
+ public static Collection<Transition> indirectIncomings(State state) {
+ EList<Transition> indirectIncoming = new BasicEList<Transition>();
+ for (Pseudostate p : entryPoints(state)) {
+ for (Transition t : p.getIncomings()) {
+ indirectIncoming.add(t);
+ }
+ }
+ return indirectIncoming;
+ }
+
+ /**
+ * @return The set of all transitions ending indirectly on the state.
+ * This is, those which end on one of the state's entry points.
+ */
+ public static Collection<Transition> indirectOutgoings(State state) {
+ EList<Transition> indirectIncoming = new BasicEList<Transition>();
+ for (Pseudostate p : entryPoints(state)) {
+ for (Transition t : p.getIncomings()) {
+ indirectIncoming.add(t);
+ }
+ }
+ return indirectIncoming;
+ }
+
+
+ /**
+ * @return The set of all direct and indirect incoming transitions to the state.
+ */
+ public static Collection<Transition> allIncomings(State state) {
+ EList<Transition> allIncoming = new BasicEList<Transition>();
+ for (Transition t : state.getIncomings()) {
+ allIncoming.add(t);
+ }
+ allIncoming.addAll(indirectIncomings(state));
+ return allIncoming;
+ }
+
+ /**
+ * @return The set of all direct and indirect incoming transitions to the state.
+ */
+ public static Collection<Transition> allOutgoings(State state) {
+ EList<Transition> allIncoming = new BasicEList<Transition>();
+ for (Transition t : state.getIncomings()) {
+ allIncoming.add(t);
+ }
+ allIncoming.addAll(indirectOutgoings(state));
+ return allIncoming;
+ }
+
+ /**
+ * Adds all the inner elements of a composite state to self, except for the
+ * initial, entry, exit and history pseudo-states.
+ *
+ * This operation moves those elements, as it removes them from their
+ * original container and sets their owner to the recipient.
+ */
+ public static void moveContents(Region targetRegion, State source) {
+ Region sourceRegion = region(source);
+ EList<Vertex> vertices = new BasicEList<Vertex>(sourceRegion.getSubvertices());
+ for (Vertex v : vertices) {
+ // move states and pseudostates
+ targetRegion.getSubvertices().add(v);
+ }
+ EList<Transition> transitions = new BasicEList<Transition>(sourceRegion.getTransitions());
+ for (Transition t : transitions) {
+ targetRegion.getTransitions().add(t);
+ }
+ }
+
+ public static Pseudostate initialState(Region region) {
+ return firstPseudoState(region, PseudostateKind.INITIAL_LITERAL);
+ }
+
+ public static Pseudostate deepHistory(Region region) {
+ return firstPseudoState(region, PseudostateKind.DEEP_HISTORY_LITERAL);
+ }
+
+ public static State createState(Region region, String name) {
+ return (State) region.createSubvertex(name, UMLPackage.eINSTANCE.getState());
+ }
+
+ public static Pseudostate createPseudostate(Region region, String name) {
+ return (Pseudostate) region.createSubvertex(name, UMLPackage.eINSTANCE.getPseudostate());
+ }
+
+ /**
+ * Return the bound package in the context of template instantiation for a given actual.
+ *
+ * This is required by the state machine template which needs to access operation IDs
+ * provided by the call interceptor.
+ *
+ * @param actual
+ * The actual for template binding
+ * @return
+ */
+ public static Package boundPackageRef(Type actual) {
+ for (Package nestedPkg : Utils.getTop(actual).getNestedPackages()) {
+ if (nestedPkg.getTemplateBindings().size() > 0) {
+ TemplateBinding binding = nestedPkg.getTemplateBindings().get(0);
+ if (actual == TemplateUtils.getFirstActualFromBinding(binding)) {
+ return nestedPkg;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Declares a dependency from the current classifier which is produced by template instantiation
+ * to the element (enum) "OperationIDs", if found within the passed package.
+ *
+ * @param pkg
+ * @return
+ */
+ public static void declareDependencyToOperationIDs(Package pkg) {
+ PackageableElement type = pkg.getPackagedElement("OperationIDs"); //$NON-NLS-1$
+ if (type instanceof Type) {
+ UMLTool.declareDependency(TransformationContext.classifier, (Type) type);
+ }
+ }
+
+ /**
+ * Declares a dependency from the current classifier which is produced by template instantiation
+ * to the element (enum) "SignalIDs", if found within the passed package.
+ *
+ * @param pkg
+ * the package in which an enumeration is looked up
+ * @return
+ */
+ public static void declareDependencyToSignalIDs(Package pkg) {
+ NamedElement type = Utils.getQualifiedElement(pkg, "globalenums::" + SIGNAL_ENUM); //$NON-NLS-1$
+ if (type instanceof Type) {
+ UMLTool.declareDependency(TransformationContext.classifier, (Type) type);
+ }
+ }
+
+ static final String SIGNAL_ENUM = "SignalIDs";
+}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/StructBasedMarshalling.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/StructBasedMarshalling.xtend
new file mode 100644
index 00000000000..89d085b3937
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/StructBasedMarshalling.xtend
@@ -0,0 +1,25 @@
+package org.eclipse.papyrus.qompass.modellibs.core.xtend
+
+import org.eclipse.uml2.uml.Operation
+import static extension org.eclipse.papyrus.qompass.designer.core.UMLTool.*
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.CppUtils.cppType
+
+// TODO: original model code does effectively do more than marshalling
+class StructBasedMarshalling {
+ def static marshall(Operation operation) '''
+ struct ParamData {
+ «FOR parameter : operation.parametersInInout»
+ «parameter.type.cppType» «parameter.name»;
+ «ENDFOR»
+ };
+ Event event;
+ event.ID = [operation.name/];
+ event.kind = CallEvent;
+ ParamData * data = &event.params;
+ «FOR parameter : operation.parametersInInout»
+ data->[parameter.name/] = [parameter.name/];
+ «ENDFOR»
+ out->dispatch(event);
+ '''
+
+} \ No newline at end of file
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/SyncCalls.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/SyncCalls.xtend
new file mode 100644
index 00000000000..96952f2f8d1
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/SyncCalls.xtend
@@ -0,0 +1,13 @@
+package org.eclipse.papyrus.qompass.modellibs.core.xtend
+
+import org.eclipse.uml2.uml.Operation
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.CppUtils.*
+
+class SyncCalls {
+ def syncCall(Operation operation) '''
+ // put pre-interceptors here
+ [comment type is a derived property containing the operations return type/]
+ «IF operation.type != null»return «ENDIF»rconn->«operation.cppCall»;
+ // put post-interceptors here
+ '''
+} \ No newline at end of file
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLAction.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLAction.xtend
new file mode 100644
index 00000000000..3cbc6f2da3a
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLAction.xtend
@@ -0,0 +1,58 @@
+/*******************************************************************************
+* Copyright (c) 2014 Zeligsoft, CEA and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package org.eclipse.papyrus.qompass.modellibs.core.xtend
+
+import org.eclipse.xtend.lib.annotations.Accessors
+import org.eclipse.uml2.uml.Behavior
+import java.util.List
+import java.util.ArrayList
+
+/**
+ * An action in the sense of the invocation of a behavior.
+ * This means that the actual behavior is not described here. The action
+ * is referencing the behavior and providing information how to invoke the
+ * behavior.
+ * The action has no prefix: the name of the referenced behavior needs to be prefixed, if necessary
+ *
+ * @author Ansgar (based on code from eposse)
+ *
+ */
+class UMLAction {
+
+ /** Source UMLRT model element. */
+ @Accessors Behavior origin
+
+ // list of parameters for a call, simply a list of strings. if null => no parameters
+ public List<String> callParams;
+
+ new(Behavior origin) {
+ this.origin = origin
+ }
+
+ /**
+ * Add a parameter
+ */
+ def addParam(String parameter) {
+ if (callParams == null) {
+ callParams = new ArrayList<String>()
+ }
+ callParams.add = parameter
+ }
+
+ def getSpecification() {
+ origin.specification
+ }
+
+ def getFuncName() {
+ origin.name
+ }
+
+ override toString() '''Action(«origin.name»)'''
+
+} \ No newline at end of file
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLChain.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLChain.xtend
new file mode 100644
index 00000000000..05bf596b9a6
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLChain.xtend
@@ -0,0 +1,91 @@
+/*******************************************************************************
+* Copyright (c) 2014 Zeligsoft (2009) Limited and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package org.eclipse.papyrus.qompass.modellibs.core.xtend
+
+import java.util.HashMap
+import java.util.List
+import java.util.Map
+import org.eclipse.uml2.uml.Behavior
+import org.eclipse.uml2.uml.Transition
+import org.eclipse.xtend.lib.annotations.Accessors
+
+/**
+ * A chain of state entry, exit and transition actions for a "flat"
+ * {@link Transition}.
+ *
+ * @author eposse
+ *
+ */
+class UMLChain {
+
+ @Accessors List<UMLAction> actions
+ @Accessors Transition owner
+
+ static Map<Transition, UMLChain> chains;
+
+ new () {
+ actions = newArrayList
+ }
+
+ new (List<UMLAction> actions) {
+ this.actions = newArrayList(actions) // We need this to be mutable.
+ }
+
+ def static void initChains() {
+ chains = new HashMap<Transition, UMLChain>();
+ }
+
+ /**
+ * Return the chain of behaviors associated with a transition
+ * IF the chain does not exist yet, it will be created (and stored in a hash map)
+ * @param t
+ * @return
+ */
+ def static UMLChain chain(Transition t) {
+ var UMLChain chain = chains.get(t)
+ if (chain == null) {
+ chain = new UMLChain()
+ chain.setOwner(t)
+ chains.put(t, chain)
+ }
+ return chain
+ }
+
+ def append(UMLAction action) {
+ actions.add(action)
+ return this
+ }
+
+ def append(Behavior behavior) {
+ if (behavior != null) {
+ append(new UMLAction(behavior))
+ }
+ return this
+ }
+
+ def prepend(UMLAction action) {
+ actions.add(0, action)
+ return this
+ }
+
+ def prepend(Behavior behavior) {
+ prepend(new UMLAction(behavior))
+ return this
+ }
+
+ def getOwner() {
+ owner
+ }
+
+ def setOwner(Transition t) {
+ owner = t
+ // add transition effect to action list
+ append(t.effect)
+ }
+} \ No newline at end of file
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLFlatModel2Cpp.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLFlatModel2Cpp.xtend
new file mode 100644
index 00000000000..fe1b522e4bf
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLFlatModel2Cpp.xtend
@@ -0,0 +1,667 @@
+/*******************************************************************************
+* Copyright (c) 2014 Zeligsoft, CEA and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+package org.eclipse.papyrus.qompass.modellibs.core.xtend
+
+import org.eclipse.uml2.uml.Port
+import org.eclipse.uml2.uml.Class
+import org.eclipse.uml2.uml.Property
+import org.eclipse.uml2.uml.State
+import org.eclipse.uml2.uml.StateMachine
+import org.eclipse.uml2.uml.Transition
+import java.util.Map
+import org.eclipse.uml2.uml.NamedElement
+import java.util.Collection
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.StateMachineUtil.*
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.BehaviorUtil.*
+import org.eclipse.uml2.uml.UMLPackage
+import org.eclipse.uml2.uml.Enumeration
+import org.eclipse.uml2.uml.EnumerationLiteral
+import org.eclipse.uml2.uml.Pseudostate
+import org.eclipse.uml2.uml.PseudostateKind
+import org.eclipse.uml2.uml.Operation
+import org.eclipse.uml2.uml.OpaqueBehavior
+import org.eclipse.uml2.uml.Parameter
+import org.eclipse.uml2.uml.CallEvent
+import org.eclipse.uml2.uml.Stereotype
+import org.eclipse.uml2.uml.Type
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.UMLChain.chain
+import java.util.List
+import org.eclipse.papyrus.qompass.designer.core.EnumService
+
+/**
+ * This class contains the transformation from flat UML-RT state machines to the
+ * C/C++ language model.
+ *
+ * It implements the algorithms described in the technical report
+ *
+ * E. Posse. "Transforming flat UML-RT State Machines to a C/C++ language model".
+ * Technical Report ZTR-2014-EP-002, Version 2, Zeligsoft, Sep 2014.
+ *
+ * Ansgar Radermacher (CEA): translation to UML transformation
+ * @author eposse
+ */
+class UMLFlatModel2Cpp {
+
+ /**
+ * The CppCodePattern that is being used for this transformation operation.
+ */
+
+ /** The source state machine to transform */
+ StateMachine machine
+ Class clazz
+
+ /** Elements that go into the generated model. */
+ Enumeration statesDeclaration
+ Property currentStateField
+ Map<State, EnumerationLiteral> stateEnumerators
+ Property historyTableDeclaration
+ Operation saveHistoryFunction
+ Map<Transition, OpaqueBehavior> actionChainFunctions
+ Map<Pseudostate, OpaqueBehavior> junctionPointFunctions
+ Map<Pseudostate, OpaqueBehavior> choicePointFunctions
+ Map<State, OpaqueBehavior> stateFunctions
+ Operation injectFunc
+ Operation initializeFunc
+ Stereotype refStereo
+ Stereotype constStereo
+
+ new() {
+ stateEnumerators = newHashMap
+ // userActionFunctions = newHashMap
+ actionChainFunctions = newHashMap
+ junctionPointFunctions = newHashMap
+ choicePointFunctions = newHashMap
+ stateFunctions = newHashMap
+ }
+
+ /**
+ * This is the main method of the transformation. It performs the
+ * transformation by invoking methods that generate each part of the
+ * target language model.
+ */
+ def transform(StateMachine m) {
+ machine = m
+ clazz = m.owner as Class
+
+ generateStatesDeclaration
+ generateCurrentStateField
+ generateHistoryTableDeclaration
+ generateSaveHistoryFunction
+ // generateAllUserActionFunctions
+ generateAllActionChainFunctions
+ generateAllJunctionFunctions
+ generateAllChoicePointFunctions
+ generateAllStateFunctions
+ generateInjectFunc
+ generateInitializeFunc
+ }
+
+ /**
+ * Builds an enum type for the states of the state machine.
+ *
+ * The generated code would be something like:
+ *
+ * <p><pre>
+ * <code>enum State { s0, s1, s1_s0, s1_s1, s2, ... };</code>
+ * </pre>
+ */
+ def generateStatesDeclaration() {
+
+ val clazz = machine.owner as Class
+ statesDeclaration = clazz.createNestedClassifier(GlobalConstants.STATE_TYPE_NAME,
+ UMLPackage.eINSTANCE.getEnumeration) as Enumeration
+ for (s : machine.states) {
+ if (s.name == null) {
+ s.name = "undefined"
+ }
+ val stateLiteral = statesDeclaration.createOwnedLiteral(s.name)
+ stateEnumerators.put(s, stateLiteral)
+ }
+ statesDeclaration.createOwnedLiteral(GlobalConstants.UNVISITED)
+
+ // stateEnumerators.put(State.UNVISITED, unvisitedStateLiteral)
+ }
+
+ /**
+ * Generates a field to hold the current state.
+ *
+ * The generated code would be something like:
+-- *
+ * <p><pre>
+ * <code>
+ * State currentState;
+ * </code>
+ * </pre>
+ */
+ def generateCurrentStateField() {
+ currentStateField = clazz.createOwnedAttribute(GlobalConstants.CURRENT_STATE_FIELD_NAME, statesDeclaration)
+ }
+
+ /**
+ * Generates a declaration for the history table for the state machine.
+ *
+ * The generated code would be something like:
+ *
+ * <p>
+ * <code>State[] history = { UNDEFINED, ..., UNDEFINED };
+ */
+ def generateHistoryTableDeclaration() {
+
+ // TODO: currentStateField already used (probably wrong!)
+ historyTableDeclaration = clazz.createOwnedAttribute(GlobalConstants.HISTORY_TABLE_NAME, statesDeclaration)
+ val numStates = machine.states.size
+
+ // use CppArray instead?
+ // TODO
+ // currentStateField.upper = numStates
+
+ // get constructor TODO
+ var ctor = clazz.getOwnedOperation(clazz.getName(), null, null)
+ var OpaqueBehavior ctorOB
+ if (ctor != null) {
+ ctorOB = ctor.methods.get(0) as OpaqueBehavior
+ }
+ if (ctor == null) {
+ ctor = clazz.createOperation(clazz.getName(), null)
+ ctorOB = clazz.createOpaqueBehavior(ctor)
+ }
+
+ // TODO: might be more than one constructor
+ ctorOB.set('''
+ int i = 0;
+ while (i<«numStates») {
+ «GlobalConstants.HISTORY_TABLE_NAME»[i++] = «GlobalConstants.UNVISITED»;
+ }''')
+ }
+
+ /**
+ * Generates a function that saves history.
+ *
+ * The code generated is as follows:
+ *
+ * <p><pre>
+ * <code>
+ * void saveHistory(State compositeState, State subState) {
+ * history[compositeState] = subState;
+ * }
+ * <code>
+ * </pre>
+ *
+ * where <code>State</code> is the capsule's state type (an enum) and
+ * <code>history</code> is the capsule's history table.
+ *
+ * <p><b>Note:</b> The current implementation generates this as a normal
+ * function but it should be either a macro or an inline function.
+ * However the C/C++ language model does not currently support these.
+ *
+ * @see
+ * #generateStatesDeclaration
+ * #generateHistoryTableDeclaration
+ */
+ def generateSaveHistoryFunction() {
+
+ // Create the operation programmatically. Yet, it would be better
+ // to provide a model template for this
+ // [LW container-transformation
+ // saveHist(State compositeState, State subState) {
+ // historyTable[param1] = param2;
+ // }
+ saveHistoryFunction = clazz.createOwnedOperation(GlobalConstants.SAVE_HISTORY_FUNC_NAME, null, null)
+ saveHistoryFunction.createOwnedParameter("compositeState", stateType)
+ saveHistoryFunction.createOwnedParameter("subState", stateType)
+ // behavior might exist already (created by flattener)
+ var funcOB = clazz.getOwnedBehavior(GlobalConstants.SAVE_HISTORY_FUNC_NAME)
+ if (funcOB == null) {
+ funcOB = clazz.createOpaqueBehavior(saveHistoryFunction)
+ }
+ else {
+ funcOB.specification = saveHistoryFunction
+ }
+ funcOB.set("history[compositeState] = subState;")
+ }
+
+ /**
+ * Generate function declarations for transition action chains.
+ *
+ * <p>Each function generated will have a sequence of calls, invoking either
+ * the action functions generated by {@link generateActionFunc} for
+ * transition, state entry and state exit actions, as well as invoking
+ * "save history" actions produced by the flattening transformation.
+ */
+ def generateAllActionChainFunctions() {
+ for (t : machine.region.transitions) {
+ val f = generateActionFunc(t)
+ actionChainFunctions.put(t, f)
+ }
+ }
+
+ /**
+ * Generates the function declaration for a single action chain.
+ */
+ def generateActionFunc(Transition t) {
+ val transitionFuncName = GlobalConstants.TRANS_ACTION_FUNC_PREFIX + "__" + t.name
+ val transitionFunc = clazz.createOwnedOperation(transitionFuncName, null, null)
+ transitionFunc.createRTMessageParam(GlobalConstants.CHAIN_FUNC_PARAM)
+ var transitionFuncOB = t.effect
+ if (transitionFuncOB == null) {
+ transitionFuncOB = clazz.createOpaqueBehavior(transitionFunc);
+ }
+ else {
+ transitionFuncOB.specification = transitionFunc
+ clazz.ownedBehaviors.add(transitionFuncOB)
+ }
+
+ val chainFuncName = GlobalConstants.ACTION_FUNC_PREFIX + "__" + t.name
+ val chainFunc = clazz.createOwnedOperation(chainFuncName, null, null)
+ chainFunc.createRTMessageParam(GlobalConstants.CHAIN_FUNC_PARAM)
+ val chainFuncOB = clazz.createOpaqueBehavior(chainFunc);
+
+ // now examine chain (separate function generateActionInvocation in original code)
+ // Generates a call to an action, either user action or action generated by
+ // the transformation.
+ var code = ""
+ for (action : t.chain.actions) {
+ code += call(action.specification, action.callParams)
+ }
+ chainFuncOB.set(code)
+ return chainFuncOB as OpaqueBehavior
+ }
+
+ // def Enumerator getEnum(CppEnum enum1, String string) {
+ // throw new UnsupportedOperationException("TODO: auto-generated method stub")
+ // }
+ /**
+ * Generates all functions corresponding to choice points.
+ */
+ def generateAllChoicePointFunctions() {
+ for (c : machine.region.choicePoints) {
+ val f = generateChoiceFunc(c)
+ choicePointFunctions.put(c, f)
+ }
+ }
+
+ /**
+ * Generates the function corresponding to a given choice point.
+ */
+ def generateChoiceFunc(Pseudostate p) {
+ val funcName = GlobalConstants.CHOICE_FUNC_PREFIX + p.name
+ val funcDecl = clazz.createOperation(funcName, null)
+ val param = funcDecl.createRTMessageParam(GlobalConstants.CHOICE_FUNC_PARAM)
+ val funcDeclOB = clazz.createOpaqueBehavior(funcDecl)
+
+ // if (generateGuard) { [actFunc/](param); [DestStatement]
+ var code = ""
+ for (t : p.outgoings) {
+ code += '''
+ if («t.guard.body») {
+ «call(actionChainFunctions.get(t), param.name)»
+ // TODO: return instead
+ «currentStateField.name» = «getDestination(t, false)»;
+ }
+ '''
+ }
+ funcDeclOB.set(code)
+ return funcDeclOB
+ }
+
+ /**
+ * Generates all functions corresponding to junction points.
+ */
+ def generateAllJunctionFunctions() {
+ for (j : machine.region.junctionPoints) {
+ val f = generateJunctionFunc(j)
+ junctionPointFunctions.put(j, f)
+ }
+ }
+
+ /**
+ * Generates the function corresponding to a specific junction point.
+ */
+ def generateJunctionFunc(
+ Pseudostate p
+ ) {
+ val funcName = GlobalConstants.JUNCTION_FUNC_PREFIX + p.name
+ val funcDecl = clazz.createOperation(funcName, null)
+ val funcDeclOB = clazz.createOpaqueBehavior(funcDecl)
+ funcDecl.createRTMessageParam(GlobalConstants.JUNC_FUNC_PARAM)
+ val t = p.outgoings.get(0) // There should be only one.
+ var code = ""
+ if (t != null) {
+ val actFunc = actionChainFunctions.get(t)
+ code += call(actFunc, GlobalConstants.JUNC_FUNC_PARAM)
+ }
+ code += getDestination(t, false)
+ funcDeclOB.set(code)
+ funcDeclOB
+ }
+
+ /**
+ * Generates all functions corresponding to states.
+ */
+ def generateAllStateFunctions() {
+ for (s : machine.states) {
+ val f = generateStateFunc(s)
+ stateFunctions.put(s, f)
+ }
+ }
+
+ /**
+ * Generates the function corresponding to a given state.
+ */
+ def generateStateFunc(State state) {
+ val name = GlobalConstants.STATE_FUNC_PREFIX + state.name
+ val retType = statesDeclaration
+ val func = clazz.createOperation(name, retType)
+ val param = func.createRTMessageParam(GlobalConstants.STATE_FUNC_PARAM)
+ val funcOB = clazz.createOpaqueBehavior(func)
+ val table = getPortTransitionsTable(state)
+
+ val code = '''
+ switch («getPortCond(param)») {
+ «FOR port : table.keySet»
+ case «enumeratorFor(port)»:
+ switch(«getSigCond(param)») {
+ «FOR t : table.get(port)»
+ «FOR trigger : t.triggers.filter[it.ports.contains(port)]»
+ case «enumeratorFor(trigger.event as CallEvent)»:
+ «IF (t.guard != null)»if (t.guard) { «ENDIF»
+ «actionChainFunctions.get(t).name»(«param.name»);
+ return «getDestination(t, false)»;
+ «IF (t.guard != null)»}«ENDIF»
+ «ENDFOR»
+ «ENDFOR»
+ }
+ «ENDFOR»
+ }
+ '''
+ funcOB.set(code)
+ funcOB
+ }
+
+ /**
+ * Builds a table that contains for each port, all the outgoing transitions
+ * of a given state whose trigger has that port.
+ *
+ * @param s a {@link State}
+ * @return a table T indexed by {@link Port}s such that for each port p, the
+ * entry T[p] contains all outgoing {@link Transition}s from s
+ * whose trigger has port p.
+ */
+ private def getPortTransitionsTable(State s) {
+ val table = newHashMap
+ for (t : s.outgoings) {
+ for (trigger : t.triggers) {
+ for (p : trigger.ports) {
+ if (!table.containsKey(p)) {
+ table.put(p, newHashSet)
+ }
+ table.get(p).add(t)
+ }
+ }
+ }
+ return table
+ }
+
+ /**
+ * Obtains the function call corresponding to a transition's destination.
+ *
+ * @param t - The {@link Transition}
+ * @param init - Whether we are looking for the destination to be obtained
+ * in the ized method or in the inject method.
+ */
+ private def getDestination(Transition t, boolean init) {
+ var String retVal
+ if (t.target instanceof Pseudostate) {
+ val ps = t.target as Pseudostate
+ if (ps.kind == PseudostateKind.CHOICE_LITERAL) {
+ val func = choicePointFunctions.get(ps)
+ retVal = func.getName() + "();"
+ } else if (ps.kind == PseudostateKind.JUNCTION_LITERAL) {
+ val func = junctionPointFunctions.get(ps)
+ retVal = func.getName() + "();"
+ }
+ } else {
+ retVal = stateEnumerators.get(t.target).name
+ }
+ if (init) {
+ // currentStateField = << code >>
+ retVal = '''«currentStateField.name» = «retVal»;'''
+ }
+ retVal
+ }
+
+ /**
+ * Generates the main 'inject' function that receives and handles events.
+ */
+ def generateInjectFunc() {
+ injectFunc = clazz.createOperation(GlobalConstants.INJECT_FUNC_NAME, null)
+
+ // injectFunc.setVirtual()
+ injectFunc.createRTMessageParam(GlobalConstants.INJECT_FUNC_PARAM)
+ val injectFuncOB = clazz.createOpaqueBehavior(injectFunc)
+ val code = '''
+ switch(stateCond) {
+ «FOR s : machine.states»
+ case «enumFor(s)»:
+ «currentStateField.name» = «call(stateFunctions.get(s), GlobalConstants.INJECT_FUNC_PARAM)»
+ break;
+ «ENDFOR»
+ }
+ '''
+ injectFuncOB.set(code)
+ injectFunc
+ }
+
+
+ /**
+ * Build the initialize function which performs the initial transition.
+ *
+ * <p>This assumes that the top level of the state machine must have an
+ * initial pseudo-state, and that there is exactly one outgoing transition
+ * from such initial point.
+ *
+ * <p> If there is no initial point, the body of the initialize method is
+ * empty.
+ */
+ def generateInitializeFunc() {
+ initializeFunc = clazz.createOperation(GlobalConstants.INITIALIZE_FUNC_NAME, null)
+
+ // initializeFunc.setVirtual()
+ initializeFunc.createRTMessageParam(GlobalConstants.INITIALIZE_FUNC_PARAM)
+ val initializeFuncOB = clazz.createOpaqueBehavior(initializeFunc)
+
+ var code = ""
+ if (machine.region.initialState != null) {
+ val initialTransition = machine.region.initialState.outgoings.get(0);
+ if (initialTransition != null) {
+ val actFunc = actionChainFunctions.get(initialTransition)
+ if (actFunc != null) {
+ code += call(actFunc, GlobalConstants.INITIALIZE_FUNC_PARAM)
+ }
+ }
+ code += getDestination(initialTransition, true)
+ initializeFuncOB.set(code)
+ }
+ }
+
+ def call(NamedElement fct, String param) '''
+ «fct.name»(«param»);
+ '''
+
+ def call(NamedElement fct, List<String> params) '''
+ «IF params != null»
+ «fct.name»(«FOR param : params SEPARATOR ', '»«param»«ENDFOR»);
+ «ELSE»
+ «fct.name»();
+ «ENDIF»
+ '''
+
+ /**
+ * Generates the compilation unit for the state machine (*)
+ *
+ * <p><b>Notes:</b> This implementation generates only a list of elements
+ * to be consumed by the capsule generator which is assumed to be
+ * responsible for putting together the full compilation unit.
+ */
+ /*
+ def generateCompilationUnit() {
+ // already added?
+
+ cppCapsuleClass.addMember(CppClass.Visibility.PRIVATE, statesDeclaration);
+ cppCapsuleClass.addMember(CppClass.Visibility.PRIVATE, currentStateField)
+ cppCapsuleClass.addMember(CppClass.Visibility.PRIVATE, historyTableDeclaration)
+ cppCapsuleClass.addMember(CppClass.Visibility.PRIVATE, saveHistoryFunction)
+ for (action : userActionFunctions.keySet) {
+ cppCapsuleClass.addMember(CppClass.Visibility.PRIVATE, userActionFunctions.get(action))
+ }
+ for (chain : actionChainFunctions.keySet) {
+ cppCapsuleClass.addMember(CppClass.Visibility.PRIVATE, actionChainFunctions.get(chain))
+ }
+ for (junction : junctionPointFunctions.keySet) {
+ cppCapsuleClass.addMember(CppClass.Visibility.PRIVATE, junctionPointFunctions.get(junction))
+ }
+ for (choice : choicePointFunctions.keySet) {
+ cppCapsuleClass.addMember(CppClass.Visibility.PRIVATE, choicePointFunctions.get(choice))
+ }
+ for (state : stateFunctions.keySet) {
+ cppCapsuleClass.addMember(CppClass.Visibility.PRIVATE, stateFunctions.get(state))
+ }
+
+ return generatedModel
+ }
+ */
+ /**
+ * Auxiliary methods
+ */
+ private def getStateType() {
+ statesDeclaration
+ }
+
+ private def getRTMessageType() {
+ // TODO: import umlrts instead of declaring it in model
+ val umlrts = clazz.getModel().getPackagedElement("umlrts") as org.eclipse.uml2.uml.Package
+ umlrts.getPackagedElement("RTMessage") as org.eclipse.uml2.uml.Type;
+ }
+
+ private def createRTMessageParam(Operation operation, String paramName) {
+ val param = operation.createOwnedParameter(paramName, RTMessageType)
+ if (refStereo == null) {
+ refStereo = param.getApplicableStereotype("C_Cpp::Ref")
+ }
+ if (refStereo != null) {
+ param.applyStereotype(refStereo)
+ }
+ if (constStereo == null) {
+ constStereo = param.getApplicableStereotype("C_Cpp::Const")
+ }
+ if (constStereo != null) {
+ param.applyStereotype(constStereo)
+ }
+ param
+ }
+
+ // TODO - why not used any more?
+ private def getRTDataType(Transition t) {
+ var Type rtdataType = null
+ val Collection<Type> types = newHashSet
+ for (trigger : t.triggers) {
+ val evt = trigger.event as CallEvent
+ val params = evt.operation.ownedParameters
+ if (! params.empty) {
+ val first = params.get(0)
+ types.add(first.type)
+ }
+ }
+ if (types.size == 1) {
+ val type = types.get(0)
+ // TODO - was - createType
+ rtdataType = type
+ }
+ rtdataType
+ }
+
+ private def enumFor(State s) {
+ stateEnumerators.get(s).label
+ }
+
+ private def dispatch enumeratorFor(Port port) {
+ val enumerator = EnumService.literal('PortID', port.name)
+ enumerator
+ }
+
+ private def dispatch enumeratorFor(CallEvent ce) {
+ val operation = ce.operation
+ val protocolCls = EnumService.literal('ProtocolClass', (operation.getInterface().owner as NamedElement).name);
+ '''«protocolCls»::signal_«ce.name»'''
+ }
+
+ /**
+ * Builds an expression to obtain the port enum id for the switch.
+ *
+ * <p>It assumes that the message parameter to the inject function is a
+ * pointer to the RTMessage type, as returned by {@link #getRTMessageType},
+ * this is, the signature of the inject function must be:
+ *
+ * <p><pre>
+ * <code>void inject(UMLRTMessage * msg)</code>
+ * </pre>
+ *
+ * <p>It also assumes that the port id and signal id are accessible from
+ * this type. Basically the assumption is that the relevant definitions are
+ * as follows:
+ *
+ * <p>
+ * <pre>
+ * <code>
+ * class UMLRTMessage : ... {
+ * public:
+ * UMLRTPort * destPort;
+ * UMLRTSignal * signal;
+ * }
+ *
+ * struct UMLRTPort {
+ * int id;
+ * // ...
+ * }
+ *
+ * class UMLRTSignal {
+ * public:
+ * int id;
+ * // ...
+ * }
+ * </code>
+ * </pre>
+ *
+ * <p>... where the typed <code>UMLRTPortId</code> and
+ * <code>UMLRTSignalId</code> can be cast to the <code>Port</code> and
+ * <code>Signal</code> enum types generated in the state machine's class.
+ *
+ * <p>Given this assumptions, the port condition generated has the form:
+ *
+ * <p><pre><code>(Port)(msg->destPort)->id</code></pre>
+ *
+ * <p>and the signal condition is:
+ *
+ * <p><pre><code>(ProtocolX::Signal)(msg->signal)->getId()</code></pre>
+ *
+ * <p>where <code>ProtocolX</code> is the name of the port's protocol
+ */
+ private def getPortCond(Parameter param) {
+ //val messagePortField = UMLRTMessage.destPort()
+ //val portIdField = UMLRTCommsPort.id()
+ //'''«param.name».«messagePortField.name»->«portIdField.name»'''
+ '''TODO'''
+ }
+
+ private def getSigCond(Parameter param) {
+ //val messageSignalField = UMLRTMessage.signal()
+ //val signalIdAccessor = UMLRTSignal.getId()
+ //'''«param.name»->«messageSignalField.name»->«signalIdAccessor.name»()'''
+ '''TODO'''
+ }
+}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLFlattener.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLFlattener.xtend
new file mode 100644
index 00000000000..002469ae5b0
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/xtend/UMLFlattener.xtend
@@ -0,0 +1,556 @@
+/*******************************************************************************
+* Copyright (c) 2014 Zeligsoft, CEA and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+package org.eclipse.papyrus.qompass.modellibs.core.xtend
+
+import org.eclipse.uml2.uml.Behavior
+import org.eclipse.uml2.uml.Class
+import org.eclipse.uml2.uml.NamedElement
+import org.eclipse.uml2.uml.Pseudostate
+import org.eclipse.uml2.uml.PseudostateKind
+import org.eclipse.uml2.uml.Region
+import org.eclipse.uml2.uml.State
+import org.eclipse.uml2.uml.StateMachine
+import org.eclipse.uml2.uml.Transition
+import org.eclipse.uml2.uml.UMLPackage
+import org.eclipse.uml2.uml.Vertex
+
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.BehaviorUtil.*
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.StateMachineUtil.*
+import static extension org.eclipse.papyrus.qompass.modellibs.core.xtend.UMLChain.chain
+import org.eclipse.uml2.uml.OpaqueBehavior
+
+/**
+ * This class contains the transformation for flattening UML-RT state machines
+ *
+ * It implements the algorithms described in the technical report
+ *
+ * E. Posse. "Flattening UML-RT State Machines".
+ * Technical Report ZTR-2014-EP-001, Version 2, Zeligsoft, Sep 2014.
+ *
+ * @author eposse
+ */
+class UMLFlattener {
+
+ val FRESH_NAME_PREFIX = "p"
+ val FRESH_ENTRYPOINT_NAME_PREFIX = "entrypoint_"
+ val FRESH_EXITPOINT_NAME_PREFIX = "exitpoint_"
+ val FRESH_CHOICEPOINT_NAME_PREFIX = "c"
+ val FRESH_JUNCTIONPOINT_NAME_PREFIX = "j"
+ var FRESH_TRANSITION_NAME_PREFIX = "transition_"
+
+ var freshNameCounter = 0
+ var freshEntryPointNameCounter = 0
+ var freshExitPointNameCounter = 0
+ var freshChoicePointNameCounter = 0
+ var freshJunctionPointNameCounter = 0
+ var freshTransitionNameCounter = 0
+
+ var Behavior saveHistoryBehavior = null
+ var Class clazz
+
+ /**
+ * Flattens a UML-RT state machine, removing composite states, and making
+ * explicit transitions implied by group transitions, history points and
+ * initial points.
+ *
+ * This is the 'main' method of the transformer. It performs the
+ * transformation in-place.
+ *
+ * @param m a {@link StateMachine}
+ * @return the flat {@link StateMachine} m with all composite states, group
+ * transitions, history and initial pseudo-states removed.
+ */
+ def StateMachine transform(StateMachine m) {
+ var StateMachine intermediateModel
+ clazz = m.owner as Class
+ UMLChain.initChains
+ phase0QualifyNames(m.region, m.name)
+ phase1(m)
+ intermediateModel = phase2(m)
+ return intermediateModel
+ }
+
+ /**
+ * Change the names of states and transitions: prefix them with the names
+ * of the stateMachine and composite states.
+ */
+ protected def void phase0QualifyNames(Region region, String parentName) {
+ for (Transition transition : region.transitions) {
+ transition.name = parentName + '_' + transition.name
+ }
+ for (Vertex vertex : region.subvertices) {
+ vertex.name = parentName + '_' + vertex.name
+ if (vertex instanceof State) {
+ val State state = vertex as State
+ for (subRegion : state.regions) {
+ phase0QualifyNames(subRegion, vertex.name)
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Makes explicit transitions implied by group transitions, history points
+ * and initial points.
+ */
+ protected def StateMachine phase1(StateMachine m) {
+ for (State s : m.states) {
+ phase1ProcessState(s)
+ }
+ return m
+ }
+
+ def void phase1ProcessState(State state) {
+ phase1ProcessSimpleState(state)
+ if (!state.regions.empty) {
+ phase1ProcessCompositeState(state)
+ }
+ }
+
+ /**
+ * Moves a simple state's entry actions to its incoming transitions and
+ * the state's exit actions to its outgoing transitions.
+ *
+ */
+ def void phase1ProcessSimpleState(State state) {
+ // TODO: should that be done in UML2FlatBody (need chain?)
+ if (state.entry != null) {
+ val entryOp = clazz.createOperation(entryFctName(state), null);
+ state.entry.name = entryFctName(state)
+ // add specification
+ state.entry.specification = entryOp;
+ // clazz.ownedBehaviors.add(state.entry)
+ for (Transition t : state.incomings) {
+ t.chain.append(state.entry)
+ }
+ }
+ if (state.exit != null) {
+ val exitOp = clazz.createOperation(exitFctName(state), null);
+ state.exit.name = exitFctName(state)
+ // add specification
+ state.exit.specification = exitOp;
+ // clazz.ownedBehaviors.add(state.exit)
+ for (Transition t : state.allOutgoings) {
+ t.chain.prepend(state.exit)
+ }
+ }
+ }
+
+ def entryFctName(State state) {
+ GlobalConstants.ENTRY_ACTION_FUNC_PREFIX + GlobalConstants.FUNC_NAME_QUAL_NAME_SEP + state.name + GlobalConstants.FUNC_NAME_QUAL_NAME_SEP + state.entry.name
+ }
+
+ def exitFctName(State state) {
+ GlobalConstants.EXIT_ACTION_FUNC_PREFIX + GlobalConstants.FUNC_NAME_QUAL_NAME_SEP + state.name + GlobalConstants.FUNC_NAME_QUAL_NAME_SEP + state.exit.name
+ }
+
+ /**
+ * Creates entry transitions for incoming arrows ending at the composite
+ * state's boundary or history pseudo-state. Creates exit transitions
+ * implied by group transitions.
+ */
+ def void phase1ProcessCompositeState(State state) {
+
+ // if (state.substates.empty) {
+ // replaceBySimpleState(state)
+ // return
+ // }
+ // Deal with incoming transitions
+ // TODO (ar): such a state can have entry and exit as well, no?
+ annotateExplicitEntryTransitions(state)
+ createEntryPoints(state)
+ var historyChoicePoint = replaceHistoryPoint(state)
+ removeInitialTransition(state, historyChoicePoint)
+
+ // Deal with outgoing transitions
+ annotateExplicitExitTransitions(state)
+ createExitPoints(state)
+ createExitTransitions(state)
+
+ // Process sub-states
+ for (State subState : state.subStates) {
+ phase1ProcessState(subState)
+ }
+ }
+
+ /**
+ * Prepends the state's entry action to each explicit entry transition
+ * (transition from an entry point to a sub-state).
+ */
+ def annotateExplicitEntryTransitions(State state) {
+ for (Pseudostate p : state.entryPoints) {
+ if (!p.outgoings.empty) {
+ for (Transition t : p.outgoings) {
+ t.chain.append(state.entry)
+ }
+ }
+ }
+ }
+
+ /**
+ * Creates entry points for every direct incoming transition (transition
+ * ending directly on the state's boundary).
+ */
+ def createEntryPoints(State state) {
+ for (Transition t : state.incomings) {
+ val p = state.createConnectionPoint(state.newFreshEntryPointName)
+ p.kind = PseudostateKind.ENTRY_POINT_LITERAL
+ t.target = p
+ } //TODO: maybe remove all directIncomming?
+ }
+
+ /**
+ * Replaces the (deep)history pseudo-state with a choice point with transitions
+ * to each sub-state with conditions checking the value of the history table
+ * entry for this composite-state.
+ */
+ def Pseudostate replaceHistoryPoint(State state) {
+
+ // transform history state into a choice point
+ val c = state.region.deepHistory;
+
+ if (c != null) {
+ // No need to redirect incoming transitions, since we transform the history
+ // state with a choice point
+ c.kind = PseudostateKind.CHOICE_LITERAL;
+ }
+ else {
+ return null;
+ }
+
+ // Create transitions from the choice point to each sub-state with the
+ // appropriate guard.
+ for (State subState : state.subStates) {
+ var Vertex targetVertex
+ if (subState.regions.size() == 0) {
+ targetVertex = subState
+ }
+ else {
+ targetVertex = subState.region.deepHistory
+ if (targetVertex == null) {
+ targetVertex = subState
+ }
+ }
+
+ val newTransition = state.region.createTransition(state.newFreshTransitionName)
+ newTransition.source = c;
+ newTransition.target = targetVertex;
+ val guard = newTransition.createGuard("CheckHistory");
+ guard.createOpaqueExpression('''history[«state.name»] == «subState.name»''')
+ if (state.entry != null) {
+ newTransition.chain.append(state.entry)
+ }
+ }
+ // If there was an initial pseudo-state, create a transition from the
+ // choice point to the initial state where the guard will be true if
+ // the composite state has not been visited before.
+ val initialState = state.region.initialState
+ if (initialState != null) {
+ val initialTransition = initialState.outgoings.get(0)
+
+ val newTransition = state.region.createTransition(state.newFreshTransitionName)
+ newTransition.source = c;
+ newTransition.target = initialTransition.target;
+ val guard = newTransition.createGuard("CheckHistory");
+ guard.createOpaqueExpression('''history[«state.name»] == «GlobalConstants.UNVISITED»''')
+ // TODO: not sure, if semantics is the same.
+ if (initialTransition.effect != null) {
+ // caveat: assigining the effect to the new transition will remove it from the original
+ // (initial will be removed later on => not a problem?)
+ newTransition.effect = initialTransition.effect;
+ newTransition.chain.append(newTransition.effect)
+ }
+ newTransition.chain.append(state.entry)
+ }
+ // If there was no initial pseudo-state, create a 'dummy' simple state
+ // representing "staying at the boundary", and create a transition from
+ // the choice point to this dummy state, where the guard is true if
+ // the state has not been visited before.
+ else {
+ // The name should be different name because one of the sub-states
+ // may have the same name as the composite.
+ val border = state.region.createState(state.newFreshName);
+
+ val newTransition = state.region.createTransition(state.newFreshTransitionName);
+ newTransition.source = c;
+ newTransition.target = border;
+ val guard = newTransition.createGuard("Check History")
+ guard.createOpaqueExpression('''history[«state.name»] == «GlobalConstants.UNVISITED»''')
+ if (state.entry != null) {
+ newTransition.chain.append(state.entry)
+ }
+ }
+ return c
+ }
+
+ /**
+ * Remove the initial pseudo-state and transition and create a transition
+ * from each entry point which does not have an explicit entry transition
+ * to a sub-state, to the initial state.
+ */
+ def removeInitialTransition(State state, Pseudostate historyChoicePoint) {
+ val initialState = state.region.initialState
+ if (initialState != null) {
+ val initialTransition = initialState.outgoings.get(0) // There should be exactly one initial transition
+ for (Pseudostate p : state.entryPoints) {
+ if (p.outgoings.empty) {
+ val newTransition =
+ state.region.createTransition(state.newFreshTransitionName)
+ newTransition.source = p
+ newTransition.target = initialTransition.target
+ newTransition.chain.append(state.entry)
+ newTransition.chain.append(initialTransition.effect);
+ }
+ }
+ state.region.transitions.remove(initialTransition)
+ // initialTransition.targetVertex.incomingTransitions.remove(initialTransition) // TODO: this might not be enough if the initial transition ends in a pseudo-state
+ // state.removeInitial
+ }
+ else {
+ for (Pseudostate p : state.entryPoints) {
+ if (p.outgoings.empty) {
+ val newTransition =
+ state.region.createTransition(state.newFreshTransitionName)
+ newTransition.setSource(p)
+ newTransition.setTarget(historyChoicePoint)
+ newTransition.effect = state.entry;
+ }
+ }
+ }
+ }
+
+ /**
+ * Annotate explicit exit transitions (transitions from a sub-state to an
+ * exit point) with a "history saving action", an action that sets the
+ * history table entry for the composite state according to the sub-state
+ * that is exited.
+ */
+ def annotateExplicitExitTransitions(State state) {
+ for (Pseudostate p : state.exitPoints) {
+ if (!p.incomings.empty) {
+ for (Transition t : p.incomings) {
+ if (saveHistoryBehavior == null) {
+ createSaveHistoryBehavior
+ }
+ // Actions can have specific subclasses in the Zeligsoft model. Here we use a single generic class.
+ // Therefore we add call information explicitly.
+ val UMLAction saveHistoryAction = new UMLAction(saveHistoryBehavior)
+ saveHistoryAction.addParam = state.name
+ saveHistoryAction.addParam = t.source.name
+ t.chain.append = saveHistoryAction
+ if (state.exit != null) {
+ t.chain.append(state.exit)
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Create exit points for each direct outgoing transition (transition leaving
+ * directly from the composite state's boundary).
+ */
+ def createExitPoints(State state) {
+ for (Transition t : state.outgoings) {
+ val p = state.createConnectionPoint(state.newFreshExitPointName);
+ p.kind = PseudostateKind.EXIT_POINT_LITERAL
+ t.source = p;
+ }
+ }
+
+ def createSaveHistoryBehavior() {
+ // create an opaque behavior without body. This will be added later in the UMLFlat2Cpp operation
+ saveHistoryBehavior = clazz.createOwnedBehavior(GlobalConstants.SAVE_HISTORY_FUNC_NAME,
+ UMLPackage.eINSTANCE.getOpaqueBehavior()
+ );
+ }
+
+ /**
+ * Create explicit exit transitions implied by group transitions. For each
+ * group transition creates a transition from every sub-state to the
+ * group-transitions's source exit point. It annotates these transitions
+ * with a "history saving action", an action which stores the sub-state
+ * in the history table entry for this composite state.
+ */
+ def createExitTransitions(State state) {
+
+ // Iterate over exit points, looking for group transitions.
+ for (Pseudostate p : state.exitPoints) {
+
+ // If the exit point doesn't have incoming transitions then there
+ // is at least one group transition from it.
+ if (p.incomings.empty) {
+
+ // Create explicit transitions from every sub-state to this
+ // exit point...
+ for (State subState : state.subStates) {
+
+ // ...for each group transition leaving the exit point.
+ for (Transition t : p.outgoings) {
+
+ if (saveHistoryBehavior == null) {
+ createSaveHistoryBehavior
+ }
+ // Append the history saving action and the state's
+ // exit action.
+ val newTransition = state.region.createTransition(state.newFreshTransitionName)
+ newTransition.source = subState
+ newTransition.target = p
+ // make a copy (adding it to triggers list would remove it from original transition).
+ for (trigger : t.triggers) {
+ val newTrigger = newTransition.createTrigger(trigger.name)
+ newTrigger.event = trigger.event
+ }
+ // newTransition.triggers.addAll(t.triggers)
+ newTransition.guard = t.guard
+ val UMLAction saveHistoryAction = new UMLAction(saveHistoryBehavior)
+ saveHistoryAction.addParam = state.name
+ saveHistoryAction.addParam = subState.name
+ newTransition.chain.append(saveHistoryAction)
+ newTransition.chain.append(state.exit)
+ // make a copy of the effect (but: quite bad, since we might create several copies of same effect)
+ if (t.effect instanceof OpaqueBehavior) {
+ val newBehavior = newTransition.createOpaqueEffect
+ newBehavior.name = t.effect.name
+ newBehavior.set = t.effect.body
+ }
+ }
+ }
+
+ // Remove the trigger and guard from the old group transition,
+ // but leave the transition.
+ // TODO: we must replace the direct group transition with an indirect group transition leaving from the exit point
+ for (Transition t : p.outgoings) {
+ t.triggers.clear
+ t.guard = null
+ t.effect = null
+ }
+ }
+ }
+ }
+
+ /**
+ * Flatten composite states.
+ */
+ protected def StateMachine phase2(StateMachine m) {
+ for (State s : m.states.clone) {
+ phase2ProcessState(s)
+ if (!s.subStates.empty) {
+ m.region.moveContents(s)
+ // remove regions from composite state
+ s.regions.clear
+ }
+ }
+ return m
+ }
+
+ /**
+ * Removes entry and exit points of a simple state, making all transitions
+ * to and from it, direct.
+ */
+ def dispatch void phase2ProcessState(State state) {
+ if (state.regions.empty) {
+ phase2ProcessSimpleState(state)
+ }
+ else {
+ phase2ProcessComplexState(state)
+ }
+ // change name afterwards (avoid that new names are taken into account recursively)
+ }
+
+ /**
+ * Removes entry and exit points of a simple state, making all transitions
+ * to and from it, direct.
+ */
+ def dispatch void phase2ProcessSimpleState(State state) {
+ for (Transition t : state.indirectIncomings) {
+ t.target = state // TODO: Potential problem: depending on the set implementation we may be modifying the iterator
+ }
+ for (Transition t : state.outgoings) {
+ t.source = state
+ }
+ for (Pseudostate p : state.entryPoints) {
+ state.connectionPoints.remove(p)
+ }
+ for (Pseudostate p : state.exitPoints) {
+ state.connectionPoints.remove(p)
+ }
+ }
+
+ /**
+ * Replaces all entry and exit points of the composite state with junction
+ * points, and recursively apply this to sub-states.
+ */
+ def dispatch void phase2ProcessComplexState(State state) {
+ // Replace connection points with junction points
+ for (Pseudostate p : state.connectionPoints.clone) {
+ var j = state.region.createPseudostate(GlobalConstants.JUNCTION_FUNC_PREFIX + p.name)
+ j.kind = PseudostateKind.JUNCTION_LITERAL
+
+ for (Transition t : p.incomings) {
+ t.target = j
+ }
+ for (Transition t : p.outgoings) {
+ t.source = j
+ }
+ if (p.kind == PseudostateKind.ENTRY_POINT_LITERAL) {
+ state.connectionPoints.remove(p)
+ }
+ else if (p.kind == PseudostateKind.EXIT_POINT_LITERAL) {
+ state.connectionPoints.remove(p)
+ }
+ }
+
+ // Process substates
+ for (State subState : state.subStates.clone) {
+ phase2ProcessState(subState)
+ if (!subState.regions.empty) {
+ state.region.moveContents(subState)
+ subState.regions.clear
+ }
+ }
+ }
+
+ /**
+ * Auxiliary methods
+ */
+ def String getNewFreshName(NamedElement parent) {
+ freshNameCounter ++
+ return parent.namePrefix + FRESH_NAME_PREFIX + freshNameCounter
+ }
+
+ def String getNewFreshEntryPointName(NamedElement parent) {
+ freshEntryPointNameCounter ++
+ return parent.namePrefix + FRESH_ENTRYPOINT_NAME_PREFIX + freshEntryPointNameCounter
+ }
+
+ def String getNewFreshExitPointName(NamedElement parent) {
+ freshExitPointNameCounter ++
+ return parent.namePrefix + FRESH_EXITPOINT_NAME_PREFIX + freshExitPointNameCounter
+ }
+
+ def String getNewFreshChoicePointName(NamedElement parent) {
+ freshChoicePointNameCounter ++
+ return parent.namePrefix + FRESH_CHOICEPOINT_NAME_PREFIX + freshChoicePointNameCounter
+ }
+
+ def String getNewFreshJunctionPointName(NamedElement parent) {
+ freshJunctionPointNameCounter ++
+ return parent.namePrefix + FRESH_JUNCTIONPOINT_NAME_PREFIX + freshJunctionPointNameCounter
+ }
+
+ def String getNewFreshTransitionName(NamedElement parent) {
+ freshTransitionNameCounter ++
+ return parent.namePrefix + FRESH_TRANSITION_NAME_PREFIX + freshTransitionNameCounter
+ }
+
+ def namePrefix(NamedElement ne) {
+ return ne.name + "_"
+ }
+}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/xtend-gen/.gitignore b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/xtend-gen/.gitignore
new file mode 100644
index 00000000000..c96a04f008e
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/xtend-gen/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore \ No newline at end of file

Back to the top