Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2013-02-08 04:29:51 -0500
committerHenrik Rentz-Reichert2013-02-08 04:30:41 -0500
commita6e700137dfd6408042e1cc13d845c7a9fa9f89b (patch)
treec11d7021958a607ec61873e0e328dc4b6bda4bc7
parent320cff5ef39f5e3771a3124af49ed3a0764e36d5 (diff)
downloadorg.eclipse.etrice-a6e700137dfd6408042e1cc13d845c7a9fa9f89b.tar.gz
org.eclipse.etrice-a6e700137dfd6408042e1cc13d845c7a9fa9f89b.tar.xz
org.eclipse.etrice-a6e700137dfd6408042e1cc13d845c7a9fa9f89b.zip
[core.room, abstractexec, generator] moved method from genmodel to RoomHelpers
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityCheck.java6
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/SemanticsCheck.java6
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java26
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java7
5 files changed, 36 insertions, 11 deletions
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityCheck.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityCheck.java
index 2af199a2c..43c1c91fd 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityCheck.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityCheck.java
@@ -58,7 +58,7 @@ public class ReachabilityCheck {
for (Transition trans : transitions)
if (trans instanceof InitialTransition) {
visited.add(trans);
- StateGraphNode cur = xpAct.getNode(trans.getTo());
+ StateGraphNode cur = RoomHelpers.getNode(trans.getTo());
if (!visited.contains(cur))
queue.add(cur);
break;
@@ -100,7 +100,7 @@ public class ReachabilityCheck {
for (ActiveTrigger trigger : xpAct.getActiveTriggers(st)) {
for (Transition trans : trigger.getTransitions()) {
visited.add(trans);
- StateGraphNode target = xpAct.getNode(trans.getTo());
+ StateGraphNode target = RoomHelpers.getNode(trans.getTo());
if (!visited.contains(target)) {
queue.add(target);
StateGraph triggerContext = (StateGraph) trans
@@ -131,7 +131,7 @@ public class ReachabilityCheck {
}
for (Transition trans : xpAct.getOutgoingTransitions(node)) {
visited.add(trans);
- StateGraphNode target = xpAct.getNode(trans.getTo());
+ StateGraphNode target = RoomHelpers.getNode(trans.getTo());
if (!visited.contains(target)) {
queue.add(target);
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/SemanticsCheck.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/SemanticsCheck.java
index 81947f4d0..83d1fae91 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/SemanticsCheck.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/SemanticsCheck.java
@@ -86,7 +86,7 @@ public class SemanticsCheck {
EList<Transition> transitions = graph.getTransitions();
for (Transition trans : transitions)
if (trans instanceof InitialTransition) {
- StateGraphNode cur = xpAct.getNode(trans.getTo());
+ StateGraphNode cur = RoomHelpers.getNode(trans.getTo());
List<HandledMessage> msgList = codeAnalyzer.analyze(trans.getAction());
if (cur instanceof State) {
msgList.addAll(codeAnalyzer.analyze(((State) cur).getEntryCode()));
@@ -128,7 +128,7 @@ public class SemanticsCheck {
}
for (Transition trans : trigger.getTransitions()) {
- StateGraphNode target = xpAct.getNode(trans.getTo());
+ StateGraphNode target = RoomHelpers.getNode(trans.getTo());
List<HandledMessage> msgList = new LinkedList<HandledMessage>();
// create a list of codes here in the order
// trigger, exit, action, entry
@@ -188,7 +188,7 @@ public class SemanticsCheck {
for (Transition trans : xpAct.getOutgoingTransitions(node)) {
ActiveRules tempRule = mapToRules.get(node).createCopy();
List<HandledMessage> msgList = codeAnalyzer.analyze(trans.getAction());
- StateGraphNode target = xpAct.getNode(trans.getTo());
+ StateGraphNode target = RoomHelpers.getNode(trans.getTo());
if (target instanceof State) {
msgList.addAll(codeAnalyzer.analyze(((State) target).getEntryCode()));
}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java
index a224b2ad8..11d88e2e3 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java
@@ -31,6 +31,7 @@ import org.eclipse.etrice.core.room.Annotation;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.Binding;
import org.eclipse.etrice.core.room.ChoicePoint;
+import org.eclipse.etrice.core.room.ChoicepointTerminal;
import org.eclipse.etrice.core.room.DataClass;
import org.eclipse.etrice.core.room.DataType;
import org.eclipse.etrice.core.room.DetailCode;
@@ -61,10 +62,15 @@ import org.eclipse.etrice.core.room.StandardOperation;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.StateGraphItem;
+import org.eclipse.etrice.core.room.StateGraphNode;
+import org.eclipse.etrice.core.room.StateTerminal;
import org.eclipse.etrice.core.room.StructureClass;
+import org.eclipse.etrice.core.room.SubStateTrPointTerminal;
import org.eclipse.etrice.core.room.SubSystemClass;
import org.eclipse.etrice.core.room.TrPoint;
+import org.eclipse.etrice.core.room.TrPointTerminal;
import org.eclipse.etrice.core.room.Transition;
+import org.eclipse.etrice.core.room.TransitionTerminal;
import org.eclipse.etrice.core.room.Trigger;
import org.eclipse.etrice.core.room.VarDecl;
import org.eclipse.etrice.core.validation.ValidationUtil;
@@ -667,6 +673,26 @@ public class RoomHelpers {
}
/**
+ * Returns the destination {@link StateGraphNode} of a {@link TransitionTerminal}.
+ *
+ * @param tt the transition terminal
+ *
+ * @return the destination {@link StateGraphNode} of a {@link TransitionTerminal}
+ */
+ public static StateGraphNode getNode(TransitionTerminal tt) {
+ if (tt instanceof StateTerminal)
+ return ((StateTerminal)tt).getState();
+ else if (tt instanceof TrPointTerminal)
+ return ((TrPointTerminal)tt).getTrPoint();
+ else if (tt instanceof SubStateTrPointTerminal)
+ return ((SubStateTrPointTerminal)tt).getTrPoint();
+ else if (tt instanceof ChoicepointTerminal)
+ return ((ChoicepointTerminal)tt).getCp();
+
+ return null;
+ }
+
+ /**
* Returns all {@link State}s of a {@link StateGraph} including parent state graphs recursively.
*
* @param sg the {@link StateGraph}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend
index a8fd352cc..03ec2857c 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend
@@ -393,7 +393,7 @@ class GenericStateMachineGenerator {
def protected genEventDrivenTriggers(ExpandedActorClass xpac, State state, List<ActiveTrigger> atlist, boolean usesHdlr) {
'''
«FOR at : atlist»
- case «xpac.getTriggerCodeName(at.trigger)»:
+ case «xpac.getTriggerCodeName(at)»:
«var needData = xpac.hasGuard(at)»
«IF needData»{ «langExt.getTypedDataDefinition(at.msg)»«ENDIF»
«FOR tt : at.transitions SEPARATOR " else "»
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java
index 20a107444..3dcccca6c 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java
@@ -1260,8 +1260,7 @@ public class GenericStateMachineGenerator {
{
for(final ActiveTrigger at : atlist) {
_builder.append("case ");
- String _trigger = at.getTrigger();
- String _triggerCodeName = xpac.getTriggerCodeName(_trigger);
+ String _triggerCodeName = xpac.getTriggerCodeName(at);
_builder.append(_triggerCodeName, "");
_builder.append(":");
_builder.newLineIfNotEmpty();
@@ -1292,8 +1291,8 @@ public class GenericStateMachineGenerator {
_builder.newLineIfNotEmpty();
_builder.append("\t");
Transition _transition = chain.getTransition();
- String _trigger_1 = at.getTrigger();
- CharSequence _guard = this.guard(_transition, _trigger_1, xpac);
+ String _trigger = at.getTrigger();
+ CharSequence _guard = this.guard(_transition, _trigger, xpac);
_builder.append(_guard, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t");

Back to the top