فهرست منبع

Fixed event life cycle handling in interpreter.

terfloth@itemis.de 13 سال پیش
والد
کامیت
8c725e6c07
21فایلهای تغییر یافته به همراه503 افزوده شده و 82 حذف شده
  1. 75 12
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/impl/ExecutionFlowInterpreter.xtend
  2. 1 1
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/impl/TimerTaskTimingService.java
  3. 1 0
      plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/stext/StextStatementInterpreter.xtend
  4. 155 16
      plugins/org.yakindu.sct.model.sexec.interpreter/xtend-gen/org/yakindu/sct/model/sexec/interpreter/impl/ExecutionFlowInterpreter.java
  5. BIN
      plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/.StructureMapping.java._trace
  6. 33 0
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/IEventSlot.java
  7. 46 2
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/IExecutionContext.java
  8. 2 4
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/IExecutionContextListener.java
  9. 39 0
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/ISlot.java
  10. 5 0
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/ISlotChangedEvent.java
  11. 6 0
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/ISlotContext.java
  12. 5 3
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/AbstractExecutionContext.java
  13. 28 3
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/AbstractSlot.java
  14. 48 27
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/ExecutionContextImpl.java
  15. 42 1
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/ExecutionEvent.java
  16. 4 3
      plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/ExecutionContextContentProvider.java
  17. 2 1
      plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/ExecutionContextLabelProvider.java
  18. 3 2
      plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/SimulationView.java
  19. 2 2
      plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/editing/BooleanEditingSupport.java
  20. 4 3
      plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/editing/ScopeSlotEditingSupport.java
  21. 2 2
      plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/editing/StringEditingSupport.java

+ 75 - 12
plugins/org.yakindu.sct.model.sexec.interpreter/src/org/yakindu/sct/model/sexec/interpreter/impl/ExecutionFlowInterpreter.xtend

@@ -47,6 +47,15 @@ import org.yakindu.sct.simulation.core.runtime.AbstractExecutionFacade
 import org.yakindu.sct.simulation.core.runtime.IExecutionContext
 import org.yakindu.sct.simulation.core.runtime.impl.ExecutionEvent
 import org.yakindu.sct.simulation.core.runtime.impl.ExecutionVariable
+import org.yakindu.sct.model.stext.stext.Direction
+import java.util.List
+import java.util.ArrayList
+import java.util.Map
+import org.yakindu.sct.model.sgraph.Declaration
+import org.yakindu.sct.simulation.core.runtime.ISlot
+import java.util.HashMap
+import org.yakindu.sct.simulation.core.runtime.IEventSlot
+import org.yakindu.sct.model.sgraph.Event
 
 /**
  * 
@@ -72,6 +81,13 @@ class ExecutionFlowInterpreter extends AbstractExecutionFacade implements IExecu
 	String interpreterName
 	
 	ExecutionFlow flow
+	List<EventDefinition> inEvents
+	List<EventDefinition> outEvents
+	List<EventDefinition> localEvents
+	List<TimeEvent> timeEvents
+	
+	Map<Declaration, ISlot> slotMap 
+	
 	int nextSVIdx
 	
 	TraceBeginRunCycle brc  
@@ -79,6 +95,9 @@ class ExecutionFlowInterpreter extends AbstractExecutionFacade implements IExecu
 
 	override initialize(ExecutionFlow flow) {
 		this.flow = flow;
+		
+		slotMap = new HashMap<Declaration, ISlot>();
+		
 		for(scope : flow.scopes){
 			scope.declareContents
 		} 
@@ -88,6 +107,11 @@ class ExecutionFlowInterpreter extends AbstractExecutionFacade implements IExecu
 		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
 		
 	}
@@ -125,61 +149,98 @@ class ExecutionFlowInterpreter extends AbstractExecutionFacade implements IExecu
 		
 		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
+		//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.qualifiedName(variable).toString
+		var ExecutionVariable varSlot 
+		
 		if(variable.type.^boolean){
-			executionContext.declareVariable(new ExecutionVariable(fqName ,typeof(Boolean),false))
+			varSlot = new ExecutionVariable(fqName ,typeof(Boolean),false)
 		} 
 		else if (variable.type.integer){
-			executionContext.declareVariable(new ExecutionVariable(fqName,typeof(Integer),0))
+			varSlot = new ExecutionVariable(fqName,typeof(Integer),0)
 		}
 		else if(variable.type.real){
-			executionContext.declareVariable(new ExecutionVariable(fqName,typeof(Float),Float::parseFloat("0.0")))
+			varSlot = new ExecutionVariable(fqName,typeof(Float),0.0f)
 		}
 		else if (variable.type.string){
-			executionContext.declareVariable(new ExecutionVariable(fqName,typeof(String),""))
+			varSlot = new ExecutionVariable(fqName,typeof(String),"")
 		}
+		
+		executionContext.declareVariable(varSlot);
+		slotMap.put(variable, varSlot);
 	}  
 	
 	def dispatch void addToScope(EventDefinition event){
 		var fqName = provider.qualifiedName(event).toString
+		var ExecutionEvent eventSlot
+		
 		if(event.type.^boolean){
-				executionContext.declareEvent(new ExecutionEvent(fqName,typeof(Boolean),false))
+			eventSlot = new ExecutionEvent(fqName,typeof(Boolean),false)
 		}
 		else if(event.type.integer){
-			executionContext.declareEvent(new ExecutionEvent(fqName,typeof(Integer),0))
+			eventSlot = new ExecutionEvent(fqName,typeof(Integer),0)
 		}
 		else if(event.type.real){
-			executionContext.declareEvent(new ExecutionEvent(fqName,typeof(Float),Float::parseFloat("0.0")))
+			eventSlot = new ExecutionEvent(fqName,typeof(Float),0.0f)
 		}
 		else if(event.type.^void){
-				executionContext.declareEvent(new ExecutionEvent(fqName,typeof(Void)))
+			eventSlot = new ExecutionEvent(fqName,typeof(Void))
 		}
 		else if (event.type.string){
-			executionContext.declareEvent(new ExecutionEvent(fqName,typeof(String),""))
+			eventSlot = new ExecutionEvent(fqName,typeof(String),"")
 		}
 		 
+		executionContext.declareEvent(eventSlot)
+		slotMap.put(event, eventSlot)
 	}
 	
 	
 	def dispatch void addToScope(OperationDefinition op){
 		var fqName = provider.qualifiedName(op).toString
 		var type = op.type.mappedType
+		val opSlot = new ExecutionVariable(fqName, type, type.defaultValue);
 		
-		executionContext.declareVariable(new ExecutionVariable(fqName, type, type.defaultValue))
+		executionContext.declareVariable(opSlot)
+		slotMap.put(op, opSlot)
 	}
 	
 	def Class<?> mappedType(Type it) {
@@ -202,7 +263,9 @@ class ExecutionFlowInterpreter extends AbstractExecutionFacade implements IExecu
 	}
 	
 	def dispatch void addToScope(TimeEvent event){
-		executionContext.declareEvent(new ExecutionEvent(event.name, typeof(Long))) 
+		val eventSlot = new ExecutionEvent(event.name, typeof(Long))
+		executionContext.declareEvent(eventSlot) 
+		slotMap.put(event, eventSlot)
 	}
 
 	override enter() {

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

@@ -63,7 +63,7 @@ public class TimerTaskTimingService implements ITimingService {
 		}
 
 		public void run() {
-			context.raiseEvent(eventName, null);
+			context.scheduleEvent(eventName, null);
 		}
 	}
 

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

@@ -70,6 +70,7 @@ class StextStatementInterpreter extends AbstractStatementInterpreter {
 	}
 
 	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){

+ 155 - 16
plugins/org.yakindu.sct.model.sexec.interpreter/xtend-gen/org/yakindu/sct/model/sexec/interpreter/impl/ExecutionFlowInterpreter.java

@@ -1,14 +1,21 @@
 package org.yakindu.sct.model.sexec.interpreter.impl;
 
 import com.google.common.base.Objects;
+import com.google.common.collect.Iterables;
 import com.google.inject.Inject;
 import com.google.inject.name.Named;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.xtext.naming.QualifiedName;
 import org.eclipse.xtext.xbase.lib.Conversions;
+import org.eclipse.xtext.xbase.lib.Functions.Function1;
 import org.eclipse.xtext.xbase.lib.InputOutput;
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
+import org.eclipse.xtext.xbase.lib.ListExtensions;
+import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
 import org.yakindu.base.types.ITypeSystemAccess;
 import org.yakindu.base.types.Type;
 import org.yakindu.sct.model.sexec.Call;
@@ -38,16 +45,20 @@ 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.sgraph.Statement;
 import org.yakindu.sct.model.stext.naming.StextNameProvider;
+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.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;
 
@@ -77,6 +88,16 @@ public class ExecutionFlowInterpreter extends AbstractExecutionFacade implements
   
   private ExecutionFlow flow;
   
+  private List<EventDefinition> inEvents;
+  
+  private List<EventDefinition> outEvents;
+  
+  private List<EventDefinition> localEvents;
+  
+  private List<TimeEvent> timeEvents;
+  
+  private Map<Declaration,ISlot> slotMap;
+  
   private int nextSVIdx;
   
   private TraceBeginRunCycle brc;
@@ -85,6 +106,8 @@ public class ExecutionFlowInterpreter extends AbstractExecutionFacade implements
   
   public void initialize(final ExecutionFlow flow) {
     this.flow = flow;
+    HashMap<Declaration,ISlot> _hashMap = new HashMap<Declaration,ISlot>();
+    this.slotMap = _hashMap;
     EList<Scope> _scopes = flow.getScopes();
     for (final Scope scope : _scopes) {
       this.declareContents(scope);
@@ -98,6 +121,78 @@ public class ExecutionFlowInterpreter extends AbstractExecutionFacade implements
     this.brc = _createTraceBeginRunCycle;
     TraceEndRunCycle _createTraceEndRunCycle = SexecFactory.eINSTANCE.createTraceEndRunCycle();
     this.erc = _createTraceEndRunCycle;
+    EList<Scope> _scopes_1 = flow.getScopes();
+    final Function1<Scope,Iterable<EventDefinition>> _function = new Function1<Scope,Iterable<EventDefinition>>() {
+        public Iterable<EventDefinition> apply(final Scope s) {
+          EList<Declaration> _declarations = s.getDeclarations();
+          Iterable<EventDefinition> _filter = Iterables.<EventDefinition>filter(_declarations, EventDefinition.class);
+          final Function1<EventDefinition,Boolean> _function = new Function1<EventDefinition,Boolean>() {
+              public Boolean apply(final EventDefinition e) {
+                Direction _direction = e.getDirection();
+                boolean _equals = Objects.equal(_direction, Direction.IN);
+                return Boolean.valueOf(_equals);
+              }
+            };
+          Iterable<EventDefinition> _filter_1 = IterableExtensions.<EventDefinition>filter(_filter, _function);
+          return _filter_1;
+        }
+      };
+    List<Iterable<EventDefinition>> _map = ListExtensions.<Scope, Iterable<EventDefinition>>map(_scopes_1, _function);
+    Iterable<EventDefinition> _flatten = Iterables.<EventDefinition>concat(_map);
+    List<EventDefinition> _list = IterableExtensions.<EventDefinition>toList(_flatten);
+    this.inEvents = _list;
+    EList<Scope> _scopes_2 = flow.getScopes();
+    final Function1<Scope,Iterable<EventDefinition>> _function_1 = new Function1<Scope,Iterable<EventDefinition>>() {
+        public Iterable<EventDefinition> apply(final Scope s) {
+          EList<Declaration> _declarations = s.getDeclarations();
+          Iterable<EventDefinition> _filter = Iterables.<EventDefinition>filter(_declarations, EventDefinition.class);
+          final Function1<EventDefinition,Boolean> _function = new Function1<EventDefinition,Boolean>() {
+              public Boolean apply(final EventDefinition e) {
+                Direction _direction = e.getDirection();
+                boolean _equals = Objects.equal(_direction, Direction.OUT);
+                return Boolean.valueOf(_equals);
+              }
+            };
+          Iterable<EventDefinition> _filter_1 = IterableExtensions.<EventDefinition>filter(_filter, _function);
+          return _filter_1;
+        }
+      };
+    List<Iterable<EventDefinition>> _map_1 = ListExtensions.<Scope, Iterable<EventDefinition>>map(_scopes_2, _function_1);
+    Iterable<EventDefinition> _flatten_1 = Iterables.<EventDefinition>concat(_map_1);
+    List<EventDefinition> _list_1 = IterableExtensions.<EventDefinition>toList(_flatten_1);
+    this.outEvents = _list_1;
+    EList<Scope> _scopes_3 = flow.getScopes();
+    final Function1<Scope,Iterable<EventDefinition>> _function_2 = new Function1<Scope,Iterable<EventDefinition>>() {
+        public Iterable<EventDefinition> apply(final Scope s) {
+          EList<Declaration> _declarations = s.getDeclarations();
+          Iterable<EventDefinition> _filter = Iterables.<EventDefinition>filter(_declarations, EventDefinition.class);
+          final Function1<EventDefinition,Boolean> _function = new Function1<EventDefinition,Boolean>() {
+              public Boolean apply(final EventDefinition e) {
+                Direction _direction = e.getDirection();
+                boolean _equals = Objects.equal(_direction, Direction.LOCAL);
+                return Boolean.valueOf(_equals);
+              }
+            };
+          Iterable<EventDefinition> _filter_1 = IterableExtensions.<EventDefinition>filter(_filter, _function);
+          return _filter_1;
+        }
+      };
+    List<Iterable<EventDefinition>> _map_2 = ListExtensions.<Scope, Iterable<EventDefinition>>map(_scopes_3, _function_2);
+    Iterable<EventDefinition> _flatten_2 = Iterables.<EventDefinition>concat(_map_2);
+    List<EventDefinition> _list_2 = IterableExtensions.<EventDefinition>toList(_flatten_2);
+    this.localEvents = _list_2;
+    EList<Scope> _scopes_4 = flow.getScopes();
+    final Function1<Scope,Iterable<TimeEvent>> _function_3 = new Function1<Scope,Iterable<TimeEvent>>() {
+        public Iterable<TimeEvent> apply(final Scope s) {
+          EList<Declaration> _declarations = s.getDeclarations();
+          Iterable<TimeEvent> _filter = Iterables.<TimeEvent>filter(_declarations, TimeEvent.class);
+          return _filter;
+        }
+      };
+    List<Iterable<TimeEvent>> _map_3 = ListExtensions.<Scope, Iterable<TimeEvent>>map(_scopes_4, _function_3);
+    Iterable<TimeEvent> _flatten_3 = Iterables.<TimeEvent>concat(_map_3);
+    List<TimeEvent> _list_3 = IterableExtensions.<TimeEvent>toList(_flatten_3);
+    this.timeEvents = _list_3;
     Sequence _initSequence = flow.getInitSequence();
     this.execute(_initSequence);
   }
@@ -135,6 +230,7 @@ public class ExecutionFlowInterpreter extends AbstractExecutionFacade implements
     this.executionContext.flush();
     this.nextSVIdx = 0;
     this.execute(this.brc);
+    this.clearOutEvents();
     ExecutionState[] _stateConfiguration = this.executionContext.getStateConfiguration();
     int _size = ((List<ExecutionState>)Conversions.doWrapArray(_stateConfiguration)).size();
     boolean _lessThan = (this.nextSVIdx < _size);
@@ -156,81 +252,120 @@ public class ExecutionFlowInterpreter extends AbstractExecutionFacade implements
       boolean _lessThan_1 = (this.nextSVIdx < _size_1);
       _while = _lessThan_1;
     }
-    this.executionContext.resetRaisedEvents();
+    this.clearEvents();
     this.execute(this.erc);
   }
   
+  public void clearOutEvents() {
+    final Procedure1<EventDefinition> _function = new Procedure1<EventDefinition>() {
+        public void apply(final EventDefinition e) {
+          ExecutionFlowInterpreter.this.unraise(e);
+        }
+      };
+    IterableExtensions.<EventDefinition>forEach(this.outEvents, _function);
+  }
+  
+  public void clearEvents() {
+    final Procedure1<EventDefinition> _function = new Procedure1<EventDefinition>() {
+        public void apply(final EventDefinition e) {
+          ExecutionFlowInterpreter.this.unraise(e);
+        }
+      };
+    IterableExtensions.<EventDefinition>forEach(this.inEvents, _function);
+    final Procedure1<EventDefinition> _function_1 = new Procedure1<EventDefinition>() {
+        public void apply(final EventDefinition e) {
+          ExecutionFlowInterpreter.this.unraise(e);
+        }
+      };
+    IterableExtensions.<EventDefinition>forEach(this.localEvents, _function_1);
+    final Procedure1<TimeEvent> _function_2 = new Procedure1<TimeEvent>() {
+        public void apply(final TimeEvent e) {
+          ExecutionFlowInterpreter.this.unraise(e);
+        }
+      };
+    IterableExtensions.<TimeEvent>forEach(this.timeEvents, _function_2);
+  }
+  
+  public void unraise(final Event it) {
+    ISlot _get = this.slotMap.get(it);
+    ((IEventSlot) _get).unraise();
+  }
+  
   protected void _addToScope(final VariableDefinition variable) {
     QualifiedName _qualifiedName = this.provider.qualifiedName(variable);
     String fqName = _qualifiedName.toString();
+    ExecutionVariable varSlot = null;
     Type _type = variable.getType();
     boolean _isBoolean = this.ts.isBoolean(_type);
     if (_isBoolean) {
       ExecutionVariable _executionVariable = new ExecutionVariable(fqName, Boolean.class, Boolean.valueOf(false));
-      this.executionContext.declareVariable(_executionVariable);
+      varSlot = _executionVariable;
     } else {
       Type _type_1 = variable.getType();
       boolean _isInteger = this.ts.isInteger(_type_1);
       if (_isInteger) {
         ExecutionVariable _executionVariable_1 = new ExecutionVariable(fqName, Integer.class, Integer.valueOf(0));
-        this.executionContext.declareVariable(_executionVariable_1);
+        varSlot = _executionVariable_1;
       } else {
         Type _type_2 = variable.getType();
         boolean _isReal = this.ts.isReal(_type_2);
         if (_isReal) {
-          float _parseFloat = Float.parseFloat("0.0");
-          ExecutionVariable _executionVariable_2 = new ExecutionVariable(fqName, Float.class, Float.valueOf(_parseFloat));
-          this.executionContext.declareVariable(_executionVariable_2);
+          ExecutionVariable _executionVariable_2 = new ExecutionVariable(fqName, Float.class, Float.valueOf(0.0f));
+          varSlot = _executionVariable_2;
         } else {
           Type _type_3 = variable.getType();
           boolean _isString = this.ts.isString(_type_3);
           if (_isString) {
             ExecutionVariable _executionVariable_3 = new ExecutionVariable(fqName, String.class, "");
-            this.executionContext.declareVariable(_executionVariable_3);
+            varSlot = _executionVariable_3;
           }
         }
       }
     }
+    this.executionContext.declareVariable(varSlot);
+    this.slotMap.put(variable, varSlot);
   }
   
   protected void _addToScope(final EventDefinition event) {
     QualifiedName _qualifiedName = this.provider.qualifiedName(event);
     String fqName = _qualifiedName.toString();
+    ExecutionEvent eventSlot = null;
     Type _type = event.getType();
     boolean _isBoolean = this.ts.isBoolean(_type);
     if (_isBoolean) {
       ExecutionEvent _executionEvent = new ExecutionEvent(fqName, Boolean.class, Boolean.valueOf(false));
-      this.executionContext.declareEvent(_executionEvent);
+      eventSlot = _executionEvent;
     } else {
       Type _type_1 = event.getType();
       boolean _isInteger = this.ts.isInteger(_type_1);
       if (_isInteger) {
         ExecutionEvent _executionEvent_1 = new ExecutionEvent(fqName, Integer.class, Integer.valueOf(0));
-        this.executionContext.declareEvent(_executionEvent_1);
+        eventSlot = _executionEvent_1;
       } else {
         Type _type_2 = event.getType();
         boolean _isReal = this.ts.isReal(_type_2);
         if (_isReal) {
-          float _parseFloat = Float.parseFloat("0.0");
-          ExecutionEvent _executionEvent_2 = new ExecutionEvent(fqName, Float.class, Float.valueOf(_parseFloat));
-          this.executionContext.declareEvent(_executionEvent_2);
+          ExecutionEvent _executionEvent_2 = new ExecutionEvent(fqName, Float.class, Float.valueOf(0.0f));
+          eventSlot = _executionEvent_2;
         } else {
           Type _type_3 = event.getType();
           boolean _isVoid = this.ts.isVoid(_type_3);
           if (_isVoid) {
             ExecutionEvent _executionEvent_3 = new ExecutionEvent(fqName, Void.class);
-            this.executionContext.declareEvent(_executionEvent_3);
+            eventSlot = _executionEvent_3;
           } else {
             Type _type_4 = event.getType();
             boolean _isString = this.ts.isString(_type_4);
             if (_isString) {
               ExecutionEvent _executionEvent_4 = new ExecutionEvent(fqName, String.class, "");
-              this.executionContext.declareEvent(_executionEvent_4);
+              eventSlot = _executionEvent_4;
             }
           }
         }
       }
     }
+    this.executionContext.declareEvent(eventSlot);
+    this.slotMap.put(event, eventSlot);
   }
   
   protected void _addToScope(final OperationDefinition op) {
@@ -240,7 +375,9 @@ public class ExecutionFlowInterpreter extends AbstractExecutionFacade implements
     Class<? extends Object> type = this.mappedType(_type);
     Object _defaultValue = this.defaultValue(type);
     ExecutionVariable _executionVariable = new ExecutionVariable(fqName, type, _defaultValue);
-    this.executionContext.declareVariable(_executionVariable);
+    final ExecutionVariable opSlot = _executionVariable;
+    this.executionContext.declareVariable(opSlot);
+    this.slotMap.put(op, opSlot);
   }
   
   public Class<? extends Object> mappedType(final Type it) {
@@ -321,7 +458,9 @@ public class ExecutionFlowInterpreter extends AbstractExecutionFacade implements
   protected void _addToScope(final TimeEvent event) {
     String _name = event.getName();
     ExecutionEvent _executionEvent = new ExecutionEvent(_name, Long.class);
-    this.executionContext.declareEvent(_executionEvent);
+    final ExecutionEvent eventSlot = _executionEvent;
+    this.executionContext.declareEvent(eventSlot);
+    this.slotMap.put(event, eventSlot);
   }
   
   public void enter() {

BIN
plugins/org.yakindu.sct.model.sexec/xtend-gen/org/yakindu/sct/model/sexec/transformation/.StructureMapping.java._trace


+ 33 - 0
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/IEventSlot.java

@@ -0,0 +1,33 @@
+/**
+ * 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.runtime;
+
+/**
+ * Defines the interface of an event slot.
+ * EventSlot are extensions of Slot that adds notion of raising and unraising (resetting) events.
+ *  
+ * @author axel terfloth
+ */
+public interface IEventSlot extends ISlot {
+	
+	
+	public static class SlotEventRaised implements ISlotChangedEvent {}
+	public static class SlotEventUnraised implements ISlotChangedEvent {}
+
+	public static final SlotEventRaised SLOT_EVENT_RAISED = new SlotEventRaised();
+	public static final SlotEventUnraised SLOT_EVENT_UNRAISED = new SlotEventUnraised();
+
+	
+	void raise(Object value);
+	void unraise();
+	boolean isRaised();
+
+}

+ 46 - 2
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/IExecutionContext.java

@@ -22,6 +22,7 @@ import org.yakindu.sct.simulation.core.runtime.impl.ExecutionVariable;
 /**
  * 
  * @author andreas muelder - Initial contribution and API
+ * @author axel terfloth - extensions and refactorings
  * 
  */
 public interface IExecutionContext {
@@ -41,33 +42,69 @@ public interface IExecutionContext {
 	 */
 	public List<ExecutionEvent> getRaisedEvents();
 
+	/**
+	 * @deprecated Event scheduling is not responsibility of the execution context. It should be done by the execution container.
+	 * @return
+	 */
 	public List<ExecutionEvent> getScheduledEvents();
 
 	/**
 	 * Clears the collection of raised events
+	 * 
+	 * @deprecated this method is not appropriate for event life cycle handling. 
 	 */
 	public void resetRaisedEvents();
 
+
+	/** 
+	 * @deprecated Unsetting events should be performed on the ExectionEvent instances.
+	 * @param eventName
+	 */
 	public void unraiseEvent(String eventName);
 
+
+	/**
+	 * @deprecated Event scheduling is not responsibility of the execution context. It should be done by the execution container.
+	 */
 	public void flush();
 
 	/**
-	 * Raises an event with an value, can be null
+	 * Schedules an event with an value that can be null
 	 * 
+	 * @deprecated Event scheduling is not responsibility of the execution context. It should be done by the execution container.
 	 * @throws ExecutionException
 	 *             if the value is incompatible with the declared event type or
 	 *             the Event can not be found
 	 */
+	public void scheduleEvent(String name, Object value) throws ExecutionException;
+
+	
+	/**
+	 * Immediately raises an event with an optional value.
+	 * 
+	 * @deprecated Should be done on the ExecutionEvent instances
+	 * 
+	 * @param name
+	 * @param value
+	 * @throws ExecutionException
+	 */
 	public void raiseEvent(String name, Object value) throws ExecutionException;
 
 	/**
 	 * Returns true if the given event is currently raised, false otherwise
+	 * 
+	 *  @deprecated Should be done on the ExecutionEvent instances
 	 */
 	public boolean isEventRaised(String eventName);
 
+	/**
+	 * @deprecated Event scheduling is not responsibility of the execution context. It should be done by the execution container.
+	 * @param name
+	 * @return
+	 */
 	public boolean isEventScheduled(String name);
 
+	
 	/**
 	 * Returns a readonly (!) List of all variables
 	 */
@@ -85,6 +122,8 @@ public interface IExecutionContext {
 
 	/**
 	 * Changes the value of a variable / event
+	 * 
+	 * @deprecated will be removed ...
 	 */
 	public void setSlotValue(String name, Object value)
 			throws ExecutionException;
@@ -131,8 +170,13 @@ public interface IExecutionContext {
 
 	public void saveHistoryStateConfiguration(ExecutionRegion region);
 
-	public abstract ExecutionEvent getDeclaredEvent(String eventName);
+	public abstract IEventSlot getDeclaredEvent(String eventName);
 
+	/**
+	 * @deprecated
+	 * 
+	 * @param eventName
+	 */
 	public void unscheduleEvent(String eventName);
 
 }

+ 2 - 4
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/IExecutionContextListener.java

@@ -10,8 +10,6 @@
  */
 package org.yakindu.sct.simulation.core.runtime;
 
-import org.yakindu.sct.simulation.core.runtime.impl.AbstractSlot;
-import org.yakindu.sct.simulation.core.runtime.impl.ExecutionEvent;
 
 /**
  * 
@@ -23,10 +21,10 @@ public interface IExecutionContextListener {
 	/**
 	 * called when an event is raised
 	 */
-	public void eventRaised(ExecutionEvent event);
+	public void eventRaised(IEventSlot event);
 
 	/**
 	 * called when a variable value changed
 	 */
-	public void slotValueChanged(AbstractSlot variable);
+	public void slotValueChanged(ISlot variable);
 }

+ 39 - 0
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/ISlot.java

@@ -0,0 +1,39 @@
+/**
+ * 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.runtime;
+
+/**
+ * Defines the interface of a slot that holds a value within an execution context. 
+ * 
+ * The name and type of a slot can be accessed read only. The value can be read and set.
+ * 
+ * @author axel terfloth
+ *
+ */
+public interface ISlot {
+
+	public static class SlotValueChanged implements ISlotChangedEvent {}
+	public static final SlotValueChanged SLOT_VALUE_CHANGED = new SlotValueChanged();
+	
+	void setContext(ISlotContext ctx);
+	ISlotContext getContext();
+	
+	public String getName();
+	
+	public Class<?> getType();
+
+	public void setValue(Object value);
+
+	public Object getValue();
+
+	
+
+}

+ 5 - 0
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/ISlotChangedEvent.java

@@ -0,0 +1,5 @@
+package org.yakindu.sct.simulation.core.runtime;
+
+public interface ISlotChangedEvent {
+
+}

+ 6 - 0
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/ISlotContext.java

@@ -0,0 +1,6 @@
+package org.yakindu.sct.simulation.core.runtime;
+
+public interface ISlotContext {
+
+	void slotChanged(ISlot slot, ISlotChangedEvent changeEvent);
+}

+ 5 - 3
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/AbstractExecutionContext.java

@@ -13,8 +13,10 @@ package org.yakindu.sct.simulation.core.runtime.impl;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.yakindu.sct.simulation.core.runtime.IEventSlot;
 import org.yakindu.sct.simulation.core.runtime.IExecutionContext;
 import org.yakindu.sct.simulation.core.runtime.IExecutionContextListener;
+import org.yakindu.sct.simulation.core.runtime.ISlot;
 
 /**
  * Abstract implementation of {@link IExecutionContext}. Adds some convenience
@@ -44,7 +46,7 @@ public abstract class AbstractExecutionContext implements IExecutionContext {
 		}
 	}
 
-	public void notifyEventRaised(ExecutionEvent event) {
+	public void notifyEventRaised(IEventSlot event) {
 		synchronized (_listeners) {
 			for (IExecutionContextListener listener : _listeners) {
 				listener.eventRaised(event);
@@ -52,7 +54,7 @@ public abstract class AbstractExecutionContext implements IExecutionContext {
 		}
 	}
 
-	public void notifyValueChanged(AbstractSlot slot) {
+	public void notifyValueChanged(ISlot slot) {
 		synchronized (_listeners) {
 			for (IExecutionContextListener listener : _listeners) {
 				listener.slotValueChanged(slot);
@@ -61,7 +63,7 @@ public abstract class AbstractExecutionContext implements IExecutionContext {
 	}
 	
 
-	public ExecutionEvent getDeclaredEvent(String eventName) {
+	public IEventSlot getDeclaredEvent(String eventName) {
 		return null;
 	}
 

+ 28 - 3
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/AbstractSlot.java

@@ -12,13 +12,17 @@ package org.yakindu.sct.simulation.core.runtime.impl;
 
 import org.eclipse.core.runtime.Assert;
 import org.yakindu.sct.simulation.core.runtime.ExecutionException;
+import org.yakindu.sct.simulation.core.runtime.ISlot;
+import org.yakindu.sct.simulation.core.runtime.ISlotContext;
 
 /**
  * @author andreas muelder - Initial contribution and API
+ * @author axel terfloth - refactoring
  * 
  */
-public abstract class AbstractSlot {
+public abstract class AbstractSlot implements ISlot {
 
+	protected ISlotContext context;
 	protected String name;
 	protected String scopeSegment;
 	protected String simpleName;
@@ -49,6 +53,7 @@ public abstract class AbstractSlot {
 		return simpleName;
 	}
 
+	
 	public String getName() {
 		return name;
 	}
@@ -61,7 +66,14 @@ public abstract class AbstractSlot {
 		return value;
 	}
 
-	/* package */void setValue(Object value) {
+	public void setValue(Object value) {
+		assertValue(value);
+		this.value = value;
+		
+		notifyValueChanged();
+	}
+
+	protected void assertValue(Object value) {
 		Assert.isNotNull(value, "Value must not be null ");
 		//TODO refactor
 		if (type == Float.class && value != null && !value.getClass().isAssignableFrom(type)) {
@@ -77,7 +89,20 @@ public abstract class AbstractSlot {
 					+ "\' Can not assign value " + value + " of type"
 					+ value.getClass() + " to type " + type);
 		}
-		this.value = value;
+	}
+
+	public void setContext(ISlotContext ctx) {
+		context = ctx;
+	}
+
+	public ISlotContext getContext() {
+		return context;
+	}
+	
+	protected void notifyValueChanged() {
+		if ( context != null ) {
+			context.slotChanged(this, SLOT_VALUE_CHANGED);
+		}
 	}
 
 }

+ 48 - 27
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/ExecutionContextImpl.java

@@ -25,17 +25,22 @@ import org.yakindu.sct.model.sexec.ExecutionState;
 import org.yakindu.sct.model.sgraph.RegularState;
 import org.yakindu.sct.model.sgraph.State;
 import org.yakindu.sct.simulation.core.runtime.ExecutionException;
+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.ISlotChangedEvent;
+import org.yakindu.sct.simulation.core.runtime.ISlotContext;
 
 import com.google.common.collect.Maps;
 
 /**
  * 
  * @author andreas muelder - Initial contribution and API
+ * @author axel terfloth - extensions and refactorings
  * 
  */
 public class ExecutionContextImpl extends AbstractExecutionContext implements
-		IExecutionContext {
+		IExecutionContext, ISlotContext {
 
 	private List<ExecutionVariable> variables;
 	private List<ExecutionEvent> declaredEvents;
@@ -67,6 +72,7 @@ public class ExecutionContextImpl extends AbstractExecutionContext implements
 
 	public void declareEvent(ExecutionEvent event) {
 		synchronized (declaredEvents) {
+			event.setContext(this);
 			declaredEvents.add(event);
 		}
 	}
@@ -85,7 +91,7 @@ public class ExecutionContextImpl extends AbstractExecutionContext implements
 		}
 	}
 	
-	public void raiseEvent(String eventName, Object value) {
+	public void scheduleEvent(String eventName, Object value) {
 		ExecutionEvent event = getDeclaredEvent(eventName);
 		if (event == null)
 			throw new ExecutionException("Event with name " + eventName
@@ -99,25 +105,26 @@ public class ExecutionContextImpl extends AbstractExecutionContext implements
 		}
 	}
 
-	protected void raiseEventInternal(String eventName, Object value) {
+	public  void raiseEvent(String eventName, Object value) {
 		synchronized (raisedEvents) {
 			ExecutionEvent event = getDeclaredEvent(eventName);
 			if (event == null)
 				throw new ExecutionException("Event with name " + eventName
 						+ " is undefined!");
-			ExecutionEvent eventCopy = event.getCopy();
-			if (value != null) {
-				eventCopy.setValue(value);
-			}
-			raisedEvents.add(eventCopy);
-			notifyEventRaised(eventCopy);
+			event.raise(value);
+//			ExecutionEvent eventCopy = event.getCopy();
+//			if (value != null) {
+//				eventCopy.setValue(value);
+//			}
+//			raisedEvents.add(eventCopy);
+//			notifyEventRaised(eventCopy);
 		}
 	}
 
 	public void flush() {
 		synchronized (scheduledToRaiseEvents) {
-			for (ExecutionEvent event : scheduledToRaiseEvents) {
-				raiseEventInternal(event.getName(), event.getValue());
+			for (IEventSlot event : scheduledToRaiseEvents) {
+				raiseEvent(event.getName(), event.getValue());
 			}
 			scheduledToRaiseEvents.clear();
 		}
@@ -136,13 +143,14 @@ public class ExecutionContextImpl extends AbstractExecutionContext implements
 
 	public boolean isEventRaised(String eventName) {
 		synchronized (raisedEvents) {
-			for (ExecutionEvent event : raisedEvents) {
-				if (eventName.equals(event.getName())) {
-					return true;
-				}
-			}
+			return getDeclaredEvent(eventName).isRaised();
+//			for (IEventSlot event : raisedEvents) {
+//				if (eventName.equals(event.getName())) {
+//					return true;
+//				}
+//			}
 		}
-		return false;
+//		return false;
 	}
 
 	public List<ExecutionVariable> getVariables() {
@@ -168,14 +176,12 @@ public class ExecutionContextImpl extends AbstractExecutionContext implements
 
 	public void setSlotValue(String name, Object value)
 			throws ExecutionException {
-		AbstractSlot slot = getVariable(name);
+		ISlot slot = getVariable(name);
 		if(slot == null)
 			slot = getDeclaredEvent(name);
 		if (slot == null)
 			throw new ExecutionException("Unknown slot " + name);
 		slot.setValue(value);
-		notifyValueChanged(slot);
-
 	}
 
 	public ExecutionState[] getStateConfiguration() {
@@ -239,12 +245,13 @@ public class ExecutionContextImpl extends AbstractExecutionContext implements
 
 	public void unraiseEvent(String eventName) {
 		synchronized (raisedEvents) {
-			Iterator<ExecutionEvent> iterator = raisedEvents.iterator();
-			while (iterator.hasNext()) {
-				if (iterator.next().getName().equals(eventName)) {
-					iterator.remove();
-				}
-			}
+			getDeclaredEvent(eventName).unraise();
+//			Iterator<ExecutionEvent> iterator = raisedEvents.iterator();
+//			while (iterator.hasNext()) {
+//				if (iterator.next().getName().equals(eventName)) {
+//					iterator.remove();
+//				}
+//			}
 		}
 	}
 
@@ -262,7 +269,7 @@ public class ExecutionContextImpl extends AbstractExecutionContext implements
 
 	public boolean isEventScheduled(String name) {
 		synchronized (scheduledToRaiseEvents) {
-			for (ExecutionEvent event : scheduledToRaiseEvents) {
+			for (IEventSlot event : scheduledToRaiseEvents) {
 				if (name.equals(event.getName())) {
 					return true;
 				}
@@ -270,4 +277,18 @@ public class ExecutionContextImpl extends AbstractExecutionContext implements
 		}
 		return false;
 	}
+
+	
+	public void slotChanged(ISlot slot, ISlotChangedEvent changeEvent) {
+		if (changeEvent instanceof IEventSlot.SlotEventRaised) {
+			raisedEvents.add((ExecutionEvent)slot);
+			notifyEventRaised((ExecutionEvent)slot);			
+		} else if ( changeEvent instanceof IEventSlot.SlotEventUnraised ) {
+			raisedEvents.remove((ExecutionEvent)slot);
+		} else if (changeEvent instanceof ISlot.SlotValueChanged) {
+			notifyValueChanged(slot);
+		}
+	}
+	
+	
 }

+ 42 - 1
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/ExecutionEvent.java

@@ -10,6 +10,7 @@
  */
 package org.yakindu.sct.simulation.core.runtime.impl;
 
+import org.yakindu.sct.simulation.core.runtime.IEventSlot;
 import org.yakindu.sct.simulation.core.runtime.IExecutionContext;
 
 /**
@@ -17,11 +18,14 @@ import org.yakindu.sct.simulation.core.runtime.IExecutionContext;
  * {@link IExecutionContext}#setVariableValue
  * 
  * @author andreas muelder - Initial contribution and API
+ * @author axel terfloth - refactoring
  * 
  * 
  */
-public class ExecutionEvent extends AbstractSlot {
+public class ExecutionEvent extends AbstractSlot implements IEventSlot {
 
+	protected boolean raised = false;
+	
 	public ExecutionEvent(String name) {
 		this(name, null, null);
 	}
@@ -38,4 +42,41 @@ public class ExecutionEvent extends AbstractSlot {
 		return new ExecutionEvent(getName(), getType(), getValue());
 	}
 
+	public void raise(Object value) {
+		if ( ! raised ) {
+			raised = true;
+			if (value != null) {
+				assertValue(value);
+				this.value = value;
+			}
+			
+			notifyRaised();
+		}
+	}
+
+	public void unraise() {
+		if ( raised ) {
+			raised = false;
+			notifyUnraised();
+		}
+	}
+
+	public boolean isRaised() {
+		return raised;
+	}
+
+	
+	protected void notifyRaised() {
+		if ( context != null ) {
+			context.slotChanged(this, SLOT_EVENT_RAISED);
+		}
+	}
+
+	protected void notifyUnraised() {
+		if ( context != null ) {
+			context.slotChanged(this, SLOT_EVENT_UNRAISED);
+		}
+	}
+
+
 }

+ 4 - 3
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/ExecutionContextContentProvider.java

@@ -21,10 +21,11 @@ import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.swt.widgets.Display;
+import org.yakindu.sct.simulation.core.runtime.IEventSlot;
 import org.yakindu.sct.simulation.core.runtime.IExecutionContext;
 import org.yakindu.sct.simulation.core.runtime.IExecutionContextListener;
+import org.yakindu.sct.simulation.core.runtime.ISlot;
 import org.yakindu.sct.simulation.core.runtime.impl.AbstractSlot;
-import org.yakindu.sct.simulation.core.runtime.impl.ExecutionEvent;
 import org.yakindu.sct.simulation.ui.SimulationActivator;
 import org.yakindu.sct.simulation.ui.view.actions.HideTimeEventsAction;
 
@@ -129,13 +130,13 @@ public class ExecutionContextContentProvider implements ITreeContentProvider,
 		return false;
 	}
 
-	public void eventRaised(ExecutionEvent event) {
+	public void eventRaised(IEventSlot event) {
 	}
 
 	public void timeScaleFactorChanged(double oldFactor, double newFactor) {
 	}
 
-	public void slotValueChanged(AbstractSlot variable) {
+	public void slotValueChanged(ISlot variable) {
 		Display.getDefault().asyncExec(new Runnable() {
 			public void run() {
 				if (viewer != null && !viewer.getControl().isDisposed())

+ 2 - 1
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/ExecutionContextLabelProvider.java

@@ -15,6 +15,7 @@ import org.eclipse.jface.viewers.StyledCellLabelProvider;
 import org.eclipse.jface.viewers.ViewerCell;
 import org.eclipse.swt.custom.StyleRange;
 import org.yakindu.sct.simulation.core.runtime.IExecutionContext;
+import org.yakindu.sct.simulation.core.runtime.ISlot;
 import org.yakindu.sct.simulation.core.runtime.impl.AbstractSlot;
 import org.yakindu.sct.simulation.core.runtime.impl.ExecutionEvent;
 import org.yakindu.sct.simulation.core.runtime.impl.ExecutionVariable;
@@ -49,7 +50,7 @@ public class ExecutionContextLabelProvider extends StyledCellLabelProvider {
 	private void updateValueCell(ViewerCell cell) {
 		Object element = cell.getElement();
 		if (element instanceof AbstractSlot) {
-			Object value = ((AbstractSlot) element).getValue();
+			Object value = ((ISlot) element).getValue();
 			if (value != null)
 				cell.setText(value.toString());
 		}

+ 3 - 2
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/SimulationView.java

@@ -40,6 +40,7 @@ import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.forms.widgets.FormToolkit;
 import org.eclipse.ui.part.ViewPart;
 import org.yakindu.sct.simulation.core.debugmodel.SCTDebugTarget;
+import org.yakindu.sct.simulation.core.runtime.IEventSlot;
 import org.yakindu.sct.simulation.core.runtime.IExecutionContext;
 import org.yakindu.sct.simulation.core.runtime.IExecutionFacade;
 import org.yakindu.sct.simulation.core.runtime.impl.ExecutionEvent;
@@ -151,7 +152,7 @@ public class SimulationView extends ViewPart implements IDebugContextListener,
 				Object firstElement = ((IStructuredSelection) event
 						.getSelection()).getFirstElement();
 				if (firstElement instanceof ExecutionEvent) {
-					ExecutionEvent casted = (ExecutionEvent) firstElement;
+					IEventSlot casted = (IEventSlot) firstElement;
 					IExecutionContext input = (IExecutionContext) viewer
 							.getInput();
 					if (input.isEventRaised(casted.getName())) {
@@ -159,7 +160,7 @@ public class SimulationView extends ViewPart implements IDebugContextListener,
 					} else if (input.isEventScheduled(casted.getName())) {
 						input.unscheduleEvent(casted.getName());
 					} else {
-						input.raiseEvent(casted.getName(), null);
+						input.scheduleEvent(casted.getName(), null);
 					}
 					viewer.refresh();
 				}

+ 2 - 2
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/editing/BooleanEditingSupport.java

@@ -15,7 +15,7 @@ import org.eclipse.jface.viewers.ColumnViewer;
 import org.eclipse.jface.viewers.ComboBoxCellEditor;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
-import org.yakindu.sct.simulation.core.runtime.impl.AbstractSlot;
+import org.yakindu.sct.simulation.core.runtime.ISlot;
 import org.yakindu.sct.simulation.core.runtime.impl.ExecutionVariable;
 
 /**
@@ -43,7 +43,7 @@ public class BooleanEditingSupport extends ScopeSlotEditingSupport {
 
 	public Object getValue(Object element) {
 		if (element instanceof ExecutionVariable) {
-			Boolean value = (Boolean) ((AbstractSlot) element).getValue();
+			Boolean value = (Boolean) ((ISlot) element).getValue();
 			return value ? 0 : 1;
 		}
 		return null;

+ 4 - 3
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/editing/ScopeSlotEditingSupport.java

@@ -12,6 +12,7 @@ package org.yakindu.sct.simulation.ui.view.editing;
 
 import org.eclipse.jface.viewers.ColumnViewer;
 import org.yakindu.sct.simulation.core.runtime.IExecutionContext;
+import org.yakindu.sct.simulation.core.runtime.ISlot;
 import org.yakindu.sct.simulation.core.runtime.impl.AbstractSlot;
 
 /**
@@ -33,7 +34,7 @@ public abstract class ScopeSlotEditingSupport extends PublicEditingSupport {
 	public boolean canEdit(Object element) {
 		if (element instanceof AbstractSlot) {
 			return getSupportedType()
-					.equals(((AbstractSlot) element).getType());
+					.equals(((ISlot) element).getType());
 		}
 		return false;
 	}
@@ -41,7 +42,7 @@ public abstract class ScopeSlotEditingSupport extends PublicEditingSupport {
 	@Override
 	public Object getValue(Object element) {
 		if (element instanceof AbstractSlot) {
-			Object value = ((AbstractSlot) element).getValue();
+			Object value = ((ISlot) element).getValue();
 			if (value != null)
 				return String.valueOf(value);
 		}
@@ -55,7 +56,7 @@ public abstract class ScopeSlotEditingSupport extends PublicEditingSupport {
 			return;
 		IExecutionContext input = (IExecutionContext) getViewer().getInput();
 		if (element instanceof AbstractSlot) {
-			input.setSlotValue(((AbstractSlot) element).getName(), value);
+			input.setSlotValue(((ISlot) element).getName(), value);
 		}
 	}
 }

+ 2 - 2
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/editing/StringEditingSupport.java

@@ -14,7 +14,7 @@ import org.eclipse.jface.viewers.CellEditor;
 import org.eclipse.jface.viewers.ColumnViewer;
 import org.eclipse.jface.viewers.TextCellEditor;
 import org.eclipse.swt.widgets.Composite;
-import org.yakindu.sct.simulation.core.runtime.impl.AbstractSlot;
+import org.yakindu.sct.simulation.core.runtime.ISlot;
 import org.yakindu.sct.simulation.core.runtime.impl.ExecutionVariable;
 
 /**
@@ -41,7 +41,7 @@ public class StringEditingSupport extends ScopeSlotEditingSupport {
 
 	public Object getValue(Object element) {
 		if (element instanceof ExecutionVariable) {
-			return (String) ((AbstractSlot) element).getValue();
+			return (String) ((ISlot) element).getValue();
 		}
 		return null;
 	}