Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeremie.tatibouet2017-04-18 08:48:59 +0000
committerjeremie.tatibouet2017-05-14 13:39:09 +0000
commit4f3c6973c0d45a8b9a4d8ef3ad0475af524d64fe (patch)
tree06559bfe94825e6465c8aa261015b3c51e2c7150
parent77d5385f83098b9497681ad35dd8bc190bb953be (diff)
downloadorg.eclipse.papyrus-4f3c6973c0d45a8b9a4d8ef3ad0475af524d64fe.tar.gz
org.eclipse.papyrus-4f3c6973c0d45a8b9a4d8ef3ad0475af524d64fe.tar.xz
org.eclipse.papyrus-4f3c6973c0d45a8b9a4d8ef3ad0475af524d64fe.zip
PSSM-1 Take advantage of EventOccurrence trigger matching API.
Change-Id: I47f42c8f7ca96c2e1bdab95acabf3accc3df493a Signed-off-by: jeremie.tatibouet <jeremie.tatibouet@cea.fr>
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/StateActivation.java4
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/StateMachineSemanticVisitor.java58
-rw-r--r--extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/TransitionActivation.java4
3 files changed, 4 insertions, 62 deletions
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/StateActivation.java b/extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/StateActivation.java
index 4c46360593e..260357b8be1 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/StateActivation.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/StateActivation.java
@@ -439,10 +439,10 @@ public class StateActivation extends VertexActivation {
// received event occurrence is a signal event occurrence. This will change
// as soon as other kind of event (e.g. call event) will be supported in fUML.
State state = (State) this.node;
- boolean deferred = this.match(eventOccurrence, state.getDeferrableTriggers());
+ boolean deferred = eventOccurrence.matchAny(state.getDeferrableTriggers());
while(!deferred && state.getRedefinedState() != null){
state = state.getRedefinedState();
- deferred = this.match(eventOccurrence, state.getDeferrableTriggers());
+ deferred = eventOccurrence.matchAny(state.getDeferrableTriggers());
}
if(deferred){
int i = 0;
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/StateMachineSemanticVisitor.java b/extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/StateMachineSemanticVisitor.java
index c87736ea112..1a3cc292226 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/StateMachineSemanticVisitor.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/StateMachineSemanticVisitor.java
@@ -16,20 +16,14 @@ package org.eclipse.papyrus.moka.fuml.statemachines.Semantics.StateMachines;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.papyrus.moka.composites.Semantics.CompositeStructures.InvocationActions.CS_SignalInstance;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.Object_;
import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.Execution;
import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.EventOccurrence;
-import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.SignalEventOccurrence;
import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.Locus;
import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.SemanticVisitor;
-import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.CommonBehavior.CallEventOccurrence;
import org.eclipse.papyrus.moka.fuml.statemachines.Semantics.CommonBehavior.EventTriggeredExecution;
import org.eclipse.uml2.uml.Behavior;
-import org.eclipse.uml2.uml.CallEvent;
import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.SignalEvent;
-import org.eclipse.uml2.uml.Trigger;
public abstract class StateMachineSemanticVisitor extends SemanticVisitor {
@@ -136,58 +130,6 @@ public abstract class StateMachineSemanticVisitor extends SemanticVisitor {
return execution;
}
- protected boolean match(EventOccurrence eventOccurrence, List<Trigger> triggers){
- // Check if the event occurrence matches one of the trigger in the list.
- // The matching rule are the following:
- // 1. If the event occurrence is a signal event occurrence then type
- // of the signal must conforms to the type referenced by the event
- // In addition, if the trigger defines ports through wich the event occurrence
- // is allowed to arrive then the arrival port of the event occurrence
- // must be one the referenced port.
- // 2. If the event occurrence is a call event occurrence then the operation
- // that is referenced must be the same than the one specified in the call
- // event.
- // NOTE: CallEventOccurrence are not related to an arrival port. This limitation is
- // introduced by a limitation in the current PSCS semantic model.
- //
- // If a match is found then true is returned, false otherwise.
- boolean match = false;
- int i = 0;
- while(!match && i < triggers.size()){
- Trigger trigger = triggers.get(i);
- if(eventOccurrence instanceof SignalEventOccurrence
- && trigger.getEvent() instanceof SignalEvent){
- SignalEventOccurrence signalEventOccurrence = (SignalEventOccurrence) eventOccurrence;
- SignalEvent event = (SignalEvent) trigger.getEvent();
- if(event.getSignal() == signalEventOccurrence.signalInstance.type){
- match = true;
- }
- if(match && trigger.getPorts().size() > 0){
- int j = 0;
- boolean matchingPort = false;
- while(j < trigger.getPorts().size() & !matchingPort){
- if(((CS_SignalInstance)signalEventOccurrence.signalInstance).interactionPoint.definingPort == trigger.getPorts().get(j)){
- matchingPort = true;
- }
- j = j + 1;
- }
- if(!matchingPort){
- match = matchingPort;
- }
- }
- }else if(eventOccurrence instanceof CallEventOccurrence
- && trigger.getEvent() instanceof CallEvent){
- CallEvent event = (CallEvent) trigger.getEvent();
- CallEventOccurrence callEventOccurrence = (CallEventOccurrence) eventOccurrence;
- if(event.getOperation() == callEventOccurrence.execution.operation){
- match = true;
- }
- }
- i++;
- }
- return match;
- }
-
public String toString(){
return this.node.getName();
}
diff --git a/extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/TransitionActivation.java b/extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/TransitionActivation.java
index 21186237a4e..309a394ff1a 100644
--- a/extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/TransitionActivation.java
+++ b/extraplugins/moka/org.eclipse.papyrus.moka.fuml.statemachines/src/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/TransitionActivation.java
@@ -208,10 +208,10 @@ public abstract class TransitionActivation extends StateMachineSemanticVisitor {
// the redefining transition is considered has being able to react to the event occurrence.
// The rule applies recursively.
Transition transition = (Transition) this.node;
- boolean match = this.match(eventOccurrence, transition.getTriggers());
+ boolean match = eventOccurrence.matchAny(transition.getTriggers());
while(!match && transition.getRedefinedTransition() != null){
transition = transition.getRedefinedTransition();
- match = this.match(eventOccurrence, transition.getTriggers());
+ match = eventOccurrence.matchAny(transition.getTriggers());
}
return match;
}

Back to the top