فهرست منبع

Added xtend generated sources

Andreas Mülder 13 سال پیش
والد
کامیت
a82e6ebf4a

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

@@ -0,0 +1,610 @@
+package org.yakindu.sct.model.sexec.interpreter.impl;
+
+import com.google.common.base.Objects;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import java.util.Arrays;
+import java.util.List;
+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.InputOutput;
+import org.yakindu.base.types.ITypeSystemAccess;
+import org.yakindu.base.types.Type;
+import org.yakindu.sct.model.sexec.Call;
+import org.yakindu.sct.model.sexec.Check;
+import org.yakindu.sct.model.sexec.EnterState;
+import org.yakindu.sct.model.sexec.Execution;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sexec.ExecutionRegion;
+import org.yakindu.sct.model.sexec.ExecutionState;
+import org.yakindu.sct.model.sexec.ExitState;
+import org.yakindu.sct.model.sexec.HistoryEntry;
+import org.yakindu.sct.model.sexec.If;
+import org.yakindu.sct.model.sexec.SaveHistory;
+import org.yakindu.sct.model.sexec.ScheduleTimeEvent;
+import org.yakindu.sct.model.sexec.Sequence;
+import org.yakindu.sct.model.sexec.SexecFactory;
+import org.yakindu.sct.model.sexec.StateCase;
+import org.yakindu.sct.model.sexec.StateSwitch;
+import org.yakindu.sct.model.sexec.StateVector;
+import org.yakindu.sct.model.sexec.Step;
+import org.yakindu.sct.model.sexec.TimeEvent;
+import org.yakindu.sct.model.sexec.Trace;
+import org.yakindu.sct.model.sexec.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.Scope;
+import org.yakindu.sct.model.sgraph.Statement;
+import org.yakindu.sct.model.stext.naming.StextNameProvider;
+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.IExecutionContext;
+import org.yakindu.sct.simulation.core.runtime.IExecutionContextListener;
+import org.yakindu.sct.simulation.core.runtime.impl.ExecutionEvent;
+import org.yakindu.sct.simulation.core.runtime.impl.ExecutionVariable;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ */
+@SuppressWarnings("all")
+public class ExecutionFlowInterpreter extends AbstractExecutionFacade implements IExecutionFlowInterpreter, IExecutionContextListener {
+  @Inject
+  private IStatementInterpreter interpreter;
+  
+  @Inject
+  private IExecutionContext executionContext;
+  
+  @Inject
+  private StextNameProvider provider;
+  
+  @Inject
+  private ITimingService timingService;
+  
+  @Inject
+  private ITypeSystemAccess ts;
+  
+  @Inject
+  @Named(value = "InterpreterName")
+  private String interpreterName;
+  
+  private ExecutionFlow flow;
+  
+  private int nextSVIdx;
+  
+  private TraceBeginRunCycle brc;
+  
+  private TraceEndRunCycle erc;
+  
+  public void initialize(final ExecutionFlow flow) {
+    this.flow = flow;
+    EList<Scope> _scopes = flow.getScopes();
+    for (final Scope scope : _scopes) {
+      this.declareContents(scope);
+    }
+    StateVector _stateVector = flow.getStateVector();
+    int _size = _stateVector.getSize();
+    this.executionContext.initStateConfigurationVector(_size);
+    this.executionContext.addExecutionContextListener(this);
+    TraceBeginRunCycle _createTraceBeginRunCycle = SexecFactory.eINSTANCE.createTraceBeginRunCycle();
+    this.brc = _createTraceBeginRunCycle;
+    TraceEndRunCycle _createTraceEndRunCycle = SexecFactory.eINSTANCE.createTraceEndRunCycle();
+    this.erc = _createTraceEndRunCycle;
+  }
+  
+  public void tearDown() {
+    this.timingService.stop();
+  }
+  
+  public String getName() {
+    return this.interpreterName;
+  }
+  
+  protected void _declareContents(final InternalScope scope) {
+    EList<Declaration> _declarations = scope.getDeclarations();
+    for (final Declaration declaration : _declarations) {
+      this.addToScope(declaration);
+    }
+  }
+  
+  protected void _declareContents(final Scope scope) {
+    EList<Declaration> _declarations = scope.getDeclarations();
+    for (final Declaration declaration : _declarations) {
+      this.addToScope(declaration);
+    }
+  }
+  
+  protected void _declareContents(final InterfaceScope scope) {
+    EList<Declaration> _declarations = scope.getDeclarations();
+    for (final Declaration declaration : _declarations) {
+      this.addToScope(declaration);
+    }
+  }
+  
+  public void runCycle() {
+    this.executionContext.flush();
+    this.nextSVIdx = 0;
+    this.execute(this.brc);
+    ExecutionState[] _stateConfiguration = this.executionContext.getStateConfiguration();
+    int _size = ((List<ExecutionState>)Conversions.doWrapArray(_stateConfiguration)).size();
+    boolean _lessThan = (this.nextSVIdx < _size);
+    boolean _while = _lessThan;
+    while (_while) {
+      {
+        ExecutionState[] _stateConfiguration_1 = this.executionContext.getStateConfiguration();
+        ExecutionState state = ((List<ExecutionState>)Conversions.doWrapArray(_stateConfiguration_1)).get(this.nextSVIdx);
+        boolean _notEquals = (!Objects.equal(state, null));
+        if (_notEquals) {
+          Sequence _reactSequence = state.getReactSequence();
+          this.execute(_reactSequence);
+        }
+        int _plus = (this.nextSVIdx + 1);
+        this.nextSVIdx = _plus;
+      }
+      ExecutionState[] _stateConfiguration_1 = this.executionContext.getStateConfiguration();
+      int _size_1 = ((List<ExecutionState>)Conversions.doWrapArray(_stateConfiguration_1)).size();
+      boolean _lessThan_1 = (this.nextSVIdx < _size_1);
+      _while = _lessThan_1;
+    }
+    this.executionContext.resetRaisedEvents();
+    this.execute(this.erc);
+  }
+  
+  protected void _addToScope(final VariableDefinition variable) {
+    QualifiedName _qualifiedName = this.provider.qualifiedName(variable);
+    String fqName = _qualifiedName.toString();
+    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);
+    } 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);
+      } 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);
+        } 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);
+          }
+        }
+      }
+    }
+  }
+  
+  protected void _addToScope(final EventDefinition event) {
+    QualifiedName _qualifiedName = this.provider.qualifiedName(event);
+    String fqName = _qualifiedName.toString();
+    Type _type = event.getType();
+    boolean _isBoolean = this.ts.isBoolean(_type);
+    if (_isBoolean) {
+      ExecutionEvent _executionEvent = new ExecutionEvent(fqName, Boolean.class, null);
+      this.executionContext.declareEvent(_executionEvent);
+    } else {
+      Type _type_1 = event.getType();
+      boolean _isInteger = this.ts.isInteger(_type_1);
+      if (_isInteger) {
+        ExecutionEvent _executionEvent_1 = new ExecutionEvent(fqName, Integer.class, null);
+        this.executionContext.declareEvent(_executionEvent_1);
+      } else {
+        Type _type_2 = event.getType();
+        boolean _isReal = this.ts.isReal(_type_2);
+        if (_isReal) {
+          ExecutionEvent _executionEvent_2 = new ExecutionEvent(fqName, Float.class, null);
+          this.executionContext.declareEvent(_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);
+          } 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);
+            }
+          }
+        }
+      }
+    }
+  }
+  
+  protected void _addToScope(final OperationDefinition op) {
+    QualifiedName _qualifiedName = this.provider.qualifiedName(op);
+    String fqName = _qualifiedName.toString();
+    Type _type = op.getType();
+    Class<? extends Object> type = this.mappedType(_type);
+    Object _defaultValue = this.defaultValue(type);
+    ExecutionVariable _executionVariable = new ExecutionVariable(fqName, type, _defaultValue);
+    this.executionContext.declareVariable(_executionVariable);
+  }
+  
+  public Class<? extends Object> mappedType(final Type it) {
+    Class<? extends Object> _xifexpression = null;
+    boolean _isBoolean = this.ts.isBoolean(it);
+    if (_isBoolean) {
+      _xifexpression = Boolean.class;
+    } else {
+      Class<? extends Object> _xifexpression_1 = null;
+      boolean _isInteger = this.ts.isInteger(it);
+      if (_isInteger) {
+        _xifexpression_1 = Integer.class;
+      } else {
+        Class<? extends Object> _xifexpression_2 = null;
+        boolean _isReal = this.ts.isReal(it);
+        if (_isReal) {
+          _xifexpression_2 = Float.class;
+        } else {
+          Class<? extends Object> _xifexpression_3 = null;
+          boolean _isVoid = this.ts.isVoid(it);
+          if (_isVoid) {
+            _xifexpression_3 = Void.class;
+          } else {
+            Class<String> _xifexpression_4 = null;
+            boolean _isString = this.ts.isString(it);
+            if (_isString) {
+              _xifexpression_4 = String.class;
+            } else {
+              _xifexpression_4 = null;
+            }
+            _xifexpression_3 = _xifexpression_4;
+          }
+          _xifexpression_2 = _xifexpression_3;
+        }
+        _xifexpression_1 = _xifexpression_2;
+      }
+      _xifexpression = _xifexpression_1;
+    }
+    return _xifexpression;
+  }
+  
+  public Object defaultValue(final Class<? extends Object> type) {
+    Object _switchResult = null;
+    boolean _matched = false;
+    if (!_matched) {
+      if (Objects.equal(type,Boolean.class)) {
+        _matched=true;
+        _switchResult = true;
+      }
+    }
+    if (!_matched) {
+      if (Objects.equal(type,Integer.class)) {
+        _matched=true;
+        _switchResult = 0;
+      }
+    }
+    if (!_matched) {
+      if (Objects.equal(type,Float.class)) {
+        _matched=true;
+        _switchResult = 0.0;
+      }
+    }
+    if (!_matched) {
+      if (Objects.equal(type,Void.class)) {
+        _matched=true;
+        _switchResult = null;
+      }
+    }
+    if (!_matched) {
+      if (Objects.equal(type,String.class)) {
+        _matched=true;
+        _switchResult = "";
+      }
+    }
+    return ((Comparable<Object>)_switchResult);
+  }
+  
+  protected void _addToScope(final TimeEvent event) {
+    String _name = event.getName();
+    ExecutionEvent _executionEvent = new ExecutionEvent(_name, Long.class);
+    this.executionContext.declareEvent(_executionEvent);
+  }
+  
+  public void enter() {
+    Sequence _enterSequence = this.flow.getEnterSequence();
+    EList<Step> _steps = _enterSequence.getSteps();
+    for (final Step step : _steps) {
+      this.execute(step);
+    }
+  }
+  
+  protected Object _execute(final Step step) {
+    String _plus = ("Missing dispatch function for " + step);
+    String _println = InputOutput.<String>println(_plus);
+    return _println;
+  }
+  
+  protected Object _execute(final Call call) {
+    Object _xblockexpression = null;
+    {
+      Step _step = call.getStep();
+      this.execute(_step);
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final Trace trace) {
+    Object _xblockexpression = null;
+    {
+      this.notifyTraceStepEntered(trace);
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final Check check) {
+    Statement _condition = check.getCondition();
+    boolean _equals = Objects.equal(_condition, null);
+    if (_equals) {
+      return Boolean.valueOf(true);
+    }
+    Statement _condition_1 = check.getCondition();
+    Object interpreterResult = this.interpreter.evaluateStatement(_condition_1, this.executionContext);
+    return interpreterResult;
+  }
+  
+  protected Object _execute(final EnterState enterState) {
+    Object _xblockexpression = null;
+    {
+      ExecutionState[] _stateConfiguration = this.executionContext.getStateConfiguration();
+      ExecutionState _state = enterState.getState();
+      StateVector _stateVector = _state.getStateVector();
+      int _offset = _stateVector.getOffset();
+      ExecutionState _state_1 = enterState.getState();
+      ((List<ExecutionState>)Conversions.doWrapArray(_stateConfiguration)).set(_offset, _state_1);
+      ExecutionState _state_2 = enterState.getState();
+      StateVector _stateVector_1 = _state_2.getStateVector();
+      int _offset_1 = _stateVector_1.getOffset();
+      this.nextSVIdx = _offset_1;
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final HistoryEntry entry) {
+    Object _xblockexpression = null;
+    {
+      ExecutionRegion _region = entry.getRegion();
+      ExecutionState _historyStateConfiguration = this.executionContext.getHistoryStateConfiguration(_region);
+      boolean _notEquals = (!Objects.equal(_historyStateConfiguration, null));
+      if (_notEquals) {
+        Step _historyStep = entry.getHistoryStep();
+        this.execute(_historyStep);
+      } else {
+        Step _initialStep = entry.getInitialStep();
+        boolean _equals = Objects.equal(_initialStep, null);
+        if (_equals) {
+          String _plus = ("Missing initial transition " + entry);
+          InputOutput.<String>println(_plus);
+        } else {
+          Step _initialStep_1 = entry.getInitialStep();
+          this.execute(_initialStep_1);
+        }
+      }
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final Execution execution) {
+    Statement _statement = execution.getStatement();
+    Object _evaluateStatement = this.interpreter.evaluateStatement(_statement, this.executionContext);
+    return _evaluateStatement;
+  }
+  
+  protected Object _execute(final ExitState exitState) {
+    Object _xblockexpression = null;
+    {
+      ExecutionState[] _stateConfiguration = this.executionContext.getStateConfiguration();
+      ExecutionState _state = exitState.getState();
+      StateVector _stateVector = _state.getStateVector();
+      int _offset = _stateVector.getOffset();
+      ((List<ExecutionState>)Conversions.doWrapArray(_stateConfiguration)).set(_offset, null);
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final If ifStep) {
+    Object _xblockexpression = null;
+    {
+      Check _check = ifStep.getCheck();
+      Object check = this.execute(_check);
+      if ((((Boolean) check)).booleanValue()) {
+        Step _thenStep = ifStep.getThenStep();
+        this.execute(_thenStep);
+      } else {
+        Step _elseStep = ifStep.getElseStep();
+        boolean _notEquals = (!Objects.equal(_elseStep, null));
+        if (_notEquals) {
+          Step _elseStep_1 = ifStep.getElseStep();
+          this.execute(_elseStep_1);
+        }
+      }
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final Sequence sequence) {
+    Object _xblockexpression = null;
+    {
+      EList<Step> _steps = sequence.getSteps();
+      for (final Step step : _steps) {
+        this.execute(step);
+      }
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final SaveHistory action) {
+    Object _xblockexpression = null;
+    {
+      ExecutionRegion _region = action.getRegion();
+      this.executionContext.saveHistoryStateConfiguration(_region);
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final StateSwitch stateSwitch) {
+    Object _xblockexpression = null;
+    {
+      final ExecutionRegion historyRegion = stateSwitch.getHistoryRegion();
+      boolean _notEquals = (!Objects.equal(historyRegion, null));
+      if (_notEquals) {
+        final ExecutionState historyState = this.executionContext.getHistoryStateConfiguration(historyRegion);
+        EList<StateCase> _cases = stateSwitch.getCases();
+        for (final StateCase stateCase : _cases) {
+          ExecutionState _state = stateCase.getState();
+          boolean _equals = Objects.equal(historyState, _state);
+          if (_equals) {
+            Step _step = stateCase.getStep();
+            this.execute(_step);
+          }
+        }
+      } else {
+        EList<StateCase> _cases_1 = stateSwitch.getCases();
+        for (final StateCase stateCase_1 : _cases_1) {
+          ExecutionState[] _stateConfiguration = this.executionContext.getStateConfiguration();
+          ExecutionState _state_1 = stateCase_1.getState();
+          boolean _contains = ((List<ExecutionState>)Conversions.doWrapArray(_stateConfiguration)).contains(_state_1);
+          if (_contains) {
+            Step _step_1 = stateCase_1.getStep();
+            this.execute(_step_1);
+          }
+        }
+      }
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final ScheduleTimeEvent scheduleTimeEvent) {
+    Object _xblockexpression = null;
+    {
+      TimeEvent timeEvent = scheduleTimeEvent.getTimeEvent();
+      Statement _timeValue = scheduleTimeEvent.getTimeValue();
+      Object duration = this.interpreter.evaluateStatement(_timeValue, this.executionContext);
+      String _name = timeEvent.getName();
+      boolean _isPeriodic = timeEvent.isPeriodic();
+      this.timingService.scheduleTimeEvent(this.executionContext, _name, _isPeriodic, (((Integer) duration)).intValue());
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final UnscheduleTimeEvent timeEvent) {
+    Object _xblockexpression = null;
+    {
+      TimeEvent _timeEvent = timeEvent.getTimeEvent();
+      String _name = _timeEvent.getName();
+      this.timingService.unscheduleTimeEvent(_name);
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  public void eventRaised(final ExecutionEvent event) {
+  }
+  
+  public void variableValueChanged(final ExecutionVariable variable) {
+  }
+  
+  public IExecutionContext getExecutionContext() {
+    return this.executionContext;
+  }
+  
+  public void declareContents(final Scope scope) {
+    if (scope instanceof InterfaceScope) {
+      _declareContents((InterfaceScope)scope);
+      return;
+    } else if (scope instanceof InternalScope) {
+      _declareContents((InternalScope)scope);
+      return;
+    } else if (scope != null) {
+      _declareContents(scope);
+      return;
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(scope).toString());
+    }
+  }
+  
+  public void addToScope(final Declaration event) {
+    if (event instanceof TimeEvent) {
+      _addToScope((TimeEvent)event);
+      return;
+    } else if (event instanceof EventDefinition) {
+      _addToScope((EventDefinition)event);
+      return;
+    } else if (event instanceof OperationDefinition) {
+      _addToScope((OperationDefinition)event);
+      return;
+    } else if (event instanceof VariableDefinition) {
+      _addToScope((VariableDefinition)event);
+      return;
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(event).toString());
+    }
+  }
+  
+  public Object execute(final Step call) {
+    if (call instanceof Call) {
+      return _execute((Call)call);
+    } else if (call instanceof Check) {
+      return _execute((Check)call);
+    } else if (call instanceof EnterState) {
+      return _execute((EnterState)call);
+    } else if (call instanceof Execution) {
+      return _execute((Execution)call);
+    } else if (call instanceof ExitState) {
+      return _execute((ExitState)call);
+    } else if (call instanceof HistoryEntry) {
+      return _execute((HistoryEntry)call);
+    } else if (call instanceof If) {
+      return _execute((If)call);
+    } else if (call instanceof SaveHistory) {
+      return _execute((SaveHistory)call);
+    } else if (call instanceof ScheduleTimeEvent) {
+      return _execute((ScheduleTimeEvent)call);
+    } else if (call instanceof Sequence) {
+      return _execute((Sequence)call);
+    } else if (call instanceof StateSwitch) {
+      return _execute((StateSwitch)call);
+    } else if (call instanceof Trace) {
+      return _execute((Trace)call);
+    } else if (call instanceof UnscheduleTimeEvent) {
+      return _execute((UnscheduleTimeEvent)call);
+    } else if (call != null) {
+      return _execute(call);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(call).toString());
+    }
+  }
+}

+ 529 - 0
plugins/org.yakindu.sct.model.sexec.interpreter/xtend-gen/org/yakindu/sct/model/sexec/interpreter/stext/StextStatementInterpreter.java

@@ -0,0 +1,529 @@
+package org.yakindu.sct.model.sexec.interpreter.stext;
+
+import com.google.common.base.Objects;
+import com.google.inject.Inject;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.naming.QualifiedName;
+import org.eclipse.xtext.util.SimpleAttributeResolver;
+import org.yakindu.sct.model.sexec.interpreter.stext.AbstractStatementInterpreter;
+import org.yakindu.sct.model.sexec.interpreter.stext.CoreFunction;
+import org.yakindu.sct.model.sgraph.RegularState;
+import org.yakindu.sct.model.sgraph.State;
+import org.yakindu.sct.model.sgraph.Statement;
+import org.yakindu.sct.model.stext.naming.StextNameProvider;
+import org.yakindu.sct.model.stext.stext.ActiveStateReferenceExpression;
+import org.yakindu.sct.model.stext.stext.AdditiveOperator;
+import org.yakindu.sct.model.stext.stext.AssignmentExpression;
+import org.yakindu.sct.model.stext.stext.AssignmentOperator;
+import org.yakindu.sct.model.stext.stext.BitwiseAndExpression;
+import org.yakindu.sct.model.stext.stext.BitwiseOrExpression;
+import org.yakindu.sct.model.stext.stext.BitwiseXorExpression;
+import org.yakindu.sct.model.stext.stext.BoolLiteral;
+import org.yakindu.sct.model.stext.stext.ConditionalExpression;
+import org.yakindu.sct.model.stext.stext.ElementReferenceExpression;
+import org.yakindu.sct.model.stext.stext.EventDefinition;
+import org.yakindu.sct.model.stext.stext.EventRaisingExpression;
+import org.yakindu.sct.model.stext.stext.EventValueReferenceExpression;
+import org.yakindu.sct.model.stext.stext.Expression;
+import org.yakindu.sct.model.stext.stext.FeatureCall;
+import org.yakindu.sct.model.stext.stext.HexLiteral;
+import org.yakindu.sct.model.stext.stext.IntLiteral;
+import org.yakindu.sct.model.stext.stext.Literal;
+import org.yakindu.sct.model.stext.stext.LogicalAndExpression;
+import org.yakindu.sct.model.stext.stext.LogicalNotExpression;
+import org.yakindu.sct.model.stext.stext.LogicalOrExpression;
+import org.yakindu.sct.model.stext.stext.LogicalRelationExpression;
+import org.yakindu.sct.model.stext.stext.MultiplicativeOperator;
+import org.yakindu.sct.model.stext.stext.NumericalAddSubtractExpression;
+import org.yakindu.sct.model.stext.stext.NumericalMultiplyDivideExpression;
+import org.yakindu.sct.model.stext.stext.NumericalUnaryExpression;
+import org.yakindu.sct.model.stext.stext.PrimitiveValueExpression;
+import org.yakindu.sct.model.stext.stext.RealLiteral;
+import org.yakindu.sct.model.stext.stext.RelationalOperator;
+import org.yakindu.sct.model.stext.stext.ShiftExpression;
+import org.yakindu.sct.model.stext.stext.ShiftOperator;
+import org.yakindu.sct.model.stext.stext.StringLiteral;
+import org.yakindu.sct.model.stext.stext.UnaryOperator;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
+import org.yakindu.sct.simulation.core.runtime.IExecutionContext;
+import org.yakindu.sct.simulation.core.runtime.impl.ExecutionEvent;
+import org.yakindu.sct.simulation.core.runtime.impl.ExecutionVariable;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ * @authos axel terfloth - additions
+ */
+@SuppressWarnings("all")
+public class StextStatementInterpreter extends AbstractStatementInterpreter {
+  @Inject
+  private StextNameProvider provider;
+  
+  protected IExecutionContext context;
+  
+  public Object evaluateStatement(final Statement statement, final IExecutionContext context) {
+    Object _xblockexpression = null;
+    {
+      this.context = context;
+      Object _execute = this.execute(statement);
+      _xblockexpression = (_execute);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final Statement statement) {
+    return null;
+  }
+  
+  protected Object _execute(final AssignmentExpression assignment) {
+    Object _xblockexpression = null;
+    {
+      Expression _varRef = assignment.getVarRef();
+      EObject _variable = this.variable(_varRef);
+      QualifiedName _fullyQualifiedName = this.provider.getFullyQualifiedName(_variable);
+      String _string = _fullyQualifiedName.toString();
+      ExecutionVariable scopeVariable = this.context.getVariable(_string);
+      Expression _expression = assignment.getExpression();
+      Object result = this.execute(_expression);
+      AssignmentOperator _operator = assignment.getOperator();
+      boolean _equals = Objects.equal(_operator, AssignmentOperator.ASSIGN);
+      if (_equals) {
+        String _name = scopeVariable.getName();
+        this.context.setVariableValue(_name, result);
+      } else {
+        AssignmentOperator _operator_1 = assignment.getOperator();
+        String _name_1 = _operator_1.getName();
+        String operator = AbstractStatementInterpreter.assignFunctionMap.get(_name_1);
+        String _name_2 = scopeVariable.getName();
+        Object _value = scopeVariable.getValue();
+        Object _evaluate = this.evaluate(operator, _value, result);
+        this.context.setVariableValue(_name_2, _evaluate);
+      }
+      _xblockexpression = (result);
+    }
+    return _xblockexpression;
+  }
+  
+  protected EObject _variable(final ElementReferenceExpression e) {
+    EObject _xifexpression = null;
+    EObject _reference = e.getReference();
+    if ((_reference instanceof VariableDefinition)) {
+      EObject _reference_1 = e.getReference();
+      _xifexpression = _reference_1;
+    } else {
+      _xifexpression = null;
+    }
+    return _xifexpression;
+  }
+  
+  protected EObject _variable(final FeatureCall e) {
+    EObject _xifexpression = null;
+    EObject _feature = e.getFeature();
+    if ((_feature instanceof VariableDefinition)) {
+      EObject _feature_1 = e.getFeature();
+      _xifexpression = _feature_1;
+    } else {
+      _xifexpression = null;
+    }
+    return _xifexpression;
+  }
+  
+  protected EObject _variable(final AssignmentExpression e) {
+    Expression _varRef = e.getVarRef();
+    EObject _variable = this.variable(_varRef);
+    return ((EObject) _variable);
+  }
+  
+  protected EObject _event(final ElementReferenceExpression e) {
+    EObject _xifexpression = null;
+    EObject _reference = e.getReference();
+    if ((_reference instanceof EventDefinition)) {
+      EObject _reference_1 = e.getReference();
+      _xifexpression = _reference_1;
+    } else {
+      _xifexpression = null;
+    }
+    return _xifexpression;
+  }
+  
+  protected EObject _event(final FeatureCall e) {
+    EObject _xifexpression = null;
+    EObject _feature = e.getFeature();
+    if ((_feature instanceof EventDefinition)) {
+      EObject _feature_1 = e.getFeature();
+      _xifexpression = _feature_1;
+    } else {
+      _xifexpression = null;
+    }
+    return _xifexpression;
+  }
+  
+  protected Object _execute(final EventRaisingExpression eventRaising) {
+    Object _xblockexpression = null;
+    {
+      Expression _value = eventRaising.getValue();
+      boolean _notEquals = (!Objects.equal(_value, null));
+      if (_notEquals) {
+        Expression _event = eventRaising.getEvent();
+        EObject _event_1 = this.event(_event);
+        QualifiedName _fullyQualifiedName = this.provider.getFullyQualifiedName(_event_1);
+        String _string = _fullyQualifiedName.toString();
+        Expression _value_1 = eventRaising.getValue();
+        Object _execute = this.execute(_value_1);
+        this.context.raiseEvent(_string, _execute);
+      } else {
+        Expression _event_2 = eventRaising.getEvent();
+        EObject _event_3 = this.event(_event_2);
+        QualifiedName _fullyQualifiedName_1 = this.provider.getFullyQualifiedName(_event_3);
+        String _string_1 = _fullyQualifiedName_1.toString();
+        this.context.raiseEvent(_string_1, null);
+      }
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final ConditionalExpression expression) {
+    Expression _condition = expression.getCondition();
+    Object _execute = this.execute(_condition);
+    if ((((Boolean) _execute)).booleanValue()) {
+      Expression _trueCase = expression.getTrueCase();
+      return this.execute(_trueCase);
+    } else {
+      Expression _falseCase = expression.getFalseCase();
+      return this.execute(_falseCase);
+    }
+  }
+  
+  protected Object _execute(final ElementReferenceExpression expression) {
+    EObject _reference = expression.getReference();
+    QualifiedName _fullyQualifiedName = this.provider.getFullyQualifiedName(_reference);
+    String _string = _fullyQualifiedName.toString();
+    ExecutionVariable variableRef = this.context.getVariable(_string);
+    boolean _notEquals = (!Objects.equal(variableRef, null));
+    if (_notEquals) {
+      return variableRef.getValue();
+    }
+    EObject _reference_1 = expression.getReference();
+    QualifiedName _fullyQualifiedName_1 = this.provider.getFullyQualifiedName(_reference_1);
+    String _string_1 = _fullyQualifiedName_1.toString();
+    return Boolean.valueOf(this.context.isEventRaised(_string_1));
+  }
+  
+  protected Object _execute(final EventValueReferenceExpression expression) {
+    Object _xblockexpression = null;
+    {
+      List<ExecutionEvent> _raisedEvents = this.context.getRaisedEvents();
+      for (final ExecutionEvent event : _raisedEvents) {
+        String _name = event.getName();
+        Expression _value = expression.getValue();
+        String _qname = this.qname(_value);
+        Boolean _equals = this.equals(_name, _qname);
+        if ((_equals).booleanValue()) {
+          return event.getValue();
+        }
+      }
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  public String name(final EObject e) {
+    return SimpleAttributeResolver.NAME_RESOLVER.apply(e);
+  }
+  
+  protected String _qname(final FeatureCall e) {
+    EObject _feature = e.getFeature();
+    QualifiedName _fullyQualifiedName = this.provider.getFullyQualifiedName(_feature);
+    return _fullyQualifiedName.toString();
+  }
+  
+  protected String _qname(final ElementReferenceExpression e) {
+    EObject _reference = e.getReference();
+    QualifiedName _fullyQualifiedName = this.provider.getFullyQualifiedName(_reference);
+    String _string = _fullyQualifiedName.toString();
+    return _string;
+  }
+  
+  protected Object _execute(final ActiveStateReferenceExpression expression) {
+    Set<RegularState> _allActiveStates = this.context.getAllActiveStates();
+    for (final RegularState activeState : _allActiveStates) {
+      State _value = expression.getValue();
+      boolean _equals = Objects.equal(activeState, _value);
+      if (_equals) {
+        return Boolean.valueOf(true);
+      }
+    }
+    return Boolean.valueOf(false);
+  }
+  
+  protected Object _execute(final LogicalAndExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Object leftResult = this.execute(_leftOperand);
+    boolean _not = (!((Boolean) leftResult));
+    if (_not) {
+      return Boolean.valueOf(false);
+    }
+    Expression _rightOperand = expression.getRightOperand();
+    Object rightResult = this.execute(_rightOperand);
+    boolean _and = false;
+    if (!(((Boolean) leftResult)).booleanValue()) {
+      _and = false;
+    } else {
+      _and = ((((Boolean) leftResult)).booleanValue() && (((Boolean) rightResult)).booleanValue());
+    }
+    return Boolean.valueOf(_and);
+  }
+  
+  protected Object _execute(final LogicalOrExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Object leftResult = this.execute(_leftOperand);
+    if ((((Boolean) leftResult)).booleanValue()) {
+      return Boolean.valueOf(true);
+    }
+    Expression _rightOperand = expression.getRightOperand();
+    Object rightResult = this.execute(_rightOperand);
+    boolean _or = false;
+    if ((((Boolean) leftResult)).booleanValue()) {
+      _or = true;
+    } else {
+      _or = ((((Boolean) leftResult)).booleanValue() || (((Boolean) rightResult)).booleanValue());
+    }
+    return Boolean.valueOf(_or);
+  }
+  
+  protected Object _execute(final LogicalNotExpression expression) {
+    Expression _operand = expression.getOperand();
+    Object _execute = this.execute(_operand);
+    return Boolean.valueOf((!((Boolean) _execute)));
+  }
+  
+  protected Object _execute(final BitwiseAndExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Expression _rightOperand = expression.getRightOperand();
+    Object _executeBinaryCoreFunction = this.executeBinaryCoreFunction(_leftOperand, _rightOperand, CoreFunction.BIT_AND);
+    return _executeBinaryCoreFunction;
+  }
+  
+  protected Object _execute(final BitwiseOrExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Expression _rightOperand = expression.getRightOperand();
+    Object _executeBinaryCoreFunction = this.executeBinaryCoreFunction(_leftOperand, _rightOperand, CoreFunction.BIT_OR);
+    return _executeBinaryCoreFunction;
+  }
+  
+  protected Object _execute(final BitwiseXorExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Expression _rightOperand = expression.getRightOperand();
+    Object _executeBinaryCoreFunction = this.executeBinaryCoreFunction(_leftOperand, _rightOperand, CoreFunction.BIT_XOR);
+    return _executeBinaryCoreFunction;
+  }
+  
+  protected Object _execute(final LogicalRelationExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Expression _rightOperand = expression.getRightOperand();
+    RelationalOperator _operator = expression.getOperator();
+    String _name = _operator.getName();
+    Object _executeBinaryCoreFunction = this.executeBinaryCoreFunction(_leftOperand, _rightOperand, _name);
+    return _executeBinaryCoreFunction;
+  }
+  
+  protected Object _execute(final NumericalAddSubtractExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Expression _rightOperand = expression.getRightOperand();
+    AdditiveOperator _operator = expression.getOperator();
+    String _literal = _operator.getLiteral();
+    Object _executeBinaryCoreFunction = this.executeBinaryCoreFunction(_leftOperand, _rightOperand, _literal);
+    return _executeBinaryCoreFunction;
+  }
+  
+  protected Object _execute(final NumericalMultiplyDivideExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Expression _rightOperand = expression.getRightOperand();
+    MultiplicativeOperator _operator = expression.getOperator();
+    String _name = _operator.getName();
+    Object _executeBinaryCoreFunction = this.executeBinaryCoreFunction(_leftOperand, _rightOperand, _name);
+    return _executeBinaryCoreFunction;
+  }
+  
+  protected Object _execute(final ShiftExpression expression) {
+    Expression _leftOperand = expression.getLeftOperand();
+    Expression _rightOperand = expression.getRightOperand();
+    ShiftOperator _operator = expression.getOperator();
+    String _name = _operator.getName();
+    Object _executeBinaryCoreFunction = this.executeBinaryCoreFunction(_leftOperand, _rightOperand, _name);
+    return _executeBinaryCoreFunction;
+  }
+  
+  protected Object _execute(final NumericalUnaryExpression expression) {
+    Expression _operand = expression.getOperand();
+    UnaryOperator _operator = expression.getOperator();
+    String _name = _operator.getName();
+    Object _executeUnaryCoreFunction = this.executeUnaryCoreFunction(_operand, _name);
+    return _executeUnaryCoreFunction;
+  }
+  
+  public Object executeBinaryCoreFunction(final Statement leftStatement, final Statement rightStatement, final String operator) {
+    Object leftResult = this.execute(leftStatement);
+    Object rightResult = this.execute(rightStatement);
+    return this.evaluate(operator, leftResult, rightResult);
+  }
+  
+  public Object executeUnaryCoreFunction(final Statement statement, final String operator) {
+    Object result = this.execute(statement);
+    return this.evaluate(operator, result);
+  }
+  
+  protected Object _execute(final FeatureCall call) {
+    Object _xblockexpression = null;
+    {
+      boolean _isOperationCall = call.isOperationCall();
+      if (_isOperationCall) {
+        EObject _feature = call.getFeature();
+        String _name = this.name(_feature);
+        this.context.call(_name);
+      } else {
+        EObject _feature_1 = call.getFeature();
+        QualifiedName _fullyQualifiedName = this.provider.getFullyQualifiedName(_feature_1);
+        String _string = _fullyQualifiedName.toString();
+        ExecutionVariable variableRef = this.context.getVariable(_string);
+        boolean _notEquals = (!Objects.equal(variableRef, null));
+        if (_notEquals) {
+          return variableRef.getValue();
+        }
+        EObject _feature_2 = call.getFeature();
+        QualifiedName _fullyQualifiedName_1 = this.provider.getFullyQualifiedName(_feature_2);
+        String _string_1 = _fullyQualifiedName_1.toString();
+        return Boolean.valueOf(this.context.isEventRaised(_string_1));
+      }
+      _xblockexpression = (null);
+    }
+    return _xblockexpression;
+  }
+  
+  protected Object _execute(final PrimitiveValueExpression expression) {
+    Literal _value = expression.getValue();
+    return ((Comparable<Object>)this.valueLiteral(_value));
+  }
+  
+  protected Object _valueLiteral(final IntLiteral literal) {
+    return Integer.valueOf(literal.getValue());
+  }
+  
+  protected Object _valueLiteral(final HexLiteral literal) {
+    return Integer.valueOf(literal.getValue());
+  }
+  
+  protected Object _valueLiteral(final BoolLiteral bool) {
+    return Boolean.valueOf(bool.isValue());
+  }
+  
+  protected Object _valueLiteral(final RealLiteral literal) {
+    return Float.valueOf(literal.getValue());
+  }
+  
+  protected Object _valueLiteral(final StringLiteral literal) {
+    return literal.getValue();
+  }
+  
+  public Object execute(final Statement expression) {
+    if (expression instanceof ActiveStateReferenceExpression) {
+      return _execute((ActiveStateReferenceExpression)expression);
+    } else if (expression instanceof AssignmentExpression) {
+      return _execute((AssignmentExpression)expression);
+    } else if (expression instanceof BitwiseAndExpression) {
+      return _execute((BitwiseAndExpression)expression);
+    } else if (expression instanceof BitwiseOrExpression) {
+      return _execute((BitwiseOrExpression)expression);
+    } else if (expression instanceof BitwiseXorExpression) {
+      return _execute((BitwiseXorExpression)expression);
+    } else if (expression instanceof ConditionalExpression) {
+      return _execute((ConditionalExpression)expression);
+    } else if (expression instanceof ElementReferenceExpression) {
+      return _execute((ElementReferenceExpression)expression);
+    } else if (expression instanceof EventRaisingExpression) {
+      return _execute((EventRaisingExpression)expression);
+    } else if (expression instanceof EventValueReferenceExpression) {
+      return _execute((EventValueReferenceExpression)expression);
+    } else if (expression instanceof FeatureCall) {
+      return _execute((FeatureCall)expression);
+    } else if (expression instanceof LogicalAndExpression) {
+      return _execute((LogicalAndExpression)expression);
+    } else if (expression instanceof LogicalNotExpression) {
+      return _execute((LogicalNotExpression)expression);
+    } else if (expression instanceof LogicalOrExpression) {
+      return _execute((LogicalOrExpression)expression);
+    } else if (expression instanceof LogicalRelationExpression) {
+      return _execute((LogicalRelationExpression)expression);
+    } else if (expression instanceof NumericalAddSubtractExpression) {
+      return _execute((NumericalAddSubtractExpression)expression);
+    } else if (expression instanceof NumericalMultiplyDivideExpression) {
+      return _execute((NumericalMultiplyDivideExpression)expression);
+    } else if (expression instanceof NumericalUnaryExpression) {
+      return _execute((NumericalUnaryExpression)expression);
+    } else if (expression instanceof PrimitiveValueExpression) {
+      return _execute((PrimitiveValueExpression)expression);
+    } else if (expression instanceof ShiftExpression) {
+      return _execute((ShiftExpression)expression);
+    } else if (expression != null) {
+      return _execute(expression);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(expression).toString());
+    }
+  }
+  
+  public EObject variable(final Expression e) {
+    if (e instanceof AssignmentExpression) {
+      return _variable((AssignmentExpression)e);
+    } else if (e instanceof ElementReferenceExpression) {
+      return _variable((ElementReferenceExpression)e);
+    } else if (e instanceof FeatureCall) {
+      return _variable((FeatureCall)e);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(e).toString());
+    }
+  }
+  
+  public EObject event(final Expression e) {
+    if (e instanceof ElementReferenceExpression) {
+      return _event((ElementReferenceExpression)e);
+    } else if (e instanceof FeatureCall) {
+      return _event((FeatureCall)e);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(e).toString());
+    }
+  }
+  
+  public String qname(final Expression e) {
+    if (e instanceof ElementReferenceExpression) {
+      return _qname((ElementReferenceExpression)e);
+    } else if (e instanceof FeatureCall) {
+      return _qname((FeatureCall)e);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(e).toString());
+    }
+  }
+  
+  public Object valueLiteral(final Literal bool) {
+    if (bool instanceof BoolLiteral) {
+      return _valueLiteral((BoolLiteral)bool);
+    } else if (bool instanceof HexLiteral) {
+      return _valueLiteral((HexLiteral)bool);
+    } else if (bool instanceof IntLiteral) {
+      return _valueLiteral((IntLiteral)bool);
+    } else if (bool instanceof RealLiteral) {
+      return _valueLiteral((RealLiteral)bool);
+    } else if (bool instanceof StringLiteral) {
+      return _valueLiteral((StringLiteral)bool);
+    } else {
+      throw new IllegalArgumentException("Unhandled parameter types: " +
+        Arrays.<Object>asList(bool).toString());
+    }
+  }
+}