PSSM-1 Alignment with PSCS 1.1 (handling of CS_Eventoccurrence)

Change-Id: I03cca9560c329e11c5b831919e10e09d61bef16e
Signed-off-by: jeremie.tatibouet <jeremie.tatibouet@cea.fr>
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines.interfaces/src/org/eclipse/papyrus/moka/fuml/statemachines/interfaces/Semantics/CommonBehavior/IEventTriggeredExecution.java b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines.interfaces/src/org/eclipse/papyrus/moka/fuml/statemachines/interfaces/Semantics/CommonBehavior/IEventTriggeredExecution.java
index 961e822..2043043 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines.interfaces/src/org/eclipse/papyrus/moka/fuml/statemachines/interfaces/Semantics/CommonBehavior/IEventTriggeredExecution.java
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines.interfaces/src/org/eclipse/papyrus/moka/fuml/statemachines/interfaces/Semantics/CommonBehavior/IEventTriggeredExecution.java
@@ -29,6 +29,6 @@
 	

 	public void initialize();

 	

-	public void finalize();

+	public void finalize_();

 	

 }

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/CommonBehavior/EventTriggeredExecution.java b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/CommonBehavior/EventTriggeredExecution.java
index 32e1492..2aeee01 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/CommonBehavior/EventTriggeredExecution.java
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/CommonBehavior/EventTriggeredExecution.java
@@ -16,6 +16,7 @@
 import java.util.ArrayList;

 import java.util.List;

 

+import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.InvocationActions.ICS_EventOccurrence;

 import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IValue;

 import org.eclipse.papyrus.moka.fuml.Semantics.impl.CommonBehaviors.BasicBehaviors.Execution;

 import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.IExecution;

@@ -54,8 +55,12 @@
 		this._beginIsolation();

 		if(this.wrappedExecution.getBehavior().getOwnedParameters().size() > 0){

 			Behavior behavior = this.wrappedExecution.getBehavior();

-			if(this.triggeringEventOccurrence instanceof SignalEventOccurrence){

-				SignalEventOccurrence signalEventOccurrence = (SignalEventOccurrence) this.triggeringEventOccurrence;

+			IEventOccurrence currentEventOccurrence = this.triggeringEventOccurrence; 

+			if(this.triggeringEventOccurrence instanceof ICS_EventOccurrence){

+				currentEventOccurrence = ((ICS_EventOccurrence)this.triggeringEventOccurrence).getWrappedEventOccurrence();

+			}

+			if(currentEventOccurrence instanceof SignalEventOccurrence){

+				SignalEventOccurrence signalEventOccurrence = (SignalEventOccurrence) currentEventOccurrence;

 				if(behavior.inputParameters().size() == 1){

 					Parameter parameter = behavior.inputParameters().get(0);

 					IParameterValue parameterValue = new ParameterValue();

@@ -65,8 +70,8 @@
 					parameterValue.setValues(values);

 					this.wrappedExecution.setParameterValue(parameterValue);

 				}

-			}else if(this.triggeringEventOccurrence instanceof ICallEventOccurrence){

-				ICallEventOccurrence callEventOccurrence = (ICallEventOccurrence) this.triggeringEventOccurrence;

+			}else if(currentEventOccurrence instanceof ICallEventOccurrence){

+				ICallEventOccurrence callEventOccurrence = (ICallEventOccurrence) currentEventOccurrence;

 				List<Parameter> behaviorInputParameters = behavior.inputParameters();

 				List<IParameterValue> inputParameterValues = callEventOccurrence.getCallEventExecution().getInputParameterValues();

 				if(behaviorInputParameters.size() == inputParameterValues.size()){

@@ -94,11 +99,11 @@
 		if(this.wrappedExecution != null && this.triggeringEventOccurrence != null){

 			this.initialize();

 			this.wrappedExecution.execute();

-			this.finalize();

+			this.finalize_();

 		}

 	}

 	

-	public void finalize(){

+	public void finalize_(){

 		// Transfer output parameter values (produced by the wrapped execution) back to

 		// the execution associated t the call event.

 		// If an effect, entry or exit Behavior is not just input-conforming, then the

@@ -116,9 +121,12 @@
 		//    The values returned may legally be those produced any Behavior that produces potential

 		//    output values and is the last to complete in any execution trace for the RTC

 		//    step consistent with the specified StateMachine semantics.

-		this._beginIsolation();

-		if(this.triggeringEventOccurrence instanceof ICallEventOccurrence){

-			ICallEventOccurrence callEventOccurrence = (ICallEventOccurrence) this.triggeringEventOccurrence;

+		IEventOccurrence currentEventOccurrence = this.triggeringEventOccurrence; 

+		if(this.triggeringEventOccurrence instanceof ICS_EventOccurrence){

+			currentEventOccurrence = ((ICS_EventOccurrence)this.triggeringEventOccurrence).getWrappedEventOccurrence();

+		}

+		if(currentEventOccurrence instanceof ICallEventOccurrence){

+			ICallEventOccurrence callEventOccurrence = (ICallEventOccurrence) currentEventOccurrence;

 			Behavior behavior = this.wrappedExecution.getBehavior();

 			List<IParameterValue> outputParameterValues = this.wrappedExecution.getOutputParameterValues();

 			if(behavior.outputParameters().size() == outputParameterValues.size()){

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/DeferredEventOccurrence.java b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/DeferredEventOccurrence.java
index 50fcf79..d2e015d 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/DeferredEventOccurrence.java
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/DeferredEventOccurrence.java
@@ -71,7 +71,6 @@
 		// Do nothing - the deferred event is not sent to a target.

 		// It is registered during the RTC step of the active object that

 		// entered the state from which it was generated.

-		super.sendTo(target);

 	}

 

 	@Override

@@ -79,7 +78,6 @@
 		// Do nothing - the deferred event is not sent to a target.

 		// It is registered during the RTC step of the active object that

 		// entered the state from which it was generated.

-		super.doSend();

 	}

 

 	@Override

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/StateMachineEventAccepter.java b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/StateMachineEventAccepter.java
index e4b2e83..edd7e2d 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/StateMachineEventAccepter.java
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/StateMachineEventAccepter.java
@@ -17,6 +17,7 @@
 import java.util.Iterator;

 import java.util.List;

 

+import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.InvocationActions.ICS_EventOccurrence;

 import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IObject_;

 import org.eclipse.papyrus.moka.fuml.Semantics.impl.CommonBehaviors.Communications.EventAccepter;

 import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.ICallEventOccurrence;

@@ -27,48 +28,63 @@
 import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.IStateMachineEventAccepter;

 import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.ITransitionActivation;

 

-public class StateMachineEventAccepter extends EventAccepter implements IStateMachineEventAccepter{

+public class StateMachineEventAccepter extends EventAccepter implements IStateMachineEventAccepter {

 

 	// The execution that actually made the event accepter registered

 	// in the object activation. Note this is particularly useful to access the

 	// the configured related to the state-machine that registered this event

 	// accepter.

 	public StateMachineExecution registrationContext;

-	

+

 	public StateMachineEventAccepter(StateMachineExecution execution) {

 		this.registrationContext = execution;

 	}

-	

+

 	@Override

 	public void accept(IEventOccurrence eventOccurrence) {

-		// When an event occurrence is accepted this marks the beginning of a new RTC step for

+		// When an event occurrence is accepted this marks the beginning of a new RTC

+		// step for

 		// the executed state-machine. The following set of actions takes place:

-		// 1 - The list of transition that can be fired using the given event occurrence is computed

-		// 2 - This list is organized as a different sub-set of transitions that can be fired. One of the

-		//     subset is chosen to be fired. Each transition fires **Concurrently**

-		// 3 - When the RTC step is about to complete a new event accepter for the state-machine

-		//     is registered at the waiting event accepter list handled by the object activation

-		// Note that there always is a single event accepter for a state-machine (this works differently

+		// 1 - The list of transition that can be fired using the given event occurrence

+		// is computed

+		// 2 - This list is organized as a different sub-set of transitions that can be

+		// fired. One of the

+		// subset is chosen to be fired. Each transition fires **Concurrently**

+		// 3 - If the accepted event occurrence is a call event occurrence then there is

+		// a explicit

+		// "return from call" which enables the caller to continue its execution

+		// 4 - When the RTC step is about to complete a new event accepter for the

+		// state-machine

+		// is registered at the waiting event accepter list handled by the object

+		// activation

+		// Note that there always is a single event accepter for a state-machine (this

+		// works differently

 		// than for activities).

-		if(this.isDeferred(eventOccurrence)){

+		if (this.isDeferred(eventOccurrence)) {

 			this.defer(eventOccurrence);

-		}else{

+		} else {

 			List<ITransitionActivation> fireableTransitionActivations = this.select(eventOccurrence);

-			if(!fireableTransitionActivations.isEmpty()){

-				for(Iterator<ITransitionActivation> fireableTransitionsIterator = fireableTransitionActivations.iterator(); fireableTransitionsIterator.hasNext();){

+			if (!fireableTransitionActivations.isEmpty()) {

+				for (Iterator<ITransitionActivation> fireableTransitionsIterator = fireableTransitionActivations

+						.iterator(); fireableTransitionsIterator.hasNext();) {

 					fireableTransitionsIterator.next().fire(eventOccurrence);

 				}

 			}

 		}

-		// If the dispatched event was an CallEventOccurrence then check

-		// if the caller need to be released.

-		// FIXME: This moved on further updates to common behavior semantics

-		if(eventOccurrence instanceof ICallEventOccurrence){

-			ICallEventOccurrence callEventOccurrence = (ICallEventOccurrence) eventOccurrence;

+		ICallEventOccurrence callEventOccurrence = null;

+		if (eventOccurrence instanceof ICS_EventOccurrence) {

+			IEventOccurrence wrappedEventOccurrence = ((ICS_EventOccurrence) eventOccurrence).getWrappedEventOccurrence();

+			if (wrappedEventOccurrence instanceof ICallEventOccurrence) {

+				callEventOccurrence = (ICallEventOccurrence) wrappedEventOccurrence;

+			}

+		} else if (eventOccurrence instanceof ICallEventOccurrence) {

+			callEventOccurrence = (ICallEventOccurrence) eventOccurrence;

+		}

+		if (callEventOccurrence != null) {

 			callEventOccurrence.returnFromCall();

 		}

 		IObject_ context = this.registrationContext.context;

-		if(context!=null && context.getObjectActivation()!=null){

+		if (context != null && context.getObjectActivation() != null) {

 			context.register(new StateMachineEventAccepter(this.registrationContext));

 		}

 	}

@@ -77,31 +93,35 @@
 	public Boolean match(IEventOccurrence eventOccurrence) {

 		// There are two cases in which the state machine event accepter can match

 		// 1 - In the current state machine configuration the event can be deferred

-		// 2 - In the current state machine configuration the current event can trigger one or more transitions

+		// 2 - In the current state machine configuration the current event can trigger

+		// one or more transitions

 		return this.isDeferred(eventOccurrence) | this.isTriggering(eventOccurrence);

 	}

-	

-	

-	public boolean isDeferred(IEventOccurrence eventOccurrence){

+

+	public boolean isDeferred(IEventOccurrence eventOccurrence) {

 		// Determine if the dispatched event occurrence is deferred in the

 		// current state machine configuration. An event occurrence can only be deferred

 		// if the following conditions are fulfilled:

-		// 1 - One active state in the hierarchy declares the event types as being deferred.

-		// 2 - No transitions (ready to fire) with a higher priority than the deferring state

-		//     could be found.

-		// 3 - It does not exist any running doActivity having already registered an accepter

-		//     for the given event occurrence

+		// 1 - One active state in the hierarchy declares the event types as being

+		// deferred.

+		// 2 - No transitions (ready to fire) with a higher priority than the deferring

+		// state

+		// could be found.

+		// 3 - It does not exist any running doActivity having already registered an

+		// accepter

+		// for the given event occurrence

 		boolean deferred = this._isDeferred(eventOccurrence, this.registrationContext.getConfiguration().getRoot());

-		if(deferred){

+		if (deferred) {

 			IObject_ context = this.registrationContext.context;

-			if(context != null && context.getObjectActivation() != null){

-				int  i = 1;

-				while(deferred && i <= context.getObjectActivation().getWaitingEventAccepters().size()){

-					IEventAccepter currentEventAccepter = context.getObjectActivation().getWaitingEventAccepters().get(i - 1);

-					if(currentEventAccepter != this 

-							&& currentEventAccepter instanceof DoActivityExecutionEventAccepter

-							&& currentEventAccepter.match(eventOccurrence)){

-						deferred = false;;

+			if (context != null && context.getObjectActivation() != null) {

+				int i = 1;

+				while (deferred && i <= context.getObjectActivation().getWaitingEventAccepters().size()) {

+					IEventAccepter currentEventAccepter = context.getObjectActivation().getWaitingEventAccepters()

+							.get(i - 1);

+					if (currentEventAccepter != this && currentEventAccepter instanceof DoActivityExecutionEventAccepter

+							&& currentEventAccepter.match(eventOccurrence)) {

+						deferred = false;

+						;

 					}

 					i++;

 				}

@@ -109,78 +129,86 @@
 		}

 		return deferred;

 	}

-	

-	protected boolean _isDeferred(IEventOccurrence eventOccurrence, IStateConfiguration stateConfiguration){

-		// Determine if the given state configuration is capable of deferring the given event occurrence.

+

+	protected boolean _isDeferred(IEventOccurrence eventOccurrence, IStateConfiguration stateConfiguration) {

+		// Determine if the given state configuration is capable of deferring the given

+		// event occurrence.

 		int i = 0;

 		boolean deferred = false;

-		while(!deferred && i < stateConfiguration.getChildren().size()){

+		while (!deferred && i < stateConfiguration.getChildren().size()) {

 			deferred = this._isDeferred(eventOccurrence, stateConfiguration.getChildren().get(i));

 			i++;

 		}

-		if(!deferred && 

-				stateConfiguration.getVertexActivation() != null &&

-				((StateActivation)stateConfiguration.getVertexActivation()).canDefer(eventOccurrence)){

-			if(this._select(eventOccurrence, stateConfiguration).isEmpty()){

+		if (!deferred && stateConfiguration.getVertexActivation() != null

+				&& ((StateActivation) stateConfiguration.getVertexActivation()).canDefer(eventOccurrence)) {

+			if (this._select(eventOccurrence, stateConfiguration).isEmpty()) {

 				deferred = true;

 			}

 		}

 		return deferred;

 	}

-	

-	protected void defer(IEventOccurrence eventOccurrence){

-		// Defers the given event occurrence. A deferred event occurrence is registered in

-		// the deferred event pool. This latter refers to the deferred event as well as to the

+

+	protected void defer(IEventOccurrence eventOccurrence) {

+		// Defers the given event occurrence. A deferred event occurrence is registered

+		// in

+		// the deferred event pool. This latter refers to the deferred event as well as

+		// to the

 		// the deferring state.

 		this._defer(eventOccurrence, this.registrationContext.getConfiguration().getRoot());

 	}

-	

-	protected boolean _defer(IEventOccurrence eventOccurrence, IStateConfiguration stateConfiguration){

-		// Defers the given event occurrence in the context of the given state configuration.

+

+	protected boolean _defer(IEventOccurrence eventOccurrence, IStateConfiguration stateConfiguration) {

+		// Defers the given event occurrence in the context of the given state

+		// configuration.

 		int i = 0;

 		boolean deferred = false;

-		while(!deferred && i < stateConfiguration.getChildren().size()){

+		while (!deferred && i < stateConfiguration.getChildren().size()) {

 			deferred = this._defer(eventOccurrence, stateConfiguration.getChildren().get(i));

 			i++;

 		}

-		if(!deferred &&

-				stateConfiguration.getVertexActivation() != null &&

-				((StateActivation)stateConfiguration.getVertexActivation()).canDefer(eventOccurrence)){

-			((StateActivation)stateConfiguration.getVertexActivation()).defer(eventOccurrence);

+		if (!deferred && stateConfiguration.getVertexActivation() != null

+				&& ((StateActivation) stateConfiguration.getVertexActivation()).canDefer(eventOccurrence)) {

+			((StateActivation) stateConfiguration.getVertexActivation()).defer(eventOccurrence);

 			deferred = true;

 		}

 		return deferred;

 	}

 

-	public boolean isTriggering(IEventOccurrence eventOccurrence){

-		// Returns true when one or more transition are ready to be fired using this event

+	public boolean isTriggering(IEventOccurrence eventOccurrence) {

+		// Returns true when one or more transition are ready to be fired using this

+		// event

 		// occurrence; false otherwise.

 		return !this.select(eventOccurrence).isEmpty();

 	}

-	

+

 	protected List<ITransitionActivation> select(IEventOccurrence eventOccurrence) {

 		// Find for the given configuration the set of transition that can fire.

 		return this._select(eventOccurrence, this.registrationContext.getConfiguration().getRoot());

 	}

-	

-	protected List<ITransitionActivation> _select(IEventOccurrence eventOccurrence, IStateConfiguration stateConfiguration){

+

+	protected List<ITransitionActivation> _select(IEventOccurrence eventOccurrence,

+			IStateConfiguration stateConfiguration) {

 		// Find for the given state configuration all transition that can actually fire.

-		// The set of transition only contains transitions with the highest priority. In addition

+		// The set of transition only contains transitions with the highest priority. In

+		// addition

 		// no conflicting transitions are added to that set.

 		List<ITransitionActivation> selectedTransitions = new ArrayList<ITransitionActivation>();

-		for(int i = 0; i < stateConfiguration.getChildren().size(); i++){

+		for (int i = 0; i < stateConfiguration.getChildren().size(); i++) {

 			selectedTransitions.addAll(this._select(eventOccurrence, stateConfiguration.getChildren().get(i)));

 		}

-		if(selectedTransitions.isEmpty() && stateConfiguration.getVertexActivation() != null){

-			for(int i = 0; i < stateConfiguration.getVertexActivation().getOutgoingTransitions().size(); i++){

-				ITransitionActivation transitionActivation = stateConfiguration.getVertexActivation().getOutgoingTransitions().get(i);

-				if(transitionActivation.canFireOn(eventOccurrence)){

+		if (selectedTransitions.isEmpty() && stateConfiguration.getVertexActivation() != null) {

+			for (int i = 0; i < stateConfiguration.getVertexActivation().getOutgoingTransitions().size(); i++) {

+				ITransitionActivation transitionActivation = stateConfiguration.getVertexActivation()

+						.getOutgoingTransitions().get(i);

+				if (transitionActivation.canFireOn(eventOccurrence)) {

 					selectedTransitions.add(transitionActivation);

 				}

 			}

-			if(selectedTransitions.size() > 1){

-				ChoiceStrategy choiceStrategy = (ChoiceStrategy) this.registrationContext.locus.getFactory().getStrategy("choice");

-				ITransitionActivation electedTransition = selectedTransitions.get(choiceStrategy.choose(selectedTransitions.size()) - 1);

+			if (selectedTransitions.size() > 1) {

+				ChoiceStrategy choiceStrategy = (ChoiceStrategy) this.registrationContext.locus.getFactory()

+						.getStrategy("choice");

+				ITransitionActivation electedTransition = selectedTransitions

+						.get(choiceStrategy.choose(selectedTransitions.size()) - 1);

 				selectedTransitions.clear();

 				selectedTransitions.add(electedTransition);

 			}

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/TransitionActivation.java b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/TransitionActivation.java
index 4e3c1fc..f8aca68 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/TransitionActivation.java
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/TransitionActivation.java
@@ -19,9 +19,7 @@
 import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IBooleanValue;

 import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IEvaluation;

 import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.IExecution;

-import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.ICallEventOccurrence;

 import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.IEventOccurrence;

-import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.ISignalEventOccurrence;

 import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.ICompletionEventOccurrence;

 import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.IRegionActivation;

 import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.ITransitionActivation;

@@ -227,25 +225,17 @@
 	

 	public boolean canFireOn(IEventOccurrence eventOccurrence){

 		// A transition is can fire when:

-		//

-		// A completion event is being dispatched and this transition has no trigger

-		// but its eventual guard evaluates to true. Note: the scope of a completion

-		// event is the state from which it was generated

-		//

-		// A signal event is being dispatched and this transition has a trigger

-		// that matches the signal and its eventual guard evaluates to true

-		boolean reactive = true;

-		if(eventOccurrence instanceof ICompletionEventOccurrence){

-			reactive = !this.isTriggered() &&

-						this.getSourceActivation()==((ICompletionEventOccurrence)eventOccurrence).getScope() &&

-						this.evaluateGuard(eventOccurrence) &&

-						this.canPropagateExecution(eventOccurrence);

-		}else if(eventOccurrence instanceof ISignalEventOccurrence | eventOccurrence instanceof ICallEventOccurrence){

-			reactive = this.hasTrigger(eventOccurrence) && 

-					   this.evaluateGuard(eventOccurrence) &&

-					   this.canPropagateExecution(eventOccurrence);

-		}else{

-			reactive = false;

+		// 1. It has a trigger that matches the dispatched event occurrence.

+		// 2. Its guard evaluates to true.

+		// 3. A valid path can found to the next state machine configuration.

+		// Note: If the dispatched event is a completion event, the transition matches this latter

+		// if it has no trigger and the transition leaves the state from which the completion event

+		// was generated.

+		boolean reactive = this.hasTrigger(eventOccurrence) && 

+		this.evaluateGuard(eventOccurrence) &&

+		this.canPropagateExecution(eventOccurrence);

+		if(reactive && eventOccurrence instanceof ICompletionEventOccurrence){

+			reactive = this.getSourceActivation()==((ICompletionEventOccurrence)eventOccurrence).getScope();

 		}

 		return reactive;

 	}

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 fb36d37..8e35807 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
@@ -14,6 +14,7 @@
 package org.eclipse.papyrus.moka.fuml.statemachines;

 

 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;

@@ -40,6 +41,7 @@
 	protected void registerSemanticStrategies(ILocus locus) {

 		locus.getFactory().setStrategy(new FirstChoiceStrategy());

 		locus.getFactory().setStrategy(new FIFOGetNextEventStrategy());

+		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());