Andreas Mülder 12 лет назад
Родитель
Сommit
c910bfe15e
23 измененных файлов с 0 добавлено и 2430 удалено
  1. 0 8
      plugins/org.yakindu.sct.model.sexec.interpreter/.classpath
  2. 0 45
      plugins/org.yakindu.sct.model.sexec.interpreter/.project
  3. 0 2
      plugins/org.yakindu.sct.model.sexec.interpreter/.settings/org.eclipse.core.resources.prefs
  4. 0 2
      plugins/org.yakindu.sct.model.sexec.interpreter/.settings/org.eclipse.core.runtime.prefs
  5. 0 8
      plugins/org.yakindu.sct.model.sexec.interpreter/.settings/org.eclipse.jdt.core.prefs
  6. 0 8
      plugins/org.yakindu.sct.model.sexec.interpreter/.settings/org.eclipse.xtend.core.Xtend.prefs
  7. 0 22
      plugins/org.yakindu.sct.model.sexec.interpreter/META-INF/MANIFEST.MF
  8. 0 6
      plugins/org.yakindu.sct.model.sexec.interpreter/build.properties
  9. 0 11
      plugins/org.yakindu.sct.model.sexec.interpreter/plugin.xml
  10. 0 48
      plugins/org.yakindu.sct.model.sexec.interpreter/pom.xml
  11. 0 30
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/Activator.java
  12. 0 28
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/IExecutionFlowInterpreter.java
  13. 0 36
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/IStatementInterpreter.java
  14. 0 50
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/ITimingService.java
  15. 0 82
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/InterpreterModule.java
  16. 0 57
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/factory/SexecExecutionFacadeFactory.java
  17. 0 366
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/impl/ExecutionFlowInterpreter.xtend
  18. 0 86
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/impl/TimerTaskTimingService.java
  19. 0 87
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/stext/AbstractStatementInterpreter.java
  20. 0 876
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/stext/CoreFunction.java
  21. 0 224
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/stext/Function.java
  22. 0 73
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/stext/Signature.java
  23. 0 275
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/stext/StextStatementInterpreter.xtend

+ 0 - 8
plugins/org.yakindu.sct.model.sexec.interpreter/.classpath

@@ -1,8 +0,0 @@
-<?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/J2SE-1.5"/>
-	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="output" path="bin"/>
-</classpath>

+ 0 - 45
plugins/org.yakindu.sct.model.sexec.interpreter/.project

@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>org.yakindu.sct.model.sexec.interpreter</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>
-		<buildCommand>
-			<name>org.eclipse.xtext.ui.shared.xtextBuilder</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>
-	<filteredResources>
-		<filter>
-			<id>1375978393627</id>
-			<name></name>
-			<type>10</type>
-			<matcher>
-				<id>org.eclipse.ui.ide.multiFilter</id>
-				<arguments>1.0-name-matches-false-false-target</arguments>
-			</matcher>
-		</filter>
-	</filteredResources>
-</projectDescription>

+ 0 - 2
plugins/org.yakindu.sct.model.sexec.interpreter/.settings/org.eclipse.core.resources.prefs

@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-encoding/<project>=UTF-8

+ 0 - 2
plugins/org.yakindu.sct.model.sexec.interpreter/.settings/org.eclipse.core.runtime.prefs

@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-line.separator=\n

+ 0 - 8
plugins/org.yakindu.sct.model.sexec.interpreter/.settings/org.eclipse.jdt.core.prefs

@@ -1,8 +0,0 @@
-#Thu Mar 08 11:57:02 CET 2012
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5

+ 0 - 8
plugins/org.yakindu.sct.model.sexec.interpreter/.settings/org.eclipse.xtend.core.Xtend.prefs

@@ -1,8 +0,0 @@
-autobuilding=true
-eclipse.preferences.version=1
-is_project_specific=true
-outlet.DEFAULT_OUTPUT.cleanDirectory=false
-outlet.DEFAULT_OUTPUT.cleanupDerived=true
-outlet.DEFAULT_OUTPUT.createDirectory=true
-outlet.DEFAULT_OUTPUT.derived=false
-outlet.DEFAULT_OUTPUT.override=true

+ 0 - 22
plugins/org.yakindu.sct.model.sexec.interpreter/META-INF/MANIFEST.MF

@@ -1,22 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: SExec Runtime
-Bundle-SymbolicName: org.yakindu.sct.model.sexec.interpreter;singleton:=true
-Bundle-Version: 2.1.2.qualifier
-Bundle-Activator: org.yakindu.sct.model.sexec.interpreter.Activator
-Bundle-Vendor: yakindu.org
-Require-Bundle: org.eclipse.core.runtime,
- org.yakindu.sct.model.sexec;bundle-version="1.0.0",
- com.google.inject;bundle-version="2.0.0",
- org.eclipse.xtext.util;bundle-version="2.0.0",
- org.yakindu.sct.model.stext;bundle-version="1.0.0",
- org.yakindu.sct.simulation.core;bundle-version="1.0.0";visibility:=reexport,
- org.yakindu.base.types;bundle-version="1.0.0",
- org.eclipse.xtend;bundle-version="1.2.0",
- org.eclipse.xtext.xbase.lib;bundle-version="2.3.0"
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
-Export-Package: org.yakindu.sct.model.sexec.interpreter,
- org.yakindu.sct.model.sexec.interpreter.factory,
- org.yakindu.sct.model.sexec.interpreter.impl,
- org.yakindu.sct.model.sexec.interpreter.stext

+ 0 - 6
plugins/org.yakindu.sct.model.sexec.interpreter/build.properties

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

+ 0 - 11
plugins/org.yakindu.sct.model.sexec.interpreter/plugin.xml

@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-   <extension
-         point="org.yakindu.sct.simulation.core.executionfactory">
-      <ExecutionFacadeFactory
-            class="org.yakindu.sct.model.sexec.interpreter.factory.SexecExecutionFacadeFactory">
-      </ExecutionFacadeFactory>
-   </extension>
-
-</plugin>

+ 0 - 48
plugins/org.yakindu.sct.model.sexec.interpreter/pom.xml

@@ -1,48 +0,0 @@
-<?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.model.sexec.interpreter</artifactId>
-	<groupId>org.yakindu.sct.plugins</groupId>
-	<packaging>eclipse-plugin</packaging>
-	<build>
-		<plugins>
-			
-			<plugin>
-				<artifactId>maven-clean-plugin</artifactId>
-				<configuration>
-					<filesets>
-						<fileset>
-							<directory>xtend-gen</directory>
-							<includes>
-								<include>**</include>
-							</includes>
-							<excludes>
-								<exclude>.svn/</exclude>
-								<exclude>.gitignore</exclude>
-							</excludes>
-						</fileset>
-					</filesets>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.eclipse.xtend</groupId>
-				<artifactId>xtend-maven-plugin</artifactId>
-				<executions>
-					<execution>
-						<goals>
-							<goal>compile</goal>
-						</goals>
-					</execution>
-				</executions>
-			</plugin>
-		</plugins>
-	</build>
-</project>

+ 0 - 30
plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/Activator.java

@@ -1,30 +0,0 @@
-package org.yakindu.sct.model.sexec.interpreter;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator 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 {
-		Activator.context = bundleContext;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
-	 */
-	public void stop(BundleContext bundleContext) throws Exception {
-		Activator.context = null;
-	}
-
-}

+ 0 - 28
plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/IExecutionFlowInterpreter.java

@@ -1,28 +0,0 @@
-/**
- * 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.model.sexec.interpreter;
-
-import org.yakindu.sct.model.sexec.ExecutionFlow;
-import org.yakindu.sct.simulation.core.runtime.IExecutionFacade;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public interface IExecutionFlowInterpreter extends IExecutionFacade {
-
-	/**
-	 * @param flow
-	 */
-	public void initialize(final ExecutionFlow flow);
-	
-}

+ 0 - 36
plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/IStatementInterpreter.java

@@ -1,36 +0,0 @@
-/**
- * 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.model.sexec.interpreter;
-
-import java.util.List;
-
-import org.yakindu.sct.model.sgraph.Statement;
-import org.yakindu.sct.simulation.core.runtime.ExecutionException;
-import org.yakindu.sct.simulation.core.runtime.IExecutionContext;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public interface IStatementInterpreter {
-	/**
-	 * 
-	 * @param statement
-	 * @param context
-	 * @return
-	 * @throws ExecutionException
-	 */
-	public Object evaluateStatement(Statement statement,
-			IExecutionContext context) throws ExecutionException;
-
-	public void setOperationCallbacks(List<Object> callbacks);
-}

+ 0 - 50
plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/ITimingService.java

@@ -1,50 +0,0 @@
-/**
- * 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.model.sexec.interpreter;
-
-import org.yakindu.sct.simulation.core.runtime.IExecutionContext;
-
-/**
- * 
- * @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(IExecutionContext 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();
-
-}

+ 0 - 82
plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/InterpreterModule.java

@@ -1,82 +0,0 @@
-/**
- * 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.model.sexec.interpreter;
-
-import org.eclipse.xtext.naming.IQualifiedNameProvider;
-import org.eclipse.xtext.service.AbstractGenericModule;
-import org.yakindu.base.types.ITypeSystem;
-import org.yakindu.sct.model.sexec.interpreter.impl.ExecutionFlowInterpreter;
-import org.yakindu.sct.model.sexec.interpreter.impl.TimerTaskTimingService;
-import org.yakindu.sct.model.sexec.interpreter.stext.StextStatementInterpreter;
-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.STextDefaultTypeSystem;
-import org.yakindu.sct.model.stext.types.STextDefaultTypeInferrer;
-import org.yakindu.sct.simulation.core.runtime.IExecutionContext;
-import org.yakindu.sct.simulation.core.runtime.impl.ExecutionContextImpl;
-
-import com.google.inject.Binder;
-import com.google.inject.name.Names;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * @author Alexander Nyßen (alexander.nyssen@itemis.de) - Refactored to
- *         AbstractGenericModule to allow subclasses to overwrite bindings
- * 
- */
-public class InterpreterModule extends AbstractGenericModule {
-
-	public static final String INTERPRETER_NAME = "InterpreterName";
-
-	public void configure(Binder binder) {
-		super.configure(binder);
-		binder.bind(Boolean.class)
-				.annotatedWith(Names.named(SequencerModule.ADD_TRACES))
-				.toInstance(Boolean.TRUE);
-		binder.bind(String.class).annotatedWith(Names.named(INTERPRETER_NAME))
-				.toInstance("SExecution Interpreter");
-	}
-	
-	public Class<? extends ITimingService> bindITimingService(){
-		return TimerTaskTimingService.class;
-	}
-	
-	public Class<? extends IExecutionContext> bindIExecutionContext(){
-		return ExecutionContextImpl.class;
-	}
-	
-	public Class<? extends IStatementInterpreter> bindIStatementInterpreter(){
-		return StextStatementInterpreter.class;
-	}
-	
-	public Class<? extends IExecutionFlowInterpreter> bindIExecutionFlowInterpreter(){
-		return ExecutionFlowInterpreter.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;
-	}
-}

+ 0 - 57
plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/factory/SexecExecutionFacadeFactory.java

@@ -1,57 +0,0 @@
-/**
- * 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.model.sexec.interpreter.factory;
-
-import org.yakindu.sct.model.sexec.ExecutionFlow;
-import org.yakindu.sct.model.sexec.interpreter.IExecutionFlowInterpreter;
-import org.yakindu.sct.model.sexec.interpreter.InterpreterModule;
-import org.yakindu.sct.model.sexec.transformation.IModelSequencer;
-import org.yakindu.sct.model.sexec.transformation.SequencerModule;
-import org.yakindu.sct.model.sgraph.Statechart;
-import org.yakindu.sct.simulation.core.runtime.IExecutionFacadeFactory;
-
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.util.Modules;
-
-/**
- * Factory registered via extension point
- * 'org.yakindu.sct.simulation.core.executionfactory'
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class SexecExecutionFacadeFactory implements IExecutionFacadeFactory {
-
-	@Inject
-	protected IModelSequencer sequencer;
-	@Inject
-	protected IExecutionFlowInterpreter interpreter;
-
-	public SexecExecutionFacadeFactory() {
-		Guice.createInjector(
-				Modules.override(new SequencerModule()).with(
-						new InterpreterModule())).injectMembers(this);
-	}
-
-	public IExecutionFlowInterpreter createExecutionFacade(Statechart statechart) {
-		ExecutionFlow flow = sequencer.transform(statechart);
-		interpreter.initialize(flow);
-		return interpreter;
-
-	}
-
-	public boolean isApplicable(Statechart statechart) {
-		return statechart.eResource().getURI().fileExtension().equals("sct");
-	}
-
-   
-}

+ 0 - 366
plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/impl/ExecutionFlowInterpreter.xtend

@@ -1,366 +0,0 @@
-/**
- * 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.model.sexec.interpreter.impl
-
-import com.google.inject.Inject
-import com.google.inject.name.Named
-import java.util.HashMap
-import java.util.List
-import java.util.Map
-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.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.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.SexecFactory
-import org.yakindu.sct.model.sexec.StateSwitch
-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.TraceBeginRunCycle
-import org.yakindu.sct.model.sexec.TraceEndRunCycle
-import org.yakindu.sct.model.sexec.UnscheduleTimeEvent
-import org.yakindu.sct.model.sexec.interpreter.IExecutionFlowInterpreter
-import org.yakindu.sct.model.sexec.interpreter.IStatementInterpreter
-import org.yakindu.sct.model.sexec.interpreter.ITimingService
-import org.yakindu.sct.model.sgraph.Declaration
-import org.yakindu.sct.model.sgraph.Event
-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.InterfaceScope
-import org.yakindu.sct.model.stext.stext.InternalScope
-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.runtime.AbstractExecutionFacade
-import org.yakindu.sct.simulation.core.runtime.IEventSlot
-import org.yakindu.sct.simulation.core.runtime.IExecutionContext
-import org.yakindu.sct.simulation.core.runtime.ISlot
-import org.yakindu.sct.simulation.core.runtime.impl.ExecutionEvent
-import org.yakindu.sct.simulation.core.runtime.impl.ExecutionVariable
-import org.yakindu.sct.model.sexec.transformation.SexecExtensions
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-class ExecutionFlowInterpreter extends AbstractExecutionFacade implements IExecutionFlowInterpreter {
-	
-	
-	@Inject
-	IStatementInterpreter interpreter
-	@Inject
-	IExecutionContext executionContext
-	@Inject
-	IQualifiedNameProvider provider
-	@Inject 
-	ITimingService timingService
-	@Inject extension ISTextTypeSystem 
-	@Inject extension ISTextTypeInferrer
-	
-	@Inject extension SexecExtensions
-	 
-	@Inject
-	@Named("InterpreterName")
-	String interpreterName
-	
-	ExecutionFlow flow
-	List<EventDefinition> inEvents
-	List<EventDefinition> outEvents
-	List<EventDefinition> localEvents
-	List<TimeEvent> timeEvents
-	
-	Map<Declaration, ISlot> slotMap 
-	
-	int nextSVIdx
-	
-	TraceBeginRunCycle brc  
-	TraceEndRunCycle erc  
-
-	override initialize(ExecutionFlow flow) {
-		this.flow = flow;
-		
-		slotMap = new HashMap<Declaration, ISlot>();
-		
-		for(scope : flow.scopes){
-			scope.declareContents
-		} 
-		
-		executionContext.initStateConfigurationVector(flow.stateVector.size)
-		interpreter.setOperationCallbacks(super.callbacks)
-		brc = SexecFactory::eINSTANCE.createTraceBeginRunCycle
-		erc = SexecFactory::eINSTANCE.createTraceEndRunCycle
-		
-		inEvents = flow.scopes.map( s | s.declarations.filter( typeof(EventDefinition) ).filter( e | e.direction == Direction::IN) ).flatten.toList
-		outEvents = flow.scopes.map( s | s.declarations.filter( typeof(EventDefinition) ).filter( e | e.direction == Direction::OUT) ).flatten.toList
-		localEvents = flow.scopes.map( s | s.declarations.filter( typeof(EventDefinition) ).filter( e | e.direction == Direction::LOCAL) ).flatten.toList
-		timeEvents = flow.scopes.map( s | s.declarations.filter( typeof(TimeEvent) )).flatten.toList
-		
-		flow.initSequence.execute
-		
-	}
-	
-	override tearDown(){
-		timingService.stop
-	}
-	
-	override getName(){
-		interpreterName
-	}
-	
-	def dispatch declareContents(InternalScope scope) {
-		for(declaration : scope.declarations){
-				declaration.addToScope
-		}
-	} 
-	
-	def dispatch declareContents(Scope scope){
-		for(declaration : scope.declarations){
-				declaration.addToScope
-		}
-	}
-	
-	def dispatch declareContents(InterfaceScope scope){
-		for(declaration : scope.declarations){
-				declaration.addToScope
-		}
-	}
-	
-	override runCycle() {
-		executionContext.flush
-		
-		nextSVIdx = 0; // this is a member that can be manipulated during state reactions in case of orthogonality
-		
-		brc.execute
-		
-		clearOutEvents()
-		
-		while (nextSVIdx < executionContext.stateConfiguration.size) {
-			var state = executionContext.stateConfiguration.get(nextSVIdx)
-			if (state != null) state.reactSequence.execute			
-			nextSVIdx = nextSVIdx + 1
-		}  
-		
-		//executionContext.resetRaisedEvents
-
-		clearEvents()
-		
-		erc.execute		
-	} 
-
-
-	def clearOutEvents() {
-		// val outEvents = flow.scopes.map( s | s.declarations.filter( typeof(EventDefinition) ).filter( e | e.direction == Direction::OUT) ).flatten
-//		outEvents.forEach( e | executionContext.unraiseEvent(provider.qualifiedName(e).toString))
-		outEvents.forEach( e | e.unraise)
-	}
-	
-	
-	def clearEvents() {
-		//val events = flow.scopes.map( s | s.declarations.filter( typeof(EventDefinition) ).filter( e | e.direction != Direction::OUT) ).flatten
-		//val timeEvents = flow.scopes.map( s | s.declarations.filter( typeof(TimeEvent) )).flatten
-//		inEvents.forEach( e | executionContext.unraiseEvent(provider.qualifiedName(e).toString))
-//		localEvents.forEach( e | executionContext.unraiseEvent(provider.qualifiedName(e).toString))
-//		timeEvents.forEach( e | executionContext.unraiseEvent(provider.qualifiedName(e).toString))
-		inEvents.forEach( e | e.unraise)
-		localEvents.forEach( e | e.unraise)
-		timeEvents.forEach( e | e.unraise)
-	}
-	
-	
-	def unraise(Event it) {
-		(slotMap.get(it) as IEventSlot).unraise
-	}
-
-	def dispatch void addToScope(VariableDefinition variable){
-		var fqName = provider.getFullyQualifiedName(variable).toString
-		
-		var type = variable.inferType.type
-		var ExecutionVariable varSlot = new ExecutionVariable(fqName,type, type.defaultValue)
-		
-		executionContext.declareVariable(varSlot);
-		slotMap.put(variable, varSlot);
-	}  
-	
-	def dispatch void addToScope(EventDefinition event){
-		var fqName = provider.getFullyQualifiedName(event).toString
-		
-		val type = event.inferType.type
-		var ExecutionEvent eventSlot = new ExecutionEvent(fqName,type,type.defaultValue)
-		 
-		executionContext.declareEvent(eventSlot)
-		slotMap.put(event, eventSlot)
-	}
-	
-	
-	def dispatch void addToScope(OperationDefinition op){
-		var fqName = provider.getFullyQualifiedName(op).toString
-		val type = new InferredType(op.type)
-		val opSlot = new ExecutionVariable(fqName, type, type.defaultValue);
-		
-		executionContext.declareVariable(opSlot)
-		slotMap.put(op, opSlot)
-	}
-	
-	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
-		}
-	}
-	
-	def dispatch void addToScope(TimeEvent event){
-		val eventSlot = new ExecutionEvent(event.name, new InferredType(integerType))
-		executionContext.declareEvent(eventSlot) 
-		slotMap.put(event, eventSlot)
-	}
-
-	override enter() {
-		if (flow.enterSequences.defaultSequence != null) {
-			for(step : flow.enterSequences.defaultSequence.steps){
-				step.execute
-			} 		
-		}
-	}
-	
-	override exit() {
-		for(step : flow.exitSequence.steps){
-			step.execute
-		} 
-	}
-	
-	def dispatch execute(Step step){
-		println("Missing dispatch function for " + step)
-	}
-	def dispatch execute(Call call){
-		call.step.execute
-		null
-	}
-	
-	def dispatch execute(Trace trace){
-		notifyTraceStepEntered(trace)
-		null
-	}
-	
-	def dispatch execute(Check check){
-		if(check.condition == null)
-			return true
-		var interpreterResult =  interpreter.evaluateStatement(check.condition, executionContext)
-		return interpreterResult
-		
-	}
-	
-	def dispatch execute(EnterState enterState){
-		executionContext.stateConfiguration.set(enterState.state.stateVector.offset, enterState.state)
-		nextSVIdx = enterState.state.stateVector.offset // mark all state vector elements up to this as processed ...		
-		null
-	}
-
-	def dispatch execute(HistoryEntry entry){
-		if (executionContext.getHistoryStateConfiguration(entry.region) != null) {
-			entry.historyStep.execute
-		} else {
-			if (entry.initialStep == null) {
-				//TODO handle model error
-				println("Missing initial transition " + entry)
-			} else {
-				entry.initialStep.execute
-			}
-		}
-		null
-	}
-	
-	def dispatch execute(Execution execution){ 
-		interpreter.evaluateStatement(execution.statement, executionContext)
-	}
-	
-	def dispatch execute(ExitState exitState){
-		executionContext.stateConfiguration.set(exitState.state.stateVector.offset, null)
-		null
-	}
-	
-	def dispatch execute(If ifStep){
-		var check  = execute(ifStep.check)
-		if(check as Boolean){
-			execute(ifStep.thenStep)
-		}
-		else if(ifStep.elseStep != null){
-			execute(ifStep.elseStep)
-		}
-		null
-	}
-	
-	def dispatch execute(Sequence sequence){
-		for(step : sequence.steps){
-			step.execute
-		}
-		null
-	}
-	
-	def dispatch execute(SaveHistory action){
-		executionContext.saveHistoryStateConfiguration(action.region);
-		null
-	} 
-	
-	def dispatch execute(StateSwitch stateSwitch){
-		val historyRegion = stateSwitch.historyRegion
-		if (historyRegion != null) {
-			val historyState = executionContext.getHistoryStateConfiguration(historyRegion)
-			for(stateCase : stateSwitch.cases) {
-				if(historyState == stateCase.state){
-					stateCase.step.execute
-				}
-			}
-			
-		} else {			
-			for(stateCase : stateSwitch.cases)
-				if(executionContext.stateConfiguration.contains(stateCase.state)){
-					stateCase.step.execute
-				} 
-		}
-		null 
-	}
-	
-	def dispatch execute(ScheduleTimeEvent scheduleTimeEvent){
-		var timeEvent = scheduleTimeEvent.timeEvent
-		var duration = interpreter.evaluateStatement(scheduleTimeEvent.timeValue, executionContext)
-		timingService.scheduleTimeEvent(executionContext,timeEvent.name,timeEvent.periodic, duration as Integer)
-		null
-	}
-	
-	def dispatch execute(UnscheduleTimeEvent timeEvent){
-		timingService.unscheduleTimeEvent(timeEvent.timeEvent.name)
-		null
-	}
-	
-	
-	override getExecutionContext() {
-		return executionContext;
-	}
-	
-}

+ 0 - 86
plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/impl/TimerTaskTimingService.java

@@ -1,86 +0,0 @@
-/**
- * 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.model.sexec.interpreter.impl;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import org.yakindu.sct.model.sexec.interpreter.ITimingService;
-import org.yakindu.sct.simulation.core.runtime.IExecutionContext;
-
-/**
- * Implementation of {@link ITimingService} interface using standard
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class TimerTaskTimingService implements ITimingService {
-
-	private Timer timer;
-
-	private Map<String, TimerTask> timerTasks;
-
-	public TimerTaskTimingService() {
-		timer = new Timer();
-		timerTasks = new HashMap<String, TimerTask>();
-	}
-
-	public void scheduleTimeEvent(IExecutionContext 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 IExecutionContext context;
-		private final String eventName;
-
-		public TimeEventTask(IExecutionContext context, String eventName) {
-			this.context = context;
-			this.eventName = eventName;
-		}
-
-		public void run() {
-			context.scheduleEvent(eventName, null);
-		}
-	}
-
-	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();
-	}
-
-}

+ 0 - 87
plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/stext/AbstractStatementInterpreter.java

@@ -1,87 +0,0 @@
-/**
- * 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.model.sexec.interpreter.stext;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.emf.common.util.WrappedException;
-import org.eclipse.xtext.util.PolymorphicDispatcher;
-import org.yakindu.sct.model.sexec.interpreter.IStatementInterpreter;
-import org.yakindu.sct.model.stext.stext.OperationDefinition;
-
-/**
- * 
- * @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>();
-
-	protected List<Object> operationCallback;
-
-	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;
-	}
-
-	public void setOperationCallbacks(List<Object> callbacks) {
-		this.operationCallback = callbacks;
-	}
-
-	public Object executeOperationCallback(OperationDefinition definition,
-			Object... parameter) {
-		PolymorphicDispatcher<Object> dispatcher = new PolymorphicDispatcher<Object>(
-				definition.getName(), definition.getParameters().size(),
-				definition.getParameters().size(), operationCallback);
-		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);
-		}
-	}
-
-}

+ 0 - 876
plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/stext/CoreFunction.java

@@ -1,876 +0,0 @@
-/**
- * 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.model.sexec.interpreter.stext;
-
-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;
-	}
-}

+ 0 - 224
plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/stext/Function.java

@@ -1,224 +0,0 @@
-/**
- * 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.model.sexec.interpreter.stext;
-
-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());
-		}
-	}
-
-}

+ 0 - 73
plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/stext/Signature.java

@@ -1,73 +0,0 @@
-/**
- * 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.model.sexec.interpreter.stext;
-
-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;
-	}
-	
-	
-
-}

+ 0 - 275
plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/stext/StextStatementInterpreter.xtend

@@ -1,275 +0,0 @@
-/**
- * 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.model.sexec.interpreter.stext
-
-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.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.runtime.IExecutionContext
-import org.yakindu.base.types.Enumerator
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API 
- * @authos axel terfloth - additions
- * 
- */
-class StextStatementInterpreter extends AbstractStatementInterpreter {
-	
-	@Inject
-	extension IQualifiedNameProvider provider 
-	
-	protected IExecutionContext context
-	
-	override Object evaluateStatement(Statement statement,
-			IExecutionContext context){
-		this.context = context
-		statement.execute()
-	}
-	
-	def dispatch execute(Statement statement){
-		null
-	}
-
-	def dispatch execute(AssignmentExpression assignment){
-//		var scopeVariable = context.getVariable(assignment.varRef.variable.fullyQualifiedName.toString)
-		var scopeVariable = context.getVariable(assignment.varRef.variable.fullyQualifiedName.toString)
-		var result = assignment.expression.execute
-		if(assignment.operator == AssignmentOperator::ASSIGN){
-			context.setSlotValue(scopeVariable.getName, result)
-		}else{
-			var operator = AbstractStatementInterpreter::assignFunctionMap.get(assignment.operator.getName())
-			context.setSlotValue(scopeVariable.name, evaluate(operator, scopeVariable.getValue,result))
-		}
-		context.getVariable(scopeVariable.name).value		
-	}
-	
-	
-	def dispatch variable(ElementReferenceExpression e) {
-		if (e.reference instanceof VariableDefinition) e.reference else null	
-	} 
-	
-	
-	def dispatch variable(FeatureCall e) {
-		if (e.feature instanceof VariableDefinition) e.feature else null
-	}
-	
-	def dispatch 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 execute(EventRaisingExpression eventRaising){
-		if(eventRaising.value != null){
-			context.raiseEvent(eventRaising.event.event.fullyQualifiedName.toString, eventRaising.value.execute)
-		}else {
-			context.raiseEvent(eventRaising.event.event.fullyQualifiedName.toString, null)
-		}
-		null
-	}
-	
-	def dispatch Object execute(ConditionalExpression expression){
-		if(expression.condition.execute as Boolean ){
-			return expression.trueCase.execute
-		}else{
-			return expression.falseCase.execute
-		}
-	} 
-	
-	def dispatch execute(ElementReferenceExpression expression){
-		if(expression.operationCall && super.operationCallback.size() > 0){
-			var parameter = expression.args.map(it| execute)
-			return super.executeOperationCallback(expression.reference as OperationDefinition, parameter.toArray)
-		}
-		var variableRef = context.getVariable(expression.reference.fullyQualifiedName.toString)
-		if(variableRef != null){
-			return variableRef.getValue
-		}
-		return context.isEventRaised(expression.reference.fullyQualifiedName.toString)
-	}
-	
-	def dispatch 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.fullyQualifiedName.toString
-	}
-
-	def dispatch qname(ElementReferenceExpression e) {
-		e.reference.fullyQualifiedName.toString
-	}
-	
-	def dispatch execute(ActiveStateReferenceExpression expression){
-		for(activeState : context.allActiveStates){
-			if(activeState == expression.value){
-				return true;
-			}
-		}
-		return false;
-	}
-	
-	def dispatch 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 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 execute(LogicalNotExpression expression){
-		return ! (expression.operand.execute() as Boolean)
-	}
-	def dispatch execute(BitwiseAndExpression expression){
-		executeBinaryCoreFunction(expression.leftOperand, expression.rightOperand, CoreFunction::BIT_AND)
-	}
-	def dispatch execute(BitwiseOrExpression expression){
-		executeBinaryCoreFunction(expression.leftOperand, expression.rightOperand, CoreFunction::BIT_OR)
-	}
-	def dispatch execute(BitwiseXorExpression expression){
-		executeBinaryCoreFunction(expression.leftOperand, expression.rightOperand, CoreFunction::BIT_XOR)		
-	}
-	def dispatch execute(LogicalRelationExpression expression){
-		executeBinaryCoreFunction(expression.leftOperand, expression.rightOperand, expression.operator.getName())
-	}
-	def dispatch execute(NumericalAddSubtractExpression expression){
-		executeBinaryCoreFunction(expression.leftOperand, expression.rightOperand, expression.operator.literal)
-	}
-	def dispatch execute(NumericalMultiplyDivideExpression expression){
-		executeBinaryCoreFunction(expression.leftOperand, expression.rightOperand, expression.operator.getName())
-	}
-	def dispatch execute(ShiftExpression expression){
-		executeBinaryCoreFunction(expression.leftOperand, expression.rightOperand, expression.operator.getName())
-	}
-	def dispatch 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 execute(FeatureCall call){
-		if(call.operationCall && super.operationCallback.size() > 0){
-			var parameter = call.args.map(it| execute)
-			return super.executeOperationCallback(call.feature as OperationDefinition, parameter.toArray)
-		}
-		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.isEventRaised(fqn)
-		}
-	}
-
-    def String fqn(EObject obj) {
-    	obj.fullyQualifiedName.toString
-    } 
-
-	def dispatch execute(ParenthesizedExpression e){
-		e.expression.execute()
-	}
-	
-	
-	def dispatch 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
-	}
-		
-}