Initial version of an animator for composite structures.
Change-Id: Ic4b7adaf13d5c00a1bceb064e9eb068d0b8585af
Signed-off-by: jeremie.tatibouet <jeremie.tatibouet@cea.fr>
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.composites.interfaces/META-INF/MANIFEST.MF b/bundles/core/engines/org.eclipse.papyrus.moka.composites.interfaces/META-INF/MANIFEST.MF
index 2ddcc9f..ea42f69 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.composites.interfaces/META-INF/MANIFEST.MF
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.composites.interfaces/META-INF/MANIFEST.MF
@@ -13,4 +13,5 @@
org.eclipse.papyrus.moka.composites.interfaces.Semantics.Classes.Kernel,
org.eclipse.papyrus.moka.composites.interfaces.Semantics.CommonBehaviors.BasicBehaviors,
org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.InvocationActions,
- org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses
+ org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses,
+ org.eclipse.papyrus.moka.composites.interfaces.extensions.Semantics.CompositeStructures.StructuredClasses
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.composites.interfaces/src/org/eclipse/papyrus/moka/composites/interfaces/extensions/Semantics/CompositeStructures/StructuredClasses/ICS_ConnectorLink.java b/bundles/core/engines/org.eclipse.papyrus.moka.composites.interfaces/src/org/eclipse/papyrus/moka/composites/interfaces/extensions/Semantics/CompositeStructures/StructuredClasses/ICS_ConnectorLink.java
new file mode 100644
index 0000000..b171b84
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.composites.interfaces/src/org/eclipse/papyrus/moka/composites/interfaces/extensions/Semantics/CompositeStructures/StructuredClasses/ICS_ConnectorLink.java
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.composites.interfaces.extensions.Semantics.CompositeStructures.StructuredClasses;
+
+import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_Link;
+import org.eclipse.uml2.uml.Connector;
+
+public interface ICS_ConnectorLink extends ICS_Link{
+
+ public void setConnector(Connector connector);
+
+ public Connector getConnector();
+
+}
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.composites/.classpath b/bundles/core/engines/org.eclipse.papyrus.moka.composites/.classpath
index fa0b965..3b62692 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.composites/.classpath
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.composites/.classpath
@@ -9,5 +9,6 @@
<attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
</attributes>
</classpathentry>
+ <classpathentry kind="src" path="aspects"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.composites/META-INF/MANIFEST.MF b/bundles/core/engines/org.eclipse.papyrus.moka.composites/META-INF/MANIFEST.MF
index 73cb70a..2e1d13b 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.composites/META-INF/MANIFEST.MF
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.composites/META-INF/MANIFEST.MF
@@ -10,7 +10,8 @@
org.eclipse.papyrus.moka.composites.Semantics.impl.CommonBehaviors.Communications,
org.eclipse.papyrus.moka.composites.Semantics.impl.CompositeStructures.InvocationActions,
org.eclipse.papyrus.moka.composites.Semantics.impl.CompositeStructures.StructuredClasses,
- org.eclipse.papyrus.moka.composites.Semantics.impl.Loci.LociL3
+ org.eclipse.papyrus.moka.composites.Semantics.impl.Loci.LociL3,
+ org.eclipse.papyrus.moka.composites.extensions.Semantics.CompositeStructures
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
Bundle-Version: 3.0.0.qualifier
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/InvocationActions/CS_DefaultConstructStrategyProfiler.aj b/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/InvocationActions/CS_DefaultConstructStrategyProfiler.aj
new file mode 100644
index 0000000..3c3aed6
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/InvocationActions/CS_DefaultConstructStrategyProfiler.aj
Binary files differ
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/StructuredClasses/CS_ConnectorLinkWrapper.java b/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/StructuredClasses/CS_ConnectorLinkWrapper.java
new file mode 100644
index 0000000..a33e4e5
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/StructuredClasses/CS_ConnectorLinkWrapper.java
@@ -0,0 +1,206 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.moka.composites.profiling.Semantics.CompositeStructures.StructuredClasses;
+
+import java.util.List;
+
+import org.eclipse.papyrus.moka.composites.interfaces.extensions.Semantics.CompositeStructures.StructuredClasses.ICS_ConnectorLink;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IExtensionalValue;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IFeatureValue;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IValue;
+import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ILocus;
+import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.StructuralFeature;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+public class CS_ConnectorLinkWrapper implements ICS_ConnectorLink, ISemanticVisitor{
+
+ protected ICS_ConnectorLink connectorLink;
+
+ public CS_ConnectorLinkWrapper(ICS_ConnectorLink connectorLink) {
+ this.connectorLink = connectorLink;
+ }
+
+ @Override
+ public Boolean hasValueForAFeature(IValue value) {
+ return this.connectorLink.hasValueForAFeature(value);
+ }
+
+ @Override
+ public StructuralFeature getFeature(IValue value) {
+ return this.connectorLink.getFeature(value);
+ }
+
+ @Override
+ public Boolean isMatchingLink(IExtensionalValue link, Property end) {
+ return this.connectorLink.isMatchingLink(link, end);
+ }
+
+ @Override
+ public List<IFeatureValue> getOtherFeatureValues(List<IExtensionalValue> extent, Property end) {
+ return this.connectorLink.getOtherFeatureValues(extent, end);
+ }
+
+ @Override
+ public void addTo(ILocus locus) {
+ this.connectorLink.addTo(locus);
+ }
+
+ @Override
+ public void setType(Association association) {
+ this.connectorLink.setType(association);
+ }
+
+ @Override
+ public Association getType() {
+ return this.connectorLink.getType();
+ }
+
+ @Override
+ public void destroy() {
+ this.connectorLink.destroy();
+ }
+
+ @Override
+ public void setLocus(ILocus locus) {
+ this.connectorLink.setLocus(locus);
+ }
+
+ @Override
+ public ILocus getLocus() {
+ return this.connectorLink.getLocus();
+ }
+
+ @Override
+ public void setIdentifier(String identifier) {
+ this.connectorLink.setIdentifier(identifier);
+ }
+
+ @Override
+ public String getIdentifier() {
+ return this.connectorLink.getIdentifier();
+ }
+
+ @Override
+ public void addFeatureValues(List<IFeatureValue> oldFeatureValues) {
+ this.connectorLink.addFeatureValues(oldFeatureValues);
+ }
+
+ @Override
+ public void addFeatureValuesForType(Classifier type, List<IFeatureValue> oldFeatureValues) {
+ this.connectorLink.addFeatureValuesForType(type, oldFeatureValues);
+ }
+
+ @Override
+ public void createFeatureValues() {
+ this.connectorLink.createFeatureValues();
+ }
+
+ @Override
+ public List<IFeatureValue> getMemberValues() {
+ return this.connectorLink.getMemberValues();
+ }
+
+ @Override
+ public List<IValue> getValues(NamedElement feature, List<IFeatureValue> featureValues) {
+ return this.connectorLink.getValues(feature, featureValues);
+ }
+
+ @Override
+ public IFeatureValue getFeatureValue(StructuralFeature feature) {
+ return this.connectorLink.getFeatureValue(feature);
+ }
+
+ @Override
+ public void setFeatureValue(StructuralFeature feature, List<IValue> values, Integer position) {
+ this.connectorLink.setFeatureValue(feature, values, position);
+ }
+
+ @Override
+ public List<IFeatureValue> getFeatureValues() {
+ return this.connectorLink.getFeatureValues();
+ }
+
+ @Override
+ public void setFeatureValues(List<IFeatureValue> featureValues) {
+ this.connectorLink.setFeatureValues(featureValues);
+ }
+
+ @Override
+ public ValueSpecification specify() {
+ return this.connectorLink.specify();
+ }
+
+ @Override
+ public boolean checkAllParents(Classifier type, Classifier classifier) {
+ return this.connectorLink.checkAllParents(type, classifier);
+ }
+
+ @Override
+ public boolean isInstanceOf(Classifier classifier) {
+ return this.connectorLink.isInstanceOf(classifier);
+ }
+
+ @Override
+ public Boolean equals(IValue otherValue) {
+ return this.connectorLink.equals(otherValue);
+ }
+
+ @Override
+ public IValue copy() {
+ return this.connectorLink.copy();
+ }
+
+ @Override
+ public IValue new_() {
+ return this.connectorLink.new_();
+ }
+
+ @Override
+ public List<Classifier> getTypes() {
+ return this.connectorLink.getTypes();
+ }
+
+ @Override
+ public Boolean hasType(Classifier type) {
+ return this.connectorLink.hasType(type);
+ }
+
+ @Override
+ public void _endIsolation() {
+ this.connectorLink._endIsolation();
+ }
+
+ @Override
+ public void _beginIsolation() {
+ this.connectorLink._beginIsolation();
+ }
+
+ @Override
+ public void setConnector(Connector connector) {
+ this.connectorLink.setConnector(connector);
+ }
+
+ @Override
+ public Connector getConnector() {
+ return this.connectorLink.getConnector();
+ }
+
+}
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/StructuredClasses/CS_InteractionPointWrapper.java b/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/StructuredClasses/CS_InteractionPointWrapper.java
new file mode 100644
index 0000000..238907a
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/StructuredClasses/CS_InteractionPointWrapper.java
@@ -0,0 +1,176 @@
+package org.eclipse.papyrus.moka.composites.profiling.Semantics.CompositeStructures.StructuredClasses;
+
+import java.util.List;
+
+import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_InteractionPoint;
+import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_Reference;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IFeatureValue;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IObject_;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IValue;
+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.IExecution;
+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.IParameterValue;
+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.IEventOccurrence;
+import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Port;
+import org.eclipse.uml2.uml.StructuralFeature;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+public class CS_InteractionPointWrapper implements ISemanticVisitor, ICS_InteractionPoint {
+
+ protected ICS_InteractionPoint interactionPoint;
+
+ public CS_InteractionPointWrapper(ICS_InteractionPoint interactionPoint) {
+ this.interactionPoint = interactionPoint;
+ }
+
+ @Override
+ public void _endIsolation() {
+ // Do nothing
+ }
+
+ @Override
+ public void _beginIsolation() {
+ // Do nothing
+
+ }
+
+ @Override
+ public void startBehavior(Class classifier, List<IParameterValue> inputs) {
+ this.interactionPoint.startBehavior(classifier, inputs);
+ }
+
+ @Override
+ public IExecution dispatch(Operation operation) {
+ return this.interactionPoint.dispatch(operation);
+ }
+
+ @Override
+ public void send(IEventOccurrence eventOccurrence) {
+ this.interactionPoint.send(eventOccurrence);
+ }
+
+ @Override
+ public void destroy() {
+ this.interactionPoint.destroy();
+ }
+
+ @Override
+ public void setReferent(IObject_ referent) {
+ this.interactionPoint.setReferent(referent);
+ }
+
+ @Override
+ public IObject_ getReferent() {
+ return this.interactionPoint.getReferent();
+ }
+
+ @Override
+ public void addFeatureValues(List<IFeatureValue> oldFeatureValues) {
+ this.interactionPoint.addFeatureValues(oldFeatureValues);
+ }
+
+ @Override
+ public void addFeatureValuesForType(Classifier type, List<IFeatureValue> oldFeatureValues) {
+ this.interactionPoint.addFeatureValuesForType(type, oldFeatureValues);
+ }
+
+ @Override
+ public void createFeatureValues() {
+ this.interactionPoint.createFeatureValues();
+ }
+
+ @Override
+ public List<IFeatureValue> getMemberValues() {
+ return this.interactionPoint.getMemberValues();
+ }
+
+ @Override
+ public List<IValue> getValues(NamedElement feature, List<IFeatureValue> featureValues) {
+ return this.interactionPoint.getValues(feature, featureValues);
+ }
+
+ @Override
+ public IFeatureValue getFeatureValue(StructuralFeature feature) {
+ return this.interactionPoint.getFeatureValue(feature);
+ }
+
+ @Override
+ public void setFeatureValue(StructuralFeature feature, List<IValue> values, Integer position) {
+ this.interactionPoint.setFeatureValue(feature, values, position);
+ }
+
+ @Override
+ public List<IFeatureValue> getFeatureValues() {
+ return this.interactionPoint.getFeatureValues();
+ }
+
+ @Override
+ public void setFeatureValues(List<IFeatureValue> featureValues) {
+ this.interactionPoint.setFeatureValues(featureValues);
+ }
+
+ @Override
+ public ValueSpecification specify() {
+ return this.interactionPoint.specify();
+ }
+
+ @Override
+ public boolean checkAllParents(Classifier type, Classifier classifier) {
+ return this.interactionPoint.checkAllParents(type, classifier);
+ }
+
+ @Override
+ public boolean isInstanceOf(Classifier classifier) {
+ return this.interactionPoint.isInstanceOf(classifier);
+ }
+
+ @Override
+ public Boolean equals(IValue otherValue) {
+ return this.interactionPoint.equals(otherValue);
+ }
+
+ @Override
+ public IValue copy() {
+ return this.interactionPoint.copy();
+ }
+
+ @Override
+ public IValue new_() {
+ return this.interactionPoint.new_();
+ }
+
+ @Override
+ public List<Classifier> getTypes() {
+ return this.interactionPoint.getTypes();
+ }
+
+ @Override
+ public Boolean hasType(Classifier type) {
+ return this.interactionPoint.hasType(type);
+ }
+
+ @Override
+ public ICS_Reference getOwner() {
+ return this.interactionPoint.getOwner();
+ }
+
+ @Override
+ public void setOwner(ICS_Reference owner) {
+ this.interactionPoint.setOwner(owner);
+ }
+
+ @Override
+ public Port getDefiningPort() {
+ return this.interactionPoint.getDefiningPort();
+ }
+
+ @Override
+ public void setDefiningPort(Port definingPort) {
+ this.interactionPoint.setDefiningPort(definingPort);
+ }
+
+}
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/StructuredClasses/CS_ObjectProfiler.aj b/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/StructuredClasses/CS_ObjectProfiler.aj
new file mode 100644
index 0000000..bb61a7f
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/StructuredClasses/CS_ObjectProfiler.aj
@@ -0,0 +1,141 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST 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
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.moka.composites.profiling.Semantics.CompositeStructures.StructuredClasses;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.papyrus.moka.composites.Semantics.impl.CompositeStructures.InvocationActions.CS_RequestPropagationStrategy;
+import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_InteractionPoint;
+import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_Link;
+import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_Object;
+import org.eclipse.papyrus.moka.composites.interfaces.extensions.Semantics.CompositeStructures.StructuredClasses.ICS_ConnectorLink;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IReference;
+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.IEventOccurrence;
+import org.eclipse.papyrus.moka.fuml.Semantics.impl.Actions.BasicActions.SendSignalActionActivation;
+import org.eclipse.papyrus.moka.fuml.profiling.Semantics.Loci.SemanticVisitorProfiler;
+import org.eclipse.uml2.uml.ConnectorKind;
+
+public aspect CS_ObjectProfiler extends SemanticVisitorProfiler {
+
+ public CS_ObjectProfiler() {
+ super();
+ }
+
+ // Listen to any call on a CS_Object that results in sendIn(...)
+ pointcut sendIn(ICS_Object object, IEventOccurrence eventOccurrence, ICS_InteractionPoint interactionPoint) :
+ target(object) &&
+ args(eventOccurrence, interactionPoint) &&
+ call(* ICS_Object.sendIn(IEventOccurrence, ICS_InteractionPoint));
+
+ // Listen to any call on a CS_Object that results in sendOut(...)
+ pointcut sendOut(ICS_Object object, IEventOccurrence eventOccurrence, ICS_InteractionPoint interactionPoint) :
+ target(object) &&
+ args(eventOccurrence, interactionPoint) &&
+ call(* ICS_Object.sendOut(IEventOccurrence, ICS_InteractionPoint));
+
+ before(ICS_Object object, IEventOccurrence eventOccurrence, ICS_InteractionPoint interactionPoint) :
+ sendIn(object, eventOccurrence, interactionPoint){
+ // Each time a sendIn(...) is performed this implies the event occurrence is
+ // propagated through the interaction point to an internal target. This target is always
+ // an interaction point. At this point, the interaction point from which the
+ // event occurrence flows and the outgoing links are visited. This implies that
+ // any service listening to the node visited events will get notified about the
+ // the visit of the interaction points as well as its outgoing links.
+ this.visit(new CS_InteractionPointWrapper(interactionPoint));
+ Iterator<ICS_ConnectorLink> linkIterator = this
+ .getTraversedLinkWhenSentIn(object, eventOccurrence, interactionPoint).iterator();
+ while (linkIterator.hasNext()) {
+ this.visit(new CS_ConnectorLinkWrapper(linkIterator.next()));
+ }
+ }
+
+ before(ICS_Object object, IEventOccurrence eventOccurrence, ICS_InteractionPoint interactionPoint) :
+ sendOut(object, eventOccurrence, interactionPoint){
+ // Each time a sendOut(...) is performed this implies the event occurrences is
+ // propagated through the interaction point to the environment of the object. The
+ // target of the propagation always is an interaction point. At this point, the
+ // interaction point from which the event occurs flows and the outgoing links are
+ // visited. This implies that any service listening to the node visited events will
+ // get notified about the the visit of the interaction points as well as its outgoing links.
+ this.visit(new CS_InteractionPointWrapper(interactionPoint));
+ Iterator<ICS_ConnectorLink> linkIterator = this
+ .getTraversedLinkWhenSentOut(object, eventOccurrence, interactionPoint).iterator();
+ while (linkIterator.hasNext()) {
+ this.visit(new CS_ConnectorLinkWrapper(linkIterator.next()));
+ }
+ }
+
+ public List<ICS_ConnectorLink> getTraversedLinkWhenSentIn(ICS_Object object, IEventOccurrence eventOccurrence,
+ ICS_InteractionPoint interactionPoint) {
+ // Find out all links (i.e., runtime manifestation of connectors) that can be traversed
+ // to propagate the event occurrence when sent to the internals the object.
+ Iterator<ICS_Link> linkIterator = object.getLinks(interactionPoint).iterator();
+ List<ICS_ConnectorLink> traversedLink = new ArrayList<ICS_ConnectorLink>();
+ while (linkIterator.hasNext()) {
+ ICS_Link link = linkIterator.next();
+ List<IReference> targets = object.selectTargetsForSending(link, interactionPoint,
+ ConnectorKind.DELEGATION_LITERAL, true);
+ if (!targets.isEmpty()) {
+ traversedLink.add((ICS_ConnectorLink) link);
+ }
+ }
+ return traversedLink;
+ }
+
+ public List<ICS_ConnectorLink> getTraversedLinkWhenSentOut(ICS_Object object, IEventOccurrence eventOccurrence,
+ ICS_InteractionPoint interactionPoint) {
+ // Find out all links (i.e., runtime manifestation of connectors) that can be traversed
+ // to propagate the event occurrence when sent to the object environment.
+ // Note: in order to accurately notify the services about which links have been traversed,
+ // it is required to rely on a RequestPropagationStrategy that when executed two times on the
+ // same target list produces the exact same results.
+ List<IReference> allPotentialTargets = new ArrayList<IReference>();
+ List<ICS_ConnectorLink> referencedLink = new ArrayList<ICS_ConnectorLink>();
+ List<ICS_ConnectorLink> traversedLink = new ArrayList<ICS_ConnectorLink>();
+ Iterator<ICS_Link> linkIterator = object.getLinks(interactionPoint).iterator();
+ while(linkIterator.hasNext()) {
+ boolean referenceLink = false;
+ ICS_Link link = linkIterator.next();
+ Iterator<IReference> referenceIterator = object.selectTargetsForSending(link, interactionPoint, ConnectorKind.ASSEMBLY_LITERAL, false).iterator();
+ while(referenceIterator.hasNext()) {
+ if(!referenceLink) {
+ referenceLink = true;
+ }
+ allPotentialTargets.add(referenceIterator.next());
+ }
+ referenceIterator = object.selectTargetsForSending(link, interactionPoint, ConnectorKind.DELEGATION_LITERAL, false).iterator();
+ while(referenceIterator.hasNext()) {
+ if(!referenceLink) {
+ referenceLink = true;
+ }
+ allPotentialTargets.add(referenceIterator.next());
+ }
+ if(referenceLink) {
+ referencedLink.add((ICS_ConnectorLink)link);
+ }
+ }
+ CS_RequestPropagationStrategy strategy = (CS_RequestPropagationStrategy) object.getLocus().getFactory().getStrategy("requestPropagation");
+ List<IReference> selectedTargets = strategy.select(allPotentialTargets, new SendSignalActionActivation());
+ for(IReference target : selectedTargets){
+ for(ICS_ConnectorLink connectorLink : referencedLink) {
+ if(connectorLink.hasValueForAFeature(target)) {
+ traversedLink.add((ICS_ConnectorLink) connectorLink);
+ }
+ }
+ }
+ return traversedLink;
+ }
+}
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.composites/src/org/eclipse/papyrus/moka/composites/CompositeStructuresExecutionEngine.java b/bundles/core/engines/org.eclipse.papyrus.moka.composites/src/org/eclipse/papyrus/moka/composites/CompositeStructuresExecutionEngine.java
index 80694af..dc262ca 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.composites/src/org/eclipse/papyrus/moka/composites/CompositeStructuresExecutionEngine.java
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.composites/src/org/eclipse/papyrus/moka/composites/CompositeStructuresExecutionEngine.java
@@ -15,11 +15,11 @@
import org.eclipse.papyrus.moka.composites.Semantics.impl.CommonBehaviors.Communications.CS_DispatchOperationOfInterfaceStrategy;
import org.eclipse.papyrus.moka.composites.Semantics.impl.CommonBehaviors.Communications.CS_NameBased_StructuralFeatureOfInterfaceAccessStrategy;
-import org.eclipse.papyrus.moka.composites.Semantics.impl.CompositeStructures.InvocationActions.CS_DefaultConstructStrategy;
import org.eclipse.papyrus.moka.composites.Semantics.impl.CompositeStructures.InvocationActions.CS_DefaultRequestPropagationStrategy;
import org.eclipse.papyrus.moka.composites.Semantics.impl.Loci.LociL3.CS_ExecutionFactory;
import org.eclipse.papyrus.moka.composites.Semantics.impl.Loci.LociL3.CS_Executor;
import org.eclipse.papyrus.moka.composites.Semantics.impl.Loci.LociL3.CS_Locus;
+import org.eclipse.papyrus.moka.composites.extensions.Semantics.CompositeStructures.CS_NotNormativeDefaultConstructStrategy;
import org.eclipse.papyrus.moka.fuml.FUMLExecutionEngine;
import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ILocus;
@@ -40,6 +40,6 @@
locus.getFactory().setStrategy(new CS_DispatchOperationOfInterfaceStrategy());
locus.getFactory().setStrategy(new CS_NameBased_StructuralFeatureOfInterfaceAccessStrategy());
locus.getFactory().setStrategy(new CS_DefaultRequestPropagationStrategy());
- locus.getFactory().setStrategy(new CS_DefaultConstructStrategy());
+ locus.getFactory().setStrategy(new CS_NotNormativeDefaultConstructStrategy());
}
}
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.composites/src/org/eclipse/papyrus/moka/composites/extensions/Semantics/CompositeStructures/CS_NotNormativeDefaultConstructStrategy.java b/bundles/core/engines/org.eclipse.papyrus.moka.composites/src/org/eclipse/papyrus/moka/composites/extensions/Semantics/CompositeStructures/CS_NotNormativeDefaultConstructStrategy.java
new file mode 100644
index 0000000..971ee9a
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.composites/src/org/eclipse/papyrus/moka/composites/extensions/Semantics/CompositeStructures/CS_NotNormativeDefaultConstructStrategy.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.composites.extensions.Semantics.CompositeStructures;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.papyrus.moka.composites.Semantics.impl.CompositeStructures.InvocationActions.CS_DefaultConstructStrategy;
+import org.eclipse.papyrus.moka.composites.extensions.Semantics.InvocationActions.CS_ConnectorLink;
+import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_Reference;
+import org.eclipse.papyrus.moka.composites.interfaces.extensions.Semantics.CompositeStructures.StructuredClasses.ICS_ConnectorLink;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IReference;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IValue;
+import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.ConnectorEnd;
+
+public class CS_NotNormativeDefaultConstructStrategy extends CS_DefaultConstructStrategy{
+
+ public void generateArrayPattern(ICS_Reference context, Connector connector) {
+ ConnectorEnd end1 = connector.getEnds().get(0);
+ ConnectorEnd end2 = connector.getEnds().get(1);
+ List<IReference> end1Values = this.getValuesFromConnectorEnd(context, end1);
+ List<IReference> end2Values = this.getValuesFromConnectorEnd(context, end2);
+ for (int i = 0; i < end1Values.size(); i++) {
+ ICS_ConnectorLink link = new CS_ConnectorLink();
+ link.setConnector(connector);
+ if (connector.getType() == null) {
+ link.setType(this.getDefaultAssociation());
+ } else {
+ link.setType(connector.getType());
+ }
+ List<IValue> valuesForEnd1 = new ArrayList<IValue>();
+ valuesForEnd1.add(end1Values.get(i));
+ List<IValue> valuesForEnd2 = new ArrayList<IValue>();
+ valuesForEnd2.add(end2Values.get(i));
+ link.setFeatureValue(link.getType().getOwnedEnds().get(0), valuesForEnd1, -1);
+ link.setFeatureValue(link.getType().getOwnedEnds().get(1), valuesForEnd2, -1);
+ link.addTo(context.getReferent().getLocus());
+ }
+ }
+
+ public void generateStarPattern(ICS_Reference context, Connector connector) {
+ ConnectorEnd end1 = connector.getEnds().get(0);
+ ConnectorEnd end2 = connector.getEnds().get(1);
+ List<IReference> end1Values = this.getValuesFromConnectorEnd(context, end1);
+ List<IReference> end2Values = this.getValuesFromConnectorEnd(context, end2);
+ for (int i = 0; i < end1Values.size(); i++) {
+ for (int j = 0; j < end2Values.size(); j++) {
+ ICS_ConnectorLink link = new CS_ConnectorLink();
+ link.setConnector(connector);
+ if (connector.getType() == null) {
+ link.setType(this.getDefaultAssociation());
+ } else {
+ link.setType(connector.getType());
+ }
+ List<IValue> valuesForEnd1 = new ArrayList<IValue>();
+ valuesForEnd1.add(end1Values.get(i));
+ List<IValue> valuesForEnd2 = new ArrayList<IValue>();
+ valuesForEnd2.add(end2Values.get(j));
+ link.setFeatureValue(link.getType().getOwnedEnds().get(0), valuesForEnd1, -1);
+ link.setFeatureValue(link.getType().getOwnedEnds().get(1), valuesForEnd2, -1);
+ link.addTo(context.getReferent().getLocus());
+ }
+ }
+ }
+
+}
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.composites/src/org/eclipse/papyrus/moka/composites/extensions/Semantics/InvocationActions/CS_ConnectorLink.java b/bundles/core/engines/org.eclipse.papyrus.moka.composites/src/org/eclipse/papyrus/moka/composites/extensions/Semantics/InvocationActions/CS_ConnectorLink.java
new file mode 100644
index 0000000..475d92b
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.composites/src/org/eclipse/papyrus/moka/composites/extensions/Semantics/InvocationActions/CS_ConnectorLink.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.composites.extensions.Semantics.InvocationActions;
+
+import org.eclipse.papyrus.moka.composites.Semantics.impl.CompositeStructures.StructuredClasses.CS_Link;
+import org.eclipse.papyrus.moka.composites.interfaces.extensions.Semantics.CompositeStructures.StructuredClasses.ICS_ConnectorLink;
+import org.eclipse.uml2.uml.Connector;
+
+public class CS_ConnectorLink extends CS_Link implements ICS_ConnectorLink{
+
+ protected Connector connector;
+
+ public void setConnector(Connector connector) {
+ this.connector = connector;
+ }
+
+ public Connector getConnector() {
+ return this.connector;
+ }
+
+}
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/META-INF/MANIFEST.MF b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/META-INF/MANIFEST.MF
index 21c8c25..4baf1fe 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/META-INF/MANIFEST.MF
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/META-INF/MANIFEST.MF
@@ -22,4 +22,5 @@
org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel,
org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors,
org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications,
- org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1
+ org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1,
+ org.eclipse.papyrus.moka.fuml.profiling.Semantics.Kernel.Classes
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/src/org/eclipse/papyrus/moka/fuml/Profiling/Semantics/Kernel/Classes/IFeatureValueWrapper.java b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/src/org/eclipse/papyrus/moka/fuml/Profiling/Semantics/Kernel/Classes/IFeatureValueWrapper.java
new file mode 100644
index 0000000..0bba62b
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/src/org/eclipse/papyrus/moka/fuml/Profiling/Semantics/Kernel/Classes/IFeatureValueWrapper.java
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.moka.fuml.profiling.Semantics.Kernel.Classes;
+
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IFeatureValue;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IObject_;
+import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;
+
+public interface IFeatureValueWrapper extends IFeatureValue, ISemanticVisitor{
+
+ public IObject_ getContext();
+
+}
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/StateMachineExecutionEngine.java b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/StateMachineExecutionEngine.java
index 3638a72..b0f71a6 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/StateMachineExecutionEngine.java
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/StateMachineExecutionEngine.java
@@ -16,9 +16,9 @@
import org.eclipse.papyrus.moka.composites.CompositeStructuresExecutionEngine;
import org.eclipse.papyrus.moka.composites.Semantics.impl.CommonBehaviors.Communications.CS_DispatchOperationOfInterfaceStrategy;
import org.eclipse.papyrus.moka.composites.Semantics.impl.CommonBehaviors.Communications.CS_NameBased_StructuralFeatureOfInterfaceAccessStrategy;
-import org.eclipse.papyrus.moka.composites.Semantics.impl.CompositeStructures.InvocationActions.CS_DefaultConstructStrategy;
import org.eclipse.papyrus.moka.composites.Semantics.impl.CompositeStructures.InvocationActions.CS_DefaultRequestPropagationStrategy;
import org.eclipse.papyrus.moka.composites.Semantics.impl.Loci.LociL3.CS_Executor;
+import org.eclipse.papyrus.moka.composites.extensions.Semantics.CompositeStructures.CS_NotNormativeDefaultConstructStrategy;
import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ILocus;
import org.eclipse.papyrus.moka.fuml.Semantics.impl.Actions.IntermediateActions.DefaultCreateObjectActionStrategy;
import org.eclipse.papyrus.moka.fuml.Semantics.impl.Actions.IntermediateActions.DefaultGetAssociationStrategy;
@@ -44,7 +44,7 @@
locus.getFactory().setStrategy(new CS_DispatchOperationOfInterfaceStrategy());
locus.getFactory().setStrategy(new CS_NameBased_StructuralFeatureOfInterfaceAccessStrategy());
locus.getFactory().setStrategy(new CS_DefaultRequestPropagationStrategy());
- locus.getFactory().setStrategy(new CS_DefaultConstructStrategy());
+ locus.getFactory().setStrategy(new CS_NotNormativeDefaultConstructStrategy());
locus.getFactory().setStrategy(new DefaultGetAssociationStrategy());
locus.getFactory().setStrategy(new DefaultCreateObjectActionStrategy());
}
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Classes/Kernel/FeatureValueWrapper.java b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Classes/Kernel/FeatureValueWrapper.java
new file mode 100644
index 0000000..93a67e0
--- /dev/null
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Classes/Kernel/FeatureValueWrapper.java
@@ -0,0 +1,90 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST 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
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.moka.fuml.profiling.Semantics.Classes.Kernel;
+
+import java.util.List;
+
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IFeatureValue;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IObject_;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IValue;
+import org.eclipse.papyrus.moka.fuml.profiling.Semantics.Kernel.Classes.IFeatureValueWrapper;
+import org.eclipse.uml2.uml.StructuralFeature;
+
+public class FeatureValueWrapper implements IFeatureValueWrapper{
+
+ protected IFeatureValue featureValue;
+
+ protected IObject_ context;
+
+ public FeatureValueWrapper(IFeatureValue featureValue, IObject_ context) {
+ this.featureValue = featureValue;
+ this.context = context;
+ }
+
+ @Override
+ public void _endIsolation() {
+ // Do nothing
+ }
+
+ @Override
+ public void _beginIsolation() {
+ // Do nothing
+ }
+
+ @Override
+ public Boolean hasEqualValues(IFeatureValue other) {
+ return this.featureValue.hasEqualValues(other);
+ }
+
+ @Override
+ public IFeatureValue copy() {
+ return this.featureValue.copy();
+ }
+
+ @Override
+ public List<IValue> getValues() {
+ return this.featureValue.getValues();
+ }
+
+ @Override
+ public void setValues(List<IValue> values) {
+ this.featureValue.setValues(values);
+ }
+
+ @Override
+ public StructuralFeature getFeature() {
+ return this.featureValue.getFeature();
+ }
+
+ @Override
+ public void setFeature(StructuralFeature feature) {
+ this.featureValue.setFeature(feature);
+ }
+
+ @Override
+ public Integer getPosition() {
+ return this.featureValue.getPosition();
+ }
+
+ @Override
+ public void setPosition(Integer position) {
+ this.featureValue.setPosition(position);
+ }
+
+ @Override
+ public IObject_ getContext() {
+ return this.context;
+ }
+
+}
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/plugin.xml b/bundles/core/services/org.eclipse.papyrus.moka.animation/plugin.xml
index 0faaf41..424e186 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.animation/plugin.xml
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/plugin.xml
@@ -75,6 +75,10 @@
class="org.eclipse.papyrus.moka.animation.engine.animators.ActivityAnimator"
priority="0">
</animator>
+ <animator
+ class="org.eclipse.papyrus.moka.animation.engine.animators.CompositeAnimator"
+ priority="0">
+ </animator>
</extension>
</plugin>
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/ActivityAnimator.java b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/ActivityAnimator.java
index 7804ec7..8da194f 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/ActivityAnimator.java
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/ActivityAnimator.java
@@ -18,6 +18,8 @@
import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IActivityNodeActivation;
import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;
import org.eclipse.papyrus.moka.utils.constants.MokaConstants;
+import org.eclipse.uml2.uml.ActivityNode;
+import org.eclipse.uml2.uml.SendSignalAction;
public class ActivityAnimator extends Animator{
@@ -74,11 +76,20 @@
public boolean accept(ISemanticVisitor visitor) {
// If the visitor are either for activity nodes or activity edges then they can be accepted
// by this animator to perform animation.
- if(visitor instanceof IActivityNodeActivation
- || visitor instanceof IActivityEdgeInstance){
- return true;
+ boolean accept = false;
+ if(visitor instanceof IActivityNodeActivation){
+ ActivityNode activityNode = ((IActivityNodeActivation) visitor).getNode();
+ if(!(activityNode instanceof SendSignalAction)) {
+ accept = true;
+ } else {
+ if(((SendSignalAction)activityNode).getOnPort() == null) {
+ accept = true;
+ }
+ }
+ }else if (visitor instanceof IActivityEdgeInstance) {
+ accept = true;
}
- return false;
+ return accept;
}
}
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/CompositeAnimator.java b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/CompositeAnimator.java
new file mode 100644
index 0000000..e4f1c73
--- /dev/null
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/CompositeAnimator.java
@@ -0,0 +1,93 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST 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
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.moka.animation.engine.animators;
+
+import org.eclipse.papyrus.moka.animation.engine.rendering.AnimationKind;
+import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_InteractionPoint;
+import org.eclipse.papyrus.moka.composites.interfaces.extensions.Semantics.CompositeStructures.StructuredClasses.ICS_ConnectorLink;
+import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IActivityNodeActivation;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IFeatureValue;
+import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;
+import org.eclipse.papyrus.moka.fuml.profiling.Semantics.Kernel.Classes.IFeatureValueWrapper;
+import org.eclipse.papyrus.moka.utils.constants.MokaConstants;
+import org.eclipse.uml2.uml.SendSignalAction;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.Class;
+
+public class CompositeAnimator extends Animator {
+
+ @Override
+ public void nodeVisited(ISemanticVisitor nodeVisitor) {
+ if (nodeVisitor instanceof ICS_InteractionPoint) {
+ // If the visited element is the runtime manifestation of a port then it is
+ // animated and then after the specified delay marked as visited.
+ this.renderAs(((ICS_InteractionPoint) nodeVisitor).getDefiningPort(),
+ ((ICS_InteractionPoint) nodeVisitor).getOwner().getReferent(), AnimationKind.ANIMATED,
+ AnimationKind.VISITED, MokaConstants.MOKA_ANIMATION_DELAY);
+ } else if (nodeVisitor instanceof ICS_ConnectorLink) {
+ // If the visited element is the runtime manifestation of a connector then it
+ // animated and then after the specified delay marked as visited.
+ this.renderAs(((ICS_ConnectorLink) nodeVisitor).getConnector(), null, AnimationKind.ANIMATED,
+ AnimationKind.VISITED, MokaConstants.MOKA_ANIMATION_DELAY);
+ } else if(nodeVisitor instanceof IFeatureValueWrapper) {
+ // If the visited element is a structural feature newly associated to values then
+ // two different animation behavior can occur:
+ // 1] The structural feature has a type that is an active class then the feature
+ // is marked as being animated (i.e., it is currently executed).
+ // 2] The structural feature is not typed by an active class then the feature is
+ // marked as being visited (i.e., it is not currently executing)
+ IFeatureValueWrapper featureValue = (IFeatureValueWrapper) nodeVisitor;
+ Type type = featureValue.getFeature().getType();
+ if(type instanceof Class && ((Class)type).isActive()) {
+ this.renderAs(featureValue.getFeature(), featureValue.getContext(), AnimationKind.ANIMATED);
+ } else {
+ this.renderAs(featureValue.getFeature(), featureValue.getContext(), AnimationKind.VISITED);
+ }
+ } else if (nodeVisitor instanceof IActivityNodeActivation
+ && ((IActivityNodeActivation) nodeVisitor).getNode() instanceof SendSignalAction) {
+ // If the visited element is a SendSignalAction with the property 'onPort' specified
+ // then it is animated and after the certain delay marked as visited.
+ SendSignalAction sendSignalAction = (SendSignalAction) ((IActivityNodeActivation) nodeVisitor).getNode();
+ this.renderAs(sendSignalAction, ((IActivityNodeActivation) nodeVisitor).getExecutionContext(),
+ AnimationKind.ANIMATED, AnimationKind.VISITED, MokaConstants.MOKA_ANIMATION_DELAY);
+ this.renderAs(sendSignalAction.getOnPort(), ((IActivityNodeActivation) nodeVisitor).getExecutionContext(),
+ AnimationKind.ANIMATED, AnimationKind.VISITED, MokaConstants.MOKA_ANIMATION_DELAY);
+ }
+ }
+
+ @Override
+ public void nodeLeft(ISemanticVisitor nodeVisitor) {
+ // Do nothing
+ }
+
+ @Override
+ public boolean accept(ISemanticVisitor visitor) {
+ // The composite animator enables the following nodes to be animated:
+ // any feature value with newly associated value, connector and send signal
+ // action with the 'onPort' property specified.
+ if (visitor instanceof ICS_InteractionPoint) {
+ return true;
+ } else if (visitor instanceof ICS_ConnectorLink) {
+ return true;
+ } else if (visitor instanceof IFeatureValue) {
+ return true;
+ } else if (visitor instanceof IActivityNodeActivation
+ && ((IActivityNodeActivation) visitor).getNode() instanceof SendSignalAction
+ && ((SendSignalAction) ((IActivityNodeActivation) visitor).getNode()).getOnPort() != null) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/bundles/core/tools/org.eclipse.papyrus.moka.fuml.libraries.tools.annotations/xtend-gen/org/eclipse/papyrus/moka/fuml/libraries/tools/annotations/xtend/OpaqueBehaviorExecutionGenerator.java b/bundles/core/tools/org.eclipse.papyrus.moka.fuml.libraries.tools.annotations/xtend-gen/org/eclipse/papyrus/moka/fuml/libraries/tools/annotations/xtend/OpaqueBehaviorExecutionGenerator.java
new file mode 100644
index 0000000..b55f855
--- /dev/null
+++ b/bundles/core/tools/org.eclipse.papyrus.moka.fuml.libraries.tools.annotations/xtend-gen/org/eclipse/papyrus/moka/fuml/libraries/tools/annotations/xtend/OpaqueBehaviorExecutionGenerator.java
@@ -0,0 +1,205 @@
+/**
+ * Copyright (c) 2016 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:
+ * David LOPEZ BETANCUR (CEA LIST) - david.lopez@cea.fr
+ */
+package org.eclipse.papyrus.moka.fuml.libraries.tools.annotations.xtend;
+
+import com.google.common.base.Objects;
+import java.util.List;
+import javax.lang.model.element.Name;
+import org.eclipse.papyrus.moka.fuml.libraries.tools.annotations.processor.FumlLibraryData;
+import org.eclipse.xtend2.lib.StringConcatenation;
+import org.eclipse.xtext.xbase.lib.StringExtensions;
+
+@SuppressWarnings("all")
+public class OpaqueBehaviorExecutionGenerator {
+ public static String className(final FumlLibraryData.OpaqueFunction f) {
+ StringConcatenation _builder = new StringConcatenation();
+ String _firstUpper = StringExtensions.toFirstUpper(f.name());
+ _builder.append(_firstUpper);
+ _builder.append("Behavior");
+ return _builder.toString();
+ }
+
+ public static String genInputParamString(final FumlLibraryData.OpaqueFunctionParameter p, final int i, final int size) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("(");
+ String _fqType = p.fqType();
+ _builder.append(_fqType);
+ _builder.append(") in.get(");
+ _builder.append(i);
+ _builder.append(").getValues().get(0)");
+ {
+ if ((i != (size - 1))) {
+ _builder.append(",");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ return _builder.toString();
+ }
+
+ public static String generate(final FumlLibraryData.OpaqueFunction f, final FumlLibraryData lib) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("package ");
+ String _packageName = lib.packageName();
+ _builder.append(_packageName);
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ int _countParams = f.countParams(FumlLibraryData.ParameterDirection.OUT);
+ boolean hasOutput = (_countParams > 0);
+ _builder.newLineIfNotEmpty();
+ _builder.newLine();
+ {
+ if (hasOutput) {
+ _builder.append("import java.util.ArrayList;");
+ _builder.newLine();
+ }
+ }
+ _builder.append("import java.util.List;");
+ _builder.newLine();
+ _builder.newLine();
+ _builder.append("import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IValue;");
+ _builder.newLine();
+ _builder.append("import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.IParameterValue;");
+ _builder.newLine();
+ _builder.append("import org.eclipse.papyrus.moka.fuml.Semantics.impl.CommonBehaviors.BasicBehaviors.OpaqueBehaviorExecution;");
+ _builder.newLine();
+ _builder.newLine();
+ _builder.append("public class ");
+ String _className = OpaqueBehaviorExecutionGenerator.className(f);
+ _builder.append(_className);
+ _builder.append(" extends OpaqueBehaviorExecution{");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("@Override");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("public void doBody(List<IParameterValue> in, List<IParameterValue> out) {");
+ _builder.newLine();
+ _builder.append("\t\t");
+ int inputIdx = 0;
+ _builder.newLineIfNotEmpty();
+ {
+ if (hasOutput) {
+ _builder.append("\t\t");
+ _builder.append("List<IValue> outputs = new ArrayList<IValue>();");
+ _builder.newLine();
+ }
+ }
+ _builder.append("\t\t");
+ _builder.newLine();
+ {
+ List<FumlLibraryData.OpaqueFunctionParameter> _params = f.params();
+ for(final FumlLibraryData.OpaqueFunctionParameter op : _params) {
+ {
+ FumlLibraryData.ParameterDirection _direction = op.direction();
+ boolean _equals = Objects.equal(_direction, FumlLibraryData.ParameterDirection.OUT);
+ if (_equals) {
+ _builder.append("\t\t");
+ String _fqType = op.fqType();
+ _builder.append(_fqType, "\t\t");
+ _builder.append(" ");
+ String _name = op.name();
+ _builder.append(_name, "\t\t");
+ _builder.append(" = new ");
+ String _fqType_1 = op.fqType();
+ _builder.append(_fqType_1, "\t\t");
+ _builder.append("(); ");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("outputs.add(");
+ String _name_1 = op.name();
+ _builder.append(_name_1, "\t\t");
+ _builder.append(");");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ {
+ FumlLibraryData.ParameterDirection _direction_1 = op.direction();
+ boolean _equals_1 = Objects.equal(_direction_1, FumlLibraryData.ParameterDirection.IN);
+ if (_equals_1) {
+ _builder.append("\t\t");
+ String _fqType_2 = op.fqType();
+ _builder.append(_fqType_2, "\t\t");
+ _builder.append(" ");
+ String _name_2 = op.name();
+ _builder.append(_name_2, "\t\t");
+ _builder.append(" = (");
+ String _fqType_3 = op.fqType();
+ _builder.append(_fqType_3, "\t\t");
+ _builder.append(") in.get(");
+ int _plusPlus = inputIdx++;
+ _builder.append(_plusPlus, "\t\t");
+ _builder.append(").getValues().get(0);");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ }
+ }
+ _builder.append("\t\t");
+ _builder.newLine();
+ _builder.append("\t\t");
+ Name _simpleName = lib.classElement().getSimpleName();
+ _builder.append(_simpleName, "\t\t");
+ _builder.append(".");
+ String _methodName = f.methodName();
+ _builder.append(_methodName, "\t\t");
+ _builder.append("(");
+ {
+ List<FumlLibraryData.OpaqueFunctionParameter> _params_1 = f.params();
+ boolean _hasElements = false;
+ for(final FumlLibraryData.OpaqueFunctionParameter op_1 : _params_1) {
+ if (!_hasElements) {
+ _hasElements = true;
+ } else {
+ _builder.appendImmediate(",", "\t\t");
+ }
+ String _name_3 = op_1.name();
+ _builder.append(_name_3, "\t\t");
+ }
+ }
+ _builder.append(");");
+ _builder.newLineIfNotEmpty();
+ _builder.newLine();
+ {
+ if (hasOutput) {
+ _builder.append("\t\t");
+ _builder.append("out.get(0).setValues(outputs);");
+ _builder.newLine();
+ }
+ }
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("@Override");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("public IValue new_() {");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("return new ");
+ String _className_1 = OpaqueBehaviorExecutionGenerator.className(f);
+ _builder.append(_className_1, "\t\t");
+ _builder.append("();");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("}");
+ _builder.newLine();
+ return _builder.toString();
+ }
+}
diff --git a/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUConstructStrategy.java b/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUConstructStrategy.java
index 0e9418e..465443e 100644
--- a/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUConstructStrategy.java
+++ b/bundles/fmi/engines/org.eclipse.papyrus.moka.fmu.engine/src/org/eclipse/papyrus/moka/fmu/engine/semantics/FMUConstructStrategy.java
@@ -15,7 +15,7 @@
import java.util.List;
-import org.eclipse.papyrus.moka.composites.Semantics.impl.CompositeStructures.InvocationActions.CS_DefaultConstructStrategy;
+import org.eclipse.papyrus.moka.composites.extensions.Semantics.CompositeStructures.CS_NotNormativeDefaultConstructStrategy;
import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_Object;
import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_Reference;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IFeatureValue;
@@ -23,7 +23,7 @@
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Property;
-public class FMUConstructStrategy extends CS_DefaultConstructStrategy {
+public class FMUConstructStrategy extends CS_NotNormativeDefaultConstructStrategy {
@Override
public void addStructuralFeatureValue(ICS_Reference context, Property feature, IValue value) {
diff --git a/bundles/fmi/engines/org.eclipse.papyrus.moka.fuml.cosimulation/src/org/eclipse/papyrus/moka/fuml/cosimulation/semantics/CosimulationDefaultConstructStrategy.java b/bundles/fmi/engines/org.eclipse.papyrus.moka.fuml.cosimulation/src/org/eclipse/papyrus/moka/fuml/cosimulation/semantics/CosimulationDefaultConstructStrategy.java
index 1e9eea4..47bfa15 100644
--- a/bundles/fmi/engines/org.eclipse.papyrus.moka.fuml.cosimulation/src/org/eclipse/papyrus/moka/fuml/cosimulation/semantics/CosimulationDefaultConstructStrategy.java
+++ b/bundles/fmi/engines/org.eclipse.papyrus.moka.fuml.cosimulation/src/org/eclipse/papyrus/moka/fuml/cosimulation/semantics/CosimulationDefaultConstructStrategy.java
@@ -15,9 +15,9 @@
import java.util.List;
-import org.eclipse.papyrus.moka.composites.Semantics.impl.CompositeStructures.InvocationActions.CS_DefaultConstructStrategy;
import org.eclipse.papyrus.moka.composites.Semantics.impl.CompositeStructures.StructuredClasses.CS_InteractionPoint;
import org.eclipse.papyrus.moka.composites.Semantics.impl.CompositeStructures.StructuredClasses.CS_Reference;
+import org.eclipse.papyrus.moka.composites.extensions.Semantics.CompositeStructures.CS_NotNormativeDefaultConstructStrategy;
import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_InteractionPoint;
import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_Object;
import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_Reference;
@@ -29,7 +29,7 @@
import org.eclipse.uml2.uml.Property;
-public class CosimulationDefaultConstructStrategy extends CS_DefaultConstructStrategy {
+public class CosimulationDefaultConstructStrategy extends CS_NotNormativeDefaultConstructStrategy {
@Override
public void addStructuralFeatureValue(ICS_Reference context, Property feature, IValue value) {
@@ -56,6 +56,4 @@
}
}
-
-
}