Просмотр исходного кода

Share project "org.yakindu.sct.simulation.ui.sexec" into "https://svn.codespot.com/a/eclipselabs.org/yakindu"
Share project "org.yakindu.sct.simulation.core.sexec" into "https://svn.codespot.com/a/eclipselabs.org/yakindu"

Andreas Mülder 12 лет назад
Родитель
Сommit
0060d32ca4
52 измененных файлов с 4945 добавлено и 0 удалено
  1. 8 0
      plugins/org.yakindu.sct.simulation.core.sexec/.classpath
  2. 34 0
      plugins/org.yakindu.sct.simulation.core.sexec/.project
  3. 7 0
      plugins/org.yakindu.sct.simulation.core.sexec/.settings/org.eclipse.jdt.core.prefs
  4. 26 0
      plugins/org.yakindu.sct.simulation.core.sexec/META-INF/MANIFEST.MF
  5. 6 0
      plugins/org.yakindu.sct.simulation.core.sexec/build.properties
  6. 13 0
      plugins/org.yakindu.sct.simulation.core.sexec/plugin.xml
  7. 15 0
      plugins/org.yakindu.sct.simulation.core.sexec/pom.xml
  8. 30 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/SExecCoreActivator.java
  9. 111 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/SimulationModule.java
  10. 123 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/AbstractExecutionFlowSimulationEngine.java
  11. 64 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/CycleBasedSimulationEngine.java
  12. 83 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/DefaultExecutionContextInitializer.xtend
  13. 82 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/DefaultSimulationEngineFactory.java
  14. 56 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/EventDrivenSimulationEngine.java
  15. 33 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/IExecutionContextInitializer.java
  16. 27 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/ISimulationEngineFactory.java
  17. 59 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/AbstractStatementInterpreter.java
  18. 876 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/CoreFunction.java
  19. 229 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/DefaultExecutionFlowInterpreter.xtend
  20. 84 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/DefaultTimingService.java
  21. 15 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/DefaultTraceStepInterpreter.java
  22. 224 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/Function.java
  23. 37 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/IExecutionFlowInterpreter.java
  24. 39 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/IOperationMockup.java
  25. 25 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/IStatementInterpreter.java
  26. 49 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/ITimingService.java
  27. 25 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/ITraceStepInterpreter.java
  28. 88 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/JavaOperationMockup.java
  29. 73 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/Signature.java
  30. 278 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/StextStatementInterpreter.xtend
  31. 38 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/launch/ISCTLaunchParameters.java
  32. 56 0
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/launch/SexecLaunchConfigurationDelegate.java
  33. BIN
      plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/model/sexec/interpreter/impl/.ExecutionFlowInterpreter.java._trace
  34. BIN
      plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/simulation/core/sexec/container/.DefaultExecutionContextInitializer.java._trace
  35. 270 0
      plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/simulation/core/sexec/container/DefaultExecutionContextInitializer.java
  36. BIN
      plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/simulation/core/sexec/interpreter/.DefaultExecutionFlowInterpreter.java._trace
  37. BIN
      plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/simulation/core/sexec/interpreter/.StextStatementInterpreter.java._trace
  38. 566 0
      plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/simulation/core/sexec/interpreter/DefaultExecutionFlowInterpreter.java
  39. 594 0
      plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/simulation/core/sexec/interpreter/StextStatementInterpreter.java
  40. BIN
      plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/simulation/core/stext/interpreter/.StextStatementInterpreter.java._trace
  41. 7 0
      plugins/org.yakindu.sct.simulation.ui.sexec/.classpath
  42. 28 0
      plugins/org.yakindu.sct.simulation.ui.sexec/.project
  43. 7 0
      plugins/org.yakindu.sct.simulation.ui.sexec/.settings/org.eclipse.jdt.core.prefs
  44. 17 0
      plugins/org.yakindu.sct.simulation.ui.sexec/META-INF/MANIFEST.MF
  45. 5 0
      plugins/org.yakindu.sct.simulation.ui.sexec/build.properties
  46. BIN
      plugins/org.yakindu.sct.simulation.ui.sexec/icons/Statechart-Launcher-16.png
  47. 50 0
      plugins/org.yakindu.sct.simulation.ui.sexec/plugin.xml
  48. 15 0
      plugins/org.yakindu.sct.simulation.ui.sexec/pom.xml
  49. 50 0
      plugins/org.yakindu.sct.simulation.ui.sexec/src/org/yakindu/sct/simulation/ui/sexec/SExecUiActivator.java
  50. 103 0
      plugins/org.yakindu.sct.simulation.ui.sexec/src/org/yakindu/sct/simulation/ui/sexec/launch/StatechartLaunchShortcut.java
  51. 287 0
      plugins/org.yakindu.sct.simulation.ui.sexec/src/org/yakindu/sct/simulation/ui/sexec/launch/tabs/StatechartLaunchConfigurationTab.java
  52. 33 0
      plugins/org.yakindu.sct.simulation.ui.sexec/src/org/yakindu/sct/simulation/ui/sexec/launch/tabs/StatechartLaunchConfigurationTabGroup.java

+ 8 - 0
plugins/org.yakindu.sct.simulation.core.sexec/.classpath

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="xtend-gen"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

+ 34 - 0
plugins/org.yakindu.sct.simulation.core.sexec/.project

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.yakindu.sct.simulation.core.sexec</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+	</natures>
+</projectDescription>

+ 7 - 0
plugins/org.yakindu.sct.simulation.core.sexec/.settings/org.eclipse.jdt.core.prefs

@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6

+ 26 - 0
plugins/org.yakindu.sct.simulation.core.sexec/META-INF/MANIFEST.MF

@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Sexec
+Bundle-SymbolicName: org.yakindu.sct.simulation.core.sexec;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.yakindu.sct.simulation.core.sexec.SExecCoreActivator
+Require-Bundle: org.yakindu.sct.simulation.core;bundle-version="2.1.2",
+ org.eclipse.core.runtime;bundle-version="3.9.0",
+ org.yakindu.sct.model.sexec;bundle-version="2.1.2",
+ com.google.inject;bundle-version="3.0.0",
+ org.eclipse.xtext;bundle-version="2.4.2",
+ org.yakindu.sct.model.stext;bundle-version="2.1.2",
+ org.eclipse.xtend.lib,
+ com.google.guava,
+ org.eclipse.xtext.xbase.lib,
+ org.yakindu.sct.commons;bundle-version="2.1.2",
+ org.eclipse.emf.workspace;bundle-version="1.5.1",
+ org.yakindu.sct.ui.integration.stext;bundle-version="2.1.2",
+ de.itemis.xtext.utils.jface;bundle-version="2.1.2"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Export-Package: org.yakindu.sct.simulation.core.sexec,
+ org.yakindu.sct.simulation.core.sexec.container,
+ org.yakindu.sct.simulation.core.sexec.interpreter,
+ org.yakindu.sct.simulation.core.sexec.launch
+

+ 6 - 0
plugins/org.yakindu.sct.simulation.core.sexec/build.properties

@@ -0,0 +1,6 @@
+source.. = src/,\
+           xtend-gen/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml

+ 13 - 0
plugins/org.yakindu.sct.simulation.core.sexec/plugin.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+<!-- run configuration -->
+	<extension point="org.eclipse.debug.core.launchConfigurationTypes">
+    	<launchConfigurationType
+          delegate="org.yakindu.sct.simulation.core.sexec.launch.SexecLaunchConfigurationDelegate"
+          id="org.yakindu.sct.simulation.core.launch.statechart"
+          modes="run"
+          name="YAKINDU Statechart">
+    	</launchConfigurationType>
+	</extension>
+</plugin>

+ 15 - 0
plugins/org.yakindu.sct.simulation.core.sexec/pom.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.yakindu.sct</groupId>
+		<artifactId>org.yakindu.sct.releng</artifactId>
+		<version>2.1.2-SNAPSHOT</version>
+		<relativePath>../org.yakindu.sct.releng/pom.xml</relativePath>
+	</parent>
+	<artifactId>org.yakindu.sct.simulation.core.sexec</artifactId>
+	<groupId>org.yakindu.sct.plugins</groupId>
+	<packaging>eclipse-plugin</packaging>
+</project>

+ 30 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/SExecCoreActivator.java

@@ -0,0 +1,30 @@
+package org.yakindu.sct.simulation.core.sexec;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class SExecCoreActivator implements BundleActivator {
+
+	private static BundleContext context;
+
+	static BundleContext getContext() {
+		return context;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext bundleContext) throws Exception {
+		SExecCoreActivator.context = bundleContext;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext bundleContext) throws Exception {
+		SExecCoreActivator.context = null;
+	}
+
+}

+ 111 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/SimulationModule.java

@@ -0,0 +1,111 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.core.sexec;
+
+import org.eclipse.xtext.naming.IQualifiedNameProvider;
+import org.eclipse.xtext.service.AbstractGenericModule;
+import org.yakindu.base.types.ITypeSystem;
+import org.yakindu.sct.model.sexec.transformation.IModelSequencer;
+import org.yakindu.sct.model.sexec.transformation.ModelSequencer;
+import org.yakindu.sct.model.sexec.transformation.SequencerModule;
+import org.yakindu.sct.model.stext.naming.StextNameProvider;
+import org.yakindu.sct.model.stext.types.ISTextTypeInferrer;
+import org.yakindu.sct.model.stext.types.ISTextTypeSystem;
+import org.yakindu.sct.model.stext.types.STextDefaultTypeInferrer;
+import org.yakindu.sct.model.stext.types.STextDefaultTypeSystem;
+import org.yakindu.sct.simulation.core.engine.ISimulationEngine;
+import org.yakindu.sct.simulation.core.sexec.container.DefaultExecutionContextInitializer;
+import org.yakindu.sct.simulation.core.sexec.container.DefaultSimulationEngineFactory;
+import org.yakindu.sct.simulation.core.sexec.container.IExecutionContextInitializer;
+import org.yakindu.sct.simulation.core.sexec.container.ISimulationEngineFactory;
+import org.yakindu.sct.simulation.core.sexec.interpreter.DefaultExecutionFlowInterpreter;
+import org.yakindu.sct.simulation.core.sexec.interpreter.DefaultTimingService;
+import org.yakindu.sct.simulation.core.sexec.interpreter.DefaultTraceStepInterpreter;
+import org.yakindu.sct.simulation.core.sexec.interpreter.IExecutionFlowInterpreter;
+import org.yakindu.sct.simulation.core.sexec.interpreter.IOperationMockup;
+import org.yakindu.sct.simulation.core.sexec.interpreter.IStatementInterpreter;
+import org.yakindu.sct.simulation.core.sexec.interpreter.ITimingService;
+import org.yakindu.sct.simulation.core.sexec.interpreter.ITraceStepInterpreter;
+import org.yakindu.sct.simulation.core.sexec.interpreter.JavaOperationMockup;
+import org.yakindu.sct.simulation.core.sexec.interpreter.StextStatementInterpreter;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+import org.yakindu.sct.simulation.core.sruntime.impl.ExecutionContextImpl;
+
+import com.google.inject.Binder;
+import com.google.inject.name.Names;
+
+/**
+ * Default Module used by the {@link ISimulationEngine}. Override bindings to
+ * specify custom behavior.
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class SimulationModule extends AbstractGenericModule {
+
+	public void configure(Binder binder) {
+		super.configure(binder);
+		binder.bind(Boolean.class).annotatedWith(Names.named(SequencerModule.ADD_TRACES)).toInstance(Boolean.TRUE);
+	}
+
+	public Class<? extends IExecutionContextInitializer> bindIExecutionContextInitializer() {
+		return DefaultExecutionContextInitializer.class;
+	}
+
+	public Class<? extends ISimulationEngineFactory> bindISimulationEngineFactory() {
+		return DefaultSimulationEngineFactory.class;
+	}
+
+	public Class<? extends ITraceStepInterpreter> bindITraceStepInterpreter() {
+		return DefaultTraceStepInterpreter.class;
+	}
+
+	public Class<? extends IModelSequencer> bindIModelSequencer() {
+		return ModelSequencer.class;
+	}
+
+	public Class<? extends IOperationMockup> bindIOperationMockup() {
+		return JavaOperationMockup.class;
+	}
+
+	public Class<? extends ExecutionContext> bindExecutionContext() {
+		return ExecutionContextImpl.class;
+	}
+
+	public Class<? extends IExecutionFlowInterpreter> bindIExecutionFlowInterpreter() {
+		return DefaultExecutionFlowInterpreter.class;
+	}
+
+	public Class<? extends ITimingService> bindITimingService() {
+		return DefaultTimingService.class;
+	}
+
+	public Class<? extends IStatementInterpreter> bindIStatementInterpreter() {
+		return StextStatementInterpreter.class;
+	}
+
+	public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() {
+		return StextNameProvider.class;
+	}
+
+	public Class<? extends ITypeSystem> bindITypeSystem() {
+		return STextDefaultTypeSystem.class;
+	}
+
+	public Class<? extends ISTextTypeSystem> bindISTextTypeSystem() {
+		return STextDefaultTypeSystem.class;
+	}
+
+	public Class<? extends ISTextTypeInferrer> bindISTextTypeInferrer() {
+		return STextDefaultTypeInferrer.class;
+	}
+
+}

+ 123 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/AbstractExecutionFlowSimulationEngine.java

@@ -0,0 +1,123 @@
+/**
+ * Copyright (c) 2012 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+
+package org.yakindu.sct.simulation.core.sexec.container;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IStatusHandler;
+import org.eclipse.emf.common.util.WrappedException;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sexec.transformation.IModelSequencer;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.simulation.core.Activator;
+import org.yakindu.sct.simulation.core.engine.IExecutionControl;
+import org.yakindu.sct.simulation.core.engine.ISimulationEngine;
+import org.yakindu.sct.simulation.core.sexec.interpreter.IExecutionFlowInterpreter;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+
+import com.google.inject.Inject;
+
+/**
+ * Abstract implementation if the {@link ISimulationEngine} interface.
+ * transforms a {@link Statechart} to an {@link ExecutionFlow} and holds an
+ * {@link ExecutionContext}
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public abstract class AbstractExecutionFlowSimulationEngine implements ISimulationEngine, IExecutionControl {
+
+	public static final int ERROR_DURING_SIMULATION = 765;
+
+	@Inject
+	protected ExecutionContext context;
+	@Inject
+	private IModelSequencer sequencer;
+	@Inject
+	private IExecutionFlowInterpreter interpreter;
+	@Inject
+	private IExecutionContextInitializer contextInitializer;
+
+	protected boolean terminated = false;
+	protected boolean suspended = false;
+
+	private Statechart statechart;
+
+	public AbstractExecutionFlowSimulationEngine(Statechart statechart) {
+		this.statechart = statechart;
+	}
+
+	protected final void runCycle() {
+		try {
+			interpreter.runCycle();
+		} catch (WrappedException ex) {
+			Status errorStatus = new Status(Status.ERROR, Activator.PLUGIN_ID, ERROR_DURING_SIMULATION, ex.getCause()
+					.getMessage(), ex.getCause());
+			IStatusHandler statusHandler = DebugPlugin.getDefault().getStatusHandler(errorStatus);
+			try {
+				statusHandler.handleStatus(errorStatus, this);
+				interpreter.tearDown();
+			} catch (CoreException e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public void start() {
+		ExecutionFlow flow = sequencer.transform(statechart);
+		if (!context.isSnapshot()){
+			contextInitializer.initialize(context, flow);
+		}
+		interpreter.initialize(flow, context);
+		interpreter.enter();
+	}
+
+	public void suspend() {
+		suspended = true;
+		interpreter.suspend();
+	}
+
+	public void resume() {
+		suspended = false;
+		interpreter.resume();
+
+	}
+
+	public void terminate() {
+		terminated = true;
+		interpreter.tearDown();
+	}
+
+	public void stepForward() {
+		interpreter.runCycle();
+	}
+
+	public void stepBackward() {
+
+	}
+
+	@Override
+	public ExecutionContext getExecutionContext() {
+		return context;
+	}
+
+	public void setExecutionContext(ExecutionContext context) {
+		this.context = context;
+	}
+
+	@Override
+	public IExecutionControl getExecutionControl() {
+		return this;
+	}
+
+}

+ 64 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/CycleBasedSimulationEngine.java

@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2012 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.core.sexec.container;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.simulation.core.engine.ISimulationEngine;
+
+/**
+ * Cycle based implementation of {@link ISimulationEngine}
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class CycleBasedSimulationEngine extends AbstractExecutionFlowSimulationEngine {
+
+	private Timer timer;
+
+	private long cyclePeriod;
+
+	public CycleBasedSimulationEngine(Statechart statechart, long cyclePeriod) {
+		super(statechart);
+		this.cyclePeriod = cyclePeriod;
+		timer = new Timer();
+	}
+
+	protected void scheduleCycle() {
+		if (!terminated && !suspended) {
+			TimerTask virtualTimerTask = new TimerTask() {
+				public void run() {
+					runCycle();
+					scheduleCycle();
+				}
+			};
+			timer.schedule(virtualTimerTask, cyclePeriod);
+		}
+	}
+
+	public void start() {
+		super.start();
+		scheduleCycle();
+	}
+
+	public void resume() {
+		super.resume();
+		scheduleCycle();
+	}
+
+	public void terminate() {
+		super.terminate();
+		timer.cancel();
+	}
+
+}

+ 83 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/DefaultExecutionContextInitializer.xtend

@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2013 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.core.sexec.container
+
+import com.google.inject.Inject
+import org.eclipse.xtext.naming.IQualifiedNameProvider
+import org.yakindu.base.types.EnumerationType
+import org.yakindu.base.types.ITypeSystem.InferredType
+import org.yakindu.sct.model.sexec.ExecutionFlow
+import org.yakindu.sct.model.sexec.TimeEvent
+import org.yakindu.sct.model.stext.stext.EventDefinition
+import org.yakindu.sct.model.stext.stext.OperationDefinition
+import org.yakindu.sct.model.stext.stext.VariableDefinition
+import org.yakindu.sct.model.stext.types.ISTextTypeInferrer
+import org.yakindu.sct.model.stext.types.ISTextTypeSystem
+import org.yakindu.sct.simulation.core.sruntime.EventDirection
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext
+import org.yakindu.sct.simulation.core.sruntime.impl.ExecutionEventImpl
+import org.yakindu.sct.simulation.core.sruntime.impl.ExecutionVariableImpl
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+class DefaultExecutionContextInitializer implements IExecutionContextInitializer {
+
+	@Inject extension IQualifiedNameProvider
+	@Inject extension ISTextTypeSystem
+	@Inject extension ISTextTypeInferrer
+
+	override initialize(ExecutionContext context, ExecutionFlow flow) {
+		flow.scopes.forEach[declarations.forEach[context.slots += it.transform]]
+	}
+
+	def dispatch create new ExecutionVariableImpl() transform(VariableDefinition variable) {
+		var qualifiedName = variable.fullyQualifiedName
+		qualifiedName.segments
+		it.name = variable.fullyQualifiedName.toString
+		it.type = variable.inferType.type
+		it.value = it.type.defaultValue
+	}
+
+	def dispatch create new ExecutionEventImpl() transform(EventDefinition event) {
+		it.name = event.fullyQualifiedName.toString
+		it.type = event.inferType.type
+		it.value = it.type.defaultValue
+		it.direction = EventDirection.get(event.direction.value)
+	}
+
+	def dispatch create new ExecutionVariableImpl() transform(OperationDefinition op) {
+		it.name = op.fullyQualifiedName.toString
+		it.type = new InferredType(op.type)
+		it.value = it.type.defaultValue
+	}
+
+	def dispatch create new ExecutionEventImpl() transform(TimeEvent event) {
+		it.name = event.fullyQualifiedName.toString
+		it.type = new InferredType(integerType)
+		it.value = defaultValue(it.type)
+	}
+
+	def Object defaultValue(InferredType type) {
+		switch (type) {
+			case isBooleanType(type): true
+			case isIntegerType(type): 0
+			case isRealType(type): 0.0
+			case isVoidType(type): null
+			case isStringType(type): ""
+			case type instanceof EnumerationType: (type as EnumerationType).enumerator.head
+			default: null
+		}
+	}
+
+}

+ 82 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/DefaultSimulationEngineFactory.java

@@ -0,0 +1,82 @@
+/**
+ * Copyright (c) 2013 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.core.sexec.container;
+
+import static org.yakindu.sct.simulation.core.sexec.launch.ISCTLaunchParameters.CYCLE_PERIOD;
+import static org.yakindu.sct.simulation.core.sexec.launch.ISCTLaunchParameters.DEFAULT_CYCLE_PERIOD;
+import static org.yakindu.sct.simulation.core.sexec.launch.ISCTLaunchParameters.DEFAULT_IS_CYCLE_BASED;
+import static org.yakindu.sct.simulation.core.sexec.launch.ISCTLaunchParameters.IS_CYCLE_BASED;
+
+import java.util.Collections;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.simulation.core.engine.ISimulationEngine;
+import org.yakindu.sct.simulation.core.sexec.launch.ISCTLaunchParameters;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class DefaultSimulationEngineFactory implements ISimulationEngineFactory {
+
+	@Inject
+	private Injector injector;
+
+	public ISimulationEngine createExecutionContainer(Statechart statechart, ILaunch launch) throws CoreException {
+		ISimulationEngine controller = null;
+		boolean isCycleBased = launch.getLaunchConfiguration().getAttribute(IS_CYCLE_BASED, DEFAULT_IS_CYCLE_BASED);
+		if (isCycleBased) {
+			long cyclePeriod = launch.getLaunchConfiguration().getAttribute(CYCLE_PERIOD, DEFAULT_CYCLE_PERIOD);
+			controller = new CycleBasedSimulationEngine(statechart, cyclePeriod);
+		} else {
+			controller = new EventDrivenSimulationEngine(statechart);
+		}
+		injector.injectMembers(controller);
+
+		// For restoring execution context
+		String attribute = launch.getLaunchConfiguration().getAttribute(ISCTLaunchParameters.EXECUTION_CONTEXT, "");
+		if (attribute != null && attribute.trim().length() > 0) {
+			ExecutionContext context = restore(attribute);
+			controller.setExecutionContext(context);
+		}
+
+		return controller;
+	}
+
+	protected ExecutionContext restore(String context) {
+		try {
+			ResourceSet set = new ResourceSetImpl();
+			Resource resource = set.createResource(URI.createURI("test.xmi"));
+			set.getResources().add(resource);
+			resource.load(new URIConverter.ReadableInputStream(context, "UTF_8"), Collections.emptyMap());
+			EcoreUtil.resolveAll(resource);
+			ExecutionContext result = (ExecutionContext) resource.getContents().get(0);
+			result.setSnapshot(true);
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+}

+ 56 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/EventDrivenSimulationEngine.java

@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2012 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+
+package org.yakindu.sct.simulation.core.sexec.container;
+
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.simulation.core.engine.ISimulationEngine;
+
+/**
+ * Event Driven implementation of the {@link ISimulationEngine}.
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class EventDrivenSimulationEngine extends AbstractExecutionFlowSimulationEngine {
+
+	private Thread cycleRunner;
+
+	public EventDrivenSimulationEngine(Statechart statechart) {
+		super(statechart);
+	}
+
+	public void start() {
+		super.start();
+		cycleRunner = new Thread(new CycleRunner());
+		cycleRunner.start();
+	}
+
+	public void resume() {
+		super.resume();
+		cycleRunner = new Thread(new CycleRunner());
+		cycleRunner.start();
+	}
+
+	public void terminate() {
+		super.terminate();
+	}
+
+	private final class CycleRunner implements Runnable {
+		public void run() {
+			while (!terminated && !suspended) {
+				if (context.getRaisedEvents().size() > 0 || context.getScheduledEvents().size() > 0) {
+					runCycle();
+				}
+			}
+		}
+	}
+}

+ 33 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/IExecutionContextInitializer.java

@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2013 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.core.sexec.container;
+
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionEvent;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionVariable;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public interface IExecutionContextInitializer {
+	/**
+	 * Called before the interpreter is started to initialize the
+	 * {@link ExecutionContext} based on the {@link ExecutionFlow}. Clients
+	 * should create {@link ExecutionVariable}s and {@link ExecutionEvent}s
+	 * based on the {@link ExecutionFlow}
+	 * 
+	 */
+	public void initialize(ExecutionContext context, ExecutionFlow flow);
+
+}

+ 27 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/container/ISimulationEngineFactory.java

@@ -0,0 +1,27 @@
+/**
+ * Copyright (c) 2013 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.core.sexec.container;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunch;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.simulation.core.engine.ISimulationEngine;
+
+/**
+ * Factory interface to create implementations of {@link ISimulationEngine}
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public interface ISimulationEngineFactory {
+
+	public ISimulationEngine createExecutionContainer(Statechart statechart, ILaunch launch) throws CoreException;
+}

+ 59 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/AbstractStatementInterpreter.java

@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * @author axel terfloth - added caching of function lookups
+ * 
+ */
+public abstract class AbstractStatementInterpreter extends CoreFunction
+		implements IStatementInterpreter {
+
+	protected static Map<String, String> assignFunctionMap = new HashMap<String, String>();
+
+	static {
+		assignFunctionMap.put("multAssign", "*");
+		assignFunctionMap.put("divAssign", "/");
+		assignFunctionMap.put("modAssign", "%");
+		assignFunctionMap.put("addAssign", "+");
+		assignFunctionMap.put("subAssign", "-");
+		assignFunctionMap.put("leftShiftAssign", "<<");
+		assignFunctionMap.put("rightShiftAssign", ">>");
+		assignFunctionMap.put("andAssign", "&");
+		assignFunctionMap.put("xorAssign", "^");
+		assignFunctionMap.put("orAssign", "|");
+	}
+
+	protected Map<Signature, Function> functionMap = new HashMap<Signature, Function>();
+
+	public Object evaluate(String name, Object... params) {
+		Function lookup = lookup(name, params);
+		return lookup.execute(params);
+
+	}
+
+	public Function lookup(String name, Object... params) {
+
+		Signature sig = new Signature(name, toParamTypes(params));
+		Function f = functionMap.get(sig);
+		if (f == null) {
+			f = super.lookup(getClass(), name, sig.getParamTypes());
+			functionMap.put(sig, f);
+		}
+		return f;
+	}
+
+}

+ 876 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/CoreFunction.java

@@ -0,0 +1,876 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+public class CoreFunction extends Function {
+
+	public static final String EQUALS = "==";
+	public static final String NOT_EQUALS = "!=";
+	public static final String SMALLER = "<";
+	public static final String SMALLER_EQUAL = "<=";
+	public static final String GREATER = ">";
+	public static final String GREATER_EQUAL = ">=";
+
+	public static final String BIT_AND = "&";
+	public static final String BIT_OR = "|";
+	public static final String BIT_XOR = "^";
+	public static final String BIT_LSHIFT = "<<";
+	public static final String BIT_RSHIFT = ">>";
+	public static final String BIT_COMPLEMENT = "~";
+
+	public static final String PLUS = "+";
+	public static final String MINUS = "-";
+	public static final String MULTIPLY = "*";
+	public static final String DIVIDE = "/";
+	public static final String MODULO = "%";
+
+	public static final String POSITIVE = PLUS;
+	public static final String NEGATIVE = MINUS;
+	public static final String NOT = "!";
+
+	@FunctionMethod(PLUS)
+	public Integer plus(Integer i1, Integer i2) {
+		return i1 + i2;
+	}
+
+	@FunctionMethod(PLUS)
+	public Float plus(Float f1, Float f2) {
+		return f1 + f2;
+	}
+
+	@FunctionMethod(PLUS)
+	public Double plus(Double d1, Double d2) {
+		return d1 + d2;
+	}
+
+	@FunctionMethod(PLUS)
+	public Long plus(Long l1, Long l2) {
+		return l1 + l2;
+	}
+
+	@FunctionMethod(PLUS)
+	public Float plus(Integer f1, Float f2) {
+		return f1 + f2;
+	}
+
+	@FunctionMethod(PLUS)
+	public Double plus(Integer i1, Double d1) {
+		return i1 + d1;
+	}
+
+	@FunctionMethod(PLUS)
+	public Long plus(Integer i1, Long l1) {
+		return i1 + l1;
+	}
+
+	@FunctionMethod(PLUS)
+	public Float plus(Float f1, Integer i1) {
+		return f1 + i1;
+	}
+
+	@FunctionMethod(PLUS)
+	public Double plus(Float f1, Double d2) {
+		return f1 + d2;
+	}
+
+	@FunctionMethod(PLUS)
+	public Double plus(Double d1, Integer i1) {
+		return d1 + i1;
+	}
+
+	@FunctionMethod(PLUS)
+	public Double plus(Double d1, Float i1) {
+		return d1 + i1;
+	}
+
+	@FunctionMethod(PLUS)
+	public Double plus(Double d1, Long i1) {
+		return d1 + i1;
+	}
+
+	@FunctionMethod(PLUS)
+	public Long plus(Long l1, Integer i1) {
+		return l1 + i1;
+	}
+
+	@FunctionMethod(PLUS)
+	public Integer positive(Integer i) {
+		return i;
+	}
+
+	@FunctionMethod(PLUS)
+	public Float positive(Float f) {
+		return f;
+	}
+
+	@FunctionMethod(PLUS)
+	public Long positive(Long l) {
+		return l;
+	}
+
+	@FunctionMethod(PLUS)
+	public Double positive(Double d) {
+		return d;
+	}
+
+	@FunctionMethod(PLUS)
+	public Boolean positive(Boolean b) {
+		return b;
+	}
+
+	@FunctionMethod(PLUS)
+	public String positive(String s) {
+		return s;
+	}
+
+	@FunctionMethod(MINUS)
+	public Integer negative(Integer i) {
+		return -i;
+	}
+
+	@FunctionMethod(MINUS)
+	public Float negative(Float f) {
+		return -f;
+	}
+
+	@FunctionMethod(MINUS)
+	public Double negative(Double d) {
+		return -d;
+	}
+
+	@FunctionMethod(MINUS)
+	public Long negative(Long d) {
+		return -d;
+	}
+
+	@FunctionMethod(MINUS)
+	public Integer minus(Integer i1, Integer i2) {
+		return i1 - i2;
+	}
+
+	@FunctionMethod(MINUS)
+	public Float minus(Float f1, Float f2) {
+		return f1 - f2;
+	}
+
+	@FunctionMethod(MINUS)
+	public Double minus(Double d1, Double d2) {
+		return d1 - d2;
+	}
+
+	@FunctionMethod(MINUS)
+	public Long minus(Long l1, Long l2) {
+		return l1 - l2;
+	}
+
+	@FunctionMethod(MINUS)
+	public Float minus(Integer f1, Float f2) {
+		return f1 - f2;
+	}
+
+	@FunctionMethod(MINUS)
+	public Double minus(Integer i1, Double d1) {
+		return i1 - d1;
+	}
+
+	@FunctionMethod(MINUS)
+	public Long minus(Integer i1, Long l1) {
+		return i1 - l1;
+	}
+
+	@FunctionMethod(MINUS)
+	public Float minus(Float f1, Integer i1) {
+		return f1 - i1;
+	}
+
+	@FunctionMethod(MINUS)
+	public Double minus(Float f1, Double d2) {
+		return f1 - d2;
+	}
+
+	@FunctionMethod(MINUS)
+	public Double minus(Double d1, Integer i1) {
+		return d1 - i1;
+	}
+
+	@FunctionMethod(MINUS)
+	public Double minus(Double d1, Float i1) {
+		return d1 - i1;
+	}
+
+	@FunctionMethod(MINUS)
+	public Double minus(Double d1, Long i1) {
+		return d1 - i1;
+	}
+
+	@FunctionMethod(MINUS)
+	public Long minus(Long l1, Integer i1) {
+		return l1 - i1;
+	}
+
+	@FunctionMethod(MULTIPLY)
+	public Integer mul(Integer i1, Integer i2) {
+		return i1 * i2;
+	}
+
+	@FunctionMethod(MULTIPLY)
+	public Float mul(Float f1, Float f2) {
+		return f1 * f2;
+	}
+
+	@FunctionMethod(MULTIPLY)
+	public Double mul(Double d1, Double d2) {
+		return d1 * d2;
+	}
+
+	@FunctionMethod(MULTIPLY)
+	public Long mul(Long l1, Long l2) {
+		return l1 * l2;
+	}
+
+	@FunctionMethod(MULTIPLY)
+	public Float mul(Integer f1, Float f2) {
+		return f1 * f2;
+	}
+
+	@FunctionMethod(MULTIPLY)
+	public Double mul(Integer i1, Double d1) {
+		return i1 * d1;
+	}
+
+	@FunctionMethod(MULTIPLY)
+	public Long mul(Integer i1, Long l1) {
+		return i1 * l1;
+	}
+
+	@FunctionMethod(MULTIPLY)
+	public Float mul(Float f1, Integer i1) {
+		return f1 * i1;
+	}
+
+	@FunctionMethod(MULTIPLY)
+	public Double mul(Float f1, Double d2) {
+		return f1 * d2;
+	}
+
+	@FunctionMethod(MULTIPLY)
+	public Double mul(Double d1, Integer i1) {
+		return d1 * i1;
+	}
+
+	@FunctionMethod(MULTIPLY)
+	public Double mul(Double d1, Float i1) {
+		return d1 * i1;
+	}
+
+	@FunctionMethod(MULTIPLY)
+	public Double mul(Double d1, Long i1) {
+		return d1 * i1;
+	}
+
+	@FunctionMethod(MULTIPLY)
+	public Long mul(Long l1, Integer i1) {
+		return l1 * i1;
+	}
+
+	@FunctionMethod(DIVIDE)
+	public Integer div(Integer i1, Integer i2) {
+		return i1 / i2;
+	}
+
+	@FunctionMethod(DIVIDE)
+	public Float div(Float f1, Float f2) {
+		return f1 / f2;
+	}
+
+	@FunctionMethod(DIVIDE)
+	public Double div(Double d1, Double d2) {
+		return d1 / d2;
+	}
+
+	@FunctionMethod(DIVIDE)
+	public Long div(Long l1, Long l2) {
+		return l1 / l2;
+	}
+
+	@FunctionMethod(DIVIDE)
+	public Float div(Integer f1, Float f2) {
+		return f1 / f2;
+	}
+
+	@FunctionMethod(DIVIDE)
+	public Double div(Integer i1, Double d1) {
+		return i1 / d1;
+	}
+
+	@FunctionMethod(DIVIDE)
+	public Long div(Integer i1, Long l1) {
+		return i1 / l1;
+	}
+
+	@FunctionMethod(DIVIDE)
+	public Float div(Float f1, Integer i1) {
+		return f1 / i1;
+	}
+
+	@FunctionMethod(DIVIDE)
+	public Double div(Float f1, Double d2) {
+		return f1 / d2;
+	}
+
+	@FunctionMethod(DIVIDE)
+	public Double div(Double d1, Integer i1) {
+		return d1 / i1;
+	}
+
+	@FunctionMethod(DIVIDE)
+	public Double div(Double d1, Float i1) {
+		return d1 / i1;
+	}
+
+	@FunctionMethod(DIVIDE)
+	public Double div(Double d1, Long i1) {
+		return d1 / i1;
+	}
+
+	@FunctionMethod(DIVIDE)
+	public Long div(Long l1, Integer i1) {
+		return l1 / i1;
+	}
+
+	@FunctionMethod(MODULO)
+	public Integer mod(Integer i1, Integer i2) {
+		return i1 % i2;
+	}
+
+	@FunctionMethod(MODULO)
+	public Float mod(Float f1, Float f2) {
+		return f1 % f2;
+	}
+
+	@FunctionMethod(MODULO)
+	public Double mod(Double d1, Double d2) {
+		return d1 % d2;
+	}
+
+	@FunctionMethod(MODULO)
+	public Long mod(Long l1, Long l2) {
+		return l1 % l2;
+	}
+
+	@FunctionMethod(MODULO)
+	public Float mod(Integer f1, Float f2) {
+		return f1 % f2;
+	}
+
+	@FunctionMethod(MODULO)
+	public Double mod(Integer i1, Double d1) {
+		return i1 % d1;
+	}
+
+	@FunctionMethod(MODULO)
+	public Long mod(Integer i1, Long l1) {
+		return i1 % l1;
+	}
+
+	@FunctionMethod(MODULO)
+	public Float mod(Float f1, Integer i1) {
+		return f1 % i1;
+	}
+
+	@FunctionMethod(MODULO)
+	public Double mod(Float f1, Double d2) {
+		return f1 % d2;
+	}
+
+	@FunctionMethod(MODULO)
+	public Double mod(Double d1, Integer i1) {
+		return d1 % i1;
+	}
+
+	@FunctionMethod(MODULO)
+	public Double mod(Double d1, Float i1) {
+		return d1 % i1;
+	}
+
+	@FunctionMethod(MODULO)
+	public Double mod(Double d1, Long i1) {
+		return d1 % i1;
+	}
+
+	@FunctionMethod(MODULO)
+	public Long mod(Long l1, Integer i1) {
+		return l1 % i1;
+	}
+
+	@FunctionMethod(BIT_LSHIFT)
+	public Integer left(Integer i1, Integer i2) {
+		return i1 << i2;
+	}
+
+	@FunctionMethod(BIT_RSHIFT)
+	public Integer right(Integer i1, Integer i2) {
+		return i1 >> i2;
+	}
+
+	@FunctionMethod(BIT_AND)
+	public Integer bitwiseAnd(Integer i1, Integer i2) {
+		return i1 & i2;
+	}
+
+	@FunctionMethod(BIT_OR)
+	public Integer bitwiseOr(Integer i1, Integer i2) {
+		return i1 | i2;
+	}
+
+	@FunctionMethod(BIT_XOR)
+	public Integer bitwiseXor(Integer i1, Integer i2) {
+		return i1 ^ i2;
+	}
+
+	@FunctionMethod(BIT_XOR)
+	public Long bitwiseXor(Long l1, Long l2) {
+		return l1 ^ l2;
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(Boolean b1, Boolean b2) {
+		return b1.equals(b2);
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(EObject e1, EObject e2) {
+		return EcoreUtil.equals(e1, e2);
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(String string1, String string2) {
+		return string1.equals(string2);
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(Integer i1, Integer i2) {
+		return i1.intValue() == i2.intValue();
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(Float f1, Float f2) {
+		return f1.floatValue() == f2.floatValue();
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(Double d1, Double d2) {
+		return d1.doubleValue() == d2.doubleValue();
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(Long l1, Long l2) {
+		return l1.longValue() == l2.longValue();
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(Integer f1, Float f2) {
+		return f1.intValue() == f2.floatValue();
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(Integer i1, Double d1) {
+		return i1.intValue() == d1.doubleValue();
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(Integer i1, Long l1) {
+		return i1.intValue() == l1.longValue();
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(Float f1, Integer i1) {
+		return f1.floatValue() == i1.intValue();
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(Float f1, Double d2) {
+		return f1.floatValue() == d2.doubleValue();
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(Double d1, Integer i1) {
+		return d1.doubleValue() == i1.intValue();
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(Double d1, Float i1) {
+		return d1.doubleValue() == i1.floatValue();
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(Double d1, Long i1) {
+		return d1.doubleValue() == i1.longValue();
+	}
+
+	@FunctionMethod(EQUALS)
+	public Boolean equals(Long l1, Integer i1) {
+		return l1.longValue() == i1.intValue();
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(EObject e1, EObject e2) {
+		return !EcoreUtil.equals(e1, e2);
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(Boolean b1, Boolean b2) {
+		return b1.booleanValue() != b2.booleanValue();
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(String i1, String i2) {
+		return !i1.equals(i2);
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(Integer i1, Integer i2) {
+		return i1.intValue() != i2.intValue();
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(Float f1, Float f2) {
+		return f1.floatValue() != f2.floatValue();
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(Double d1, Double d2) {
+		return d1.doubleValue() != d2.doubleValue();
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(Long l1, Long l2) {
+		return l1.longValue() != l2.longValue();
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(Integer f1, Float f2) {
+		return f1.intValue() != f2.floatValue();
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(Integer i1, Double d1) {
+		return i1.intValue() != d1.doubleValue();
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(Integer i1, Long l1) {
+		return i1.intValue() != l1.longValue();
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(Float f1, Integer i1) {
+		return f1.floatValue() != i1.intValue();
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(Float f1, Double d2) {
+		return f1.floatValue() != d2.doubleValue();
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(Double d1, Integer i1) {
+		return d1.doubleValue() != i1.intValue();
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(Double d1, Float i1) {
+		return d1.doubleValue() != i1.floatValue();
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(Double d1, Long i1) {
+		return d1.doubleValue() != i1.longValue();
+	}
+
+	@FunctionMethod(NOT_EQUALS)
+	public Boolean notEquals(Long l1, Integer i1) {
+		return l1.longValue() != i1.intValue();
+	}
+
+	@FunctionMethod(GREATER_EQUAL)
+	public Boolean greaterEqual(Integer i1, Integer i2) {
+		return i1 >= i2;
+	}
+
+	@FunctionMethod(GREATER_EQUAL)
+	public Boolean greaterEqual(Float f1, Float f2) {
+		return f1 >= f2;
+	}
+
+	@FunctionMethod(GREATER_EQUAL)
+	public Boolean greaterEqual(Double d1, Double d2) {
+		return d1 >= d2;
+	}
+
+	@FunctionMethod(GREATER_EQUAL)
+	public Boolean greaterEqual(Long l1, Long l2) {
+		return l1 >= l2;
+	}
+
+	@FunctionMethod(GREATER_EQUAL)
+	public Boolean greaterEqual(Integer f1, Float f2) {
+		return f1 >= f2;
+	}
+
+	@FunctionMethod(GREATER_EQUAL)
+	public Boolean greaterEqual(Integer i1, Double d1) {
+		return i1 >= d1;
+	}
+
+	@FunctionMethod(GREATER_EQUAL)
+	public Boolean greaterEqual(Integer i1, Long l1) {
+		return i1 >= l1;
+	}
+
+	@FunctionMethod(GREATER_EQUAL)
+	public Boolean greaterEqual(Float f1, Integer i1) {
+		return f1 >= i1;
+	}
+
+	@FunctionMethod(GREATER_EQUAL)
+	public Boolean greaterEqual(Float f1, Double d2) {
+		return f1 >= d2;
+	}
+
+	@FunctionMethod(GREATER_EQUAL)
+	public Boolean greaterEqual(Double d1, Integer i1) {
+		return d1 >= i1;
+	}
+
+	@FunctionMethod(GREATER_EQUAL)
+	public Boolean greaterEqual(Double d1, Float i1) {
+		return d1 >= i1;
+	}
+
+	@FunctionMethod(GREATER_EQUAL)
+	public Boolean greaterEqual(Double d1, Long i1) {
+		return d1 >= i1;
+	}
+
+	@FunctionMethod(GREATER_EQUAL)
+	public Boolean greaterEqual(Long l1, Integer i1) {
+		return l1 >= i1;
+	}
+
+	@FunctionMethod(SMALLER_EQUAL)
+	public Boolean smallerEqual(Integer i1, Integer i2) {
+		return i1 <= i2;
+	}
+
+	@FunctionMethod(SMALLER_EQUAL)
+	public Boolean smallerEqual(Float f1, Float f2) {
+		return f1 <= f2;
+	}
+
+	@FunctionMethod(SMALLER_EQUAL)
+	public Boolean smallerEqual(Double d1, Double d2) {
+		return d1 <= d2;
+	}
+
+	@FunctionMethod(SMALLER_EQUAL)
+	public Boolean smallerEqual(Long l1, Long l2) {
+		return l1 <= l2;
+	}
+
+	@FunctionMethod(SMALLER_EQUAL)
+	public Boolean smallerEqual(Integer f1, Float f2) {
+		return f1 <= f2;
+	}
+
+	@FunctionMethod(SMALLER_EQUAL)
+	public Boolean smallerEqual(Integer i1, Double d1) {
+		return i1 <= d1;
+	}
+
+	@FunctionMethod(SMALLER_EQUAL)
+	public Boolean smallerEqual(Integer i1, Long l1) {
+		return i1 <= l1;
+	}
+
+	@FunctionMethod(SMALLER_EQUAL)
+	public Boolean smallerEqual(Float f1, Integer i1) {
+		return f1 <= i1;
+	}
+
+	@FunctionMethod(SMALLER_EQUAL)
+	public Boolean smallerEqual(Float f1, Double d2) {
+		return f1 <= d2;
+	}
+
+	@FunctionMethod(SMALLER_EQUAL)
+	public Boolean smallerEqual(Double d1, Integer i1) {
+		return d1 <= i1;
+	}
+
+	@FunctionMethod(SMALLER_EQUAL)
+	public Boolean smallerEqual(Double d1, Float i1) {
+		return d1 <= i1;
+	}
+
+	@FunctionMethod(SMALLER_EQUAL)
+	public Boolean smallerEqual(Double d1, Long i1) {
+		return d1 <= i1;
+	}
+
+	@FunctionMethod(SMALLER_EQUAL)
+	public Boolean smallerEqual(Long l1, Integer i1) {
+		return l1 <= i1;
+	}
+
+	@FunctionMethod(GREATER)
+	public Boolean greater(Integer i1, Integer i2) {
+		return i1 > i2;
+	}
+
+	@FunctionMethod(GREATER)
+	public Boolean greater(Float f1, Float f2) {
+		return f1 > f2;
+	}
+
+	@FunctionMethod(GREATER)
+	public Boolean greater(Double d1, Double d2) {
+		return d1 > d2;
+	}
+
+	@FunctionMethod(GREATER)
+	public Boolean greater(Long l1, Long l2) {
+		return l1 > l2;
+	}
+
+	@FunctionMethod(GREATER)
+	public Boolean greater(Integer f1, Float f2) {
+		return f1 > f2;
+	}
+
+	@FunctionMethod(GREATER)
+	public Boolean greater(Integer i1, Double d1) {
+		return i1 > d1;
+	}
+
+	@FunctionMethod(GREATER)
+	public Boolean greater(Integer i1, Long l1) {
+		return i1 > l1;
+	}
+
+	@FunctionMethod(GREATER)
+	public Boolean greater(Float f1, Integer i1) {
+		return f1 > i1;
+	}
+
+	@FunctionMethod(GREATER)
+	public Boolean greater(Float f1, Double d2) {
+		return f1 > d2;
+	}
+
+	@FunctionMethod(GREATER)
+	public Boolean greater(Double d1, Integer i1) {
+		return d1 > i1;
+	}
+
+	@FunctionMethod(GREATER)
+	public Boolean greater(Double d1, Float i1) {
+		return d1 > i1;
+	}
+
+	@FunctionMethod(GREATER)
+	public Boolean greater(Double d1, Long i1) {
+		return d1 > i1;
+	}
+
+	@FunctionMethod(GREATER)
+	public Boolean greater(Long l1, Integer i1) {
+		return l1 > i1;
+	}
+
+	@FunctionMethod(SMALLER)
+	public Boolean smaller(Integer i1, Integer i2) {
+		return i1 < i2;
+	}
+
+	@FunctionMethod(SMALLER)
+	public Boolean smaller(Float f1, Float f2) {
+		return f1 < f2;
+	}
+
+	@FunctionMethod(SMALLER)
+	public Boolean smaller(Double d1, Double d2) {
+		return d1 < d2;
+	}
+
+	@FunctionMethod(SMALLER)
+	public Boolean smaller(Long l1, Long l2) {
+		return l1 < l2;
+	}
+
+	@FunctionMethod(SMALLER)
+	public Boolean smaller(Integer f1, Float f2) {
+		return f1 < f2;
+	}
+
+	@FunctionMethod(SMALLER)
+	public Boolean smaller(Integer i1, Double d1) {
+		return i1 < d1;
+	}
+
+	@FunctionMethod(SMALLER)
+	public Boolean smaller(Integer i1, Long l1) {
+		return i1 < l1;
+	}
+
+	@FunctionMethod(SMALLER)
+	public Boolean smaller(Float f1, Integer i1) {
+		return f1 < i1;
+	}
+
+	@FunctionMethod(SMALLER)
+	public Boolean smaller(Float f1, Double d2) {
+		return f1 < d2;
+	}
+
+	@FunctionMethod(SMALLER)
+	public Boolean smaller(Double d1, Integer i1) {
+		return d1 < i1;
+	}
+
+	@FunctionMethod(SMALLER)
+	public Boolean smaller(Double d1, Float i1) {
+		return d1 < i1;
+	}
+
+	@FunctionMethod(SMALLER)
+	public Boolean smaller(Double d1, Long i1) {
+		return d1 < i1;
+	}
+
+	@FunctionMethod(SMALLER)
+	public Boolean smaller(Long l1, Integer i1) {
+		return l1 < i1;
+	}
+
+	@FunctionMethod(NOT)
+	public Boolean not(Boolean b) {
+		return !b;
+	}
+
+	@FunctionMethod(BIT_COMPLEMENT)
+	public Integer complement(Integer i) {
+		return ~i;
+	}
+}

+ 229 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/DefaultExecutionFlowInterpreter.xtend

@@ -0,0 +1,229 @@
+/**
+ * Copyright (c) 2013 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter
+
+import com.google.inject.Inject
+import java.util.List
+import java.util.Map
+import org.eclipse.emf.ecore.util.EcoreUtil
+import org.yakindu.sct.model.sexec.Call
+import org.yakindu.sct.model.sexec.Check
+import org.yakindu.sct.model.sexec.EnterState
+import org.yakindu.sct.model.sexec.Execution
+import org.yakindu.sct.model.sexec.ExecutionFlow
+import org.yakindu.sct.model.sexec.ExecutionState
+import org.yakindu.sct.model.sexec.ExitState
+import org.yakindu.sct.model.sexec.HistoryEntry
+import org.yakindu.sct.model.sexec.If
+import org.yakindu.sct.model.sexec.SaveHistory
+import org.yakindu.sct.model.sexec.ScheduleTimeEvent
+import org.yakindu.sct.model.sexec.Sequence
+import org.yakindu.sct.model.sexec.StateSwitch
+import org.yakindu.sct.model.sexec.Step
+import org.yakindu.sct.model.sexec.Trace
+import org.yakindu.sct.model.sexec.UnscheduleTimeEvent
+import org.yakindu.sct.model.sexec.transformation.SexecExtensions
+import org.yakindu.sct.model.sgraph.RegularState
+import org.yakindu.sct.simulation.core.sruntime.EventDirection
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+class DefaultExecutionFlowInterpreter implements IExecutionFlowInterpreter {
+
+	@Inject
+	IStatementInterpreter statementInterpreter
+	@Inject
+	ITimingService timingService
+	@Inject extension SexecExtensions
+	@Inject(optional = true)
+	ITraceStepInterpreter traceInterpreter
+
+	ExecutionFlow flow
+	ExecutionContext executionContext
+	ExecutionState[] activeStateConfiguration
+	Map<Integer, ExecutionState> historyStateConfiguration
+	List<Step> executionStack
+	int activeStateIndex
+
+	boolean suspended = false
+
+	override initialize(ExecutionFlow flow, ExecutionContext context) {
+		this.flow = flow
+		executionContext = context
+		executionStack = newLinkedList()
+		activeStateConfiguration = newArrayOfSize(flow.stateVector.size)
+		activeStateIndex = 0
+		historyStateConfiguration = newHashMap()
+		if(!executionContext.snapshot)
+			flow.initSequence.scheduleAndRun
+	}
+
+	override enter() {
+		if(!executionContext.snapshot)
+			flow.enterSequences?.defaultSequence?.scheduleAndRun
+		else{
+			executionContext.activeStates.forEach[state | activeStateConfiguration.set(state.toExecutionState.stateVector.offset, state.toExecutionState)]
+		}
+	}
+	
+	def ExecutionState toExecutionState(RegularState state){
+		return flow.eAllContents.filter[it instanceof ExecutionState && EcoreUtil::equals((it as ExecutionState).sourceElement,state)].head as ExecutionState
+	}
+
+	override runCycle() {
+		//Raise all schedules events
+		executionContext.events.filter[scheduled].forEach[raised = true scheduled = false]
+		activeStateIndex = 0
+		executionContext.executedElements.clear
+		//Clear all out events
+		executionContext.events.filter[direction == EventDirection.OUT].forEach[raised = false]
+		while (activeStateIndex < activeStateConfiguration.size) {
+			var state = activeStateConfiguration.get(activeStateIndex)
+			state?.reactSequence?.scheduleAndRun
+			activeStateIndex = activeStateIndex + 1
+		}
+		//clear all local and in events
+		executionContext.events.filter[direction == EventDirection.IN || direction == EventDirection.LOCAL].forEach[
+			raised = false]
+	}
+
+	override resume() {
+		executionContext.suspendedElements.clear
+		suspended = false
+		run
+	}
+
+	override suspend() {
+		suspended = true
+	}
+
+	override exit() {
+		flow.exitSequence.scheduleAndRun
+	}
+
+	override tearDown() {
+		timingService.stop
+	}
+
+	def scheduleAndRun(Step step) {
+		schedule(step)
+		run
+	}
+
+	def run() {
+		while (!executionStack.empty && !suspended) {
+			var head = executionStack.head
+			executionStack.remove(head)
+			head.execute
+		}
+	}
+
+	def schedule(Step step) {
+		executionStack.add(0, step)
+	}
+
+	def dispatch Object execute(Call call) {
+		call.step.schedule
+		null
+	}
+
+	def dispatch Object execute(Step step) {
+	}
+
+	def dispatch Object execute(Trace trace) {
+		traceInterpreter?.evaluate(trace, executionContext)
+		null
+	}
+	
+	
+	def dispatch Object execute(Check check) {
+		if (check.condition == null)
+			return true
+		return statementInterpreter.evaluateStatement(check.condition, executionContext)
+
+	}
+
+	def dispatch Object execute(EnterState enterState) {
+		activeStateConfiguration.set(enterState.state.stateVector.offset, enterState.state)
+		executionContext.activeStates += enterState.state.sourceElement as RegularState
+		activeStateIndex = enterState.state.stateVector.offset // mark all state vector elements up to this as processed ...		
+		null
+	}
+
+	def dispatch Object execute(Execution execution) {
+		statementInterpreter.evaluateStatement(execution.statement, executionContext)
+	}
+
+	def dispatch Object execute(ExitState exitState) {
+		activeStateConfiguration.set(exitState.state.stateVector.offset, null)
+		var activeStates = executionContext.activeStates.filter[EcoreUtil::equals(it,exitState.state.sourceElement)]
+		executionContext.activeStates.removeAll(activeStates)
+		null
+	}
+
+	def dispatch Object execute(If ifStep) {
+		var check = execute(ifStep.check)
+		if (check as Boolean) {
+			ifStep.thenStep.schedule
+		} else if (ifStep.elseStep != null) {
+			ifStep.elseStep.schedule
+		}
+		null
+	}
+
+	def dispatch Object execute(Sequence sequence) {
+		sequence.steps.reverseView.forEach[schedule]
+		null
+	}
+
+	def dispatch Object execute(SaveHistory action) {
+		var region = action.region
+		historyStateConfiguration.put(region.historyVector.offset,
+			activeStateConfiguration.get(region.stateVector.offset))
+	}
+
+	def dispatch Object execute(HistoryEntry entry) {
+		if (historyStateConfiguration.get(entry.region) != null) {
+			entry.historyStep?.execute
+		} else {
+			entry.initialStep?.execute
+		}
+		null
+	}
+
+	def dispatch Object execute(StateSwitch stateSwitch) {
+		val historyRegion = stateSwitch.historyRegion
+		if (historyRegion != null) {
+			val historyState = historyStateConfiguration.get(historyRegion)
+			stateSwitch.cases.filter[it.state == historyState].forEach[step.schedule]
+		} else {
+			stateSwitch.cases.filter[activeStateConfiguration.contains(state)].forEach[step.schedule]
+		}
+		null
+	}
+
+	def dispatch Object execute(ScheduleTimeEvent scheduleTimeEvent) {
+		var timeEvent = scheduleTimeEvent.timeEvent
+		var duration = statementInterpreter.evaluateStatement(scheduleTimeEvent.timeValue, executionContext)
+		timingService.scheduleTimeEvent(executionContext, timeEvent.name, timeEvent.periodic, duration as Integer)
+		null
+	}
+
+	def dispatch Object execute(UnscheduleTimeEvent timeEvent) {
+		timingService.unscheduleTimeEvent(timeEvent.timeEvent.name)
+		null
+	}
+
+}

+ 84 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/DefaultTimingService.java

@@ -0,0 +1,84 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+
+/**
+ * Implementation of {@link ITimingService} interface using standard
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class DefaultTimingService implements ITimingService {
+
+	private Timer timer;
+
+	private Map<String, TimerTask> timerTasks;
+
+	public DefaultTimingService() {
+		timer = new Timer();
+		timerTasks = new HashMap<String, TimerTask>();
+	}
+
+	public void scheduleTimeEvent(ExecutionContext context, String eventName, boolean isPeriodical, int duration) {
+		TimeEventTask timeEventTask = new TimeEventTask(context, eventName);
+		timerTasks.put(eventName, timeEventTask);
+		if (isPeriodical) {
+			timer.scheduleAtFixedRate(timeEventTask, duration, duration);
+		} else {
+			timer.schedule(timeEventTask, duration);
+		}
+	}
+
+	public void unscheduleTimeEvent(String eventName) {
+		TimerTask timerTask = timerTasks.get(eventName);
+		timerTask.cancel();
+	}
+
+	public class TimeEventTask extends TimerTask {
+
+		private final ExecutionContext context;
+		private final String eventName;
+
+		public TimeEventTask(ExecutionContext context, String eventName) {
+			this.context = context;
+			this.eventName = eventName;
+		}
+
+		public void run() {
+			context.getEvent(eventName).setScheduled(true);
+		}
+	}
+
+	public void pause() {
+		throw new RuntimeException("Implement me");
+	}
+
+	public void resume() {
+		throw new RuntimeException("Implement me");
+	}
+
+	public void stop() {
+		Collection<TimerTask> values = timerTasks.values();
+		for (TimerTask timerTask : values) {
+			timerTask.cancel();
+		}
+		timer.cancel();
+	}
+
+}

+ 15 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/DefaultTraceStepInterpreter.java

@@ -0,0 +1,15 @@
+package org.yakindu.sct.simulation.core.sexec.interpreter;
+
+import org.yakindu.sct.model.sexec.ReactionFired;
+import org.yakindu.sct.model.sexec.Trace;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+
+public class DefaultTraceStepInterpreter implements ITraceStepInterpreter {
+
+	@Override
+	public void evaluate(Trace trace, ExecutionContext context) {
+		if (trace instanceof ReactionFired) {
+			context.getExecutedElements().add(((ReactionFired) trace).getReaction().getSourceElement());
+		}
+	}
+}

+ 224 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/Function.java

@@ -0,0 +1,224 @@
+/**
+ * Copyright (c) 2010 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.yakindu.sct.model.stext.types.ISTextTypeSystem;
+
+import com.google.inject.Inject;
+
+/**
+ * 
+ * @author axel terfloth
+ * @author andreas muelder
+ * 
+ */
+public class Function {
+
+	@Inject ISTextTypeSystem typeSystem;
+	
+	/**
+	 * Indicates that a method is a function.
+	 * 
+	 * @author terfloth@itemis.de
+	 */
+	@Documented
+	@Retention(RetentionPolicy.RUNTIME)
+	@Target(ElementType.METHOD)
+	public @interface FunctionMethod {
+		String value();
+	}
+
+	/**
+	 * Sorts a {@link Collection} of {@link Method} . The most specialized
+	 * parameter types are put first.
+	 * 
+	 * @author muelder
+	 * 
+	 */
+	public static class PolymorphicComparator implements Comparator<Method> {
+
+		public int compare(Method method1, Method method2) {
+			Class<?>[] parameterTypes1 = method1.getParameterTypes();
+			Class<?>[] parameterTypes2 = method2.getParameterTypes();
+
+			if (parameterTypes1.length != parameterTypes2.length)
+				return -1;
+
+			for (int i = 0; i < parameterTypes1.length; i++) {
+				final Class<?> class1 = parameterTypes1[i];
+				final Class<?> class2 = parameterTypes2[i];
+				if (class1.equals(class2))
+					continue;
+				if (class1.isAssignableFrom(class2)
+						|| Void.class.equals(class2)) {
+					return 1;
+				}
+				if (class2.isAssignableFrom(class1)
+						|| Void.class.equals(class1)) {
+					return -1;
+				}
+			}
+			return 0;
+		}
+	}
+
+	protected Method functionMethod;
+
+	/**
+	 * Looks up the appropriate function for the given parameter types. This
+	 * lookup currently does not perform a polymophic lookup.
+	 * 
+	 * @param name
+	 * @param paramTypes
+	 * @return
+	 */
+	public Function lookup(Class<?> functionClass, String name,
+			Class<?>... paramTypes) {
+
+		List<Method> functionMethods = new ArrayList<Method>();
+		addFunctionMethods(functionClass, functionMethods);
+		Collections.sort(functionMethods, new PolymorphicComparator());
+		for (Method fMethod : functionMethods) {
+			FunctionMethod fAnno = fMethod.getAnnotation(FunctionMethod.class);
+			if ((name.equals(fMethod.getName())) || name.equals(fAnno.value())) {
+				if (isCallable(paramTypes, fMethod.getParameterTypes())) {
+					return createFunction(functionClass, fMethod);
+				}
+			}
+		}
+		return null;
+	}
+
+	private void addFunctionMethods(Class<?> functionClass,
+			List<Method> methodList) {
+		List<Method> result = new ArrayList<Method>();
+		Method[] methods = functionClass.getDeclaredMethods();
+		for (int i = 0; i < methods.length; i++) {
+			Method fMethod = methods[i];
+			FunctionMethod fAnno = fMethod.getAnnotation(FunctionMethod.class);
+			if (fAnno != null) {
+				result.add(fMethod);
+			}
+		}
+		methodList.addAll(result);
+		if (functionClass.getSuperclass() != null) {
+			addFunctionMethods(functionClass.getSuperclass(), methodList);
+		}
+	}
+
+	private static boolean isCallable(Class<?>[] paramTypes,
+			Class<?>[] parameterTypes) {
+		if (paramTypes.length != parameterTypes.length)
+			return false;
+		for (int i = 0; i < paramTypes.length; i++) {
+			Class<?> class1 = paramTypes[i];
+			Class<?> class2 = parameterTypes[i];
+			if (!class2.isAssignableFrom(class1))
+				return false;
+		}
+		return true;
+
+	}
+
+	public Function lookup(Class<?> functionClass, String name,
+			Object... params) {
+		Class<?>[] paramTypes = toParamTypes(params);
+		return lookup(functionClass, name, paramTypes);
+	}
+
+	protected Class<?>[] toParamTypes(Object... params) {
+		Class<?>[] paramTypes = new Class<?>[params.length];
+		for (int i = 0; i < params.length; i++) {
+			if (params[i] == null)
+				continue;
+			if(params[i] instanceof EObject){
+				paramTypes[i] = EObject.class; // enumerators and complex types
+			}
+			else {
+				paramTypes[i] = params[i].getClass(); // primitive values (boxed java types)
+			}
+			
+		}
+		return paramTypes;
+	}
+
+	protected static Function createFunction(Class<?> functionClass,
+			Method functionMethod) {
+
+		if (functionClass == null || functionMethod == null)
+			return null;
+
+		try {
+			Constructor<?> constr;
+			try {
+				constr = (Constructor<?>) functionClass
+						.getConstructor(new Class<?>[0]);
+			} catch (NoSuchMethodException e) {
+				throw new RuntimeException(
+						"Missing default constructor in class "
+								+ functionClass.getName()
+								+ " while loading function "
+								+ functionMethod.getName() + " !");
+			}
+
+			Function func = (Function) constr.newInstance(new Object[0]);
+			func.setFunctionMethod(functionMethod);
+			return func;
+
+		} catch (RuntimeException e) {
+			throw e;
+		} catch (Exception e) {
+			throw new RuntimeException("Error loading function "
+					+ functionMethod.getName() + " from function class "
+					+ functionClass.getName() + " !", e);
+		}
+	}
+
+	public Function() {
+		super();
+	}
+
+	public Method getFunctionMethod() {
+		return functionMethod;
+	}
+
+	public void setFunctionMethod(Method functionMethod) {
+		this.functionMethod = functionMethod;
+	}
+
+	public Object execute(Object[] params) {
+		try {
+			return getFunctionMethod().invoke(this, params);
+		} catch (IllegalArgumentException e) {
+			throw new RuntimeException(e);
+		} catch (IllegalAccessException e) {
+			throw new RuntimeException(e);
+		} catch (InvocationTargetException e) {
+			throw new RuntimeException(e.getCause());
+		}
+	}
+
+}

+ 37 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/IExecutionFlowInterpreter.java

@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter;
+
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public interface IExecutionFlowInterpreter {
+
+	public void initialize(final ExecutionFlow flow, final ExecutionContext context);
+
+	public void tearDown();
+
+	public void enter();
+
+ 	public void runCycle();
+
+ 	public void suspend();
+ 	
+ 	public void resume();
+
+ 	public void exit();
+ 	
+}

+ 39 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/IOperationMockup.java

@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2013 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter;
+
+import org.yakindu.base.types.Operation;
+import org.yakindu.sct.model.stext.stext.OperationDefinition;
+
+/**
+ * Called during simulation when an {@link Operation} is executed. Allows to
+ * implement Mockups for operation calls.
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public interface IOperationMockup {
+	/**
+	 * Called before an operation is executed
+	 * 
+	 * @return true if the implementation provides a mockup for the given
+	 *         definition, false otherwise
+	 */
+	public boolean canExecute(OperationDefinition definition, Object... parameter);
+
+	/**
+	 * Called when the operation is executed
+	 * 
+	 * @return the operations return value, maybe null
+	 */
+	public Object execute(OperationDefinition definition, Object... parameter);
+
+}

+ 25 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/IStatementInterpreter.java

@@ -0,0 +1,25 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter;
+
+import org.yakindu.sct.model.sgraph.Statement;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public interface IStatementInterpreter {
+	
+	public Object evaluateStatement(Statement statement, ExecutionContext context);
+
+}

+ 49 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/ITimingService.java

@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter;
+
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public interface ITimingService {
+
+	/**
+	 * schedules a new TimeEvent with the given name into the given context.
+	 * TimeEvents can be scheduled as periodical with a duration in ms.
+	 * 
+	 */
+	public void scheduleTimeEvent(ExecutionContext context, String eventName, boolean periodical, int duration);
+
+	/**
+	 * unschedules a scheduled TimeEvent
+	 */
+	public void unscheduleTimeEvent(String eventName);
+
+	/**
+	 * pauses all TimeEvent
+	 */
+	public void pause();
+
+	/**
+	 * resumes the TimeEvents
+	 */
+	public void resume();
+
+	/**
+	 * Stops all TimeEvent
+	 */
+	public void stop();
+
+}

+ 25 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/ITraceStepInterpreter.java

@@ -0,0 +1,25 @@
+/**
+ * Copyright (c) 2013 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter;
+
+import org.yakindu.sct.model.sexec.Trace;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public interface ITraceStepInterpreter {
+
+	public void evaluate(Trace trace, ExecutionContext context);
+
+}

+ 88 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/JavaOperationMockup.java

@@ -0,0 +1,88 @@
+/**
+ * Copyright (c) 2013 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.emf.common.util.WrappedException;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.xtext.util.PolymorphicDispatcher;
+import org.yakindu.sct.commons.WorkspaceClassLoaderFactory;
+import org.yakindu.sct.model.stext.stext.OperationDefinition;
+import org.yakindu.sct.simulation.core.sexec.launch.ISCTLaunchParameters;
+
+import com.google.common.collect.Lists;
+import com.google.inject.Inject;
+
+/**
+ * Implementation of {@link IOperationMockup} interface that delegates simulator
+ * operation calls to Java classes. These classes can be specified in the run
+ * configuration tab.
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class JavaOperationMockup implements IOperationMockup {
+
+	@Inject
+	private ILaunch launch;
+	
+	private List<Object> callbacks;
+
+	private void initOperationCallbacks() {
+		callbacks = Lists.newArrayList();
+		IFile file = WorkspaceSynchronizer.getFile(((EObject) launch.getAdapter(EObject.class)).eResource());
+		ClassLoader classLoader = new WorkspaceClassLoaderFactory().createClassLoader(file.getProject(), getClass()
+				.getClassLoader());
+		ILaunchConfiguration config = launch.getLaunchConfiguration();
+		try {
+			String classes = config.getAttribute(ISCTLaunchParameters.OPERATION_CLASS, "");
+			String[] split = classes.split(",");
+			if (split.length > 0)
+				for (String string : split) {
+					string = string.trim();
+					if (string.length() == 0)
+						continue;
+					Class<?> loadClass = classLoader.loadClass(string);
+					callbacks.add(loadClass.newInstance());
+				}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	@Override
+	public boolean canExecute(OperationDefinition definition, Object... parameter) {
+		if (callbacks == null)
+			initOperationCallbacks();
+		// TODO: Check if there is a operation in the callbacks for the given
+		// signature
+		return callbacks.size() > 0;
+	}
+
+	public Object execute(OperationDefinition definition, Object... parameter) {
+		PolymorphicDispatcher<Object> dispatcher = new PolymorphicDispatcher<Object>(definition.getName(), definition
+				.getParameters().size(), definition.getParameters().size(), callbacks);
+		try {
+			return dispatcher.invoke(parameter);
+		} catch (WrappedException e) {
+			throw e;
+		} catch (Exception ex) {
+			throw new WrappedException("Error during invocation of operation '" + definition.getName()
+					+ "' with params " + definition.getParameters() + " '", ex);
+		}
+	}
+
+}

+ 73 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/Signature.java

@@ -0,0 +1,73 @@
+/**
+ * Copyright (c) 2012 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter;
+
+import java.util.Arrays;
+
+
+/**
+ * This class represents a function signature consisting of the function name and the parameter types.
+ * Instances are used as keys for function mappings.
+ * 
+ * @author axel terfloth 
+ */
+public class Signature {
+	
+	protected String name;
+	protected Class<?>[] paramTypes;
+
+	public Signature(String name, Class<?>[] paramTypes) {
+		super();
+		this.name = name;
+		this.paramTypes = paramTypes;
+	}
+
+	
+	public String getName() {
+		return name;
+	}
+
+	public Class<?>[] getParamTypes() {
+		return paramTypes;
+	}
+
+	
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((name == null) ? 0 : name.hashCode());
+		result = prime * result + Arrays.hashCode(paramTypes);
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		Signature other = (Signature) obj;
+		if (name == null) {
+			if (other.name != null)
+				return false;
+		} else if (!name.equals(other.name))
+			return false;
+		if (!Arrays.equals(paramTypes, other.paramTypes))
+			return false;
+		return true;
+	}
+	
+	
+
+}

+ 278 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/StextStatementInterpreter.xtend

@@ -0,0 +1,278 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter
+
+import com.google.inject.Inject
+import org.eclipse.emf.ecore.EObject
+import org.eclipse.xtext.naming.IQualifiedNameProvider
+import org.eclipse.xtext.util.SimpleAttributeResolver
+import org.yakindu.base.types.Enumerator
+import org.yakindu.sct.model.sgraph.Statement
+import org.yakindu.sct.model.stext.stext.ActiveStateReferenceExpression
+import org.yakindu.sct.model.stext.stext.AssignmentExpression
+import org.yakindu.sct.model.stext.stext.AssignmentOperator
+import org.yakindu.sct.model.stext.stext.BitwiseAndExpression
+import org.yakindu.sct.model.stext.stext.BitwiseOrExpression
+import org.yakindu.sct.model.stext.stext.BitwiseXorExpression
+import org.yakindu.sct.model.stext.stext.BoolLiteral
+import org.yakindu.sct.model.stext.stext.ConditionalExpression
+import org.yakindu.sct.model.stext.stext.ElementReferenceExpression
+import org.yakindu.sct.model.stext.stext.EventDefinition
+import org.yakindu.sct.model.stext.stext.EventRaisingExpression
+import org.yakindu.sct.model.stext.stext.EventValueReferenceExpression
+import org.yakindu.sct.model.stext.stext.FeatureCall
+import org.yakindu.sct.model.stext.stext.HexLiteral
+import org.yakindu.sct.model.stext.stext.IntLiteral
+import org.yakindu.sct.model.stext.stext.LogicalAndExpression
+import org.yakindu.sct.model.stext.stext.LogicalNotExpression
+import org.yakindu.sct.model.stext.stext.LogicalOrExpression
+import org.yakindu.sct.model.stext.stext.LogicalRelationExpression
+import org.yakindu.sct.model.stext.stext.NumericalAddSubtractExpression
+import org.yakindu.sct.model.stext.stext.NumericalMultiplyDivideExpression
+import org.yakindu.sct.model.stext.stext.NumericalUnaryExpression
+import org.yakindu.sct.model.stext.stext.OperationDefinition
+import org.yakindu.sct.model.stext.stext.ParenthesizedExpression
+import org.yakindu.sct.model.stext.stext.PrimitiveValueExpression
+import org.yakindu.sct.model.stext.stext.RealLiteral
+import org.yakindu.sct.model.stext.stext.ShiftExpression
+import org.yakindu.sct.model.stext.stext.StringLiteral
+import org.yakindu.sct.model.stext.stext.VariableDefinition
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API 
+ * @authos axel terfloth - additions
+ * 
+ */
+class StextStatementInterpreter extends AbstractStatementInterpreter {
+
+	@Inject
+	extension IQualifiedNameProvider provider
+	@Inject
+	IOperationMockup operationDelegate
+
+	protected ExecutionContext context
+
+	override Object evaluateStatement(Statement statement, ExecutionContext context) {
+		this.context = context
+		statement.execute()
+	}
+
+	def dispatch Object execute(Statement statement) {
+		null
+	}
+
+	def dispatch Object execute(AssignmentExpression assignment) {
+		var scopeVariable = context.getVariable(assignment.varRef.variable.getFullyQualifiedName.toString)
+		var result = assignment.expression.execute
+		if (assignment.operator == AssignmentOperator::ASSIGN) {
+			context.getVariable(scopeVariable.getName).value = result
+		} else {
+			var operator = AbstractStatementInterpreter::assignFunctionMap.get(assignment.operator.getName())
+			context.getVariable(scopeVariable.name).value = evaluate(operator, scopeVariable.getValue, result)
+		}
+		context.getVariable(scopeVariable.name).value
+	}
+
+	def dispatch EObject variable(ElementReferenceExpression e) {
+		if(e.reference instanceof VariableDefinition) e.reference else null
+	}
+
+	def dispatch EObject variable(FeatureCall e) {
+		if(e.feature instanceof VariableDefinition) e.feature else null
+	}
+
+	def dispatch EObject variable(AssignmentExpression e) {
+		return e.varRef.variable as EObject
+	}
+
+	def dispatch event(ElementReferenceExpression e) {
+		if(e.reference instanceof EventDefinition) e.reference else null
+	}
+
+	def dispatch event(FeatureCall e) {
+		if(e.feature instanceof EventDefinition) e.feature else null
+	}
+
+	def dispatch Object execute(EventRaisingExpression eventRaising) {
+		var event = context.getEvent(eventRaising.event.event.getFullyQualifiedName.toString)
+		if (eventRaising.value != null) {
+			event.value = eventRaising.value.execute
+		}
+		event.raised = true
+		null
+	}
+
+	def dispatch Object execute(ConditionalExpression expression) {
+		if (expression.condition.execute as Boolean) {
+			return expression.trueCase.execute
+		} else {
+			return expression.falseCase.execute
+		}
+	}
+
+	def dispatch Object execute(ElementReferenceExpression expression) {
+		var parameter = expression.args.map(it|execute)
+		if (expression.operationCall) {
+			if (operationDelegate.canExecute(expression.reference as OperationDefinition, parameter.toArray)) {
+				return operationDelegate.execute((expression.reference as OperationDefinition),
+					parameter.toArray)
+			}
+		}
+
+		var variableRef = context.getVariable(expression.reference.getFullyQualifiedName.toString)
+		if (variableRef != null) {
+			return variableRef.getValue
+		}
+		return context.getEvent(expression.reference.getFullyQualifiedName.toString).raised
+	}
+
+	def dispatch Object execute(EventValueReferenceExpression expression) {
+		for (event : context.raisedEvents) {
+			if (event.getName.equals(expression.value.qname)) {
+				return event.getValue;
+			};
+		}
+		null;
+	}
+
+	def name(EObject e) {
+		return SimpleAttributeResolver::NAME_RESOLVER.apply(e)
+	}
+
+	def dispatch qname(FeatureCall e) {
+		return e.feature.getFullyQualifiedName.toString
+	}
+
+	def dispatch qname(ElementReferenceExpression e) {
+		e.reference.getFullyQualifiedName.toString
+	}
+
+	def dispatch Object execute(ActiveStateReferenceExpression expression) {
+		return context.allActiveStates.contains(expression.value)
+	}
+
+	def dispatch Object execute(LogicalAndExpression expression) {
+		var leftResult = execute(expression.leftOperand)
+		if (!leftResult as Boolean)
+			return false
+		var rightResult = execute(expression.rightOperand)
+		return leftResult as Boolean && rightResult as Boolean
+	}
+
+	def dispatch Object execute(LogicalOrExpression expression) {
+		var leftResult = execute(expression.leftOperand)
+		if (leftResult as Boolean)
+			return true
+		var rightResult = execute(expression.rightOperand)
+		return leftResult as Boolean || rightResult as Boolean
+	}
+
+	def dispatch Object execute(LogicalNotExpression expression) {
+		return ! (expression.operand.execute() as Boolean)
+	}
+
+	def dispatch Object execute(BitwiseAndExpression expression) {
+		executeBinaryCoreFunction(expression.leftOperand, expression.rightOperand, CoreFunction::BIT_AND)
+	}
+
+	def dispatch Object execute(BitwiseOrExpression expression) {
+		executeBinaryCoreFunction(expression.leftOperand, expression.rightOperand, CoreFunction::BIT_OR)
+	}
+
+	def dispatch Object execute(BitwiseXorExpression expression) {
+		executeBinaryCoreFunction(expression.leftOperand, expression.rightOperand, CoreFunction::BIT_XOR)
+	}
+
+	def dispatch Object execute(LogicalRelationExpression expression) {
+		executeBinaryCoreFunction(expression.leftOperand, expression.rightOperand, expression.operator.getName())
+	}
+
+	def dispatch Object execute(NumericalAddSubtractExpression expression) {
+		executeBinaryCoreFunction(expression.leftOperand, expression.rightOperand, expression.operator.literal)
+	}
+
+	def dispatch Object execute(NumericalMultiplyDivideExpression expression) {
+		executeBinaryCoreFunction(expression.leftOperand, expression.rightOperand, expression.operator.getName())
+	}
+
+	def dispatch Object execute(ShiftExpression expression) {
+		executeBinaryCoreFunction(expression.leftOperand, expression.rightOperand, expression.operator.getName())
+	}
+
+	def dispatch Object execute(NumericalUnaryExpression expression) {
+		executeUnaryCoreFunction(expression.operand, expression.operator.getName())
+	}
+
+	def executeBinaryCoreFunction(Statement leftStatement, Statement rightStatement, String operator) {
+		var leftResult = leftStatement.execute()
+		var rightResult = rightStatement.execute()
+		return evaluate(operator, leftResult, rightResult)
+	}
+
+	def executeUnaryCoreFunction(Statement statement, String operator) {
+		var result = statement.execute()
+		return evaluate(operator, result);
+	}
+
+	def dispatch Object execute(FeatureCall call) {
+		if (call.operationCall) {
+			var parameter = call.args.map(it|execute)
+			var operation = call.feature as OperationDefinition
+			if (operationDelegate.canExecute(operation, parameter)) {
+				return operationDelegate.execute(operation, parameter)
+			}
+		} else if (call.getFeature() instanceof Enumerator) {
+			return call.getFeature();
+		} else {
+			var fqn = call.feature.fqn
+			var variableRef = context.getVariable(fqn)
+			if (variableRef != null) {
+				return variableRef.getValue
+			}
+			return context.getEvent(fqn).raised
+		}
+	}
+
+	def String fqn(EObject obj) {
+		obj.getFullyQualifiedName.toString
+	}
+
+	def dispatch Object execute(ParenthesizedExpression e) {
+		e.expression.execute()
+	}
+
+	def dispatch Object execute(PrimitiveValueExpression expression) {
+		return expression.value.valueLiteral
+	}
+
+	def dispatch valueLiteral(IntLiteral literal) {
+		return literal.value
+	}
+
+	def dispatch valueLiteral(HexLiteral literal) {
+		return literal.value
+	}
+
+	def dispatch valueLiteral(BoolLiteral bool) {
+		return bool.value
+	}
+
+	def dispatch valueLiteral(RealLiteral literal) {
+		return literal.value
+	}
+
+	def dispatch valueLiteral(StringLiteral literal) {
+		return literal.value
+	}
+
+}

+ 38 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/launch/ISCTLaunchParameters.java

@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.core.sexec.launch;
+
+/**
+ * Attribute constants for the YAKINDU Statechart launch configuration.
+ * 
+ * @author andreas muelder
+ * 
+ */
+public interface ISCTLaunchParameters {
+
+	String FILE_NAME = "filename";
+	String DEFAULT_FILE_NAME = "";
+
+	String CYCLE_PERIOD = "cyclePeriod";
+	int DEFAULT_CYCLE_PERIOD = 200;
+
+	String IS_CYCLE_BASED = "cycleBased";
+	boolean DEFAULT_IS_CYCLE_BASED = true;
+
+	String IS_EVENT_DRIVEN = "eventDriven";
+	boolean DEFAULT_IS_EVENT_DRIVEN = false;
+	
+	String OPERATION_CLASS = "operationClass";
+	String DEFAULT_OPERATION_CLASS = "";
+	
+	String EXECUTION_CONTEXT = "executionContext";
+
+}

+ 56 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/launch/SexecLaunchConfigurationDelegate.java

@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.core.sexec.launch;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.simulation.core.engine.ISimulationEngine;
+import org.yakindu.sct.simulation.core.launch.AbstractSCTLaunchConfigurationDelegate;
+import org.yakindu.sct.simulation.core.sexec.SimulationModule;
+import org.yakindu.sct.simulation.core.sexec.container.ISimulationEngineFactory;
+
+import com.google.inject.Binder;
+import com.google.inject.Guice;
+import com.google.inject.Inject;
+import com.google.inject.Module;
+import com.google.inject.util.Modules;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class SexecLaunchConfigurationDelegate extends AbstractSCTLaunchConfigurationDelegate implements
+		ILaunchConfigurationDelegate {
+
+	@Inject
+	private ISimulationEngineFactory factory;
+
+	@Override
+	protected ISimulationEngine createExecutionContainer(final ILaunch launch, Statechart statechart) {
+		Module module = Modules.override(new SimulationModule()).with(new Module() {
+			@Override
+			public void configure(Binder binder) {
+				binder.bind(ILaunch.class).toInstance(launch);
+			}
+		});
+		Guice.createInjector(module).injectMembers(this);
+		try {
+			return factory.createExecutionContainer(statechart, launch);
+		} catch (CoreException e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+
+}

BIN
plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/model/sexec/interpreter/impl/.ExecutionFlowInterpreter.java._trace


BIN
plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/simulation/core/sexec/container/.DefaultExecutionContextInitializer.java._trace


+ 270 - 0
plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/simulation/core/sexec/container/DefaultExecutionContextInitializer.java

@@ -0,0 +1,270 @@
+/**
+ * Copyright (c) 2013 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.core.sexec.container;
+
+import com.google.inject.Inject;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.xtext.naming.IQualifiedNameProvider;
+import org.eclipse.xtext.naming.QualifiedName;
+import org.eclipse.xtext.xbase.lib.CollectionLiterals;
+import org.eclipse.xtext.xbase.lib.Extension;
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
+import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
+import org.yakindu.base.types.EnumerationType;
+import org.yakindu.base.types.Enumerator;
+import org.yakindu.base.types.ITypeSystem.InferenceResult;
+import org.yakindu.base.types.ITypeSystem.InferredType;
+import org.yakindu.base.types.Type;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sexec.TimeEvent;
+import org.yakindu.sct.model.sgraph.Declaration;
+import org.yakindu.sct.model.sgraph.Scope;
+import org.yakindu.sct.model.stext.stext.Direction;
+import org.yakindu.sct.model.stext.stext.EventDefinition;
+import org.yakindu.sct.model.stext.stext.OperationDefinition;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
+import org.yakindu.sct.model.stext.types.ISTextTypeInferrer;
+import org.yakindu.sct.model.stext.types.ISTextTypeSystem;
+import org.yakindu.sct.simulation.core.sexec.container.IExecutionContextInitializer;
+import org.yakindu.sct.simulation.core.sruntime.EventDirection;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionSlot;
+import org.yakindu.sct.simulation.core.sruntime.impl.ExecutionEventImpl;
+import org.yakindu.sct.simulation.core.sruntime.impl.ExecutionSlotImpl;
+import org.yakindu.sct.simulation.core.sruntime.impl.ExecutionVariableImpl;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ */
+@SuppressWarnings("all")
+public class DefaultExecutionContextInitializer implements IExecutionContextInitializer {
+  @Inject
+  @Extension
+  private IQualifiedNameProvider _iQualifiedNameProvider;
+  
+  @Inject
+  @Extension
+  private ISTextTypeSystem _iSTextTypeSystem;
+  
+  @Inject
+  @Extension
+  private ISTextTypeInferrer _iSTextTypeInferrer;
+  
+  public void initialize(final ExecutionContext context, final ExecutionFlow flow) {
+    EList<Scope> _scopes = flow.getScopes();
+    final Procedure1<Scope> _function = new Procedure1<Scope>() {
+        public void apply(final Scope it) {
+          EList<Declaration> _declarations = it.getDeclarations();
+          final Procedure1<Declaration> _function = new Procedure1<Declaration>() {
+              public void apply(final Declaration it) {
+                List<ExecutionSlot> _slots = context.getSlots();
+                ExecutionSlotImpl _transform = DefaultExecutionContextInitializer.this.transform(it);
+                _slots.add(_transform);
+              }
+            };
+          IterableExtensions.<Declaration>forEach(_declarations, _function);
+        }
+      };
+    IterableExtensions.<Scope>forEach(_scopes, _function);
+  }
+  
+  protected ExecutionSlotImpl _transform(final VariableDefinition variable) {
+    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(variable);
+    final ExecutionVariableImpl _result;
+    synchronized (_createCache_transform) {
+      if (_createCache_transform.containsKey(_cacheKey)) {
+        return _createCache_transform.get(_cacheKey);
+      }
+      ExecutionVariableImpl _executionVariableImpl = new ExecutionVariableImpl();
+      _result = _executionVariableImpl;
+      _createCache_transform.put(_cacheKey, _result);
+    }
+    _init_transform(_result, variable);
+    return _result;
+  }
+  
+  private final HashMap<ArrayList<? extends Object>,ExecutionSlotImpl> _createCache_transform = CollectionLiterals.newHashMap();
+  
+  private void _init_transform(final ExecutionVariableImpl it, final VariableDefinition variable) {
+    QualifiedName qualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(variable);
+    qualifiedName.getSegments();
+    QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(variable);
+    String _string = _fullyQualifiedName.toString();
+    it.setName(_string);
+    InferenceResult _inferType = this._iSTextTypeInferrer.inferType(variable);
+    InferredType _type = _inferType.getType();
+    it.setType(_type);
+    InferredType _type_1 = it.getType();
+    Object _defaultValue = this.defaultValue(_type_1);
+    it.setValue(_defaultValue);
+  }
+  
+  protected ExecutionSlotImpl _transform(final EventDefinition event) {
+    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(event);
+    final ExecutionEventImpl _result;
+    synchronized (_createCache_transform_1) {
+      if (_createCache_transform_1.containsKey(_cacheKey)) {
+        return _createCache_transform_1.get(_cacheKey);
+      }
+      ExecutionEventImpl _executionEventImpl = new ExecutionEventImpl();
+      _result = _executionEventImpl;
+      _createCache_transform_1.put(_cacheKey, _result);
+    }
+    _init_transform_1(_result, event);
+    return _result;
+  }
+  
+  private final HashMap<ArrayList<? extends Object>,ExecutionSlotImpl> _createCache_transform_1 = CollectionLiterals.newHashMap();
+  
+  private void _init_transform_1(final ExecutionEventImpl it, final EventDefinition event) {
+    QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(event);
+    String _string = _fullyQualifiedName.toString();
+    it.setName(_string);
+    InferenceResult _inferType = this._iSTextTypeInferrer.inferType(event);
+    InferredType _type = _inferType.getType();
+    it.setType(_type);
+    InferredType _type_1 = it.getType();
+    Object _defaultValue = this.defaultValue(_type_1);
+    it.setValue(_defaultValue);
+    Direction _direction = event.getDirection();
+    int _value = _direction.getValue();
+    EventDirection _get = EventDirection.get(_value);
+    it.setDirection(_get);
+  }
+  
+  protected ExecutionSlotImpl _transform(final OperationDefinition op) {
+    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(op);
+    final ExecutionVariableImpl _result;
+    synchronized (_createCache_transform_2) {
+      if (_createCache_transform_2.containsKey(_cacheKey)) {
+        return _createCache_transform_2.get(_cacheKey);
+      }
+      ExecutionVariableImpl _executionVariableImpl = new ExecutionVariableImpl();
+      _result = _executionVariableImpl;
+      _createCache_transform_2.put(_cacheKey, _result);
+    }
+    _init_transform_2(_result, op);
+    return _result;
+  }
+  
+  private final HashMap<ArrayList<? extends Object>,ExecutionSlotImpl> _createCache_transform_2 = CollectionLiterals.newHashMap();
+  
+  private void _init_transform_2(final ExecutionVariableImpl it, final OperationDefinition op) {
+    QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(op);
+    String _string = _fullyQualifiedName.toString();
+    it.setName(_string);
+    Type _type = op.getType();
+    InferredType _inferredType = new InferredType(_type);
+    it.setType(_inferredType);
+    InferredType _type_1 = it.getType();
+    Object _defaultValue = this.defaultValue(_type_1);
+    it.setValue(_defaultValue);
+  }
+  
+  protected ExecutionSlotImpl _transform(final TimeEvent event) {
+    final ArrayList<?>_cacheKey = CollectionLiterals.newArrayList(event);
+    final ExecutionEventImpl _result;
+    synchronized (_createCache_transform_3) {
+      if (_createCache_transform_3.containsKey(_cacheKey)) {
+        return _createCache_transform_3.get(_cacheKey);
+      }
+      ExecutionEventImpl _executionEventImpl = new ExecutionEventImpl();
+      _result = _executionEventImpl;
+      _createCache_transform_3.put(_cacheKey, _result);
+    }
+    _init_transform_3(_result, event);
+    return _result;
+  }
+  
+  private final HashMap<ArrayList<? extends Object>,ExecutionSlotImpl> _createCache_transform_3 = CollectionLiterals.newHashMap();
+  
+  private void _init_transform_3(final ExecutionEventImpl it, final TimeEvent event) {
+    QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(event);
+    String _string = _fullyQualifiedName.toString();
+    it.setName(_string);
+    Type _integerType = this._iSTextTypeSystem.getIntegerType();
+    InferredType _inferredType = new InferredType(_integerType);
+    it.setType(_inferredType);
+    InferredType _type = it.getType();
+    Object _defaultValue = this.defaultValue(_type);
+    it.setValue(_defaultValue);
+  }
+  
+  public Object defaultValue(final InferredType type) {
+    Object _switchResult = null;
+    boolean _matched = false;
+    if (!_matched) {
+      boolean _isBooleanType = this._iSTextTypeSystem.isBooleanType(type);
+      if (_isBooleanType) {
+        _matched=true;
+        _switchResult = Boolean.valueOf(true);
+      }
+    }
+    if (!_matched) {
+      boolean _isIntegerType = this._iSTextTypeSystem.isIntegerType(type);
+      if (_isIntegerType) {
+        _matched=true;
+        _switchResult = Integer.valueOf(0);
+      }
+    }
+    if (!_matched) {
+      boolean _isRealType = this._iSTextTypeSystem.isRealType(type);
+      if (_isRealType) {
+        _matched=true;
+        _switchResult = Double.valueOf(0.0);
+      }
+    }
+    if (!_matched) {
+      boolean _isVoidType = this._iSTextTypeSystem.isVoidType(type);
+      if (_isVoidType) {
+        _matched=true;
+        _switchResult = null;
+      }
+    }
+    if (!_matched) {
+      boolean _isStringType = this._iSTextTypeSystem.isStringType(type);
+      if (_isStringType) {
+        _matched=true;
+        _switchResult = "";
+      }
+    }
+    if (!_matched) {
+      if ((type instanceof EnumerationType)) {
+        _matched=true;
+        EList<Enumerator> _enumerator = ((EnumerationType) type).getEnumerator();
+        Enumerator _head = IterableExtensions.<Enumerator>head(_enumerator);
+        _switchResult = _head;
+      }
+    }
+    if (!_matched) {
+      _switchResult = null;
+    }
+    return _switchResult;
+  }
+  
+  public ExecutionSlotImpl transform(final Declaration event) {
+    if (event instanceof TimeEvent) {
+      return _transform((TimeEvent)event);
+    } else if (event instanceof EventDefinition) {
+      return _transform((EventDefinition)event);
+    } else if (event instanceof OperationDefinition) {
+      return _transform((OperationDefinition)event);
+    } else if (event instanceof VariableDefinition) {
+      return _transform((VariableDefinition)event);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(event).toString());
+    }
+  }
+}

BIN
plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/simulation/core/sexec/interpreter/.DefaultExecutionFlowInterpreter.java._trace


BIN
plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/simulation/core/sexec/interpreter/.StextStatementInterpreter.java._trace


+ 566 - 0
plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/simulation/core/sexec/interpreter/DefaultExecutionFlowInterpreter.java

@@ -0,0 +1,566 @@
+/**
+ * Copyright (c) 2013 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter;
+
+import com.google.common.base.Objects;
+import com.google.inject.Inject;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.xtext.xbase.lib.CollectionExtensions;
+import org.eclipse.xtext.xbase.lib.CollectionLiterals;
+import org.eclipse.xtext.xbase.lib.Conversions;
+import org.eclipse.xtext.xbase.lib.Extension;
+import org.eclipse.xtext.xbase.lib.Functions.Function1;
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
+import org.eclipse.xtext.xbase.lib.IteratorExtensions;
+import org.eclipse.xtext.xbase.lib.ListExtensions;
+import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
+import org.yakindu.sct.model.sexec.Call;
+import org.yakindu.sct.model.sexec.Check;
+import org.yakindu.sct.model.sexec.EnterState;
+import org.yakindu.sct.model.sexec.Execution;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sexec.ExecutionRegion;
+import org.yakindu.sct.model.sexec.ExecutionState;
+import org.yakindu.sct.model.sexec.ExitState;
+import org.yakindu.sct.model.sexec.HistoryEntry;
+import org.yakindu.sct.model.sexec.If;
+import org.yakindu.sct.model.sexec.SaveHistory;
+import org.yakindu.sct.model.sexec.ScheduleTimeEvent;
+import org.yakindu.sct.model.sexec.Sequence;
+import org.yakindu.sct.model.sexec.StateCase;
+import org.yakindu.sct.model.sexec.StateSwitch;
+import org.yakindu.sct.model.sexec.StateVector;
+import org.yakindu.sct.model.sexec.Step;
+import org.yakindu.sct.model.sexec.TimeEvent;
+import org.yakindu.sct.model.sexec.Trace;
+import org.yakindu.sct.model.sexec.UnscheduleTimeEvent;
+import org.yakindu.sct.model.sexec.transformation.SexecExtensions;
+import org.yakindu.sct.model.sgraph.RegularState;
+import org.yakindu.sct.model.sgraph.Statement;
+import org.yakindu.sct.simulation.core.sexec.interpreter.IExecutionFlowInterpreter;
+import org.yakindu.sct.simulation.core.sexec.interpreter.IStatementInterpreter;
+import org.yakindu.sct.simulation.core.sexec.interpreter.ITimingService;
+import org.yakindu.sct.simulation.core.sexec.interpreter.ITraceStepInterpreter;
+import org.yakindu.sct.simulation.core.sruntime.EventDirection;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionEvent;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ */
+@SuppressWarnings("all")
+public class DefaultExecutionFlowInterpreter implements IExecutionFlowInterpreter {
+  @Inject
+  private IStatementInterpreter statementInterpreter;
+  
+  @Inject
+  private ITimingService timingService;
+  
+  @Inject
+  @Extension
+  private SexecExtensions _sexecExtensions;
+  
+  @Inject(optional = true)
+  private ITraceStepInterpreter traceInterpreter;
+  
+  private ExecutionFlow flow;
+  
+  private ExecutionContext executionContext;
+  
+  private ExecutionState[] activeStateConfiguration;
+  
+  private Map<Integer,ExecutionState> historyStateConfiguration;
+  
+  private List<Step> executionStack;
+  
+  private int activeStateIndex;
+  
+  private boolean suspended = false;
+  
+  public void initialize(final ExecutionFlow flow, final ExecutionContext context) {
+    this.flow = flow;
+    this.executionContext = context;
+    LinkedList<Step> _newLinkedList = CollectionLiterals.<Step>newLinkedList();
+    this.executionStack = _newLinkedList;
+    StateVector _stateVector = flow.getStateVector();
+    int _size = _stateVector.getSize();
+    ExecutionState[] _newArrayOfSize = new ExecutionState[_size];
+    this.activeStateConfiguration = _newArrayOfSize;
+    this.activeStateIndex = 0;
+    HashMap<Integer,ExecutionState> _newHashMap = CollectionLiterals.<Integer, ExecutionState>newHashMap();
+    this.historyStateConfiguration = _newHashMap;
+    boolean _isSnapshot = this.executionContext.isSnapshot();
+    boolean _not = (!_isSnapshot);
+    if (_not) {
+      Sequence _initSequence = flow.getInitSequence();
+      this.scheduleAndRun(_initSequence);
+    }
+  }
+  
+  public void enter() {
+    boolean _isSnapshot = this.executionContext.isSnapshot();
+    boolean _not = (!_isSnapshot);
+    if (_not) {
+      Sequence _defaultSequence = null;
+      EList<Sequence> _enterSequences = this.flow.getEnterSequences();
+      if (_enterSequences!=null) {
+        _defaultSequence=this._sexecExtensions.defaultSequence(_enterSequences);
+      }
+      if (_defaultSequence!=null) {
+        this.scheduleAndRun(_defaultSequence);
+      }
+    } else {
+      List<RegularState> _activeStates = this.executionContext.getActiveStates();
+      final Procedure1<RegularState> _function = new Procedure1<RegularState>() {
+          public void apply(final RegularState state) {
+            ExecutionState _executionState = DefaultExecutionFlowInterpreter.this.toExecutionState(state);
+            StateVector _stateVector = _executionState.getStateVector();
+            int _offset = _stateVector.getOffset();
+            ExecutionState _executionState_1 = DefaultExecutionFlowInterpreter.this.toExecutionState(state);
+            DefaultExecutionFlowInterpreter.this.activeStateConfiguration[_offset] = _executionState_1;
+          }
+        };
+      IterableExtensions.<RegularState>forEach(_activeStates, _function);
+    }
+  }
+  
+  public ExecutionState toExecutionState(final RegularState state) {
+    TreeIterator<EObject> _eAllContents = this.flow.eAllContents();
+    final Function1<EObject,Boolean> _function = new Function1<EObject,Boolean>() {
+        public Boolean apply(final EObject it) {
+          boolean _and = false;
+          if (!(it instanceof ExecutionState)) {
+            _and = false;
+          } else {
+            EObject _sourceElement = ((ExecutionState) it).getSourceElement();
+            boolean _equals = EcoreUtil.equals(_sourceElement, state);
+            _and = ((it instanceof ExecutionState) && _equals);
+          }
+          return Boolean.valueOf(_and);
+        }
+      };
+    Iterator<EObject> _filter = IteratorExtensions.<EObject>filter(_eAllContents, _function);
+    EObject _head = IteratorExtensions.<EObject>head(_filter);
+    return ((ExecutionState) _head);
+  }
+  
+  public void runCycle() {
+    List<ExecutionEvent> _events = this.executionContext.getEvents();
+    final Function1<ExecutionEvent,Boolean> _function = new Function1<ExecutionEvent,Boolean>() {
+        public Boolean apply(final ExecutionEvent it) {
+          boolean _isScheduled = it.isScheduled();
+          return Boolean.valueOf(_isScheduled);
+        }
+      };
+    Iterable<ExecutionEvent> _filter = IterableExtensions.<ExecutionEvent>filter(_events, _function);
+    final Procedure1<ExecutionEvent> _function_1 = new Procedure1<ExecutionEvent>() {
+        public void apply(final ExecutionEvent it) {
+          it.setRaised(true);
+          it.setScheduled(false);
+        }
+      };
+    IterableExtensions.<ExecutionEvent>forEach(_filter, _function_1);
+    this.activeStateIndex = 0;
+    List<EObject> _executedElements = this.executionContext.getExecutedElements();
+    _executedElements.clear();
+    List<ExecutionEvent> _events_1 = this.executionContext.getEvents();
+    final Function1<ExecutionEvent,Boolean> _function_2 = new Function1<ExecutionEvent,Boolean>() {
+        public Boolean apply(final ExecutionEvent it) {
+          EventDirection _direction = it.getDirection();
+          boolean _equals = Objects.equal(_direction, EventDirection.OUT);
+          return Boolean.valueOf(_equals);
+        }
+      };
+    Iterable<ExecutionEvent> _filter_1 = IterableExtensions.<ExecutionEvent>filter(_events_1, _function_2);
+    final Procedure1<ExecutionEvent> _function_3 = new Procedure1<ExecutionEvent>() {
+        public void apply(final ExecutionEvent it) {
+          it.setRaised(false);
+        }
+      };
+    IterableExtensions.<ExecutionEvent>forEach(_filter_1, _function_3);
+    int _size = ((List<ExecutionState>)Conversions.doWrapArray(this.activeStateConfiguration)).size();
+    boolean _lessThan = (this.activeStateIndex < _size);
+    boolean _while = _lessThan;
+    while (_while) {
+      {
+        ExecutionState state = this.activeStateConfiguration[this.activeStateIndex];
+        Sequence _reactSequence = null;
+        if (state!=null) {
+          _reactSequence=state.getReactSequence();
+        }
+        if (_reactSequence!=null) {
+          this.scheduleAndRun(_reactSequence);
+        }
+        int _plus = (this.activeStateIndex + 1);
+        this.activeStateIndex = _plus;
+      }
+      int _size_1 = ((List<ExecutionState>)Conversions.doWrapArray(this.activeStateConfiguration)).size();
+      boolean _lessThan_1 = (this.activeStateIndex < _size_1);
+      _while = _lessThan_1;
+    }
+    List<ExecutionEvent> _events_2 = this.executionContext.getEvents();
+    final Function1<ExecutionEvent,Boolean> _function_4 = new Function1<ExecutionEvent,Boolean>() {
+        public Boolean apply(final ExecutionEvent it) {
+          boolean _or = false;
+          EventDirection _direction = it.getDirection();
+          boolean _equals = Objects.equal(_direction, EventDirection.IN);
+          if (_equals) {
+            _or = true;
+          } else {
+            EventDirection _direction_1 = it.getDirection();
+            boolean _equals_1 = Objects.equal(_direction_1, EventDirection.LOCAL);
+            _or = (_equals || _equals_1);
+          }
+          return Boolean.valueOf(_or);
+        }
+      };
+    Iterable<ExecutionEvent> _filter_2 = IterableExtensions.<ExecutionEvent>filter(_events_2, _function_4);
+    final Procedure1<ExecutionEvent> _function_5 = new Procedure1<ExecutionEvent>() {
+        public void apply(final ExecutionEvent it) {
+          it.setRaised(false);
+        }
+      };
+    IterableExtensions.<ExecutionEvent>forEach(_filter_2, _function_5);
+  }
+  
+  public void resume() {
+    List<EObject> _suspendedElements = this.executionContext.getSuspendedElements();
+    _suspendedElements.clear();
+    this.suspended = false;
+    this.run();
+  }
+  
+  public void suspend() {
+    this.suspended = true;
+  }
+  
+  public void exit() {
+    Sequence _exitSequence = this.flow.getExitSequence();
+    this.scheduleAndRun(_exitSequence);
+  }
+  
+  public void tearDown() {
+    this.timingService.stop();
+  }
+  
+  public void scheduleAndRun(final Step step) {
+    this.schedule(step);
+    this.run();
+  }
+  
+  public void run() {
+    boolean _and = false;
+    boolean _isEmpty = this.executionStack.isEmpty();
+    boolean _not = (!_isEmpty);
+    if (!_not) {
+      _and = false;
+    } else {
+      boolean _not_1 = (!this.suspended);
+      _and = (_not && _not_1);
+    }
+    boolean _while = _and;
+    while (_while) {
+      {
+        Step head = IterableExtensions.<Step>head(this.executionStack);
+        this.executionStack.remove(head);
+        this.execute(head);
+      }
+      boolean _and_1 = false;
+      boolean _isEmpty_1 = this.executionStack.isEmpty();
+      boolean _not_2 = (!_isEmpty_1);
+      if (!_not_2) {
+        _and_1 = false;
+      } else {
+        boolean _not_3 = (!this.suspended);
+        _and_1 = (_not_2 && _not_3);
+      }
+      _while = _and_1;
+    }
+  }
+  
+  public void schedule(final Step step) {
+    this.executionStack.add(0, step);
+  }
+  
+  protected Object _execute(final Call call) {
+    Object _xblockexpression = null;
+    {
+      Step _step = call.getStep();
+      this.schedule(_step);
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final Step step) {
+    return null;
+  }
+  
+  protected Object _execute(final Trace trace) {
+    Object _xblockexpression = null;
+    {
+      if (this.traceInterpreter!=null) {
+        this.traceInterpreter.evaluate(trace, this.executionContext);
+      }
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final Check check) {
+    Statement _condition = check.getCondition();
+    boolean _equals = Objects.equal(_condition, null);
+    if (_equals) {
+      return Boolean.valueOf(true);
+    }
+    Statement _condition_1 = check.getCondition();
+    return this.statementInterpreter.evaluateStatement(_condition_1, this.executionContext);
+  }
+  
+  protected Object _execute(final EnterState enterState) {
+    Object _xblockexpression = null;
+    {
+      ExecutionState _state = enterState.getState();
+      StateVector _stateVector = _state.getStateVector();
+      int _offset = _stateVector.getOffset();
+      ExecutionState _state_1 = enterState.getState();
+      this.activeStateConfiguration[_offset] = _state_1;
+      List<RegularState> _activeStates = this.executionContext.getActiveStates();
+      ExecutionState _state_2 = enterState.getState();
+      EObject _sourceElement = _state_2.getSourceElement();
+      _activeStates.add(((RegularState) _sourceElement));
+      ExecutionState _state_3 = enterState.getState();
+      StateVector _stateVector_1 = _state_3.getStateVector();
+      int _offset_1 = _stateVector_1.getOffset();
+      this.activeStateIndex = _offset_1;
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final Execution execution) {
+    Statement _statement = execution.getStatement();
+    Object _evaluateStatement = this.statementInterpreter.evaluateStatement(_statement, this.executionContext);
+    return _evaluateStatement;
+  }
+  
+  protected Object _execute(final ExitState exitState) {
+    Object _xblockexpression = null;
+    {
+      ExecutionState _state = exitState.getState();
+      StateVector _stateVector = _state.getStateVector();
+      int _offset = _stateVector.getOffset();
+      this.activeStateConfiguration[_offset] = null;
+      List<RegularState> _activeStates = this.executionContext.getActiveStates();
+      final Function1<RegularState,Boolean> _function = new Function1<RegularState,Boolean>() {
+          public Boolean apply(final RegularState it) {
+            ExecutionState _state = exitState.getState();
+            EObject _sourceElement = _state.getSourceElement();
+            boolean _equals = EcoreUtil.equals(it, _sourceElement);
+            return Boolean.valueOf(_equals);
+          }
+        };
+      Iterable<RegularState> activeStates = IterableExtensions.<RegularState>filter(_activeStates, _function);
+      List<RegularState> _activeStates_1 = this.executionContext.getActiveStates();
+      CollectionExtensions.<RegularState>removeAll(_activeStates_1, activeStates);
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final If ifStep) {
+    Object _xblockexpression = null;
+    {
+      Check _check = ifStep.getCheck();
+      Object check = this.execute(_check);
+      if ((((Boolean) check)).booleanValue()) {
+        Step _thenStep = ifStep.getThenStep();
+        this.schedule(_thenStep);
+      } else {
+        Step _elseStep = ifStep.getElseStep();
+        boolean _notEquals = (!Objects.equal(_elseStep, null));
+        if (_notEquals) {
+          Step _elseStep_1 = ifStep.getElseStep();
+          this.schedule(_elseStep_1);
+        }
+      }
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final Sequence sequence) {
+    Object _xblockexpression = null;
+    {
+      EList<Step> _steps = sequence.getSteps();
+      List<Step> _reverseView = ListExtensions.<Step>reverseView(_steps);
+      final Procedure1<Step> _function = new Procedure1<Step>() {
+          public void apply(final Step it) {
+            DefaultExecutionFlowInterpreter.this.schedule(it);
+          }
+        };
+      IterableExtensions.<Step>forEach(_reverseView, _function);
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final SaveHistory action) {
+    ExecutionState _xblockexpression = null;
+    {
+      ExecutionRegion region = action.getRegion();
+      StateVector _historyVector = region.getHistoryVector();
+      int _offset = _historyVector.getOffset();
+      StateVector _stateVector = region.getStateVector();
+      int _offset_1 = _stateVector.getOffset();
+      ExecutionState _get = this.activeStateConfiguration[_offset_1];
+      ExecutionState _put = this.historyStateConfiguration.put(Integer.valueOf(_offset), _get);
+      _xblockexpression = (_put);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final HistoryEntry entry) {
+    Object _xblockexpression = null;
+    {
+      ExecutionRegion _region = entry.getRegion();
+      ExecutionState _get = this.historyStateConfiguration.get(_region);
+      boolean _notEquals = (!Objects.equal(_get, null));
+      if (_notEquals) {
+        Step _historyStep = entry.getHistoryStep();
+        if (_historyStep!=null) {
+          this.execute(_historyStep);
+        }
+      } else {
+        Step _initialStep = entry.getInitialStep();
+        if (_initialStep!=null) {
+          this.execute(_initialStep);
+        }
+      }
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final StateSwitch stateSwitch) {
+    Object _xblockexpression = null;
+    {
+      final ExecutionRegion historyRegion = stateSwitch.getHistoryRegion();
+      boolean _notEquals = (!Objects.equal(historyRegion, null));
+      if (_notEquals) {
+        final ExecutionState historyState = this.historyStateConfiguration.get(historyRegion);
+        EList<StateCase> _cases = stateSwitch.getCases();
+        final Function1<StateCase,Boolean> _function = new Function1<StateCase,Boolean>() {
+            public Boolean apply(final StateCase it) {
+              ExecutionState _state = it.getState();
+              boolean _equals = Objects.equal(_state, historyState);
+              return Boolean.valueOf(_equals);
+            }
+          };
+        Iterable<StateCase> _filter = IterableExtensions.<StateCase>filter(_cases, _function);
+        final Procedure1<StateCase> _function_1 = new Procedure1<StateCase>() {
+            public void apply(final StateCase it) {
+              Step _step = it.getStep();
+              DefaultExecutionFlowInterpreter.this.schedule(_step);
+            }
+          };
+        IterableExtensions.<StateCase>forEach(_filter, _function_1);
+      } else {
+        EList<StateCase> _cases_1 = stateSwitch.getCases();
+        final Function1<StateCase,Boolean> _function_2 = new Function1<StateCase,Boolean>() {
+            public Boolean apply(final StateCase it) {
+              ExecutionState _state = it.getState();
+              boolean _contains = ((List<ExecutionState>)Conversions.doWrapArray(DefaultExecutionFlowInterpreter.this.activeStateConfiguration)).contains(_state);
+              return Boolean.valueOf(_contains);
+            }
+          };
+        Iterable<StateCase> _filter_1 = IterableExtensions.<StateCase>filter(_cases_1, _function_2);
+        final Procedure1<StateCase> _function_3 = new Procedure1<StateCase>() {
+            public void apply(final StateCase it) {
+              Step _step = it.getStep();
+              DefaultExecutionFlowInterpreter.this.schedule(_step);
+            }
+          };
+        IterableExtensions.<StateCase>forEach(_filter_1, _function_3);
+      }
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final ScheduleTimeEvent scheduleTimeEvent) {
+    Object _xblockexpression = null;
+    {
+      TimeEvent timeEvent = scheduleTimeEvent.getTimeEvent();
+      Statement _timeValue = scheduleTimeEvent.getTimeValue();
+      Object duration = this.statementInterpreter.evaluateStatement(_timeValue, this.executionContext);
+      String _name = timeEvent.getName();
+      boolean _isPeriodic = timeEvent.isPeriodic();
+      this.timingService.scheduleTimeEvent(this.executionContext, _name, _isPeriodic, (((Integer) duration)).intValue());
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final UnscheduleTimeEvent timeEvent) {
+    Object _xblockexpression = null;
+    {
+      TimeEvent _timeEvent = timeEvent.getTimeEvent();
+      String _name = _timeEvent.getName();
+      this.timingService.unscheduleTimeEvent(_name);
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  public Object execute(final Step call) {
+    if (call instanceof Call) {
+      return _execute((Call)call);
+    } else if (call instanceof Check) {
+      return _execute((Check)call);
+    } else if (call instanceof EnterState) {
+      return _execute((EnterState)call);
+    } else if (call instanceof Execution) {
+      return _execute((Execution)call);
+    } else if (call instanceof ExitState) {
+      return _execute((ExitState)call);
+    } else if (call instanceof HistoryEntry) {
+      return _execute((HistoryEntry)call);
+    } else if (call instanceof If) {
+      return _execute((If)call);
+    } else if (call instanceof SaveHistory) {
+      return _execute((SaveHistory)call);
+    } else if (call instanceof ScheduleTimeEvent) {
+      return _execute((ScheduleTimeEvent)call);
+    } else if (call instanceof Sequence) {
+      return _execute((Sequence)call);
+    } else if (call instanceof StateSwitch) {
+      return _execute((StateSwitch)call);
+    } else if (call instanceof Trace) {
+      return _execute((Trace)call);
+    } else if (call instanceof UnscheduleTimeEvent) {
+      return _execute((UnscheduleTimeEvent)call);
+    } else if (call != null) {
+      return _execute(call);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(call).toString());
+    }
+  }
+}

+ 594 - 0
plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/simulation/core/sexec/interpreter/StextStatementInterpreter.java

@@ -0,0 +1,594 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.core.sexec.interpreter;
+
+import com.google.common.base.Objects;
+import com.google.inject.Inject;
+import java.util.Arrays;
+import java.util.List;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.naming.IQualifiedNameProvider;
+import org.eclipse.xtext.naming.QualifiedName;
+import org.eclipse.xtext.util.SimpleAttributeResolver;
+import org.eclipse.xtext.xbase.lib.Extension;
+import org.eclipse.xtext.xbase.lib.Functions.Function1;
+import org.eclipse.xtext.xbase.lib.ListExtensions;
+import org.yakindu.base.types.Enumerator;
+import org.yakindu.sct.model.sgraph.RegularState;
+import org.yakindu.sct.model.sgraph.State;
+import org.yakindu.sct.model.sgraph.Statement;
+import org.yakindu.sct.model.stext.stext.ActiveStateReferenceExpression;
+import org.yakindu.sct.model.stext.stext.AdditiveOperator;
+import org.yakindu.sct.model.stext.stext.AssignmentExpression;
+import org.yakindu.sct.model.stext.stext.AssignmentOperator;
+import org.yakindu.sct.model.stext.stext.BitwiseAndExpression;
+import org.yakindu.sct.model.stext.stext.BitwiseOrExpression;
+import org.yakindu.sct.model.stext.stext.BitwiseXorExpression;
+import org.yakindu.sct.model.stext.stext.BoolLiteral;
+import org.yakindu.sct.model.stext.stext.ConditionalExpression;
+import org.yakindu.sct.model.stext.stext.ElementReferenceExpression;
+import org.yakindu.sct.model.stext.stext.EventDefinition;
+import org.yakindu.sct.model.stext.stext.EventRaisingExpression;
+import org.yakindu.sct.model.stext.stext.EventValueReferenceExpression;
+import org.yakindu.sct.model.stext.stext.Expression;
+import org.yakindu.sct.model.stext.stext.FeatureCall;
+import org.yakindu.sct.model.stext.stext.HexLiteral;
+import org.yakindu.sct.model.stext.stext.IntLiteral;
+import org.yakindu.sct.model.stext.stext.Literal;
+import org.yakindu.sct.model.stext.stext.LogicalAndExpression;
+import org.yakindu.sct.model.stext.stext.LogicalNotExpression;
+import org.yakindu.sct.model.stext.stext.LogicalOrExpression;
+import org.yakindu.sct.model.stext.stext.LogicalRelationExpression;
+import org.yakindu.sct.model.stext.stext.MultiplicativeOperator;
+import org.yakindu.sct.model.stext.stext.NumericalAddSubtractExpression;
+import org.yakindu.sct.model.stext.stext.NumericalMultiplyDivideExpression;
+import org.yakindu.sct.model.stext.stext.NumericalUnaryExpression;
+import org.yakindu.sct.model.stext.stext.OperationDefinition;
+import org.yakindu.sct.model.stext.stext.ParenthesizedExpression;
+import org.yakindu.sct.model.stext.stext.PrimitiveValueExpression;
+import org.yakindu.sct.model.stext.stext.RealLiteral;
+import org.yakindu.sct.model.stext.stext.RelationalOperator;
+import org.yakindu.sct.model.stext.stext.ShiftExpression;
+import org.yakindu.sct.model.stext.stext.ShiftOperator;
+import org.yakindu.sct.model.stext.stext.StringLiteral;
+import org.yakindu.sct.model.stext.stext.UnaryOperator;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
+import org.yakindu.sct.simulation.core.sexec.interpreter.AbstractStatementInterpreter;
+import org.yakindu.sct.simulation.core.sexec.interpreter.CoreFunction;
+import org.yakindu.sct.simulation.core.sexec.interpreter.IOperationMockup;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionEvent;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionVariable;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ * @authos axel terfloth - additions
+ */
+@SuppressWarnings("all")
+public class StextStatementInterpreter extends AbstractStatementInterpreter {
+  @Inject
+  @Extension
+  private IQualifiedNameProvider provider;
+  
+  @Inject
+  private IOperationMockup operationDelegate;
+  
+  protected ExecutionContext context;
+  
+  public Object evaluateStatement(final Statement statement, final ExecutionContext context) {
+    Object _xblockexpression = null;
+    {
+      this.context = context;
+      Object _execute = this.execute(statement);
+      _xblockexpression = (_execute);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final Statement statement) {
+    return null;
+  }
+  
+  protected Object _execute(final AssignmentExpression assignment) {
+    Object _xblockexpression = null;
+    {
+      Expression _varRef = assignment.getVarRef();
+      EObject _variable = this.variable(_varRef);
+      QualifiedName _fullyQualifiedName = this.provider.getFullyQualifiedName(_variable);
+      String _string = _fullyQualifiedName.toString();
+      ExecutionVariable scopeVariable = this.context.getVariable(_string);
+      Expression _expression = assignment.getExpression();
+      Object result = this.execute(_expression);
+      AssignmentOperator _operator = assignment.getOperator();
+      boolean _equals = Objects.equal(_operator, AssignmentOperator.ASSIGN);
+      if (_equals) {
+        String _name = scopeVariable.getName();
+        ExecutionVariable _variable_1 = this.context.getVariable(_name);
+        _variable_1.setValue(result);
+      } else {
+        AssignmentOperator _operator_1 = assignment.getOperator();
+        String _name_1 = _operator_1.getName();
+        String operator = AbstractStatementInterpreter.assignFunctionMap.get(_name_1);
+        String _name_2 = scopeVariable.getName();
+        ExecutionVariable _variable_2 = this.context.getVariable(_name_2);
+        Object _value = scopeVariable.getValue();
+        Object _evaluate = this.evaluate(operator, _value, result);
+        _variable_2.setValue(_evaluate);
+      }
+      String _name_3 = scopeVariable.getName();
+      ExecutionVariable _variable_3 = this.context.getVariable(_name_3);
+      Object _value_1 = _variable_3.getValue();
+      _xblockexpression = (_value_1);
+    }
+    return _xblockexpression;
+  }
+  
+  protected EObject _variable(final ElementReferenceExpression e) {
+    EObject _xifexpression = null;
+    EObject _reference = e.getReference();
+    if ((_reference instanceof VariableDefinition)) {
+      EObject _reference_1 = e.getReference();
+      _xifexpression = _reference_1;
+    } else {
+      _xifexpression = null;
+    }
+    return _xifexpression;
+  }
+  
+  protected EObject _variable(final FeatureCall e) {
+    EObject _xifexpression = null;
+    EObject _feature = e.getFeature();
+    if ((_feature instanceof VariableDefinition)) {
+      EObject _feature_1 = e.getFeature();
+      _xifexpression = _feature_1;
+    } else {
+      _xifexpression = null;
+    }
+    return _xifexpression;
+  }
+  
+  protected EObject _variable(final AssignmentExpression e) {
+    Expression _varRef = e.getVarRef();
+    EObject _variable = this.variable(_varRef);
+    return ((EObject) _variable);
+  }
+  
+  protected EObject _event(final ElementReferenceExpression e) {
+    EObject _xifexpression = null;
+    EObject _reference = e.getReference();
+    if ((_reference instanceof EventDefinition)) {
+      EObject _reference_1 = e.getReference();
+      _xifexpression = _reference_1;
+    } else {
+      _xifexpression = null;
+    }
+    return _xifexpression;
+  }
+  
+  protected EObject _event(final FeatureCall e) {
+    EObject _xifexpression = null;
+    EObject _feature = e.getFeature();
+    if ((_feature instanceof EventDefinition)) {
+      EObject _feature_1 = e.getFeature();
+      _xifexpression = _feature_1;
+    } else {
+      _xifexpression = null;
+    }
+    return _xifexpression;
+  }
+  
+  protected Object _execute(final EventRaisingExpression eventRaising) {
+    Object _xblockexpression = null;
+    {
+      Expression _event = eventRaising.getEvent();
+      EObject _event_1 = this.event(_event);
+      QualifiedName _fullyQualifiedName = this.provider.getFullyQualifiedName(_event_1);
+      String _string = _fullyQualifiedName.toString();
+      ExecutionEvent event = this.context.getEvent(_string);
+      Expression _value = eventRaising.getValue();
+      boolean _notEquals = (!Objects.equal(_value, null));
+      if (_notEquals) {
+        Expression _value_1 = eventRaising.getValue();
+        Object _execute = this.execute(_value_1);
+        event.setValue(_execute);
+      }
+      event.setRaised(true);
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final ConditionalExpression expression) {
+    Expression _condition = expression.getCondition();
+    Object _execute = this.execute(_condition);
+    if ((((Boolean) _execute)).booleanValue()) {
+      Expression _trueCase = expression.getTrueCase();
+      return this.execute(_trueCase);
+    } else {
+      Expression _falseCase = expression.getFalseCase();
+      return this.execute(_falseCase);
+    }
+  }
+  
+  protected Object _execute(final ElementReferenceExpression expression) {
+    EList<Expression> _args = expression.getArgs();
+    final Function1<Expression,Object> _function = new Function1<Expression,Object>() {
+        public Object apply(final Expression it) {
+          Object _execute = StextStatementInterpreter.this.execute(it);
+          return _execute;
+        }
+      };
+    List<Object> parameter = ListExtensions.<Expression, Object>map(_args, _function);
+    boolean _isOperationCall = expression.isOperationCall();
+    if (_isOperationCall) {
+      EObject _reference = expression.getReference();
+      Object[] _array = parameter.toArray();
+      boolean _canExecute = this.operationDelegate.canExecute(((OperationDefinition) _reference), _array);
+      if (_canExecute) {
+        EObject _reference_1 = expression.getReference();
+        Object[] _array_1 = parameter.toArray();
+        return this.operationDelegate.execute(((OperationDefinition) _reference_1), _array_1);
+      }
+    }
+    EObject _reference_2 = expression.getReference();
+    QualifiedName _fullyQualifiedName = this.provider.getFullyQualifiedName(_reference_2);
+    String _string = _fullyQualifiedName.toString();
+    ExecutionVariable variableRef = this.context.getVariable(_string);
+    boolean _notEquals = (!Objects.equal(variableRef, null));
+    if (_notEquals) {
+      return variableRef.getValue();
+    }
+    EObject _reference_3 = expression.getReference();
+    QualifiedName _fullyQualifiedName_1 = this.provider.getFullyQualifiedName(_reference_3);
+    String _string_1 = _fullyQualifiedName_1.toString();
+    ExecutionEvent _event = this.context.getEvent(_string_1);
+    return Boolean.valueOf(_event.isRaised());
+  }
+  
+  protected Object _execute(final EventValueReferenceExpression expression) {
+    Object _xblockexpression = null;
+    {
+      List<ExecutionEvent> _raisedEvents = this.context.getRaisedEvents();
+      for (final ExecutionEvent event : _raisedEvents) {
+        String _name = event.getName();
+        Expression _value = expression.getValue();
+        String _qname = this.qname(_value);
+        boolean _equals = _name.equals(_qname);
+        if (_equals) {
+          return event.getValue();
+        }
+      }
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  public String name(final EObject e) {
+    return SimpleAttributeResolver.NAME_RESOLVER.apply(e);
+  }
+  
+  protected String _qname(final FeatureCall e) {
+    EObject _feature = e.getFeature();
+    QualifiedName _fullyQualifiedName = this.provider.getFullyQualifiedName(_feature);
+    return _fullyQualifiedName.toString();
+  }
+  
+  protected String _qname(final ElementReferenceExpression e) {
+    EObject _reference = e.getReference();
+    QualifiedName _fullyQualifiedName = this.provider.getFullyQualifiedName(_reference);
+    String _string = _fullyQualifiedName.toString();
+    return _string;
+  }
+  
+  protected Object _execute(final ActiveStateReferenceExpression expression) {
+    List<RegularState> _allActiveStates = this.context.getAllActiveStates();
+    State _value = expression.getValue();
+    return Boolean.valueOf(_allActiveStates.contains(_value));
+  }
+  
+  protected Object _execute(final LogicalAndExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Object leftResult = this.execute(_leftOperand);
+    boolean _not = (!(((Boolean) leftResult)).booleanValue());
+    if (_not) {
+      return Boolean.valueOf(false);
+    }
+    Expression _rightOperand = expression.getRightOperand();
+    Object rightResult = this.execute(_rightOperand);
+    boolean _and = false;
+    if (!(((Boolean) leftResult)).booleanValue()) {
+      _and = false;
+    } else {
+      _and = ((((Boolean) leftResult)).booleanValue() && (((Boolean) rightResult)).booleanValue());
+    }
+    return Boolean.valueOf(_and);
+  }
+  
+  protected Object _execute(final LogicalOrExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Object leftResult = this.execute(_leftOperand);
+    if ((((Boolean) leftResult)).booleanValue()) {
+      return Boolean.valueOf(true);
+    }
+    Expression _rightOperand = expression.getRightOperand();
+    Object rightResult = this.execute(_rightOperand);
+    boolean _or = false;
+    if ((((Boolean) leftResult)).booleanValue()) {
+      _or = true;
+    } else {
+      _or = ((((Boolean) leftResult)).booleanValue() || (((Boolean) rightResult)).booleanValue());
+    }
+    return Boolean.valueOf(_or);
+  }
+  
+  protected Object _execute(final LogicalNotExpression expression) {
+    Expression _operand = expression.getOperand();
+    Object _execute = this.execute(_operand);
+    return Boolean.valueOf((!(((Boolean) _execute)).booleanValue()));
+  }
+  
+  protected Object _execute(final BitwiseAndExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Expression _rightOperand = expression.getRightOperand();
+    Object _executeBinaryCoreFunction = this.executeBinaryCoreFunction(_leftOperand, _rightOperand, CoreFunction.BIT_AND);
+    return _executeBinaryCoreFunction;
+  }
+  
+  protected Object _execute(final BitwiseOrExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Expression _rightOperand = expression.getRightOperand();
+    Object _executeBinaryCoreFunction = this.executeBinaryCoreFunction(_leftOperand, _rightOperand, CoreFunction.BIT_OR);
+    return _executeBinaryCoreFunction;
+  }
+  
+  protected Object _execute(final BitwiseXorExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Expression _rightOperand = expression.getRightOperand();
+    Object _executeBinaryCoreFunction = this.executeBinaryCoreFunction(_leftOperand, _rightOperand, CoreFunction.BIT_XOR);
+    return _executeBinaryCoreFunction;
+  }
+  
+  protected Object _execute(final LogicalRelationExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Expression _rightOperand = expression.getRightOperand();
+    RelationalOperator _operator = expression.getOperator();
+    String _name = _operator.getName();
+    Object _executeBinaryCoreFunction = this.executeBinaryCoreFunction(_leftOperand, _rightOperand, _name);
+    return _executeBinaryCoreFunction;
+  }
+  
+  protected Object _execute(final NumericalAddSubtractExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Expression _rightOperand = expression.getRightOperand();
+    AdditiveOperator _operator = expression.getOperator();
+    String _literal = _operator.getLiteral();
+    Object _executeBinaryCoreFunction = this.executeBinaryCoreFunction(_leftOperand, _rightOperand, _literal);
+    return _executeBinaryCoreFunction;
+  }
+  
+  protected Object _execute(final NumericalMultiplyDivideExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Expression _rightOperand = expression.getRightOperand();
+    MultiplicativeOperator _operator = expression.getOperator();
+    String _name = _operator.getName();
+    Object _executeBinaryCoreFunction = this.executeBinaryCoreFunction(_leftOperand, _rightOperand, _name);
+    return _executeBinaryCoreFunction;
+  }
+  
+  protected Object _execute(final ShiftExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Expression _rightOperand = expression.getRightOperand();
+    ShiftOperator _operator = expression.getOperator();
+    String _name = _operator.getName();
+    Object _executeBinaryCoreFunction = this.executeBinaryCoreFunction(_leftOperand, _rightOperand, _name);
+    return _executeBinaryCoreFunction;
+  }
+  
+  protected Object _execute(final NumericalUnaryExpression expression) {
+    Expression _operand = expression.getOperand();
+    UnaryOperator _operator = expression.getOperator();
+    String _name = _operator.getName();
+    Object _executeUnaryCoreFunction = this.executeUnaryCoreFunction(_operand, _name);
+    return _executeUnaryCoreFunction;
+  }
+  
+  public Object executeBinaryCoreFunction(final Statement leftStatement, final Statement rightStatement, final String operator) {
+    Object leftResult = this.execute(leftStatement);
+    Object rightResult = this.execute(rightStatement);
+    return this.evaluate(operator, leftResult, rightResult);
+  }
+  
+  public Object executeUnaryCoreFunction(final Statement statement, final String operator) {
+    Object result = this.execute(statement);
+    return this.evaluate(operator, result);
+  }
+  
+  protected Object _execute(final FeatureCall call) {
+    Object _xifexpression = null;
+    boolean _isOperationCall = call.isOperationCall();
+    if (_isOperationCall) {
+      Object _xblockexpression = null;
+      {
+        EList<Expression> _args = call.getArgs();
+        final Function1<Expression,Object> _function = new Function1<Expression,Object>() {
+            public Object apply(final Expression it) {
+              Object _execute = StextStatementInterpreter.this.execute(it);
+              return _execute;
+            }
+          };
+        List<Object> parameter = ListExtensions.<Expression, Object>map(_args, _function);
+        EObject _feature = call.getFeature();
+        OperationDefinition operation = ((OperationDefinition) _feature);
+        Object _xifexpression_1 = null;
+        boolean _canExecute = this.operationDelegate.canExecute(operation, parameter);
+        if (_canExecute) {
+          return this.operationDelegate.execute(operation, parameter);
+        }
+        _xblockexpression = (_xifexpression_1);
+      }
+      _xifexpression = _xblockexpression;
+    } else {
+      EObject _feature = call.getFeature();
+      if ((_feature instanceof Enumerator)) {
+        return call.getFeature();
+      } else {
+        EObject _feature_1 = call.getFeature();
+        String fqn = this.fqn(_feature_1);
+        ExecutionVariable variableRef = this.context.getVariable(fqn);
+        boolean _notEquals = (!Objects.equal(variableRef, null));
+        if (_notEquals) {
+          return variableRef.getValue();
+        }
+        ExecutionEvent _event = this.context.getEvent(fqn);
+        return Boolean.valueOf(_event.isRaised());
+      }
+    }
+    return _xifexpression;
+  }
+  
+  public String fqn(final EObject obj) {
+    QualifiedName _fullyQualifiedName = this.provider.getFullyQualifiedName(obj);
+    String _string = _fullyQualifiedName.toString();
+    return _string;
+  }
+  
+  protected Object _execute(final ParenthesizedExpression e) {
+    Expression _expression = e.getExpression();
+    Object _execute = this.execute(_expression);
+    return _execute;
+  }
+  
+  protected Object _execute(final PrimitiveValueExpression expression) {
+    Literal _value = expression.getValue();
+    return this.valueLiteral(_value);
+  }
+  
+  protected Object _valueLiteral(final IntLiteral literal) {
+    return literal.getValue();
+  }
+  
+  protected Object _valueLiteral(final HexLiteral literal) {
+    return literal.getValue();
+  }
+  
+  protected Object _valueLiteral(final BoolLiteral bool) {
+    return bool.isValue();
+  }
+  
+  protected Object _valueLiteral(final RealLiteral literal) {
+    return literal.getValue();
+  }
+  
+  protected Object _valueLiteral(final StringLiteral literal) {
+    return literal.getValue();
+  }
+  
+  public Object execute(final Statement expression) {
+    if (expression instanceof ActiveStateReferenceExpression) {
+      return _execute((ActiveStateReferenceExpression)expression);
+    } else if (expression instanceof AssignmentExpression) {
+      return _execute((AssignmentExpression)expression);
+    } else if (expression instanceof BitwiseAndExpression) {
+      return _execute((BitwiseAndExpression)expression);
+    } else if (expression instanceof BitwiseOrExpression) {
+      return _execute((BitwiseOrExpression)expression);
+    } else if (expression instanceof BitwiseXorExpression) {
+      return _execute((BitwiseXorExpression)expression);
+    } else if (expression instanceof ConditionalExpression) {
+      return _execute((ConditionalExpression)expression);
+    } else if (expression instanceof ElementReferenceExpression) {
+      return _execute((ElementReferenceExpression)expression);
+    } else if (expression instanceof EventRaisingExpression) {
+      return _execute((EventRaisingExpression)expression);
+    } else if (expression instanceof EventValueReferenceExpression) {
+      return _execute((EventValueReferenceExpression)expression);
+    } else if (expression instanceof FeatureCall) {
+      return _execute((FeatureCall)expression);
+    } else if (expression instanceof LogicalAndExpression) {
+      return _execute((LogicalAndExpression)expression);
+    } else if (expression instanceof LogicalNotExpression) {
+      return _execute((LogicalNotExpression)expression);
+    } else if (expression instanceof LogicalOrExpression) {
+      return _execute((LogicalOrExpression)expression);
+    } else if (expression instanceof LogicalRelationExpression) {
+      return _execute((LogicalRelationExpression)expression);
+    } else if (expression instanceof NumericalAddSubtractExpression) {
+      return _execute((NumericalAddSubtractExpression)expression);
+    } else if (expression instanceof NumericalMultiplyDivideExpression) {
+      return _execute((NumericalMultiplyDivideExpression)expression);
+    } else if (expression instanceof NumericalUnaryExpression) {
+      return _execute((NumericalUnaryExpression)expression);
+    } else if (expression instanceof ParenthesizedExpression) {
+      return _execute((ParenthesizedExpression)expression);
+    } else if (expression instanceof PrimitiveValueExpression) {
+      return _execute((PrimitiveValueExpression)expression);
+    } else if (expression instanceof ShiftExpression) {
+      return _execute((ShiftExpression)expression);
+    } else if (expression != null) {
+      return _execute(expression);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(expression).toString());
+    }
+  }
+  
+  public EObject variable(final Expression e) {
+    if (e instanceof AssignmentExpression) {
+      return _variable((AssignmentExpression)e);
+    } else if (e instanceof ElementReferenceExpression) {
+      return _variable((ElementReferenceExpression)e);
+    } else if (e instanceof FeatureCall) {
+      return _variable((FeatureCall)e);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(e).toString());
+    }
+  }
+  
+  public EObject event(final Expression e) {
+    if (e instanceof ElementReferenceExpression) {
+      return _event((ElementReferenceExpression)e);
+    } else if (e instanceof FeatureCall) {
+      return _event((FeatureCall)e);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(e).toString());
+    }
+  }
+  
+  public String qname(final Expression e) {
+    if (e instanceof ElementReferenceExpression) {
+      return _qname((ElementReferenceExpression)e);
+    } else if (e instanceof FeatureCall) {
+      return _qname((FeatureCall)e);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(e).toString());
+    }
+  }
+  
+  public Object valueLiteral(final Literal bool) {
+    if (bool instanceof BoolLiteral) {
+      return _valueLiteral((BoolLiteral)bool);
+    } else if (bool instanceof HexLiteral) {
+      return _valueLiteral((HexLiteral)bool);
+    } else if (bool instanceof IntLiteral) {
+      return _valueLiteral((IntLiteral)bool);
+    } else if (bool instanceof RealLiteral) {
+      return _valueLiteral((RealLiteral)bool);
+    } else if (bool instanceof StringLiteral) {
+      return _valueLiteral((StringLiteral)bool);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(bool).toString());
+    }
+  }
+}

BIN
plugins/org.yakindu.sct.simulation.core.sexec/xtend-gen/org/yakindu/sct/simulation/core/stext/interpreter/.StextStatementInterpreter.java._trace


+ 7 - 0
plugins/org.yakindu.sct.simulation.ui.sexec/.classpath

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

+ 28 - 0
plugins/org.yakindu.sct.simulation.ui.sexec/.project

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.yakindu.sct.simulation.ui.sexec</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

+ 7 - 0
plugins/org.yakindu.sct.simulation.ui.sexec/.settings/org.eclipse.jdt.core.prefs

@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6

+ 17 - 0
plugins/org.yakindu.sct.simulation.ui.sexec/META-INF/MANIFEST.MF

@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Sexec
+Bundle-SymbolicName: org.yakindu.sct.simulation.ui.sexec;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.yakindu.sct.simulation.ui.sexec.SExecUiActivator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.debug.core;bundle-version="3.8.0",
+ org.eclipse.debug.ui;bundle-version="3.9.0",
+ org.yakindu.sct.simulation.ui;bundle-version="2.1.2",
+ org.yakindu.sct.simulation.core.sexec;bundle-version="1.0.0",
+ org.eclipse.ui;bundle-version="3.105.0",
+ org.yakindu.sct.commons;bundle-version="2.1.2",
+ org.eclipse.ui.ide;bundle-version="3.9.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Export-Package: org.yakindu.sct.simulation.ui.sexec.launch

+ 5 - 0
plugins/org.yakindu.sct.simulation.ui.sexec/build.properties

@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml

BIN
plugins/org.yakindu.sct.simulation.ui.sexec/icons/Statechart-Launcher-16.png


+ 50 - 0
plugins/org.yakindu.sct.simulation.ui.sexec/plugin.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+<!-- Launch configuration images -->
+   <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+    	<launchConfigurationTypeImage
+        	icon="icons/Statechart-Launcher-16.png"
+        	configTypeID="org.yakindu.sct.simulation.core.launch.statechart"
+        	id="org.yakindu.sct.core.simulation.launch.statechartTypeImage">
+	    </launchConfigurationTypeImage>
+	</extension>
+	
+	<!-- launch tab group -->
+	<extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+  	  <launchConfigurationTabGroup
+    	 type="org.yakindu.sct.simulation.core.launch.statechart"
+  	     class="org.yakindu.sct.simulation.ui.sexec.launch.tabs.StatechartLaunchConfigurationTabGroup"
+  	     id="org.yakindu.sct.simulation.ui.launch.tabs.statechart.tabs">
+  	      <launchMode 
+                  mode="debug"
+                  perspective="org.yakindu.sct.ui.SimulationPerspective">
+            </launchMode>
+              <launchMode 
+                  mode="run"
+                  perspective="org.yakindu.sct.ui.SimulationPerspective">
+            </launchMode>
+   	 </launchConfigurationTabGroup>
+	</extension>
+	
+	<!-- launch shortcuts -->
+	<extension point="org.eclipse.debug.ui.launchShortcuts">
+	    <shortcut
+	        id="org.yakindu.sct.core.simulation.launch.shortcut"
+	        class="org.yakindu.sct.simulation.ui.sexec.launch.StatechartLaunchShortcut"
+	        label="YAKINDU Statechart"
+	        icon="icons/Statechart-Launcher-16.png"
+	        modes="run">
+	         <contextualLaunch>
+				<enablement>
+					<with variable="selection">
+					<count value="1"/>
+						<iterate>
+							<test property="org.eclipse.debug.ui.matchesPattern" value="*.sct"/>
+						</iterate>
+					</with>
+				</enablement>
+		  	 </contextualLaunch>
+	    </shortcut>
+	</extension>
+</plugin>

+ 15 - 0
plugins/org.yakindu.sct.simulation.ui.sexec/pom.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.yakindu.sct</groupId>
+		<artifactId>org.yakindu.sct.releng</artifactId>
+		<version>2.1.2-SNAPSHOT</version>
+		<relativePath>../org.yakindu.sct.releng/pom.xml</relativePath>
+	</parent>
+	<artifactId>org.yakindu.sct.simulation.ui.sexec</artifactId>
+	<groupId>org.yakindu.sct.plugins</groupId>
+	<packaging>eclipse-plugin</packaging>
+</project>

+ 50 - 0
plugins/org.yakindu.sct.simulation.ui.sexec/src/org/yakindu/sct/simulation/ui/sexec/SExecUiActivator.java

@@ -0,0 +1,50 @@
+package org.yakindu.sct.simulation.ui.sexec;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class SExecUiActivator extends AbstractUIPlugin {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "org.yakindu.sct.simulation.ui.sexec"; //$NON-NLS-1$
+
+	// The shared instance
+	private static SExecUiActivator plugin;
+	
+	/**
+	 * The constructor
+	 */
+	public SExecUiActivator() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 *
+	 * @return the shared instance
+	 */
+	public static SExecUiActivator getDefault() {
+		return plugin;
+	}
+
+}

+ 103 - 0
plugins/org.yakindu.sct.simulation.ui.sexec/src/org/yakindu/sct/simulation/ui/sexec/launch/StatechartLaunchShortcut.java

@@ -0,0 +1,103 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.ui.sexec.launch;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.ILaunchShortcut;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.yakindu.sct.simulation.core.launch.ISCTLaunchConfigurationType;
+import org.yakindu.sct.simulation.core.sexec.launch.ISCTLaunchParameters;
+
+/**
+ * 
+ * @author andreas muelder
+ * 
+ */
+public class StatechartLaunchShortcut implements ILaunchShortcut, ISCTLaunchConfigurationType, ISCTLaunchParameters {
+
+	public void launch(ISelection selection, String mode) {
+		if (selection instanceof IStructuredSelection) {
+			final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+			final Object object = structuredSelection.getFirstElement();
+			if (object instanceof IAdaptable) {
+				IFile file = (IFile) ((IAdaptable) object).getAdapter(IResource.class);
+				launch(file, mode);
+			}
+		}
+	}
+	
+
+	public void launch(IEditorPart editor, String mode) {
+		IResource resource = (IResource) editor.getEditorInput().getAdapter(IResource.class);
+		launch((IFile) resource, mode);
+	}
+
+	protected void launch(IFile file, String mode) {
+		final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+		final ILaunchConfigurationType configType = launchManager.getLaunchConfigurationType(getConfigType());
+		ILaunchConfiguration launchConfig = findLaunchConfiguration(configType, file);
+		if (launchConfig != null) {
+			DebugUITools.launch(launchConfig, mode);
+		} else {
+			ILaunchConfiguration launchConfiguration = createNewLaunchConfiguration(file);
+			DebugUITools.launch(launchConfiguration, mode);
+		}
+	}
+
+	protected String getConfigType() {
+		return CONFIG_TYPE;
+	}
+
+	protected ILaunchConfiguration createNewLaunchConfiguration(IFile file) {
+		final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+		final ILaunchConfigurationType configType = launchManager.getLaunchConfigurationType(getConfigType());
+		try {
+			ILaunchConfigurationWorkingCopy newConfig = configType.newInstance(null,
+					launchManager.generateLaunchConfigurationName(file.getName()));
+
+			newConfig.setAttribute(FILE_NAME, file.getFullPath().toString());
+			newConfig.setAttribute(OPERATION_CLASS, "org.yakindu.Operations");
+			return newConfig.doSave();
+
+		} catch (CoreException e) {
+			e.printStackTrace();
+		}
+		throw new IllegalStateException();
+	}
+
+	protected ILaunchConfiguration findLaunchConfiguration(ILaunchConfigurationType configType, IFile file) {
+		ILaunchConfiguration[] configs;
+		try {
+			configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(configType);
+			for (ILaunchConfiguration config : configs) {
+				String attribute = config.getAttribute(FILE_NAME, "");
+				if (attribute.equals(file.getFullPath().toString())) {
+					return config;
+				}
+			}
+		} catch (CoreException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+}

+ 287 - 0
plugins/org.yakindu.sct.simulation.ui.sexec/src/org/yakindu/sct/simulation/ui/sexec/launch/tabs/StatechartLaunchConfigurationTab.java

@@ -0,0 +1,287 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.ui.sexec.launch.tabs;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaLaunchTab;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.ResourceListSelectionDialog;
+import org.yakindu.sct.commons.WorkspaceClassLoaderFactory;
+import org.yakindu.sct.simulation.core.sexec.launch.ISCTLaunchParameters;
+import org.yakindu.sct.simulation.ui.SimulationImages;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class StatechartLaunchConfigurationTab extends JavaLaunchTab implements ISCTLaunchParameters {
+
+	private Text modelfile;
+	private Text cyclePeriod;
+	private Text operationClass;
+	private Button btnCycle;
+	private Button btnEvent;
+
+	public void createControl(Composite parent) {
+		Composite comp = new Composite(parent, SWT.NONE);
+		setControl(comp);
+		comp.setLayout(new GridLayout(1, true));
+		createFileSelectionGroup(comp);
+		new Label(comp, SWT.NONE);
+	}
+
+	private void createFileSelectionGroup(Composite comp) {
+		createModelFileGroup(comp);
+		createOperationClassGroup(comp);
+		createExecutionTypeControls(comp);
+		createCyclePeriodGroup(comp);
+	}
+
+	private void createOperationClassGroup(Composite parent) {
+		Group propertyGroup = new Group(parent, SWT.NONE);
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(propertyGroup);
+		propertyGroup.setText("Operation Class:");
+		propertyGroup.setLayout(new GridLayout(1, false));
+		operationClass = new Text(propertyGroup, SWT.BORDER);
+		operationClass.addListener(SWT.Modify, new UpdateListener());
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(operationClass);
+	}
+
+	private void createExecutionTypeControls(Composite parent) {
+		Group propertyGroup = new Group(parent, SWT.NONE);
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(propertyGroup);
+		propertyGroup.setText("Execution Type:");
+		propertyGroup.setLayout(new GridLayout(1, true));
+		btnCycle = new Button(propertyGroup, SWT.RADIO);
+		btnCycle.setText("cycle based");
+		btnCycle.addListener(SWT.Selection, new UpdateListener());
+		btnCycle.addListener(SWT.Selection, new EnableStateListener());
+		GridDataFactory.fillDefaults().applyTo(btnCycle);
+		btnEvent = new Button(propertyGroup, SWT.RADIO);
+		btnEvent.setText("event driven");
+		btnEvent.addListener(SWT.Selection, new UpdateListener());
+		btnCycle.addListener(SWT.Selection, new EnableStateListener());
+		GridDataFactory.fillDefaults().applyTo(btnEvent);
+	}
+
+	private void createCyclePeriodGroup(Composite parent) {
+		Group propertyGroup = new Group(parent, SWT.NONE);
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(propertyGroup);
+		propertyGroup.setText("Cycle Period:");
+		propertyGroup.setLayout(new GridLayout(2, false));
+		cyclePeriod = new Text(propertyGroup, SWT.BORDER);
+		cyclePeriod.addListener(SWT.Modify, new UpdateListener());
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(cyclePeriod);
+		Label lblMs = new Label(propertyGroup, SWT.NONE);
+		lblMs.setText("ms");
+		GridDataFactory.fillDefaults().applyTo(lblMs);
+	}
+
+	private void createModelFileGroup(Composite comp) {
+		Group fileGroup = new Group(comp, SWT.NONE);
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(fileGroup);
+		fileGroup.setText("Model file:");
+		fileGroup.setLayout(new GridLayout(2, false));
+
+		modelfile = new Text(fileGroup, SWT.BORDER);
+		modelfile.addListener(SWT.Modify, new UpdateListener());
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(modelfile);
+
+		Button browse = new Button(fileGroup, SWT.NONE);
+		browse.setText("Search");
+		browse.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(),
+						getStatechartResources()) {
+					@Override
+					protected String adjustPattern() {
+						String pattern = super.adjustPattern();
+						if (pattern.equals("")) {
+							return "*";
+						}
+						return pattern;
+					}
+				};
+				dialog.setTitle("Select Statechart model");
+				dialog.setMessage("Please select the YAKINDU statechart model file you want to execute.");
+				if (dialog.open() == 0) {
+					Object[] files = dialog.getResult();
+					IFile file = (IFile) files[0];
+					modelfile.setText((file.getFullPath().toString()));
+				}
+			}
+
+			private IResource[] getStatechartResources() {
+				final List<IResource> resources = new ArrayList<IResource>();
+				try {
+					ResourcesPlugin.getWorkspace().getRoot().accept(new IResourceVisitor() {
+						public boolean visit(IResource resource) throws CoreException {
+							if ("sct".equalsIgnoreCase(resource.getFileExtension())) {
+								resources.add(resource);
+							}
+							return true;
+						}
+					});
+				} catch (CoreException e) {
+					e.printStackTrace();
+				}
+				return resources.toArray(new IResource[0]);
+			}
+		});
+		GridDataFactory.fillDefaults().applyTo(browse);
+	}
+
+	public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+	}
+
+	public void initializeFrom(ILaunchConfiguration configuration) {
+		try {
+			modelfile.setText(configuration.getAttribute(FILE_NAME, DEFAULT_FILE_NAME));
+			operationClass.setText(configuration.getAttribute(OPERATION_CLASS, DEFAULT_OPERATION_CLASS));
+			cyclePeriod.setText(String.valueOf(configuration.getAttribute(CYCLE_PERIOD, DEFAULT_CYCLE_PERIOD)));
+			btnCycle.setSelection(configuration.getAttribute(IS_CYCLE_BASED, DEFAULT_IS_CYCLE_BASED));
+			btnEvent.setSelection(configuration.getAttribute(IS_EVENT_DRIVEN, DEFAULT_IS_EVENT_DRIVEN));
+			cyclePeriod.setEnabled(btnCycle.getSelection());
+		} catch (CoreException e) {
+			e.printStackTrace();
+		}
+	}
+
+	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+		configuration.setAttribute(FILE_NAME, modelfile.getText());
+		configuration.setAttribute(OPERATION_CLASS, operationClass.getText());
+		if (isCyclePeriodValid()) {
+			configuration.setAttribute(CYCLE_PERIOD, getCyclePeriod());
+		}
+		configuration.setAttribute(IS_CYCLE_BASED, btnCycle.getSelection());
+		configuration.setAttribute(IS_EVENT_DRIVEN, btnEvent.getSelection());
+	}
+
+	private int getCyclePeriod() {
+		return Integer.parseInt(cyclePeriod.getText());
+	}
+
+	public String getName() {
+		return "Main";
+	}
+
+	@Override
+	public Image getImage() {
+		return SimulationImages.LAUNCHER_ICON.image();
+	}
+
+	protected Set<String> getOperationClasses() {
+		String operationClasses = this.operationClass.getText();
+		Set<String> result = new HashSet<String>();
+		if (operationClasses.trim().length() > 0) {
+			String[] split = operationClasses.split(",");
+			for (String string : split) {
+				result.add(string.trim());
+			}
+		}
+		return result;
+	}
+
+	@Override
+	public boolean isValid(ILaunchConfiguration launchConfig) {
+		setMessage(null);
+		setErrorMessage(null);
+		String model = this.modelfile.getText().trim();
+		if (model.length() > 0)
+			if (ResourcesPlugin.getWorkspace().getRoot().findMember(model) == null) {
+				setErrorMessage("file " + model + " does not exist!");
+				return false;
+			}
+		String cyclePeriod = this.cyclePeriod.getText();
+		if (cyclePeriod.length() == 0) {
+			setErrorMessage("Empty cycle period!");
+			return false;
+		} else if (!isCyclePeriodValid()) {
+			setErrorMessage("Cycle Period must be a number!");
+			return false;
+		}
+		Set<String> operationClasses = getOperationClasses();
+		if (operationClasses.size() > 0) {
+			for (String clazz : operationClasses) {
+				// check if class exists
+				IProject project = ResourcesPlugin.getWorkspace().getRoot().findMember(model).getProject();
+				if (project != null) {
+					ClassLoader classLoader = new WorkspaceClassLoaderFactory().createClassLoader(project, getClass()
+							.getClassLoader());
+					try {
+						Class<?> loadClass = classLoader.loadClass(clazz);
+						loadClass.newInstance();
+					} catch (ClassNotFoundException e) {
+						setErrorMessage("Class " + clazz + " not found in project " + project.getName() + "!");
+						return false;
+					} catch (InstantiationException e) {
+						setErrorMessage("Could not instantiate class " + clazz
+								+ "! (No default constructor available?) ");
+						return false;
+					} catch (IllegalAccessException e) {
+						setErrorMessage("Could not access class constructor for class" + clazz + "!");
+						return false;
+					}
+				}
+			}
+		}
+		// check for default c'tor
+		return super.isValid(launchConfig);
+	}
+
+	private boolean isCyclePeriodValid() {
+		try {
+			getCyclePeriod();
+		} catch (NumberFormatException ex) {
+			return false;
+		}
+		return true;
+	}
+
+	private class EnableStateListener implements Listener {
+		public void handleEvent(Event event) {
+			cyclePeriod.setEnabled(btnCycle.getSelection());
+		}
+	}
+
+	private class UpdateListener implements Listener {
+
+		public void handleEvent(Event event) {
+			StatechartLaunchConfigurationTab.this.updateLaunchConfigurationDialog();
+		}
+
+	}
+
+}

+ 33 - 0
plugins/org.yakindu.sct.simulation.ui.sexec/src/org/yakindu/sct/simulation/ui/sexec/launch/tabs/StatechartLaunchConfigurationTabGroup.java

@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.ui.sexec.launch.tabs;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+
+/**
+ * 
+ * @author andreas muelder
+ * 
+ */
+public class StatechartLaunchConfigurationTabGroup extends
+		AbstractLaunchConfigurationTabGroup {
+
+
+	public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+		ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+				new StatechartLaunchConfigurationTab(), new CommonTab() };
+		setTabs(tabs);
+	}
+
+}