Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.etrice.abstractexec.behavior')
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/.options8
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/build.properties3
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java36
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java11
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java64
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityCheck.java190
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java64
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/SemanticsCheck.java6
9 files changed, 201 insertions, 184 deletions
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/.options b/plugins/org.eclipse.etrice.abstractexec.behavior/.options
new file mode 100644
index 000000000..d2483c955
--- /dev/null
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/.options
@@ -0,0 +1,8 @@
+org.eclipse.etrice.abstractexec.behavior/debug=true
+org.eclipse.etrice.abstractexec.behavior/trace/proposals=true
+org.eclipse.etrice.abstractexec.behavior/trace/checks=true
+org.eclipse.etrice.abstractexec.behavior/trace/checks/level=1
+org.eclipse.etrice.abstractexec.behavior/trace/rules=true
+org.eclipse.etrice.abstractexec.behavior/trace/rules/level=2
+org.eclipse.etrice.abstractexec.behavior/trace/abstractexec=true
+org.eclipse.etrice.abstractexec.behavior/trace/abstractexec/name=AETest
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF
index 591b57026..de2f484d9 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF
@@ -12,3 +12,6 @@ Require-Bundle: org.eclipse.etrice.core.room;bundle-version="0.3.0",
org.eclipse.emf.ecore;bundle-version="2.7.0",
org.eclipse.xtext;bundle-version="2.1.1",
org.eclipse.xtext.ui;bundle-version="2.1.1"
+Bundle-Activator: org.eclipse.etrice.abstractexec.behavior.Activator
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.etrice.abstractexec.behavior;x-friends:="org.eclipse.etrice.abstractexec.behavior.tests"
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/build.properties b/plugins/org.eclipse.etrice.abstractexec.behavior/build.properties
index 6f20375d6..6965d1296 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/build.properties
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/build.properties
@@ -2,4 +2,5 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.xml
+ plugin.xml,\
+ .options
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java
index b0a2eeb24..6754b0d44 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java
@@ -43,6 +43,12 @@ import org.eclipse.xtext.validation.ValidationMessageAcceptor;
*/
public class AbstractExecutionValidator implements IRoomValidator {
+ // c&p in tests
+ public static String DIAG_CODE_VIOLATION_TRIGGER = "etrice.violation_trigger";
+ public static String DIAG_CODE_VIOLATION_MESSAGESEND = "etrice.violation_messagesend";
+ public static String DIAG_CODE_MISSING_TRIGGER = "etrice.receive_message";
+ public static String DIAG_CODE_MISSING_MESSAGESEND = "etrice.send_message";
+
private static boolean traceExec = false;
private static String traceName = "";
static {
@@ -72,11 +78,12 @@ public class AbstractExecutionValidator implements IRoomValidator {
if (!(object instanceof ActorClass))
return;
ActorClass ac = (ActorClass) object;
- if (traceExec && !ac.getName().equals(traceName))
- return;
- if (traceExec)
+ if (traceExec) {
+ if (!(traceName.isEmpty() || ac.getName().equals(traceName)))
+ return;
System.out.println("AbstractExecutionValidator checking class "
+ ac.getName());
+ }
boolean oneProtocolsWithSemantics = false;
List<InterfaceItem> ifItems = RoomHelpers.getAllInterfaceItems(ac);
for (InterfaceItem item : ifItems) {
@@ -137,9 +144,22 @@ public class AbstractExecutionValidator implements IRoomValidator {
.println("AbstractExecutionValidator done checking class "
+ ac.getName());
}
+ else
+ if(traceExec)
+ System.out.println("No checking because internal generation failed");
}
}
+ @Override
+ public String getName() {
+ return "Abstract FSM Execution Validator";
+ }
+
+ @Override
+ public String getDescription() {
+ return "This validator checks the state machine against the protocol semantics of its ports.";
+ }
+
private void createMarkersForProposals(ProposalGenerator propGen,
ValidationMessageAcceptor messageAcceptor, State st,
ExpandedActorClass xpac) {
@@ -154,16 +174,16 @@ public class AbstractExecutionValidator implements IRoomValidator {
messageAcceptor.acceptWarning("State should handle the message "
+ msg.getMessage().getName() + " from port "
+ msg.getFrom().getName() + " ", container,
- orig.eContainingFeature(), idx, "Receive message",
+ orig.eContainingFeature(), idx, DIAG_CODE_MISSING_TRIGGER,
st.getName());
}
List<MessageFromIf> outgoing = propGen.getOutgoingProposals();
for (MessageFromIf msg : outgoing) {
- messageAcceptor.acceptInfo("State could send the message "
+ messageAcceptor.acceptInfo("State should send the message "
+ msg.getMessage().getName() + " to port "
+ msg.getFrom().getName() + " ", container,
- orig.eContainingFeature(), idx, "Send message",
+ orig.eContainingFeature(), idx, DIAG_CODE_MISSING_MESSAGESEND,
st.getName());
}
@@ -202,7 +222,7 @@ public class AbstractExecutionValidator implements IRoomValidator {
mif.eContainingFeature(),
trig.getMsgFromIfPairs()
.indexOf(trig),
- "VIOLATION", trigger
+ DIAG_CODE_VIOLATION_TRIGGER, trigger
.getMsg().getName());
}
}
@@ -215,7 +235,7 @@ public class AbstractExecutionValidator implements IRoomValidator {
"The message violates the semantic rule",
orig.eContainer(), orig.eContainingFeature(),
ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
- "VIOLATION");
+ DIAG_CODE_VIOLATION_MESSAGESEND);
}
}
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java
index dabe29ce7..9d2152cd7 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java
@@ -142,12 +142,13 @@ public class ActiveRules {
.getActorClass());
for (InterfaceItem ifitem : portList) {
GeneralProtocolClass gpc = ifitem.getGeneralProtocol();
- if (gpc instanceof ProtocolClass
- && ((ProtocolClass) gpc).getSemantics() != null)
- rules.put(ifitem, ((ProtocolClass) gpc).getSemantics()
- .getRules());
+ if (gpc instanceof ProtocolClass) {
+ ProtocolClass pc = (ProtocolClass) gpc;
+ if (pc.getSemantics() != null)
+ rules.put(ifitem, new ArrayList<SemanticsRule>(pc
+ .getSemantics().getRules()));
+ }
}
-
}
public void print() {
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java
index 61eede315..d41ccb0e2 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java
@@ -21,8 +21,8 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.room.InterfaceItem;
+import org.eclipse.etrice.core.room.Message;
import org.eclipse.etrice.core.room.MessageFromIf;
-import org.eclipse.etrice.core.room.Port;
import org.eclipse.etrice.core.room.RoomFactory;
import org.eclipse.etrice.core.room.SemanticsRule;
import org.eclipse.etrice.core.room.State;
@@ -57,7 +57,6 @@ public class ProposalGenerator {
return outgoingProposal;
}
-
public void createProposals(State st) {
ActiveRules rules = checker.getActiveRules(st);
@@ -65,49 +64,36 @@ public class ProposalGenerator {
if (rules == null)
return;
+ // ignore substates
+ if (RoomHelpers.hasDirectSubStructure(st))
+ return;
+
outgoingProposal.clear();
incomingProposal.clear();
- Set<SemanticsRule> rulesToIgnore = new HashSet<SemanticsRule>();
-
- for (ActiveTrigger trigger : xpac.getActiveTriggers(st)) {
- SemanticsRule match = null;
- Port port = (Port) trigger.getIfitem();
- if (rules.getPortList().contains(port)) {
- List<SemanticsRule> ruleList = rules.getRulesForPort(port);
- for (SemanticsRule curRule : ruleList) {
- if (curRule.getMsg() == trigger.getMsg()) {
- match = curRule;
- break;
+ for (InterfaceItem port : rules.getPortList()) {
+ // collect all messages from active triggers
+ Set<Message> messages = new HashSet<Message>();
+ for (ActiveTrigger t : xpac.getActiveTriggers(st))
+ if (t.getIfitem().equals(port))
+ messages.add(t.getMsg());
+ // check if every rule has its messages
+ if (rules.getPortList().contains(port)) {
+ for (SemanticsRule curRule : rules.getRulesForPort(port)) {
+ if (!messages.contains(curRule.getMsg())) {
+ MessageFromIf mif = RoomFactory.eINSTANCE
+ .createMessageFromIf();
+ mif.setFrom(port);
+ mif.setMessage(curRule.getMsg());
+ boolean isOutgoing = RoomHelpers.getMessageListDeep(
+ port, true).contains(curRule.getMsg());
+ if (isOutgoing) {
+ outgoingProposal.add(mif);
+ } else {
+ incomingProposal.add(mif);
}
}
}
- if (match != null) {
- // mark this rule for ignoring while generating proposals
- // as they have already been taken care of
- rulesToIgnore.add(match);
- }
- }
-
- // now start generating proposals by listing all the rules and ignoring
- // the ones
- // marked above
- for (InterfaceItem item : rules.getPortList()) {
- for (SemanticsRule ruleToCheck : rules.getRulesForPort(item)) {
- if (!rulesToIgnore.contains(ruleToCheck)) {
- MessageFromIf mif = RoomFactory.eINSTANCE
- .createMessageFromIf();
- mif.setFrom(item);
- mif.setMessage(ruleToCheck.getMsg());
- boolean isOutgoing = RoomHelpers.getMessageListDeep(item, true)
- .contains(ruleToCheck.getMsg());
- if (isOutgoing) {
- outgoingProposal.add(mif);
- } else {
- incomingProposal.add(mif);
- }
-
- }
}
}
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 3f1b3a925..a44085f66 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
@@ -10,7 +10,6 @@
*
*******************************************************************************/
-
package org.eclipse.etrice.abstractexec.behavior;
import java.util.HashSet;
@@ -22,6 +21,7 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.room.EntryPoint;
+import org.eclipse.etrice.core.room.GuardedTransition;
import org.eclipse.etrice.core.room.InitialTransition;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraph;
@@ -30,119 +30,111 @@ import org.eclipse.etrice.core.room.StateGraphNode;
import org.eclipse.etrice.core.room.TrPoint;
import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.core.room.TransitionPoint;
+import org.eclipse.etrice.core.room.TriggeredTransition;
import org.eclipse.etrice.core.room.util.RoomHelpers;
-
+import org.eclipse.etrice.generator.generic.RoomExtensions;
public class ReachabilityCheck {
-Queue<StateGraphNode> queue;
-public Set<StateGraphItem> visited;
-private ExpandedActorClass xpAct;
-private Set<StateGraphItem> exitUsed;
-public ReachabilityCheck (ExpandedActorClass xpac) {
- queue= new LinkedList<StateGraphNode>();
- xpAct = xpac;
- visited = new HashSet<StateGraphItem>();
- exitUsed = new HashSet<StateGraphItem>();
-}
-public void computeReachability() {
- StateGraph graph = xpAct.getStateMachine();
- addStartingPoints(graph, true);
- doTraversal();
-}
-
-private void addStartingPoints(StateGraph graph, boolean add_initial)
-{
- EList<Transition> transitions = graph.getTransitions();
- EList<TrPoint> trPoint = graph.getTrPoints();
- if(add_initial)
- for(Transition trans : transitions)
- if(trans instanceof InitialTransition)
- {
- visited.add(trans);
- StateGraphNode cur = xpAct.getNode(trans.getTo());
- if(!visited.contains(cur)) queue.add(cur);
- break;
- }
- for(TrPoint tp : trPoint)
- {
- if(tp instanceof TransitionPoint && !visited.contains(tp) ) {
- queue.add(tp);
- }
- }
+ private static RoomExtensions roomExt;
- //add transition points
-}
-private void doTraversal() {
- while(!queue.isEmpty())
- {
- StateGraphNode node = queue.poll();
- Visit(node);
- //System.out.println("Visited node : " + node.getName());
+ Queue<StateGraphNode> queue;
+ public Set<StateGraphItem> visited;
+ private ExpandedActorClass xpAct;
+ //private Set<StateGraphItem> exitUsed;
+
+ public ReachabilityCheck(ExpandedActorClass xpac) {
+ roomExt = new RoomExtensions();
+ queue = new LinkedList<StateGraphNode>();
+ xpAct = xpac;
+ visited = new HashSet<StateGraphItem>();
+ //exitUsed = new HashSet<StateGraphItem>();
}
-}
-public boolean isExitUsed(StateGraphItem item)
-{
- return exitUsed.contains(item);
-}
-public boolean isReachable(StateGraphItem item)
-{
-
- return visited.contains(item);
-}
-private void Visit(StateGraphNode node)
-{
- visited.add(node);
- if(node instanceof State)
- {
- State st = (State) node;
- if(RoomHelpers.hasDirectSubStructure(st))
- {
- addStartingPoints(st.getSubgraph(),true);
- }
- else
- {
- for(ActiveTrigger trigger : xpAct.getActiveTriggers(st))
- {
- for(Transition trans : trigger.getTransitions())
- {
+
+ public void computeReachability() {
+ StateGraph graph = xpAct.getStateMachine();
+ addStartingPoints(graph, true);
+ doTraversal();
+ }
+
+ private void addStartingPoints(StateGraph graph, boolean add_initial) {
+ EList<Transition> transitions = graph.getTransitions();
+ EList<TrPoint> trPoint = graph.getTrPoints();
+ if (add_initial)
+ for (Transition trans : transitions)
+ if (trans instanceof InitialTransition) {
visited.add(trans);
- StateGraphNode target = xpAct.getNode(trans.getTo());
- if(!visited.contains(target)) {
- queue.add(target);
- StateGraph triggerContext = (StateGraph) trans.eContainer();
- State exitCalled = st;
- while(true)
- {
- exitUsed.add(exitCalled);
- if(exitCalled.eContainer()==triggerContext) break;
- exitCalled = (State) exitCalled.eContainer().eContainer();
- }
- }
+ StateGraphNode cur = RoomHelpers.getNode(trans.getTo());
+ if (!visited.contains(cur))
+ queue.add(cur);
+ break;
}
+ for (TrPoint tp : trPoint) {
+ if (tp instanceof TransitionPoint && !visited.contains(tp)) {
+ queue.add(tp);
}
}
}
- else {
- if(node instanceof EntryPoint)
- {
- State container = (State) node.eContainer().eContainer();
- visited.add(container);
+
+ private void doTraversal() {
+ while (!queue.isEmpty()) {
+ StateGraphNode node = queue.poll();
+ if (!visited.contains(node))
+ visit(node);
+ // System.out.println("Visited node : " + node.getName());
}
- for(Transition trans : xpAct.getOutgoingTransitions(node))
- {
- visited.add(trans);
- StateGraphNode target = xpAct.getNode(trans.getTo());
- if(!visited.contains(target))
- {
- queue.add(target);
-
+ }
+
+// public boolean isExitUsed(StateGraphItem item) {
+// return exitUsed.contains(item);
+// }
+
+ public boolean isReachable(StateGraphItem item) {
+
+ return visited.contains(item);
+ }
+
+ private void visit(StateGraphNode node) {
+ visited.add(node);
+ if (node instanceof State) {
+ State st = (State) node;
+ if (RoomHelpers.hasDirectSubStructure(st)) {
+ addStartingPoints(st.getSubgraph(), true);
+ } else {
+ // visit outgoing triggered transitions
+ for (ActiveTrigger trigger : xpAct.getActiveTriggers(st)) {
+ for (TriggeredTransition trans : trigger.getTransitions())
+ visit(trans);
+ }
+ // visit outgoing guarded transitions
+ for(Transition trans : roomExt.getOutgoingTransitionsHierarchical(xpAct, st)){
+ if(trans instanceof GuardedTransition)
+ visit(trans);
+ }
}
+ } else {
+ if (node instanceof EntryPoint) {
+ // if container has no initial transition then mark it visited
+ boolean markVisited = true;
+ State container = (State) node.eContainer().eContainer();
+ StateGraph parentGraph = container.getSubgraph();
+ for (Transition tr : parentGraph.getTransitions())
+ if (tr instanceof InitialTransition)
+ markVisited = false;
+ if (markVisited)
+ visited.add(container);
+ }
+ for (Transition trans : xpAct.getOutgoingTransitions(node))
+ visit(trans);
}
+
}
-}
-
+ private void visit(Transition trans){
+ visited.add(trans);
+ 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/ReachabilityValidator.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
index d568aef1f..22a34712a 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
@@ -30,6 +30,7 @@ import org.eclipse.xtext.validation.ValidationMessageAcceptor;
public class ReachabilityValidator implements IRoomValidator {
+ public static String DIAG_CODE_UNREACHABLE = "etrice.unreachable";
@Override
public void validate(EObject object, ValidationMessageAcceptor messageAcceptor) {
@@ -39,38 +40,43 @@ public class ReachabilityValidator implements IRoomValidator {
ActorClass ac = (ActorClass) object;
- NullDiagnostician diagnostician = new NullDiagnostician();
- GeneratorModelBuilder builder = new GeneratorModelBuilder(new NullLogger(), diagnostician);
- ExpandedActorClass xpac = builder.createExpandedActorClass(ac);
-
- if (xpac != null && !diagnostician.isFailed()) {
- ReachabilityCheck checker = new ReachabilityCheck(xpac);
- checker.computeReachability();
- TreeIterator<EObject> it = xpac.getStateMachine().eAllContents();
- while (it.hasNext()) {
- EObject item = it.next();
- if (item instanceof StateGraphItem)
- {
-
- StateGraphItem toCheck = (StateGraphItem) item;
- //System.out.println("Checked : " + toCheck.getName());
- if (!checker.isReachable(toCheck)) {
- //System.out.println("Unreachable "+ toCheck.getName());
-
- EObject orig = xpac.getOrig(toCheck);
- EObject container = orig.eContainer();
- @SuppressWarnings("unchecked")
- int idx = ((List<? extends EObject>)container.eGet(orig.eContainingFeature())).indexOf(orig);
- messageAcceptor.acceptWarning(
- "Unreachable state/point of graph",
- xpac.getOrig(toCheck).eContainer(), xpac.getOrig(toCheck).eContainingFeature(), idx,
- "UNREACHABLE", toCheck.getName());
- }
+ NullDiagnostician diagnostician = new NullDiagnostician();
+ GeneratorModelBuilder builder = new GeneratorModelBuilder(new NullLogger(), diagnostician);
+ ExpandedActorClass xpac = builder.createExpandedActorClass(ac);
+
+ if (xpac != null && !diagnostician.isFailed()) {
+ ReachabilityCheck checker = new ReachabilityCheck(xpac);
+ checker.computeReachability();
+ TreeIterator<EObject> it = xpac.getStateMachine().eAllContents();
+ while (it.hasNext()) {
+ EObject item = it.next();
+ if (item instanceof StateGraphItem)
+ {
+
+ StateGraphItem toCheck = (StateGraphItem) item;
+ if (!checker.isReachable(toCheck)) {
+ EObject orig = xpac.getOrig(toCheck);
+ EObject container = orig.eContainer();
+ @SuppressWarnings("unchecked")
+ int idx = ((List<? extends EObject>)container.eGet(orig.eContainingFeature())).indexOf(orig);
+ messageAcceptor.acceptWarning(
+ "Unreachable state/point of graph",
+ xpac.getOrig(toCheck).eContainer(), xpac.getOrig(toCheck).eContainingFeature(), idx,
+ DIAG_CODE_UNREACHABLE, toCheck.getName());
}
}
-
}
-
+ }
+ }
+
+ @Override
+ public String getName() {
+ return "State Reachability Validator";
+ }
+
+ @Override
+ public String getDescription() {
+ return "This validator checks the reachability of state graph items.";
}
}
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()));
}

Back to the top