Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java')
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java67
1 files changed, 50 insertions, 17 deletions
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 9891e116e..73c24b539 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
@@ -14,13 +14,17 @@ package org.eclipse.etrice.abstractexec.behavior;
import java.util.List;
+import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.core.genmodel.base.NullDiagnostician;
import org.eclipse.etrice.core.genmodel.base.NullLogger;
import org.eclipse.etrice.core.genmodel.builder.GeneratorModelBuilder;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.GeneralProtocolClass;
import org.eclipse.etrice.core.room.InterfaceItem;
+import org.eclipse.etrice.core.room.ProtocolClass;
+import org.eclipse.etrice.core.room.StateGraphItem;
import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.core.validation.IRoomValidator;
import org.eclipse.xtext.validation.ValidationMessageAcceptor;
@@ -39,26 +43,55 @@ public class AbstractExecutionValidator implements IRoomValidator {
if (!(object instanceof ActorClass))
return;
-
+
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()) {
- boolean allProtocolsWithSemantics = true;
- List<InterfaceItem> ifItems = RoomHelpers.getAllInterfaceItems(ac);
- for (InterfaceItem item : ifItems) {
- if (item.getProtocol().getSemantics()==null) {
- allProtocolsWithSemantics = false;
- break;
- }
+
+ boolean allProtocolsWithSemantics = true;
+ List<InterfaceItem> ifItems = RoomHelpers.getAllInterfaceItems(ac);
+ for (InterfaceItem item : ifItems) {
+ GeneralProtocolClass pc = item.getGeneralProtocol();
+ if (!(pc instanceof ProtocolClass))
+ continue;
+
+ if (((ProtocolClass) pc).getSemantics() == null) {
+ allProtocolsWithSemantics = false;
+ break;
}
+ }
+
+ if (allProtocolsWithSemantics) {
+ // begin abstract execution on state machine of expanded actor class
+
+ NullDiagnostician diagnostician = new NullDiagnostician();
+ GeneratorModelBuilder builder = new GeneratorModelBuilder(new NullLogger(), diagnostician);
+ ExpandedActorClass xpac = builder.createExpandedActorClass(ac);
- if (allProtocolsWithSemantics) {
- // begin abstract execution on state machine of expanded actor class
-
- ActionCodeAnalyzer analyzer = new ActionCodeAnalyzer(ac);
+ if (xpac != null && !diagnostician.isFailed()) {
+ // ActionCodeAnalyzer analyzer = new ActionCodeAnalyzer(ac);
+// 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 (false/*!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",
+ container, toCheck.eContainingFeature(), idx,
+ "UNREACHABLE", toCheck.getName());
+ }
+ }
+ }
}
}
}

Back to the top