Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeremie.tatibouet2017-01-25 13:40:49 +0000
committerjeremie.tatibouet2017-02-01 13:51:39 +0000
commit48175203bcf221e707fe242d9dfe8230a641e693 (patch)
treed5532fc84e3e5780a86c9d322b324d7560750e21
parent250dc1b9f6748d4269999bb686a2d6f17427c7cd (diff)
downloadorg.eclipse.papyrus-48175203bcf221e707fe242d9dfe8230a641e693.tar.gz
org.eclipse.papyrus-48175203bcf221e707fe242d9dfe8230a641e693.tar.xz
org.eclipse.papyrus-48175203bcf221e707fe242d9dfe8230a641e693.zip
PSCS11-6: Any EventOccurrence should be associatable as an
interaction point. Change-Id: Icbf457cb1e7d9fa0b6415bd5f3ae2024b41cf534 Signed-off-by: jeremie.tatibouet <jeremie.tatibouet@cea.fr>
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/Actions/CompleteActions/CS_ReadIsClassifiedObjectActionActivation.java87
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_AcceptEventActionActivation.java99
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_EventOccurrence.java61
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_SendSignalActionActivation.java46
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_SignalInstance.java43
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_InteractionPoint.java27
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_Object.java115
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_Reference.java18
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/Loci/LociL3/CS_ExecutionFactory.java8
9 files changed, 221 insertions, 283 deletions
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/Actions/CompleteActions/CS_ReadIsClassifiedObjectActionActivation.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/Actions/CompleteActions/CS_ReadIsClassifiedObjectActionActivation.java
deleted file mode 100644
index 9aa47146fa4..00000000000
--- a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/Actions/CompleteActions/CS_ReadIsClassifiedObjectActionActivation.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*****************************************************************************
- * 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.moka.composites.Semantics.Actions.CompleteActions;
-
-import java.util.List;
-
-import org.eclipse.papyrus.moka.fuml.Semantics.Actions.CompleteActions.ReadIsClassifiedObjectActionActivation;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Interface;
-import org.eclipse.uml2.uml.InterfaceRealization;
-
-public class CS_ReadIsClassifiedObjectActionActivation extends ReadIsClassifiedObjectActionActivation {
-
- @Override
- public boolean checkAllParents(Classifier type, Classifier classifier) {
- // If the given classifier is not an Interface, behaves like in fUML.
- // Otherwise, check if the given type (or one of its direct or indirect ancestors)
- // has an InterfaceRealization relationships with the given classifier.
- boolean matched = false;
- if (!(classifier instanceof Interface)) {
- matched = super.checkAllParents(type, classifier);
- } else if (!(type instanceof Class)) {
- matched = false;
- } else if (this.realizesInterface((Class) type, (Interface) classifier)) {
- matched = true;
- } else {
- List<Classifier> directParents = type.getGenerals();
- int i = 1;
- while (!matched & i <= directParents.size()) {
- Classifier directParent = directParents.get(i - 1);
- matched = this.checkAllParents(directParent, classifier);
- i = i + 1;
- }
- }
- return matched;
- }
-
- public Boolean realizesInterface(Class type, Interface interface_) {
- // Checks if the given type has an InterfaceRealization relationship
- // with the given interface or a descendant of the interface.
- List<InterfaceRealization> realizations = type.getInterfaceRealizations();
- boolean realized = false;
- int i = 1;
- while (i <= realizations.size() && !realized) {
- InterfaceRealization realization = realizations.get(i - 1);
- Interface contract = realization.getContract();
- if (contract == interface_) {
- realized = true;
- } else if (this.isDescendant(contract, interface_)) {
- realized = true;
- }
- i = i + 1;
- }
- return realized;
- }
-
- public Boolean isDescendant(Interface contract, Interface interface_) {
- // Checks if the given contract is a descendant of the given interface_
- boolean matched = false;
- List<Classifier> descendants = contract.getGenerals();
- int i = 1;
- while (i <= descendants.size() && !matched) {
- if (descendants.get(i - 1) instanceof Interface) {
- Interface descendant = (Interface) descendants.get(i - 1);
- if (descendant == interface_) {
- matched = true;
- } else {
- matched = this.isDescendant(descendant, interface_);
- }
- }
- i = i + 1;
- }
- return matched;
- }
-}
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_AcceptEventActionActivation.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_AcceptEventActionActivation.java
index 8c51b08088d..5bd9df20145 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_AcceptEventActionActivation.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_AcceptEventActionActivation.java
@@ -1,66 +1,33 @@
-/*****************************************************************************
- * 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.moka.composites.Semantics.CompositeStructures.InvocationActions;
-
-// Imports
-import java.util.List;
-
-import org.eclipse.papyrus.moka.fuml.Semantics.Actions.CompleteActions.AcceptEventActionActivation;
-import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.SignalInstance;
-import org.eclipse.uml2.uml.AcceptEventAction;
-import org.eclipse.uml2.uml.Port;
-import org.eclipse.uml2.uml.Signal;
-import org.eclipse.uml2.uml.SignalEvent;
-import org.eclipse.uml2.uml.Trigger;
-
-
-public class CS_AcceptEventActionActivation extends AcceptEventActionActivation {
-
- @Override
- public Boolean match(SignalInstance signalInstance) {
- // Return true if the given signal instance matches a trigger of the accept
- // event action of this activation.
- // Matching implies that the type of the signalInstance matches the Signal
- // of one of the triggers.
- // When the type matches with the Signal, and if the trigger specifies a
- // list of ports,
- // the signalInstance matches the trigger only if it occurred on a port
- // identified in the list.
-
- AcceptEventAction action = (AcceptEventAction) (this.node);
- List<Trigger> triggers = action.getTriggers();
- Signal signal = signalInstance.type;
-
- Boolean matches = false;
- Integer i = 1;
- while (!matches & i <= triggers.size()) {
- Trigger t = triggers.get(i - 1);
- matches = ((SignalEvent) t.getEvent()).getSignal() == signal;
- if (matches && t.getPorts().size() > 0) {
- List<Port> portsOfTrigger = t.getPorts();
- Port onPort = ((CS_SignalInstance) signalInstance).interactionPoint.definingPort;
- Boolean portMatches = false;
- Integer j = 1;
- while (!portMatches & j <= portsOfTrigger.size()) {
- portMatches = onPort == portsOfTrigger.get(j - 1);
- j = j + 1;
- }
- matches = portMatches;
- }
- i = i + 1;
- }
-
- return matches;
- }
-}
+/*****************************************************************************
+ * 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.Semantics.CompositeStructures.InvocationActions;
+
+import org.eclipse.papyrus.moka.fuml.Semantics.Actions.CompleteActions.AcceptEventActionActivation;
+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.EventOccurrence;
+
+public class CS_AcceptEventActionActivation extends AcceptEventActionActivation {
+
+ @Override
+ public void accept(EventOccurrence eventOccurrence) {
+ // If the accepted event occurrence is a CS_EventOccurrence then the wrapped
+ // event occurrence is extracted. The acceptance process is the one define
+ // by AcceptEventActionActivation defined in fUML.
+ if(eventOccurrence instanceof CS_EventOccurrence){
+ super.accept(((CS_EventOccurrence) eventOccurrence).wrappedEventOccurrence);
+ }else{
+ super.accept(eventOccurrence);
+ }
+ }
+
+}
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_EventOccurrence.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_EventOccurrence.java
new file mode 100644
index 00000000000..1a6093088c0
--- /dev/null
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_EventOccurrence.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * 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.Semantics.CompositeStructures.InvocationActions;
+
+import java.util.List;
+
+import org.eclipse.papyrus.moka.composites.Semantics.CompositeStructures.StructuredClasses.CS_InteractionPoint;
+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue;
+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.EventOccurrence;
+import org.eclipse.uml2.uml.Trigger;
+
+public class CS_EventOccurrence extends EventOccurrence{
+
+ // Real event occurrence
+ public EventOccurrence wrappedEventOccurrence;
+
+ // Port manifestation from which the wrapped event occurrence was received.
+ public CS_InteractionPoint interactionPoint;
+
+ @Override
+ public boolean match(Trigger trigger) {
+ // If the trigger references ports then to match this latter it is required that
+ // 1] the interaction point is instance of port referenced by the trigger
+ // 2] the referenced event occurrence match operation returns true.
+ // If the trigger does not reference ports then the behavior is the same than for fUML.
+ boolean matches = false;
+ if(trigger.getPorts().size() > 0){
+ int i = 1;
+ while(!matches && i <= trigger.getPorts().size()){
+ if(this.interactionPoint.definingPort == trigger.getPorts().get(i-1)){
+ matches = true;
+ }
+ i++;
+ }
+ if(matches){
+ matches = this.wrappedEventOccurrence.match(trigger);
+ }
+ }else{
+ matches = this.wrappedEventOccurrence.match(trigger);
+ }
+ return matches;
+ }
+
+ @Override
+ public List<ParameterValue> getParameterValues() {
+ // Return the parametric data of the referenced event occurrence
+ return this.wrappedEventOccurrence.getParameterValues();
+ }
+
+}
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_SendSignalActionActivation.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_SendSignalActionActivation.java
index c4e387079ef..0caf9c43097 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_SendSignalActionActivation.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_SendSignalActionActivation.java
@@ -19,8 +19,9 @@ import java.util.List;
import org.eclipse.papyrus.moka.composites.Semantics.CompositeStructures.StructuredClasses.CS_Reference;
import org.eclipse.papyrus.moka.fuml.Semantics.Actions.BasicActions.SendSignalActionActivation;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.Object_;
-import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.Reference;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.Value;
+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.SignalEventOccurrence;
+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.SignalInstance;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.SendSignalAction;
@@ -51,14 +52,14 @@ public class CS_SendSignalActionActivation extends SendSignalActionActivation {
if (action.getOnPort() == null) {
// Behaves like in fUML
- this.doActionDefault();
+ super.doAction();
} else {
Value target = this.takeTokens(action.getTarget()).get(0);
if (target instanceof CS_Reference) {
// Constructs the signal instance
Signal signal = action.getSignal();
- CS_SignalInstance signalInstance = new CS_SignalInstance();
+ SignalInstance signalInstance = new SignalInstance();
signalInstance.type = signal;
List<Property> attributes = signal.getOwnedAttributes();
@@ -72,49 +73,24 @@ public class CS_SendSignalActionActivation extends SendSignalActionActivation {
i = i + 1;
}
+ // Construct the signal event occurrence
+ SignalEventOccurrence signalEventOccurrence = new SignalEventOccurrence();
+ signalEventOccurrence.signalInstance = (SignalInstance) signalInstance.copy();
+
// Tries to determine if the signal has to be
// sent to the environment or to the internals of
// target, through onPort
CS_Reference targetReference = (CS_Reference) target;
// Port onPort = action.onPort ;
+
Object_ executionContext = this.group.activityExecution.context;
if (executionContext == targetReference.referent || targetReference.compositeReferent.contains(executionContext)) {
- targetReference.sendOut(signalInstance, action.getOnPort());
+ targetReference.sendOut(signalEventOccurrence, action.getOnPort());
} else {
- targetReference.sendIn(signalInstance, action.getOnPort());
+ targetReference.sendIn(signalEventOccurrence, action.getOnPort());
}
}
}
}
- public void doActionDefault() {
- // Get the value from the target pin. If the value is not a reference,
- // then do nothing.
- // Otherwise, construct a signal using the values from the argument pins
- // and send it to the referent object.
- // This operation captures same semantics as fUML
- // SendSignalActionActivation.doAction() except that it constructs
- // a CS_SignalInstance instead of a SignalInstance
-
- SendSignalAction action = (SendSignalAction) (this.node);
- Value target = this.takeTokens(action.getTarget()).get(0);
-
- if (target instanceof Reference) {
- Signal signal = action.getSignal();
-
- CS_SignalInstance signalInstance = new CS_SignalInstance();
- signalInstance.type = signal;
-
- List<Property> attributes = signal.getOwnedAttributes();
- List<InputPin> argumentPins = action.getArguments();
- for (int i = 0; i < attributes.size(); i++) {
- Property attribute = attributes.get(i);
- InputPin argumentPin = argumentPins.get(i);
- List<Value> values = this.takeTokens(argumentPin);
- signalInstance.setFeatureValue(attribute, values, 0);
- }
-
- ((Reference) target).send(signalInstance);
- }
- }
}
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_SignalInstance.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_SignalInstance.java
deleted file mode 100644
index 3747e69e5a5..00000000000
--- a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/InvocationActions/CS_SignalInstance.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************
- * 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.moka.composites.Semantics.CompositeStructures.InvocationActions;
-
-// Imports
-import org.eclipse.papyrus.moka.composites.Semantics.CompositeStructures.StructuredClasses.CS_InteractionPoint;
-import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.Value;
-import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.SignalInstance;
-
-
-public class CS_SignalInstance extends SignalInstance {
-
- /*
- * The InteractionPoint on which this signal instance occured.
- */
- public CS_InteractionPoint interactionPoint;
-
- @Override
- public Value copy() {
- // Create a new signal instance with the same type, interaction point and feature values as this signal instance.
- CS_SignalInstance newValue = (CS_SignalInstance) (super.copy());
- newValue.type = this.type;
- newValue.interactionPoint = this.interactionPoint;
- return newValue;
- }
-
- @Override
- public Value new_() {
- // Create a new signal instance with no type or feature values.
- return new CS_SignalInstance();
- }
-}
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_InteractionPoint.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_InteractionPoint.java
index 0c91993c296..7c2edf2719a 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_InteractionPoint.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_InteractionPoint.java
@@ -16,12 +16,14 @@ package org.eclipse.papyrus.moka.composites.Semantics.CompositeStructures.Struct
// Imports
import java.util.List;
+import org.eclipse.papyrus.moka.composites.Semantics.CompositeStructures.InvocationActions.CS_EventOccurrence;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.Reference;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.Value;
import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.Execution;
import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue;
-import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.SignalInstance;
+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.EventOccurrence;
import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.Port;
@@ -52,9 +54,19 @@ public class CS_InteractionPoint extends Reference {
}
@Override
- public void send(SignalInstance signalInstance) {
- // Delegates sending to the owning object
- this.owner.sendIn(signalInstance, this);
+ public void send(EventOccurrence eventOccurrence) {
+ // An event occurrence that passes through a CS_InteractionPoint is
+ // (if necessary) wrapped in a CS_EventOccurrence. This event occurrence
+ // is then sent to the owning object.
+ CS_EventOccurrence wrappingEventOccurrence = null;
+ if(eventOccurrence instanceof CS_EventOccurrence){
+ wrappingEventOccurrence = (CS_EventOccurrence) eventOccurrence;
+ }else{
+ wrappingEventOccurrence = new CS_EventOccurrence();
+ wrappingEventOccurrence.wrappedEventOccurrence = eventOccurrence;
+ }
+ wrappingEventOccurrence.interactionPoint = this;
+ this.owner.sendIn(wrappingEventOccurrence, this);
}
@Override
@@ -70,6 +82,11 @@ public class CS_InteractionPoint extends Reference {
// Create a new interaction point with no referent.
return new CS_InteractionPoint();
}
-
+
+ @Override
+ public boolean checkAllParents(Classifier type, Classifier classifier) {
+ // Delegates the type checking to the reference
+ return this.referent.checkAllParents(type, classifier);
+ }
}
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_Object.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_Object.java
index 19eba7c0a45..acaf850d531 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_Object.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_Object.java
@@ -20,7 +20,6 @@ import java.util.List;
import org.eclipse.papyrus.moka.composites.Semantics.CommonBehaviors.Communications.CS_DispatchOperationOfInterfaceStrategy;
import org.eclipse.papyrus.moka.composites.Semantics.CommonBehaviors.Communications.CS_StructuralFeatureOfInterfaceAccessStrategy;
import org.eclipse.papyrus.moka.composites.Semantics.CompositeStructures.InvocationActions.CS_RequestPropagationStrategy;
-import org.eclipse.papyrus.moka.composites.Semantics.CompositeStructures.InvocationActions.CS_SignalInstance;
import org.eclipse.papyrus.moka.fuml.Semantics.Actions.BasicActions.CallOperationActionActivation;
import org.eclipse.papyrus.moka.fuml.Semantics.Actions.BasicActions.SendSignalActionActivation;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.ExtensionalValue;
@@ -29,16 +28,16 @@ import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.Object_;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.Reference;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.Value;
import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.Execution;
-import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.SignalInstance;
+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.EventOccurrence;
import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ChoiceStrategy;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.ConnectorKind;
import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.InterfaceRealization;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.Port;
-import org.eclipse.uml2.uml.Signal;
import org.eclipse.uml2.uml.StructuralFeature;
@@ -81,25 +80,20 @@ public class CS_Object extends Object_ {
}
- public void sendIn(SignalInstance signalInstance, CS_InteractionPoint interactionPoint) {
- // If the interaction is a behavior port,
- // creates a CS_SignalInstance from the signal instance,
- // sets its interaction point,
- // and sends it to the target object using operation send
- // If this is not a behavior port,
- // select appropriate delegation targets from interactionPoint,
- // and propagates the signal to these targets
+ public void sendIn(EventOccurrence eventOccurrence, CS_InteractionPoint interactionPoint) {
+ // 1] If the interaction is a behavior port then sends the event occurrence to the target
+ // object using operation send.
+ // 2] If this is not a behavior port, select appropriate delegation targets from interactionPoint,
+ // and propagates the event occurrence to these targets
if (interactionPoint.definingPort.isBehavior()) {
- CS_SignalInstance newSignalInstance = (CS_SignalInstance) signalInstance.copy();
- newSignalInstance.interactionPoint = interactionPoint;
- this.send(newSignalInstance);
+ this.send(eventOccurrence);
} else {
boolean toInternal = true;
List<Reference> potentialTargets = new ArrayList<Reference>();
List<CS_Link> cddLinks = this.getLinks(interactionPoint);
Integer linkIndex = 1;
while (linkIndex <= cddLinks.size()) {
- List<Reference> validTargets = this.selectTargetsForSending(cddLinks.get(linkIndex - 1), interactionPoint, ConnectorKind.DELEGATION_LITERAL, signalInstance.type, toInternal);
+ List<Reference> validTargets = this.selectTargetsForSending(cddLinks.get(linkIndex - 1), interactionPoint, ConnectorKind.DELEGATION_LITERAL, toInternal);
Integer targetIndex = 1;
while (targetIndex <= validTargets.size()) {
potentialTargets.add(validTargets.get(targetIndex - 1));
@@ -112,15 +106,13 @@ public class CS_Object extends Object_ {
// Otherwise, do the following concurrently
for (int i = 0; i < potentialTargets.size(); i++) {
Reference target = potentialTargets.get(i);
- CS_SignalInstance newSignalInstance = (CS_SignalInstance) signalInstance.copy();
- newSignalInstance.interactionPoint = interactionPoint;
- target.send(newSignalInstance);
+ target.send(eventOccurrence);
}
}
}
- public List<Reference> selectTargetsForSending(CS_Link link, CS_InteractionPoint interactionPoint, ConnectorKind connectorKind, Signal signal, Boolean toInternal) {
+ public List<Reference> selectTargetsForSending(CS_Link link, CS_InteractionPoint interactionPoint, ConnectorKind connectorKind, Boolean toInternal) {
// From the given link, signal and interaction point, retrieves potential targets (i.e. end values of link)
// through which request can be propagated
// These targets are attached to interaction point through the given link, and respect the following rules:
@@ -291,15 +283,14 @@ public class CS_Object extends Object_ {
return potentialTargets;
}
- public void sendOut(SignalInstance signalInstance, CS_InteractionPoint interactionPoint) {
+ public void sendOut(EventOccurrence eventOccurrence, CS_InteractionPoint interactionPoint) {
// Select appropriate delegation links from interactionPoint,
- // and propagates the signal instance through these links
+ // and propagates the event occurrence through these links
// Appropriate links are links which target elements
// in the environment of this CS_Object.
// These can be delegation links (i.e, the targeted elements must
// require a reception for the signal) or assembly links (i.e., the target elements
// must provide a reception for the signal)
-
boolean notToInternal = false; // i.e. to environment
List<Reference> allPotentialTargets = new ArrayList<Reference>();
List<Reference> targetsForSendingIn = new ArrayList<Reference>();
@@ -308,14 +299,14 @@ public class CS_Object extends Object_ {
List<CS_Link> cddLinks = this.getLinks(interactionPoint);
Integer linkIndex = 1;
while (linkIndex <= cddLinks.size()) {
- List<Reference> validAssemblyTargets = this.selectTargetsForSending(cddLinks.get(linkIndex - 1), interactionPoint, ConnectorKind.ASSEMBLY_LITERAL, signalInstance.type, notToInternal);
+ List<Reference> validAssemblyTargets = this.selectTargetsForSending(cddLinks.get(linkIndex - 1), interactionPoint, ConnectorKind.ASSEMBLY_LITERAL, notToInternal);
Integer targetIndex = 1;
while (targetIndex <= validAssemblyTargets.size()) {
allPotentialTargets.add(validAssemblyTargets.get(targetIndex - 1));
targetsForSendingIn.add(validAssemblyTargets.get(targetIndex - 1));
targetIndex = targetIndex + 1;
}
- List<Reference> validDelegationTargets = this.selectTargetsForSending(cddLinks.get(linkIndex - 1), interactionPoint, ConnectorKind.DELEGATION_LITERAL, signalInstance.type, notToInternal);
+ List<Reference> validDelegationTargets = this.selectTargetsForSending(cddLinks.get(linkIndex - 1), interactionPoint, ConnectorKind.DELEGATION_LITERAL, notToInternal);
targetIndex = 1;
while (targetIndex <= validDelegationTargets.size()) {
allPotentialTargets.add(validDelegationTargets.get(targetIndex - 1));
@@ -333,7 +324,7 @@ public class CS_Object extends Object_ {
for (int k = 0; k < targetsForSendingIn.size(); k++) {
Reference cddTarget = targetsForSendingIn.get(k);
if (cddTarget == target) {
- target.send(signalInstance);
+ target.send(eventOccurrence);
}
}
for (int k = 0; k < targetsForSendingOut.size(); k++) {
@@ -342,7 +333,7 @@ public class CS_Object extends Object_ {
CS_InteractionPoint cddTarget = (CS_InteractionPoint) targetsForSendingOut.get(k);
if (cddTarget == target) {
CS_Reference owner = cddTarget.owner;
- owner.sendOut(signalInstance, cddTarget);
+ owner.sendOut(eventOccurrence, cddTarget);
}
}
}
@@ -651,9 +642,9 @@ public class CS_Object extends Object_ {
return isAValue;
}
- public void sendOut(SignalInstance signalInstance, Port onPort) {
+ public void sendOut(EventOccurrence eventOccurrence, Port onPort) {
// Select a CS_InteractionPoint value playing onPort,
- // and send the signal instance to this interaction point
+ // and send the event occurrence to this interaction point
FeatureValue featureValue = this.getFeatureValue(onPort);
List<Value> values = featureValue.values;
List<Reference> potentialTargets = new ArrayList<Reference>();
@@ -664,7 +655,7 @@ public class CS_Object extends Object_ {
List<Reference> targets = strategy.select(potentialTargets, new SendSignalActionActivation());
for (int i = 0; i < targets.size(); i++) {
CS_InteractionPoint target = (CS_InteractionPoint) targets.get(i);
- this.sendOut(signalInstance, target);
+ this.sendOut(eventOccurrence, target);
}
}
@@ -700,9 +691,9 @@ public class CS_Object extends Object_ {
return interactionPoint.dispatch(operation);
}
- public void sendIn(SignalInstance signalInstance, Port onPort) {
+ public void sendIn(EventOccurrence eventOccurrence, Port onPort) {
// Select a Reference value playing onPort,
- // and send the signal instance to this interaction point
+ // and send the event occurrence to this interaction point
FeatureValue featureValue = this.getFeatureValue(onPort);
List<Value> values = featureValue.values;
List<Reference> potentialTargets = new ArrayList<Reference>();
@@ -713,8 +704,68 @@ public class CS_Object extends Object_ {
List<Reference> targets = strategy.select(potentialTargets, new SendSignalActionActivation());
for (int i = 0; i < targets.size(); i++) {
Reference target = targets.get(i);
- target.send(signalInstance);
+ target.send(eventOccurrence);
}
}
+ public boolean checkAllParents(Classifier type, Classifier classifier) {
+ // If the given classifier is not an Interface, behaves like in fUML.
+ // Otherwise, check if the given type (or one of its direct or indirect ancestors)
+ // has an InterfaceRealization relationships with the given classifier.
+ boolean matched = false;
+ if (!(classifier instanceof Interface)) {
+ matched = super.checkAllParents(type, classifier);
+ } else if (!(type instanceof Class)) {
+ matched = false;
+ } else if (this.realizesInterface((Class) type, (Interface) classifier)) {
+ matched = true;
+ } else {
+ List<Classifier> directParents = type.getGenerals();
+ int i = 1;
+ while (!matched & i <= directParents.size()) {
+ Classifier directParent = directParents.get(i - 1);
+ matched = this.checkAllParents(directParent, classifier);
+ i = i + 1;
+ }
+ }
+ return matched;
+ }
+
+ public Boolean realizesInterface(Class type, Interface interface_) {
+ // Checks if the given type has an InterfaceRealization relationship
+ // with the given interface or a descendant of the interface.
+ List<InterfaceRealization> realizations = type.getInterfaceRealizations();
+ boolean realized = false;
+ int i = 1;
+ while (i <= realizations.size() && !realized) {
+ InterfaceRealization realization = realizations.get(i - 1);
+ Interface contract = realization.getContract();
+ if (contract == interface_) {
+ realized = true;
+ } else if (this.isDescendant(contract, interface_)) {
+ realized = true;
+ }
+ i = i + 1;
+ }
+ return realized;
+ }
+
+ public Boolean isDescendant(Interface contract, Interface interface_) {
+ // Checks if the given contract is a descendant of the given interface_
+ boolean matched = false;
+ List<Classifier> descendants = contract.getGenerals();
+ int i = 1;
+ while (i <= descendants.size() && !matched) {
+ if (descendants.get(i - 1) instanceof Interface) {
+ Interface descendant = (Interface) descendants.get(i - 1);
+ if (descendant == interface_) {
+ matched = true;
+ } else {
+ matched = this.isDescendant(descendant, interface_);
+ }
+ }
+ i = i + 1;
+ }
+ return matched;
+ }
}
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_Reference.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_Reference.java
index 160e9a57b61..5b6320ac26a 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_Reference.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/CompositeStructures/StructuredClasses/CS_Reference.java
@@ -17,7 +17,7 @@ package org.eclipse.papyrus.moka.composites.Semantics.CompositeStructures.Struct
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.Reference;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.Value;
import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.Execution;
-import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.SignalInstance;
+import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.EventOccurrence;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.Port;
@@ -34,14 +34,14 @@ public class CS_Reference extends Reference {
return this.compositeReferent.dispatchIn(operation, interactionPoint);
}
- public void sendIn(SignalInstance signalInstance, CS_InteractionPoint interactionPoint) {
+ public void sendIn(EventOccurrence eventOccurrence, CS_InteractionPoint interactionPoint) {
// delegates sending to composite referent
- this.compositeReferent.sendIn(signalInstance, interactionPoint);
+ this.compositeReferent.sendIn(eventOccurrence, interactionPoint);
}
- public void sendOut(SignalInstance signalInstance, Port onPort) {
+ public void sendOut(EventOccurrence eventOccurrence, Port onPort) {
// delegates sending to composite referent
- this.compositeReferent.sendOut(signalInstance, onPort);
+ this.compositeReferent.sendOut(eventOccurrence, onPort);
}
public Execution dispatchOut(Operation operation, Port onPort) {
@@ -54,9 +54,9 @@ public class CS_Reference extends Reference {
return this.compositeReferent.dispatchIn(operation, onPort);
}
- public void sendIn(SignalInstance signalInstance, Port onPort) {
+ public void sendIn(EventOccurrence eventOccurrence, Port onPort) {
// delegates sending to composite referent
- this.compositeReferent.sendIn(signalInstance, onPort);
+ this.compositeReferent.sendIn(eventOccurrence, onPort);
}
public Execution dispatchOut(Operation operation, CS_InteractionPoint interactionPoint) {
@@ -65,10 +65,10 @@ public class CS_Reference extends Reference {
return this.compositeReferent.dispatchOut(operation, interactionPoint);
}
- public void sendOut(SignalInstance signalInstance, CS_InteractionPoint interactionPoint) {
+ public void sendOut(EventOccurrence eventOccurrence, CS_InteractionPoint interactionPoint) {
// Delegates sending (through the interaction point, to the environment)
// to compositeReferent
- this.compositeReferent.sendOut(signalInstance, interactionPoint);
+ this.compositeReferent.sendOut(eventOccurrence, interactionPoint);
}
@Override
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/Loci/LociL3/CS_ExecutionFactory.java b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/Loci/LociL3/CS_ExecutionFactory.java
index 68298985456..266a5b9788b 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/Loci/LociL3/CS_ExecutionFactory.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.composites/generated/org/eclipse/papyrus/moka/composites/Semantics/Loci/LociL3/CS_ExecutionFactory.java
@@ -15,7 +15,6 @@ package org.eclipse.papyrus.moka.composites.Semantics.Loci.LociL3;
// Imports
import org.eclipse.papyrus.moka.composites.Semantics.Actions.CompleteActions.CS_ReadExtentActionActivation;
-import org.eclipse.papyrus.moka.composites.Semantics.Actions.CompleteActions.CS_ReadIsClassifiedObjectActionActivation;
import org.eclipse.papyrus.moka.composites.Semantics.Actions.IntermediateActions.CS_AddStructuralFeatureValueActionActivation;
import org.eclipse.papyrus.moka.composites.Semantics.Actions.IntermediateActions.CS_ClearStructuralFeatureValueActionActivation;
import org.eclipse.papyrus.moka.composites.Semantics.Actions.IntermediateActions.CS_CreateLinkActionActivation;
@@ -38,7 +37,6 @@ import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.InstanceValue;
import org.eclipse.uml2.uml.OpaqueExpression;
import org.eclipse.uml2.uml.ReadExtentAction;
-import org.eclipse.uml2.uml.ReadIsClassifiedObjectAction;
import org.eclipse.uml2.uml.ReadSelfAction;
import org.eclipse.uml2.uml.SendSignalAction;
@@ -53,8 +51,8 @@ public class CS_ExecutionFactory extends ExecutionFactoryL3 {
SemanticVisitor visitor = null;
if (element instanceof ReadExtentAction) {
visitor = new CS_ReadExtentActionActivation();
- } else if (element instanceof ReadIsClassifiedObjectAction) {
- visitor = new CS_ReadIsClassifiedObjectActionActivation();
+ }else if (element instanceof AcceptEventAction) {
+ visitor = new CS_AcceptEventActionActivation();
} else if (element instanceof AddStructuralFeatureValueAction) {
visitor = new CS_AddStructuralFeatureValueActionActivation();
} else if (element instanceof ClearStructuralFeatureAction) {
@@ -67,8 +65,6 @@ public class CS_ExecutionFactory extends ExecutionFactoryL3 {
visitor = new CS_ReadSelfActionActivation();
} else if (element instanceof InstanceValue) {
visitor = new CS_InstanceValueEvaluation();
- } else if (element instanceof AcceptEventAction) {
- visitor = new CS_AcceptEventActionActivation();
} else if (element instanceof CallOperationAction) {
visitor = new CS_CallOperationActionActivation();
} else if (element instanceof SendSignalAction) {

Back to the top