Browse Source

Adoption of SCT1 Runtime Model to new MetaModel

Andreas Mülder 14 years ago
parent
commit
ab4290f3ff
42 changed files with 902 additions and 738 deletions
  1. 2 2
      plugins/org.yakindu.sct.simulation.runtime/META-INF/MANIFEST.MF
  2. 21 16
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/AbstractStatechart.java
  3. 1 1
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/Action.java
  4. 10 10
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/CompoundState.java
  5. 2 2
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/ConstantTimeEvent.java
  6. 5 5
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/DefaultTimingService.java
  7. 2 2
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/Event.java
  8. 4 4
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/FinalState.java
  9. 1 1
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/Guard.java
  10. 10 10
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/Node.java
  11. 2 2
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/Pseudostate.java
  12. 15 15
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/Region.java
  13. 9 0
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/RTSignalEvent.java
  14. 6 6
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/SimpleState.java
  15. 18 18
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/State.java
  16. 2 2
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/TimeEvent.java
  17. 9 0
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/RTTimingService.java
  18. 37 37
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/Transition.java
  19. 0 9
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/SignalEvent.java
  20. 0 9
      plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/TimingService.java
  21. 0 18
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/AbstractStatechartAdvice.xpt
  22. 0 18
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/CompoundStateAdvice.xpt
  23. 0 13
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/GeneratorAdvice.ext
  24. 0 24
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/NodeAdvice.xpt
  25. 0 17
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/RegionAdvice.xpt
  26. 0 20
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/SimpleStateAdvice.xpt
  27. 0 36
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/StateAdvice.xpt
  28. 0 51
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/TransitionAdvice.xpt
  29. 0 21
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/generate_Runtime.oaw
  30. 2 2
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/ActionStatement.java
  31. 2 2
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/GuardExpression.java
  32. 224 0
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/RTStatechart.java
  33. 5 5
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/StatechartListener.java
  34. 2 2
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/TimeEventExpression.java
  35. 12 0
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/builder/ISGraphExtensionBuilder.java
  36. 220 0
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/builder/SGraphBuilder.java
  37. 0 268
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/builder/StatechartBuilder.java
  38. 177 62
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/stext/CoreFunction.java
  39. 98 24
      plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/stext/Function.java
  40. 1 1
      plugins/org.yakindu.sct.ui.simulation/META-INF/MANIFEST.MF
  41. 2 2
      plugins/org.yakindu.sct.ui.simulation/src/org/yakindu/sct/ui/simulation/launch/StatechartLaunchShortcut.java
  42. 1 1
      plugins/org.yakindu.sct.ui.simulation/src/org/yakindu/sct/ui/simulation/launch/tabs/StatechartLaunchConfigurationTab.java

+ 2 - 2
plugins/org.yakindu.sct.simulation.runtime/META-INF/MANIFEST.MF

@@ -5,9 +5,9 @@ Bundle-SymbolicName: org.yakindu.sct.simulation.runtime
 Bundle-Version: 1.1.0.qualifier
 Bundle-Vendor: YAKINDU.org
 Require-Bundle: org.yakindu.sct.model.sgraph;bundle-version="1.0.0",
- com.yakindu.statechart.codegenerator.java;bundle-version="1.1.0",
  org.eclipse.xtext;bundle-version="2.0.0",
- org.eclipse.emf.mwe.core;bundle-version="1.1.0"
+ org.eclipse.emf.mwe.core;bundle-version="1.1.0",
+ org.yakindu.sct.model.stext;bundle-version="1.0.0"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Bundle-ActivationPolicy: lazy
 Export-Package: org.yakindu.sct.simulation.runtime,

+ 21 - 16
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/AbstractStatechart.java

@@ -8,13 +8,13 @@ import java.util.Set;
 
 public abstract class AbstractStatechart {
 
-	protected Set<Event> raisedEvents = new HashSet<Event>();
+	protected Set<RTEvent> raisedEvents = new HashSet<RTEvent>();
 
 	// ------------------------------------------------------------------------
 	// (EXTERNAL) EVENT-INTERFACE IMPLEMENTATION
 	// ------------------------------------------------------------------------
 
-	public void setEvent(Event event) {
+	public void setEvent(RTEvent event) {
 
 		synchronized (raisedEvents) {
 			raisedEvents.add(event);
@@ -26,11 +26,11 @@ public abstract class AbstractStatechart {
 	// (INTERNAL) TIMING-SERVICE-INTERFACE IMPLEMENTATION
 	// ------------------------------------------------------------------------
 
-	protected void requestTimeEvent(TimeEvent event) {
+	protected void requestTimeEvent(RTTimeEvent event) {
 		timingService.requestTimeEvent(event);
 	}
 
-	protected void cancelTimeEvent(TimeEvent event) {
+	protected void cancelTimeEvent(RTTimeEvent event) {
 		timingService.cancelTimeEvent(event);
 	}
 
@@ -41,7 +41,7 @@ public abstract class AbstractStatechart {
 	public void enter() {
 
 		// enter all nested regions (in the order of their priority)
-		for (Region region : regions) {
+		for (RTRegion region : regions) {
 			region.enter();
 		}
 
@@ -49,7 +49,7 @@ public abstract class AbstractStatechart {
 
 	public void runCycle() {
 
-		Set<Event> currentEvents = new HashSet<Event>();
+		Set<RTEvent> currentEvents = new HashSet<RTEvent>();
 		synchronized (raisedEvents) {
 			currentEvents.addAll(raisedEvents);
 			raisedEvents.clear();
@@ -61,7 +61,7 @@ public abstract class AbstractStatechart {
 	public void leave() {
 
 		// leave all nested regions (in the reverse order of their priority)
-		for (ListIterator<Region> iterator = regions.listIterator(regions
+		for (ListIterator<RTRegion> iterator = regions.listIterator(regions
 				.size()); iterator.hasPrevious();) {
 			iterator.previous().leave();
 		}
@@ -77,28 +77,28 @@ public abstract class AbstractStatechart {
 
 	// the nested regions of this state, sorted by priority
 
-	private List<Region> regions = new ArrayList<Region>();
+	private List<RTRegion> regions = new ArrayList<RTRegion>();
 
-	private List<Transition> transitions = new ArrayList<Transition>();
+	private List<RTTransition> transitions = new ArrayList<RTTransition>();
 
 	// used to request time events from environment
-	protected TimingService timingService = null;
+	protected RTTimingService timingService = null;
 
 	protected AbstractStatechart(String id) {
 		this.id = id;
-		this.timingService = new DefaultTimingService(this);
+		this.timingService = new RTDefaultTimingService(this);
 	}
 
-	protected AbstractStatechart(String id, TimingService timingService) {
+	protected AbstractStatechart(String id, RTTimingService timingService) {
 		this.id = id;
 		this.timingService = timingService;
 	}
 
-	public List<Region> getRegions() {
+	public List<RTRegion> getRegions() {
 		return regions;
 	}
 
-	protected List<Transition> getTransitions() {
+	protected List<RTTransition> getTransitions() {
 
 		return transitions;
 
@@ -108,13 +108,18 @@ public abstract class AbstractStatechart {
 	// INTERNAL STATECHART BEHAVIOUR
 	// ------------------------------------------------------------------------
 
-	private void reactOn(Set<Event> events) {
+	private void reactOn(Set<RTEvent> events) {
 
 		// pass events to our nested regions (in the order of their priority)
-		for (Region region : regions) {
+		for (RTRegion region : regions) {
 			region.reactOn(events);
 		}
+	}
 
+	public String getId() {
+		return id;
 	}
+	
+	
 
 }

+ 1 - 1
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/Action.java

@@ -1,6 +1,6 @@
 package org.yakindu.sct.simulation.runtime.sgraph;
 
-public abstract class Action {
+public abstract class RTAction {
 
 	public abstract void execute();
 

+ 10 - 10
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/CompoundState.java

@@ -12,17 +12,17 @@ import java.util.Set;
  * based on their priorities). As a composite state always is "in" its
  * sub-states, it may itself not contain a do action.
  */
-public class CompoundState extends State {
+public class RTCompoundState extends RTState {
 
 	// the nested regions of this state, sorted by priority
-	private List<Region> regions = new ArrayList<Region>();
+	private List<RTRegion> regions = new ArrayList<RTRegion>();
 
-	public CompoundState(String id, String name, Region container,
-			Action entryAction, Action exitAction) {
+	public RTCompoundState(String id, String name, RTRegion container,
+			RTAction entryAction, RTAction exitAction) {
 		super(id, name, container, entryAction, exitAction);
 	}
 
-	public List<Region> getRegions() {
+	public List<RTRegion> getRegions() {
 		return regions;
 	}
 
@@ -30,7 +30,7 @@ public class CompoundState extends State {
 
 		shallowEnter();
 		// now enter all nested regions (in the order of their priority)
-		for (Region region : regions) {
+		for (RTRegion region : regions) {
 			region.enter();
 		}
 
@@ -47,7 +47,7 @@ public class CompoundState extends State {
 
 		shallowEnter();
 		// let the nested regions re-enter their former states
-		for (Region region : regions) {
+		for (RTRegion region : regions) {
 			// if we have are in DEEP history mode, notify our nested regions 
 			// to reenter into their former states as well
 			if (history == HistoryMode.DEEP) {
@@ -59,11 +59,11 @@ public class CompoundState extends State {
 
 	}
 
-	protected void reactLocallyOn(Set<Event> events) {
+	protected void reactLocallyOn(Set<RTEvent> events) {
 		// as a compound state does not locally react on events (it may not
 		// specify a do action), forward to the nested regions (in the order of
 		// their priority)
-		for (Region region : regions) {
+		for (RTRegion region : regions) {
 			region.reactOn(events);
 		}
 	}
@@ -71,7 +71,7 @@ public class CompoundState extends State {
 	protected void leave() {
 
 		// leave all nested regions (in the reverse order of their priority)
-		for (ListIterator<Region> iterator = regions.listIterator(regions
+		for (ListIterator<RTRegion> iterator = regions.listIterator(regions
 				.size()); iterator.hasPrevious();) {
 			iterator.previous().leave();
 		}

+ 2 - 2
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/ConstantTimeEvent.java

@@ -1,9 +1,9 @@
 package org.yakindu.sct.simulation.runtime.sgraph;
 
-public class ConstantTimeEvent extends TimeEvent {
+public class RTConstantTimeEvent extends RTTimeEvent {
 	private long duration = -1;
 
-	public ConstantTimeEvent(String id, long duration) {
+	public RTConstantTimeEvent(String id, long duration) {
 		super(id);
 		this.duration = duration;
 	}

+ 5 - 5
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/DefaultTimingService.java

@@ -5,17 +5,17 @@ import java.util.Set;
 import java.util.Timer;
 import java.util.TimerTask;
 
-public class DefaultTimingService implements TimingService {
+public class RTDefaultTimingService implements RTTimingService {
 
 	private final AbstractStatechart statechart;
 
-	public DefaultTimingService(AbstractStatechart statechart) {
+	public RTDefaultTimingService(AbstractStatechart statechart) {
 		this.statechart = statechart;
 	}
 
-	private Set<TimeEvent> canceledRequestedEvents = new HashSet<TimeEvent>();
+	private Set<RTTimeEvent> canceledRequestedEvents = new HashSet<RTTimeEvent>();
 
-	public void requestTimeEvent(final TimeEvent timeEvent) {
+	public void requestTimeEvent(final RTTimeEvent timeEvent) {
 
 		canceledRequestedEvents.remove(timeEvent);
 
@@ -36,7 +36,7 @@ public class DefaultTimingService implements TimingService {
 
 	}
 
-	public void cancelTimeEvent(final TimeEvent timeEvent) {
+	public void cancelTimeEvent(final RTTimeEvent timeEvent) {
 
 		canceledRequestedEvents.add(timeEvent);
 

+ 2 - 2
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/Event.java

@@ -1,10 +1,10 @@
 package org.yakindu.sct.simulation.runtime.sgraph;
 
-public abstract class Event {
+public abstract class RTEvent {
 
 	private String id;
 
-	public Event(String id) {
+	public RTEvent(String id) {
 		this.id = id;
 	}
 

+ 4 - 4
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/FinalState.java

@@ -6,9 +6,9 @@ import java.util.Set;
  * Representation of a final state. A final state is some sort of event sink, i.e.
  * it does not react on any events, and it further has to entry, do, or exit action.
  */
-public class FinalState extends State {
+public class RTFinalState extends RTState {
 
-	public FinalState(String id, Region owningRegion) {
+	public RTFinalState(String id, RTRegion owningRegion) {
 		super(id, "FINAL", owningRegion, null, null);
 	}
 
@@ -17,11 +17,11 @@ public class FinalState extends State {
 		owningRegion.setCurrentState(this);
 	}
 
-	protected void reactOn(Set<Event> events) {
+	protected void reactOn(Set<RTEvent> events) {
 		// do nothing, just ignore all events 
 	}
 
-	protected void reactLocallyOn(Set<Event> events) {
+	protected void reactLocallyOn(Set<RTEvent> events) {
 		// never called, as reactOn is overwritten as well
 	}
 

+ 1 - 1
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/Guard.java

@@ -1,6 +1,6 @@
 package org.yakindu.sct.simulation.runtime.sgraph;
 
-public abstract class Guard {
+public abstract class RTGuard {
 
 	public abstract boolean evaluate();
 

+ 10 - 10
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/Node.java

@@ -9,15 +9,15 @@ import java.util.List;
  * statechart may only reside "in" states, pseudostates will normally directly
  * trigger an outgoing transition when being entered.
  */
-public abstract class Node {
+public abstract class RTNode {
 
 	private String id;
-	protected Region owningRegion;
+	protected RTRegion owningRegion;
 
-	protected List<Transition> incomingTransitions = new ArrayList<Transition>();
-	protected List<Transition> outgoingTransitions = new ArrayList<Transition>();
+	protected List<RTTransition> incomingTransitions = new ArrayList<RTTransition>();
+	protected List<RTTransition> outgoingTransitions = new ArrayList<RTTransition>();
 
-	public Node(String id, Region owner) {
+	public RTNode(String id, RTRegion owner) {
 		this.id = id;
 		this.owningRegion = owner;
 		this.owningRegion.getNodes().add(this);
@@ -27,21 +27,21 @@ public abstract class Node {
 		return id;
 	}
 
-	protected Region getOwningRegion() {
+	protected RTRegion getOwningRegion() {
 		return owningRegion;
 	}
 
-	public List<Transition> getIncomingTransitions() {
+	public List<RTTransition> getIncomingTransitions() {
 		return incomingTransitions;
 	}
 
-	public List<Transition> getOutgoingTransitions() {
+	public List<RTTransition> getOutgoingTransitions() {
 		return outgoingTransitions;
 	}
 
-	protected Transition getEnabledOutgoingTransitionOfHighestPriority() {
+	protected RTTransition getEnabledOutgoingTransitionOfHighestPriority() {
 
-		for (Transition transition : outgoingTransitions) {
+		for (RTTransition transition : outgoingTransitions) {
 			if (transition.isEnabled()) {
 				return transition;
 			}

+ 2 - 2
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/Pseudostate.java

@@ -3,11 +3,11 @@ package org.yakindu.sct.simulation.runtime.sgraph;
 /**
  * Representation of a Pseudostate.
  */
-public class Pseudostate extends Node {
+public class RTPseudostate extends RTNode {
 
 	PseudostateKind kind;
 
-	public Pseudostate(String id, Region owningRegion, PseudostateKind kind) {
+	public RTPseudostate(String id, RTRegion owningRegion, PseudostateKind kind) {
 		super(id, owningRegion);
 		this.kind = kind;
 	}

+ 15 - 15
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/Region.java

@@ -3,25 +3,25 @@ package org.yakindu.sct.simulation.runtime.sgraph;
 import java.util.HashSet;
 import java.util.Set;
 
-public class Region {
+public class RTRegion {
 
 	private String id;
 	private int priority;
 	private AbstractStatechart owningStatechart;
-	private CompoundState owningState;
+	private RTCompoundState owningState;
 
-	private Set<Node> nodes = new HashSet<Node>();
+	private Set<RTNode> nodes = new HashSet<RTNode>();
 
-	protected State currentState;
+	protected RTState currentState;
 
-	public Region(String id, int priority, AbstractStatechart owner) {
+	public RTRegion(String id, int priority, AbstractStatechart owner) {
 		this.id = id;
 		this.priority = priority;
 		this.owningStatechart = owner;
 		this.owningStatechart.getRegions().add(this);
 	}
 
-	public Region(String id, int priority, CompoundState owner) {
+	public RTRegion(String id, int priority, RTCompoundState owner) {
 		this.id = id;
 		this.priority = priority;
 		this.owningState = owner;
@@ -49,7 +49,7 @@ public class Region {
 		}
 	}
 
-	protected CompoundState getOwningState() {
+	protected RTCompoundState getOwningState() {
 		return owningState;
 	}
 
@@ -57,25 +57,25 @@ public class Region {
 		return owningStatechart;
 	}
 
-	public Set<Node> getNodes() {
+	public Set<RTNode> getNodes() {
 		return nodes;
 	}
 
-	private Node getInitialNode() {
-		for (Node node : nodes) {
-			if (node instanceof Pseudostate
-					&& ((Pseudostate) node).getKind() == PseudostateKind.INITIAL) {
+	private RTNode getInitialNode() {
+		for (RTNode node : nodes) {
+			if (node instanceof RTPseudostate
+					&& ((RTPseudostate) node).getKind() == PseudostateKind.INITIAL) {
 				return node;
 			}
 		}
 		throw new IllegalStateException("No initial state present");
 	}
 
-	protected void setCurrentState(State state) {
+	protected void setCurrentState(RTState state) {
 		this.currentState = state;
 	}
 
-	public State getCurrentState() {
+	public RTState getCurrentState() {
 		return currentState;
 	}
 
@@ -91,7 +91,7 @@ public class Region {
 
 	}
 
-	protected void reactOn(Set<Event> events) {
+	protected void reactOn(Set<RTEvent> events) {
 
 		currentState.reactOn(events);
 

+ 9 - 0
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/RTSignalEvent.java

@@ -0,0 +1,9 @@
+package org.yakindu.sct.simulation.runtime.sgraph;
+
+public class RTSignalEvent extends RTEvent {
+
+	public RTSignalEvent(String id) {
+		super(id);
+	}
+
+}

+ 6 - 6
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/SimpleState.java

@@ -7,17 +7,17 @@ import java.util.Set;
  * specify a do action, which is executed when the statechart resides "in" this
  * state.
  */
-public class SimpleState extends State {
+public class RTSimpleState extends RTState {
 
-	private Action doAction;
+	private RTAction doAction;
 
-	public SimpleState(String id, String name, Region owningRegion,
-			Action entryAction, Action doAction, Action exitAction) {
+	public RTSimpleState(String id, String name, RTRegion owningRegion,
+			RTAction entryAction, RTAction doAction, RTAction exitAction) {
 		super(id, name, owningRegion, entryAction, exitAction);
 		this.doAction = doAction;
 	}
 
-	protected void reactLocallyOn(Set<Event> events) {
+	protected void reactLocallyOn(Set<RTEvent> events) {
 
 		if (doAction != null) {
 			doAction.execute();
@@ -25,7 +25,7 @@ public class SimpleState extends State {
 
 	}
 
-	public Action getDoAction() {
+	public RTAction getDoAction() {
 		return doAction;
 	}
 

+ 18 - 18
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/State.java

@@ -2,7 +2,7 @@ package org.yakindu.sct.simulation.runtime.sgraph;
 
 import java.util.Set;
 
-import org.yakindu.sct.simulation.runtime.sgraph.Statechart;
+import org.yakindu.sct.simulation.runtime.sgraph.RTStatechart;
 
 /**
  * Representation of a state (i.e. abstract base class for CompoundState, SimpleState,
@@ -12,14 +12,14 @@ import org.yakindu.sct.simulation.runtime.sgraph.Statechart;
  * When being entered or left, a state may execute an Action, i.e. its entry or exit action 
  * respectively.
  */
-public abstract class State extends Node {
+public abstract class RTState extends RTNode {
 
-	private Action entryAction;
-	private Action exitAction;
+	private RTAction entryAction;
+	private RTAction exitAction;
 	private String name;
 
-	public State(String id, String name, Region owningRegion,
-			Action entryAction, Action exitAction) {
+	public RTState(String id, String name, RTRegion owningRegion,
+			RTAction entryAction, RTAction exitAction) {
 		super(id, owningRegion);
 		this.name = name;
 		this.entryAction = entryAction;
@@ -39,7 +39,7 @@ public abstract class State extends Node {
 		owningRegion.setCurrentState(this);
 
 		// see if we have transitions that are time-triggered
-		for (Transition transition : outgoingTransitions) {
+		for (RTTransition transition : outgoingTransitions) {
 			if (transition.isTimeTriggered()) {
 				// register timer with timing service
 				getStatechart().requestTimeEvent(transition.getTimeTrigger());
@@ -51,7 +51,7 @@ public abstract class State extends Node {
 			entryAction.execute();
 		}
 
-		((Statechart) getStatechart()).stateEntered(this);
+		((RTStatechart) getStatechart()).stateEntered(this);
 
 	}
 
@@ -61,9 +61,9 @@ public abstract class State extends Node {
 
 	}
 
-	protected void reactOn(Set<Event> events) {
+	protected void reactOn(Set<RTEvent> events) {
 
-		Transition transition = getEnabledOutgoingTransitionOfHighestPriority(events);
+		RTTransition transition = getEnabledOutgoingTransitionOfHighestPriority(events);
 		if (transition != null) {
 			// if there is an enabled transition, take it
 			transition.take();
@@ -75,10 +75,10 @@ public abstract class State extends Node {
 
 	}
 
-	private Transition getEnabledOutgoingTransitionOfHighestPriority(
-			Set<Event> events) {
+	private RTTransition getEnabledOutgoingTransitionOfHighestPriority(
+			Set<RTEvent> events) {
 
-		for (Transition transition : outgoingTransitions /* sorted by priority */) {
+		for (RTTransition transition : outgoingTransitions /* sorted by priority */) {
 			if (transition.isTriggeredBy(events) && transition.isEnabled()) {
 				return transition;
 			}
@@ -87,12 +87,12 @@ public abstract class State extends Node {
 
 	}
 
-	protected abstract void reactLocallyOn(Set<Event> events);
+	protected abstract void reactLocallyOn(Set<RTEvent> events);
 
 	protected void leave() {
 
 		// see if we have transitions that are time-triggered
-		for (Transition transition : outgoingTransitions) {
+		for (RTTransition transition : outgoingTransitions) {
 			if (transition.isTimeTriggered()) {
 				// cancel all time events that could have been requested
 				getStatechart().cancelTimeEvent(transition.getTimeTrigger());
@@ -103,15 +103,15 @@ public abstract class State extends Node {
 			exitAction.execute();
 		}
 
-		((Statechart) getStatechart()).stateLeft(this);
+		((RTStatechart) getStatechart()).stateLeft(this);
 
 	}
 
-	public Action getEntryAction() {
+	public RTAction getEntryAction() {
 		return entryAction;
 	}
 
-	public Action getExitAction() {
+	public RTAction getExitAction() {
 		return exitAction;
 	}
 

+ 2 - 2
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/TimeEvent.java

@@ -1,8 +1,8 @@
 package org.yakindu.sct.simulation.runtime.sgraph;
 
-public abstract class TimeEvent extends Event {
+public abstract class RTTimeEvent extends RTEvent {
 
-	public TimeEvent(String id) {
+	public RTTimeEvent(String id) {
 		super(id);
 	}
 

+ 9 - 0
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/RTTimingService.java

@@ -0,0 +1,9 @@
+package org.yakindu.sct.simulation.runtime.sgraph;
+
+public interface RTTimingService {
+
+	public void requestTimeEvent(RTTimeEvent timeEvent);
+
+	public void cancelTimeEvent(RTTimeEvent timeEvent);
+
+}

+ 37 - 37
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/Transition.java

@@ -6,7 +6,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.yakindu.sct.simulation.runtime.sgraph.Statechart;
+import org.yakindu.sct.simulation.runtime.sgraph.RTStatechart;
 
 /**
  * Representation of a transition. A transition always connects a source node to
@@ -14,26 +14,26 @@ import org.yakindu.sct.simulation.runtime.sgraph.Statechart;
  * and may be additionally guarded. In case a transition is taken, its action
  * will be executed.
  */
-public class Transition {
+public class RTTransition {
 
 	private String id;
 	private int priority;
 
-	private Guard guard;
-	private Set<SignalEvent> signalTriggers = new HashSet<SignalEvent>();
-	private TimeEvent timeTrigger;
-	private Action action;
+	private RTGuard guard;
+	private Set<RTSignalEvent> signalTriggers = new HashSet<RTSignalEvent>();
+	private RTTimeEvent timeTrigger;
+	private RTAction action;
 
-	private Node sourceNode;
-	private Node targetNode;
+	private RTNode sourceNode;
+	private RTNode targetNode;
 
-	private Region commonAncestorRegion;
-	private List<CompoundState> enclosingStatesToEnter;
-	private List<CompoundState> enclosingStatesToLeave;
+	private RTRegion commonAncestorRegion;
+	private List<RTCompoundState> enclosingStatesToEnter;
+	private List<RTCompoundState> enclosingStatesToLeave;
 
-	public Transition(String id, int priority, TimeEvent timeTrigger,
-			Set<SignalEvent> signalTriggers, Guard guard, Action action,
-			Node sourceNode, Node targetNode) {
+	public RTTransition(String id, int priority, RTTimeEvent timeTrigger,
+			Set<RTSignalEvent> signalTriggers, RTGuard guard, RTAction action,
+			RTNode sourceNode, RTNode targetNode) {
 		this.id = id;
 		this.priority = priority;
 
@@ -59,7 +59,7 @@ public class Transition {
 				commonAncestorRegion);
 	}
 
-	protected boolean isTriggeredBy(Set<Event> events) {
+	protected boolean isTriggeredBy(Set<RTEvent> events) {
 
 		return !Collections.disjoint(this.signalTriggers, events)
 				|| (timeTrigger != null && events.contains(timeTrigger));
@@ -82,7 +82,7 @@ public class Transition {
 		}
 	}
 
-	public TimeEvent getTimeTrigger() {
+	public RTTimeEvent getTimeTrigger() {
 		return timeTrigger;
 	}
 
@@ -94,12 +94,12 @@ public class Transition {
 
 		// leave all enclosing states from the souceNode's container up to
 		// the common ancestor region
-		for (CompoundState state : enclosingStatesToLeave) {
+		for (RTCompoundState state : enclosingStatesToLeave) {
 			state.shallowLeave();
 		}
 		sourceNode.leave();
 
-		((Statechart) commonAncestorRegion.getStatechart())
+		((RTStatechart) commonAncestorRegion.getStatechart())
 				.transitionFired(this);
 
 		if (action != null) {
@@ -108,21 +108,21 @@ public class Transition {
 
 		// enter all enclosing states from the common ancestor region to the
 		// targetNode's container
-		for (CompoundState state : enclosingStatesToEnter) {
+		for (RTCompoundState state : enclosingStatesToEnter) {
 			state.shallowEnter();
 		}
 		targetNode.enter();
 
 	}
 
-	private List<CompoundState> getEnclosingStatesToEnter(Node targetNode,
-			Region commonAncestorRegion) {
+	private List<RTCompoundState> getEnclosingStatesToEnter(RTNode targetNode,
+			RTRegion commonAncestorRegion) {
 
 		// compute all enclosing state that have to be entered
-		List<CompoundState> enclosingStatesToEnter = new ArrayList<CompoundState>();
-		Region targetRegion = targetNode.getOwningRegion();
+		List<RTCompoundState> enclosingStatesToEnter = new ArrayList<RTCompoundState>();
+		RTRegion targetRegion = targetNode.getOwningRegion();
 		while (targetRegion != commonAncestorRegion) {
-			CompoundState state = targetRegion.getOwningState();
+			RTCompoundState state = targetRegion.getOwningState();
 			enclosingStatesToEnter.add(state);
 			targetRegion = state.getOwningRegion();
 
@@ -133,14 +133,14 @@ public class Transition {
 
 	}
 
-	private List<CompoundState> getEnclosingStatesToLeave(Node sourceNode,
-			Region commonAncestorRegion) {
+	private List<RTCompoundState> getEnclosingStatesToLeave(RTNode sourceNode,
+			RTRegion commonAncestorRegion) {
 
 		// compute all enclosing compound states up to the ancestor region
-		List<CompoundState> enclosingStatesToLeave = new ArrayList<CompoundState>();
-		Region sourceRegion = sourceNode.getOwningRegion();
+		List<RTCompoundState> enclosingStatesToLeave = new ArrayList<RTCompoundState>();
+		RTRegion sourceRegion = sourceNode.getOwningRegion();
 		while (sourceRegion != commonAncestorRegion) {
-			CompoundState state = sourceRegion.getOwningState();
+			RTCompoundState state = sourceRegion.getOwningState();
 			enclosingStatesToLeave.add(state);
 			sourceRegion = state.getOwningRegion();
 		}
@@ -148,8 +148,8 @@ public class Transition {
 
 	}
 
-	private Region getCommonAncestorRegion(Node sourceNode, Node targetNode) {
-		Region candidate = sourceNode.getOwningRegion();
+	private RTRegion getCommonAncestorRegion(RTNode sourceNode, RTNode targetNode) {
+		RTRegion candidate = sourceNode.getOwningRegion();
 		while (candidate != null
 				&& !isRegionAncestorOfNode(candidate, targetNode)) {
 			candidate = candidate.getOwningState() != null ? candidate
@@ -158,7 +158,7 @@ public class Transition {
 		return candidate;
 	}
 
-	private boolean isRegionAncestorOfNode(Region region, Node node) {
+	private boolean isRegionAncestorOfNode(RTRegion region, RTNode node) {
 		if (node.getOwningRegion() == region) {
 			return true;
 		} else {
@@ -171,23 +171,23 @@ public class Transition {
 		}
 	}
 
-	public Node getSourceNode() {
+	public RTNode getSourceNode() {
 		return sourceNode;
 	}
 
-	public Node getTargetNode() {
+	public RTNode getTargetNode() {
 		return targetNode;
 	}
 
-	public Guard getGuard() {
+	public RTGuard getGuard() {
 		return guard;
 	}
 
-	public Action getAction() {
+	public RTAction getAction() {
 		return action;
 	}
 
-	public Set<SignalEvent> getSignalTriggers() {
+	public Set<RTSignalEvent> getSignalTriggers() {
 		return signalTriggers;
 	}
 

+ 0 - 9
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/SignalEvent.java

@@ -1,9 +0,0 @@
-package org.yakindu.sct.simulation.runtime.sgraph;
-
-public class SignalEvent extends Event {
-
-	public SignalEvent(String id) {
-		super(id);
-	}
-
-}

+ 0 - 9
plugins/org.yakindu.sct.simulation.runtime/src-gen/org/yakindu/sct/simulation/runtime/sgraph/TimingService.java

@@ -1,9 +0,0 @@
-package org.yakindu.sct.simulation.runtime.sgraph;
-
-public interface TimingService {
-
-	public void requestTimeEvent(TimeEvent timeEvent);
-
-	public void cancelTimeEvent(TimeEvent timeEvent);
-
-}

+ 0 - 18
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/AbstractStatechartAdvice.xpt

@@ -1,18 +0,0 @@
-«REM» Copyright
-> Copyright (c) 2010 committers of YAKINDU and others.
-> All rights reserved. This program and the accompanying materials
-> are made available under the terms of the Eclipse Public License v1.0
-> which accompanies this distribution, and is available at
-> http://www.eclipse.org/legal/epl-v10.html
->
-> Contributors:
->     committers of YAKINDU - initial API and implementation
-«ENDREM»
-«IMPORT com::yakindu::statechart::codegenerator::java::templates::generic»
-
-
-«AROUND com::yakindu::statechart::codegenerator::java::templates::generic::AbstractStatechart::getRegionsMethod FOR Object»
-	public List<Region> getRegions() {«
-		EXPAND AbstractStatechart::getRegionsMethodBody -»
-	}
-«ENDAROUND»

+ 0 - 18
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/CompoundStateAdvice.xpt

@@ -1,18 +0,0 @@
-«REM» Copyright
-> Copyright (c) 2010 committers of YAKINDU and others.
-> All rights reserved. This program and the accompanying materials
-> are made available under the terms of the Eclipse Public License v1.0
-> which accompanies this distribution, and is available at
-> http://www.eclipse.org/legal/epl-v10.html
->
-> Contributors:
->     committers of YAKINDU - initial API and implementation
-«ENDREM»
-«IMPORT com::yakindu::statechart::codegenerator::java::templates::generic»
-
-
-«AROUND com::yakindu::statechart::codegenerator::java::templates::generic::CompoundState::getRegionsMethod FOR Object»
-	public List<Region> getRegions() {«
-		EXPAND CompoundState::getRegionsMethodBody -»
-	}
-«ENDAROUND»

+ 0 - 13
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/GeneratorAdvice.ext

@@ -1,13 +0,0 @@
-/**
- * Copyright (c) 2010 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     committers of YAKINDU - initial API and implementation
- */
-
-around  com::yakindu::statechart::codegenerator::java::extensions::Statechart2JavaNamespace::getLibraryPackage() :
-	"com.yakindu.statechart.runtime";

+ 0 - 24
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/NodeAdvice.xpt

@@ -1,24 +0,0 @@
-«REM» Copyright
-> Copyright (c) 2010 committers of YAKINDU and others.
-> All rights reserved. This program and the accompanying materials
-> are made available under the terms of the Eclipse Public License v1.0
-> which accompanies this distribution, and is available at
-> http://www.eclipse.org/legal/epl-v10.html
->
-> Contributors:
->     committers of YAKINDU - initial API and implementation
-«ENDREM»
-«IMPORT com::yakindu::statechart::codegenerator::java::templates::generic»
-
-«AROUND com::yakindu::statechart::codegenerator::java::templates::generic::Node::getIncomingTransitionsMethod FOR Object»
-	public List<Transition> getIncomingTransitions() {«
-		EXPAND Node::getIncomingTransitionsMethodBody -»
-	}
-«ENDAROUND»
-
-
-«AROUND com::yakindu::statechart::codegenerator::java::templates::generic::Node::getOutgoingTransitionsMethod FOR Object»
-	public List<Transition> getOutgoingTransitions() {«
-		EXPAND Node::getOutgoingTransitionsMethodBody -»
-	}
-«ENDAROUND»

+ 0 - 17
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/RegionAdvice.xpt

@@ -1,17 +0,0 @@
-«REM» Copyright
-> Copyright (c) 2010 committers of YAKINDU and others.
-> All rights reserved. This program and the accompanying materials
-> are made available under the terms of the Eclipse Public License v1.0
-> which accompanies this distribution, and is available at
-> http://www.eclipse.org/legal/epl-v10.html
->
-> Contributors:
->     committers of YAKINDU - initial API and implementation
-«ENDREM»
-«IMPORT com::yakindu::statechart::codegenerator::java::templates::generic»
-
-«AROUND com::yakindu::statechart::codegenerator::java::templates::generic::Region::getNodesMethod FOR Object»
-	public Set<Node> getNodes() {«
-		EXPAND Region::getNodesMethodBody -»
-	}
-«ENDAROUND»

+ 0 - 20
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/SimpleStateAdvice.xpt

@@ -1,20 +0,0 @@
-«REM» Copyright
-> Copyright (c) 2010 committers of YAKINDU and others.
-> All rights reserved. This program and the accompanying materials
-> are made available under the terms of the Eclipse Public License v1.0
-> which accompanies this distribution, and is available at
-> http://www.eclipse.org/legal/epl-v10.html
->
-> Contributors:
->     committers of YAKINDU - initial API and implementation
-«ENDREM»
-«IMPORT com::yakindu::statechart::codegenerator::java::templates::generic»
-
-«AROUND com::yakindu::statechart::codegenerator::java::templates::generic::SimpleState::SimpleStateClassBody FOR Object»
-	«targetDef.proceed()»	
-
-	public Action getDoAction() {
-		return doAction;
-	}
-
-«ENDAROUND»

+ 0 - 36
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/StateAdvice.xpt

@@ -1,36 +0,0 @@
-«REM» Copyright
-> Copyright (c) 2010 committers of YAKINDU and others.
-> All rights reserved. This program and the accompanying materials
-> are made available under the terms of the Eclipse Public License v1.0
-> which accompanies this distribution, and is available at
-> http://www.eclipse.org/legal/epl-v10.html
->
-> Contributors:
->     committers of YAKINDU - initial API and implementation
-«ENDREM»
-«IMPORT com::yakindu::statechart::codegenerator::java::templates::generic»
-
-«AROUND com::yakindu::statechart::codegenerator::java::templates::generic::State::StateClassBody FOR Object»
-	«targetDef.proceed()»
-
-	public Action getEntryAction() {
-		return entryAction;
-	}
-
-	public Action getExitAction() {
-		return exitAction;
-	}
-
-«ENDAROUND»
-
-
-«AROUND com::yakindu::statechart::codegenerator::java::templates::generic::State::leaveMethodBody FOR Object»
-		«targetDef.proceed()»
-		((Statechart) getStatechart()).stateLeft(this);
-«ENDAROUND»
-
-
-«AROUND com::yakindu::statechart::codegenerator::java::templates::generic::State::enterMethodBody FOR Object»
-		«targetDef.proceed()»
-		((Statechart) getStatechart()).stateEntered(this);
-«ENDAROUND»

+ 0 - 51
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/TransitionAdvice.xpt

@@ -1,51 +0,0 @@
-«REM» Copyright
-> Copyright (c) 2010 committers of YAKINDU and others.
-> All rights reserved. This program and the accompanying materials
-> are made available under the terms of the Eclipse Public License v1.0
-> which accompanies this distribution, and is available at
-> http://www.eclipse.org/legal/epl-v10.html
->
-> Contributors:
->     committers of YAKINDU - initial API and implementation
-«ENDREM»
-«IMPORT com::yakindu::statechart::codegenerator::java::templates::generic»
-
-
-«AROUND com::yakindu::statechart::codegenerator::java::templates::generic::Transition::getTimeTriggerMethod FOR Object»
-	public TimeEvent getTimeTrigger() {«
-		EXPAND Transition::getTimeTriggerMethodBody -»
-	}
-«ENDAROUND»
-
-
-«AROUND com::yakindu::statechart::codegenerator::java::templates::generic::Transition::TransitionClassBody FOR Object»
-	«targetDef.proceed()»
-
-	public Node getSourceNode() {
-		return sourceNode;
-	}
-
-	public Node getTargetNode() {
-		return targetNode;
-	}
-
-	public Guard getGuard() {
-		return guard;
-	}
-
-	public Action getAction() {
-		return action;
-	}
-	
-	public Set<SignalEvent> getSignalTriggers() {
-		return signalTriggers;
-	}
-	
-	
-	
-«ENDAROUND»
-
-«AROUND com::yakindu::statechart::codegenerator::java::templates::generic::Transition::postLeaveSourceNode FOR Object»
-		«targetDef.proceed()»
-		((Statechart) commonAncestorRegion.getStatechart()).transitionFired(this);
-«ENDAROUND»

+ 0 - 21
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/generator/generate_Runtime.oaw

@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<workflow>
-	<!-- src-gen point to output folder for generated code --> 
-	<property name="src-gen" value="src-gen" />
-	
-	<!-- Generator call with model-file and output-folder -->
-    <cartridge file='com/yakindu/statechart/codegenerator/java/workflow/generate_java_runtime.oaw' src-gen="${src-gen}"/>
-    
-    <component adviceTarget="runtime_generator" id="NamingAdvice" 
-    	class="org.eclipse.xpand2.GeneratorAdvice"> 
-    	<advice value="com::yakindu::statechart::runtime::generator::AbstractStatechartAdvice"/> 
-    	<advice value="com::yakindu::statechart::runtime::generator::RegionAdvice"/> 
-    	<advice value="com::yakindu::statechart::runtime::generator::NodeAdvice"/> 
-    	<advice value="com::yakindu::statechart::runtime::generator::StateAdvice"/> 
-    	<advice value="com::yakindu::statechart::runtime::generator::SimpleStateAdvice"/> 
-    	<advice value="com::yakindu::statechart::runtime::generator::CompoundStateAdvice"/> 
-    	<advice value="com::yakindu::statechart::runtime::generator::TransitionAdvice"/> 
-    	<extensionAdvice value="com::yakindu::statechart::runtime::generator::GeneratorAdvice"/> 
-   </component> 
-    
-</workflow>

+ 2 - 2
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/ActionStatement.java

@@ -11,11 +11,11 @@
 package org.yakindu.sct.simulation.runtime.sgraph;
 
 import org.yakindu.sct.simulation.runtime.ExecutionScope;
-import org.yakindu.sct.simulation.runtime.sgraph.Action;
+import org.yakindu.sct.simulation.runtime.sgraph.RTAction;
 import org.yakindu.sct.simulation.runtime.stext.Statement;
 
 
-public class ActionStatement extends Action {
+public class ActionStatement extends RTAction {
 
 	protected Statement statement;
 	protected ExecutionScope scope;

+ 2 - 2
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/GuardExpression.java

@@ -11,11 +11,11 @@
 package org.yakindu.sct.simulation.runtime.sgraph;
 
 import org.yakindu.sct.simulation.runtime.ExecutionScope;
-import org.yakindu.sct.simulation.runtime.sgraph.Guard;
+import org.yakindu.sct.simulation.runtime.sgraph.RTGuard;
 import org.yakindu.sct.simulation.runtime.stext.Expression;
 
 
-public class GuardExpression extends Guard {
+public class GuardExpression extends RTGuard {
 
 	private Expression expression;
 	private ExecutionScope scope;

+ 224 - 0
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/RTStatechart.java

@@ -0,0 +1,224 @@
+/**
+ * Copyright (c) 2010 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.runtime.sgraph;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.yakindu.sct.simulation.runtime.ExecutionScope;
+import org.yakindu.sct.simulation.runtime.sgraph.AbstractStatechart;
+import org.yakindu.sct.simulation.runtime.sgraph.RTCompoundState;
+import org.yakindu.sct.simulation.runtime.sgraph.RTEvent;
+import org.yakindu.sct.simulation.runtime.sgraph.RTNode;
+import org.yakindu.sct.simulation.runtime.sgraph.RTRegion;
+import org.yakindu.sct.simulation.runtime.sgraph.RTSignalEvent;
+import org.yakindu.sct.simulation.runtime.sgraph.RTState;
+import org.yakindu.sct.simulation.runtime.sgraph.RTTimingService;
+import org.yakindu.sct.simulation.runtime.sgraph.RTTransition;
+import org.yakindu.sct.simulation.runtime.stext.Variable;
+
+
+public class RTStatechart extends AbstractStatechart implements ExecutionScope {
+
+
+	protected Map<Object, Object> aliasToElementMap = new HashMap<Object, Object>();
+	protected Map<Object, Object> elementToAliasMap = new HashMap<Object, Object>();
+
+	protected List<RTSignalEvent> events = new ArrayList<RTSignalEvent>(); 
+	protected Map<String, RTSignalEvent> eventMap = new HashMap<String, RTSignalEvent>();
+
+	protected List<Variable> variables = new ArrayList<Variable>(); 
+	protected Map<String, Variable> variableMap = new HashMap<String, Variable>();
+		
+	protected Set<RTState> currentStateConfigurartion = new HashSet<RTState>();
+	
+	protected StatechartListener listener;
+	
+	
+	public RTStatechart(String id) {
+		super(id);
+	}
+
+	public RTStatechart(String id, RTTimingService timingService) {
+		super(id, timingService);
+	}
+
+	
+	public RTTimingService getTimingService() {
+		return timingService;
+	}
+	
+	public void setTimingService(RTTimingService ts) {
+		timingService = ts;
+	}
+	
+	
+	public StatechartListener getListener() {
+		return listener;
+	}
+
+	public void setListener(StatechartListener listener) {
+		this.listener = listener;
+	}
+
+	/**
+	 * Adds a signal event definition to the interface of the statechart. 
+	 * only those events, that are registered should be used during operation.
+	 *  
+	 * @param event
+	 */
+	public void addSignalEvent(RTSignalEvent event) {
+		events.add(event);
+		eventMap.put(event.getId(), event);
+	}
+	
+	/**
+	 * Gets a signal event by its id.
+	 * 
+	 * @param id
+	 * @return the signal event
+	 */
+	public RTSignalEvent getSignalEvent(String id) {
+		return eventMap.get(id);
+	}
+	
+	public Set<RTEvent> getRaisedEvents() {
+		return Collections.unmodifiableSet(raisedEvents);
+	}
+
+	/**
+	 * @return The list of all defined signal events of this statechart.
+	 */
+	public List<RTSignalEvent> getSignalEvents() {
+		return Collections.unmodifiableList(events);
+	}
+	
+	
+	public void addVariable(Variable var) {
+		variables.add(var);
+		variableMap.put(var.getName(), var);
+	}
+
+	
+	public Object getValue(String varName) {
+		Variable var = getVariable(varName);
+		return (var != null) ? var.getValue() : null ;		
+	}
+
+	
+	public Variable getVariable(String varName) {
+		return variableMap.get(varName);
+	}
+	
+	public List<Variable>  getVariables() {
+		return Collections.unmodifiableList(variables);
+	}
+
+	
+	protected void stateLeft(RTState state) {
+		currentStateConfigurartion.remove(state);
+		if (listener != null) listener.stateLeft(state);
+	}
+	
+	protected void stateEntered(RTState state) {
+		currentStateConfigurartion.add(state);
+		if (listener != null) listener.stateEntered(state);
+	}
+	
+	protected void transitionFired(RTTransition trans) {
+		if (listener != null) listener.transitionFired(trans);
+	}
+	
+	public Set<RTState> getCurrentStateConfiguration() {
+		return Collections.unmodifiableSet(currentStateConfigurartion);
+	}
+	
+	
+	public void raise(String signal) {
+		setEvent(eventMap.get(signal));
+	}
+
+	public void reset(String signal) {
+		raisedEvents.remove(eventMap.get(signal));
+	}
+
+	
+	public void call(String procedureId) {
+		// TODO Auto-generated method stub		
+	}
+
+	
+	/**
+	 * If a node is registered with a key then it can be accessed by the key using this method.
+	 * Before a node can be accessed this way it must be registered using {@link #registerNode}. 
+	 * @param alias
+	 * @return the node object that is registered for the given key.
+	 */
+	public Object getElementByAlias(Object alias) {
+		return aliasToElementMap.get(alias);
+	}
+	
+	/**
+	 * If a node is registered with a key then it can be accessed by the key using this method.
+	 * Before a node can be accessed this way it must be registered using {@link #registerNode}. 
+	 * @param element
+	 * @return the node object that is registered for the given key.
+	 */
+	public Object getAliasByElement(Object element) {
+		return elementToAliasMap.get(element);
+	}
+	
+	/**
+	 * Nodes can optionally be regitered with a key for later lookup.
+	 * 
+	 * @param key the key object
+	 * @param element the node
+	 */
+	public void defineAlias(Object alias, Object element) {
+		aliasToElementMap.put(alias, element);
+		elementToAliasMap.put(element, alias);
+	}
+
+	
+	public List<RTRegion> getAllRegions() {
+		List<RTRegion> allRegions = new ArrayList<RTRegion>();
+		
+		allRegions.addAll(getRegions());
+		for (RTRegion region : getRegions()) {
+			addAllRegions(allRegions, region);
+		}
+
+		
+		return allRegions;
+	}
+
+	
+	protected void addAllRegions(List<RTRegion> regions, RTRegion region) {
+		for (RTNode node : region.getNodes()) {
+			if (node instanceof RTCompoundState) addAllRegions(regions, (RTCompoundState) node);
+		}
+	}
+	
+	protected void addAllRegions(List<RTRegion> regions, RTCompoundState cState) {
+		regions.addAll(cState.getRegions());
+		
+		for (RTRegion region : cState.getRegions()) {
+			addAllRegions(regions, region);
+		}
+	}
+	
+	
+}

+ 5 - 5
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/StatechartListener.java

@@ -10,13 +10,13 @@
  */
 package org.yakindu.sct.simulation.runtime.sgraph;
 
-import org.yakindu.sct.simulation.runtime.sgraph.State;
-import org.yakindu.sct.simulation.runtime.sgraph.Transition;
+import org.yakindu.sct.simulation.runtime.sgraph.RTState;
+import org.yakindu.sct.simulation.runtime.sgraph.RTTransition;
 
 public interface StatechartListener {
 	
-	void stateEntered(State state);
-	void stateLeft(State state);
-	void transitionFired(Transition trans);
+	void stateEntered(RTState state);
+	void stateLeft(RTState state);
+	void transitionFired(RTTransition trans);
 
 }

+ 2 - 2
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/TimeEventExpression.java

@@ -11,10 +11,10 @@
 package org.yakindu.sct.simulation.runtime.sgraph;
 
 import org.yakindu.sct.simulation.runtime.ExecutionScope;
-import org.yakindu.sct.simulation.runtime.sgraph.TimeEvent;
+import org.yakindu.sct.simulation.runtime.sgraph.RTTimeEvent;
 import org.yakindu.sct.simulation.runtime.stext.Trigger;
 
-public class TimeEventExpression extends org.yakindu.sct.simulation.runtime.sgraph.TimeEvent {
+public class TimeEventExpression extends org.yakindu.sct.simulation.runtime.sgraph.RTTimeEvent {
 
 	protected Trigger.TimeEvent timeEvent;
 	protected ExecutionScope scope;

+ 12 - 0
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/builder/ISGraphExtensionBuilder.java

@@ -0,0 +1,12 @@
+package org.yakindu.sct.simulation.runtime.sgraph.builder;
+
+/**
+ * 
+ * @author andreas muelder
+ *
+ */
+public interface ISGraphExtensionBuilder {
+
+	
+	
+}

+ 220 - 0
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/builder/SGraphBuilder.java

@@ -0,0 +1,220 @@
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.runtime.sgraph.builder;
+
+import java.util.Collections;
+import java.util.Comparator;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.EcoreUtil2;
+import org.yakindu.sct.model.sgraph.Choice;
+import org.yakindu.sct.model.sgraph.Entry;
+import org.yakindu.sct.model.sgraph.Event;
+import org.yakindu.sct.model.sgraph.FinalState;
+import org.yakindu.sct.model.sgraph.Region;
+import org.yakindu.sct.model.sgraph.Scope;
+import org.yakindu.sct.model.sgraph.State;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.model.sgraph.Transition;
+import org.yakindu.sct.model.stext.stext.Type;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
+import org.yakindu.sct.simulation.runtime.sgraph.PseudostateKind;
+import org.yakindu.sct.simulation.runtime.sgraph.RTCompoundState;
+import org.yakindu.sct.simulation.runtime.sgraph.RTFinalState;
+import org.yakindu.sct.simulation.runtime.sgraph.RTNode;
+import org.yakindu.sct.simulation.runtime.sgraph.RTPseudostate;
+import org.yakindu.sct.simulation.runtime.sgraph.RTRegion;
+import org.yakindu.sct.simulation.runtime.sgraph.RTSignalEvent;
+import org.yakindu.sct.simulation.runtime.sgraph.RTSimpleState;
+import org.yakindu.sct.simulation.runtime.sgraph.RTState;
+import org.yakindu.sct.simulation.runtime.sgraph.RTStatechart;
+import org.yakindu.sct.simulation.runtime.sgraph.RTTransition;
+import org.yakindu.sct.simulation.runtime.stext.Function;
+import org.yakindu.sct.simulation.runtime.stext.FunctionMethod;
+import org.yakindu.sct.simulation.runtime.stext.Variable;
+
+/**
+ * 
+ * @author axel terfloth
+ * @author andreas muelder
+ * 
+ */
+public class SGraphBuilder extends Function {
+
+	protected static Comparator<RTRegion> regionComparator = new Comparator<RTRegion>() {
+		public int compare(RTRegion o1, RTRegion o2) {
+			return o1.getPriority() - o2.getPriority();
+		}
+	};
+
+	public RTStatechart build(Statechart source) {
+		RTStatechart sc = new RTStatechart(source.getName());
+		// Build the structure with states and regions
+		build(sc, source.eContents());
+		// Build the transitions
+		EList<EObject> allContentsOfType = new BasicEList<EObject>(
+				EcoreUtil2.getAllContentsOfType(source, Transition.class));
+		build(sc, allContentsOfType);
+		return sc;
+	}
+
+	@FunctionMethod("")
+	public Object build(RTStatechart statechart, Scope scope) {
+		build(statechart, new BasicEList<EObject>(scope.getDeclarations()));
+		return statechart;
+	}
+
+	// TODO: This is an access to the sText meta model, we have to extract these
+	// dependencies
+	// to an own builder
+	@FunctionMethod("")
+	public Object build(RTStatechart statechart, VariableDefinition definition) {
+		Variable variable = new Variable();
+		variable.setName(definition.getName());
+		statechart.addVariable(variable);
+		statechart.defineAlias(definition, variable);
+		if (definition.getType() == Type.BOOLEAN) {
+			variable.setType(Boolean.class);
+			variable.setValue(false);
+		} else if (definition.getType() == Type.INTEGER) {
+			variable.setType(Integer.class);
+			variable.setValue(0);
+		} else if (definition.getType() == Type.REAL) {
+			variable.setType(Float.class);
+			variable.setValue(0.0f);
+		}
+		return null;
+	}
+
+	@FunctionMethod("")
+	public Object build(RTStatechart tParent, Event event) {
+		RTSignalEvent signalEvent = new RTSignalEvent(event.getName());
+		tParent.addSignalEvent(signalEvent);
+		tParent.defineAlias(event, signalEvent);
+		return event;
+	}
+
+	@FunctionMethod("")
+	public Object build(RTStatechart statechart, Region region) {
+		RTRegion runtimeRegion = new RTRegion("" + region.getPriority(),
+				region.getPriority(), statechart);
+		Collections.sort(statechart.getRegions(), regionComparator);
+		build(runtimeRegion, region.eContents());
+		return runtimeRegion;
+	}
+
+	@FunctionMethod("")
+	public Object build(RTCompoundState compoundState, Region region) {
+		RTRegion runtimeRegion = new RTRegion("" + region.getPriority(),
+				region.getPriority(), compoundState);
+		Collections.sort(compoundState.getRegions(), regionComparator);
+		build(runtimeRegion, region.eContents());
+		return runtimeRegion;
+	}
+
+	@FunctionMethod("")
+	public Object build(RTRegion region, Choice choice) {
+		RTPseudostate runtimeChoice = new RTPseudostate("", region,
+				PseudostateKind.CHOICE);
+		((RTStatechart) region.getStatechart()).defineAlias(choice,
+				runtimeChoice);
+		return runtimeChoice;
+	}
+
+	@FunctionMethod("")
+	public Object build(RTRegion runtimeRegion, Entry entry) {
+		PseudostateKind kind = null;
+		switch (entry.getKind()) {
+		case INITIAL:
+			kind = PseudostateKind.INITIAL;
+			break;
+		case DEEP_HISTORY:
+			kind = PseudostateKind.DEEPHISTORY;
+			break;
+		case SHALLOW_HISTORY:
+			kind = PseudostateKind.SHALLOWHISTORY;
+			break;
+		default:
+			throw new IllegalStateException("Unknown Entry kind "
+					+ entry.getKind());
+		}
+		RTPseudostate pseudoState = new RTPseudostate(runtimeRegion.getId()
+				+ "." + "TODO", runtimeRegion, kind);
+		((RTStatechart) runtimeRegion.getStatechart()).defineAlias(entry,
+				pseudoState);
+		return pseudoState;
+	}
+
+	@FunctionMethod("")
+	public Object build(RTRegion parent, State state) {
+		RTState runtimeState = null;
+		if (state.getSubRegions().size() > 0) {
+			runtimeState = new RTCompoundState(parent.getId() + "."
+					+ state.getName(), state.getName(), parent, null, null);
+			build(runtimeState, state.eContents());
+
+		} else {
+			runtimeState = new RTSimpleState(parent.getId() + "."
+					+ state.getName(), state.getName(), parent, null, null,
+					null);
+		}
+
+		((RTStatechart) parent.getStatechart())
+				.defineAlias(state, runtimeState);
+
+		return runtimeState;
+	}
+
+	@FunctionMethod("")
+	public Object build(RTRegion runtimeRegion, FinalState finalState) {
+		RTFinalState state = new RTFinalState(runtimeRegion.getId()
+				+ ".<final>", runtimeRegion);
+		((RTStatechart) runtimeRegion.getStatechart()).defineAlias(finalState,
+				state);
+		return state;
+	}
+
+	@FunctionMethod("")
+	public Object build(RTStatechart tParent, Transition sTrans) {
+		RTNode fromNode = (RTNode) tParent
+				.getElementByAlias(sTrans.getSource());
+		RTNode toNode = (RTNode) tParent.getElementByAlias(sTrans.getTarget());
+		// TODO: Trigger, Actions, etc.
+		RTTransition tTrans = new RTTransition("t@", sTrans.getPriority(),
+				null, null, null, null, fromNode, toNode);
+		tParent.defineAlias(sTrans, tTrans);
+		return tTrans;
+	}
+
+	protected void build(Object targetParent, EList<EObject> sourceChildren) {
+		for (EObject source : sourceChildren) {
+			build(targetParent, source);
+		}
+	}
+
+	protected Object build(Object targetParent, EObject sourceChild) {
+		if (sourceChild == null)
+			return null;
+
+		Object[] params = new Object[] { targetParent, sourceChild };
+
+		Function f = lookup(this.getClass(), "build", params);
+		if (f != null)
+			return f.execute(params);
+
+		throw new IllegalStateException("No function  build("
+				+ targetParent.getClass().getName() + ", "
+				+ sourceChild.eClass().getName() + ") !");
+	}
+
+}

+ 0 - 268
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/builder/StatechartBuilder.java

@@ -1,268 +0,0 @@
-/**
- * Copyright (c) 2010 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     committers of YAKINDU - initial API and implementation
- */
-package org.yakindu.sct.simulation.runtime.sgraph.builder;
-
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.yakindu.sct.model.sgraph.impl.EventImpl;
-import org.yakindu.sct.model.sgraph.impl.FinalStateImpl;
-import org.yakindu.sct.model.sgraph.impl.PseudostateImpl;
-import org.yakindu.sct.model.sgraph.impl.RegionImpl;
-import org.yakindu.sct.model.sgraph.impl.StateImpl;
-import org.yakindu.sct.model.sgraph.impl.TransitionImpl;
-import org.yakindu.sct.model.sgraph.impl.VariableImpl;
-import org.yakindu.sct.simulation.runtime.sgraph.Action;
-import org.yakindu.sct.simulation.runtime.sgraph.ActionStatement;
-import org.yakindu.sct.simulation.runtime.sgraph.CompoundState;
-import org.yakindu.sct.simulation.runtime.sgraph.FinalState;
-import org.yakindu.sct.simulation.runtime.sgraph.Guard;
-import org.yakindu.sct.simulation.runtime.sgraph.GuardExpression;
-import org.yakindu.sct.simulation.runtime.sgraph.Node;
-import org.yakindu.sct.simulation.runtime.sgraph.Pseudostate;
-import org.yakindu.sct.simulation.runtime.sgraph.PseudostateKind;
-import org.yakindu.sct.simulation.runtime.sgraph.Region;
-import org.yakindu.sct.simulation.runtime.sgraph.SignalEvent;
-import org.yakindu.sct.simulation.runtime.sgraph.SimpleState;
-import org.yakindu.sct.simulation.runtime.sgraph.State;
-import org.yakindu.sct.simulation.runtime.sgraph.Statechart;
-import org.yakindu.sct.simulation.runtime.sgraph.TimeEvent;
-import org.yakindu.sct.simulation.runtime.sgraph.TimeEventExpression;
-import org.yakindu.sct.simulation.runtime.sgraph.Transition;
-import org.yakindu.sct.simulation.runtime.stext.Expression;
-import org.yakindu.sct.simulation.runtime.stext.Function;
-import org.yakindu.sct.simulation.runtime.stext.FunctionMethod;
-import org.yakindu.sct.simulation.runtime.stext.Trigger;
-import org.yakindu.sct.simulation.runtime.stext.Variable;
-import org.yakindu.sct.simulation.runtime.stext.builder.BuilderException;
-import org.yakindu.sct.simulation.runtime.stext.builder.ExpressionBuilder;
-
-public class StatechartBuilder extends Function {
-	
-	
-	protected static Comparator<Region> regionComparator = new Comparator<Region>(){
-		public int compare(Region o1, Region o2) {
-			return o1.getPriority() - o2.getPriority();
-		}
-	};
-	
-	protected static Map<PseudoTypes, PseudostateKind> pseudotypeMap;
-	
-	static {
-		pseudotypeMap = new HashMap<statemachine.PseudoTypes, PseudostateKind>();
-		pseudotypeMap.put(statemachine.PseudoTypes.CHOICE, PseudostateKind.CHOICE);
-		pseudotypeMap.put(statemachine.PseudoTypes.DEEP_HISTORY, PseudostateKind.DEEPHISTORY);
-		pseudotypeMap.put(statemachine.PseudoTypes.INITIAL, PseudostateKind.INITIAL);
-		pseudotypeMap.put(statemachine.PseudoTypes.JUNCTION, PseudostateKind.JUNCTION);
-		pseudotypeMap.put(statemachine.PseudoTypes.SHALLOW_HISTORY, PseudostateKind.SHALLOWHISTORY);
-	}
-	
-	public Statechart build(org.yakindu.sct.model.sgraph.Statechart source) {
-		Statechart sc = new Statechart(source.getUUID());
-		build(sc, source.eContents());		
-		
-		return sc;
-	}
-
-	
-	@FunctionMethod("")
-	public Object build(Statechart tParent, VariableImpl sChild) {
-		Variable var = new Variable(sChild.getName());
-		tParent.addVariable(var);
-		tParent.defineAlias(sChild, var);
-
-		if (sChild.getgetDataType() == statemachine.DataTypes.BOOLEAN) {
-			var.setType(Boolean.class);
-			var.setValue(false);
-		}
-		else if (sChild.getDataType() == statemachine.DataTypes.INT) {
-			var.setType(Integer.class);
-			var.setValue(0);
-		}
-		else if (sChild.getDataType() == statemachine.DataTypes.DOUBLE) {
-			var.setType(Float.class);
-			var.setValue(0.0f);
-		}
-			
-		return var;
-	}
-	
-	
-	@FunctionMethod("")
-	public Object build(Statechart tParent, EventImpl sChild) {
-		SignalEvent event = new SignalEvent(sChild.getName());
-		tParent.addSignalEvent(event);
-		tParent.defineAlias(sChild, event);
-		return event;
-	}
-	
-	
-	@FunctionMethod("")
-	public Object build(Statechart tParent, RegionImpl sChild) {
-		Region region = new Region("" + sChild.getPriority(), sChild.getPriority(), tParent);
-		Collections.sort(tParent.getRegions(), regionComparator);
-		
-		build(region, sChild.eContents());		
-
-		return region;
-	}
-	
-	
-	@FunctionMethod("")
-	public Object build(Statechart tParent, TransitionImpl sTrans) {
-		
-		Node fromNode = (Node) tParent.getElementByAlias(sTrans.getSourceNode()); 
-		Node toNode = (Node) tParent.getElementByAlias(sTrans.getTargetNode());
-		String expression = sTrans.getExpression();
-
-		String transitionId = "t@" + sTrans.getId();
-		TimeEvent timeTrigger = null;
-		Set<SignalEvent> signalTriggers = new HashSet<SignalEvent>();
-		Guard  guard  = null;
-		Action action = null;
-		
-		
-		if (expression != null && expression.trim().length()>0) {
-			ExpressionBuilder builder = new ExpressionBuilder();
-			
-			String triggerExpression = JavaExtensions.extractTriggerExpressionString(expression);
-			if (triggerExpression != null && triggerExpression.trim().length() >0) {
-				List<Trigger> triggers = builder.buildTriggerExpression(triggerExpression);
-				for (Trigger trigger : triggers) {
-					if (trigger instanceof Trigger.SignalEvent) {
-						SignalEvent event = tParent.getSignalEvent(((Trigger.SignalEvent) trigger).getSignal());
-						if (event != null) signalTriggers.add(event);
-					} else if (trigger instanceof Trigger.TimeEvent) {
-						timeTrigger = new TimeEventExpression(transitionId + ".timer", 
-								(Trigger.TimeEvent)trigger, 
-								tParent);
-					}
-				}
-			}
-			
-			String guardExpression = JavaExtensions.extractGuardExpressionString(expression);
-			guard = (guardExpression != null && guardExpression .trim().length() > 0 ) 
-			? new GuardExpression(builder.buildGuardExpression(guardExpression), tParent) 
-			: null;
-
-			String actionExpresion = JavaExtensions.extractActionExpressionString(expression);
-			action = (actionExpresion != null && actionExpresion.trim().length() > 0 ) 
-					? new ActionStatement(builder.buildActionExpression(actionExpresion), tParent) 
-					: null;
-
-		}
-		
-		Transition tTrans = new Transition(
-				"t@" + sTrans.getId(), 
-				sTrans.getPriority(), 
-				timeTrigger,
-				signalTriggers,
-				guard,
-				action, 
-				fromNode,
-				toNode);
-		
-		tParent.defineAlias(sTrans, tTrans);
-
-		return tTrans;
-	}
-	
-	
-	@FunctionMethod("")
-	public Object build(CompoundState tParent, RegionImpl sChild) {
-		Region region = new Region("" + sChild.getPriority(), sChild.getPriority(), tParent);
-		Collections.sort(tParent.getRegions(), regionComparator);
-		
-		build(region, sChild.eContents());		
-
-		return region;
-	}
-	
-	
-	@FunctionMethod("")
-	public Object build(Region tParent, PseudostateImpl sChild) {
-		Pseudostate pseudoState = new Pseudostate(tParent.getId() + "." + sChild.getId(), tParent, pseudotypeMap.get(sChild.getPseudoType()) );
-		((Statechart)tParent.getStatechart()).defineAlias(sChild, pseudoState);
-		return pseudoState;
-	}
-	
-	
-	@FunctionMethod("")
-	public Object build(Region tParent, StateImpl sChild) {
-		ExpressionBuilder builder = new ExpressionBuilder();
-		
-		ActionStatement entryAction = (sChild.getEntry() != null && sChild.getEntry().trim().length()>0) ? 
-				new ActionStatement(builder.buildActionExpression(sChild.getEntry()), (Statechart) tParent.getStatechart()) : null;
-		ActionStatement doAction = (sChild.getDo() != null && sChild.getDo().trim().length()>0) ? 
-				new ActionStatement(builder.buildActionExpression(sChild.getDo()), (Statechart) tParent.getStatechart()) : null;
-		ActionStatement exitAction = (sChild.getExit() != null && sChild.getExit().trim().length()>0) ? 
-				new ActionStatement(builder.buildActionExpression(sChild.getExit()), (Statechart) tParent.getStatechart()) : null;
-		
-		State state = null;
-		if ( sChild.getRegion().size() > 0 ) {
-			state = new CompoundState(tParent.getId() + "." + sChild.getName(), sChild.getName(), tParent, entryAction, exitAction );
-			build(state, sChild.eContents());
-			
-		} else {
-			state = new SimpleState(tParent.getId() + "." + sChild.getName(), sChild.getName(), tParent, entryAction, doAction, exitAction );
-		}
-		
-		((Statechart)tParent.getStatechart()).defineAlias(sChild, state);
-
-		return state;
-	}
-	
-	
-	
-	@FunctionMethod("")
-	public Object build(Region tParent, FinalStateImpl sChild) {		
-		FinalState state = new FinalState(tParent.getId() + ".<final>", tParent );
-		((Statechart)tParent.getStatechart()).defineAlias(sChild, state);
-		return state;
-	}
-	
-	
-	
-	protected void build(Object targetParent, EList<EObject> sourceChildren) {
-		for (EObject source : sourceChildren) {
-			build(targetParent, source);
-		}
-	}
-	
-	
-	/**
-	 * Internal build method that performs the dynamic dispatch to the appropriate (correctly named) 
-	 * builder function. The parameter is always a EObject and since we have use dynamic EMF we match by 
-	 * naming conventions.
-	 * 
-	 * @param sourceChild
-	 * @return
-	 */
-	protected Object build(Object targetParent, EObject sourceChild) {
-		if ( sourceChild == null ) return null;
-		
-		Object[] params = new Object[]{targetParent, sourceChild};
-		
-		Function f = ExpressionBuilder.lookup(this.getClass(), "build", params);
-		if (f != null) 
-			return f.execute(params);
-		
-		throw new BuilderException("No function  build(" + targetParent.getClass().getName() + ", " + sourceChild.eClass().getName() + ") !");
-	}
-
-}

+ 177 - 62
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/stext/CoreFunction.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2010 committers of YAKINDU and others.
+ * Copyright (c) 2011 committers of YAKINDU and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -10,136 +10,182 @@
  */
 package org.yakindu.sct.simulation.runtime.stext;
 
-
 public class CoreFunction extends Function {
-	
-	public static String EQUALS			= "==";
-	public static String NOT_EQUALS		= "!=";
-	public static String SMALLER		= "<";
-	public static String SMALLER_EQUAL	= "<=";
-	public static String GREATER		= ">";
-	public static String GREATER_EQUAL	= ">=";
-
-	public static String BIT_AND		= "&";
-	public static String BIT_OR			= "|";
-	public static String BIT_XOR		= "^";
-	public static String BIT_LSHIFT		= "<<";
-	public static String BIT_RSHIFT		= ">>";
+
+	public static String EQUALS = "==";
+	public static String NOT_EQUALS = "!=";
+	public static String SMALLER = "<";
+	public static String SMALLER_EQUAL = "<=";
+	public static String GREATER = ">";
+	public static String GREATER_EQUAL = ">=";
+
+	public static String BIT_AND = "&";
+	public static String BIT_OR = "|";
+	public static String BIT_XOR = "^";
+	public static String BIT_LSHIFT = "<<";
+	public static String BIT_RSHIFT = ">>";
 	public static String BIT_COMPLEMENT = "~";
-	
-	public static String PLUS			= "+";
-	public static String MINUS			= "-";
-	public static String MULTIPLY		= "*";
-	public static String DIVIDE			= "/";
-	public static String MODULO			= "%";
-	
-	public static String POSITIVE		= "+";
-	public static String NEGATIVE		= "-";
-	public static String NOT			= "!";
-
-
-	
+
+	public static String PLUS = "+";
+	public static String MINUS = "-";
+	public static String MULTIPLY = "*";
+	public static String DIVIDE = "/";
+	public static String MODULO = "%";
+
+	public static String POSITIVE = "+";
+	public static String NEGATIVE = "-";
+	public static String NOT = "!";
+
 	@FunctionMethod("+")
 	public Integer plus(Integer i1, Integer i2) {
 		return i1 + i2;
 	}
-	
+
 	@FunctionMethod("+")
 	public Float plus(Float f1, Float f2) {
 		return f1 + f2;
-	}	
-	
+	}
+
+	@FunctionMethod("+")
+	public Float plus(Integer f1, Float f2) {
+		return f1 + f2;
+	}
+
+	@FunctionMethod("+")
+	public Float plus(Float f1, Integer f2) {
+		return f1 + f2;
+	}
+
 	@FunctionMethod("+")
 	public Integer positive(Integer i) {
 		return i;
-	}	
-	
+	}
+
 	@FunctionMethod("+")
 	public Float positive(Float f) {
 		return f;
-	}	
-	
+	}
+
 	@FunctionMethod("-")
 	public Integer negative(Integer i) {
 		return -i;
-	}	
-	
+	}
+
 	@FunctionMethod("-")
 	public Float negative(Float f) {
 		return -f;
-	}	
-	
+	}
 
 	@FunctionMethod("-")
 	public Integer minus(Integer i1, Integer i2) {
 		return i1 - i2;
 	}
-	
+
+	@FunctionMethod("-")
+	public Float minus(Integer i1, Float i2) {
+		return i1 - i2;
+	}
+
+	@FunctionMethod("-")
+	public Float minus(Float i1, Integer i2) {
+		return i1 - i2;
+	}
+
 	@FunctionMethod("-")
 	public Float minus(Float i1, Float i2) {
 		return i1 - i2;
 	}
-	
+
 	@FunctionMethod("*")
 	public Integer mul(Integer i1, Integer i2) {
 		return i1 * i2;
 	}
-	
+
+	@FunctionMethod("*")
+	public Float mul(Integer i1, Float i2) {
+		return i1 * i2;
+	}
+
+	@FunctionMethod("*")
+	public Float mul(Float i1, Integer i2) {
+		return i1 * i2;
+	}
+
 	@FunctionMethod("*")
 	public Float mul(Float i1, Float i2) {
 		return i1 * i2;
 	}
-	
+
 	@FunctionMethod("/")
 	public Integer div(Integer i1, Integer i2) {
 		return i1 / i2;
 	}
-	
+
+	@FunctionMethod("/")
+	public Float div(Float i1, Integer i2) {
+		return i1 / i2;
+	}
+
+	@FunctionMethod("/")
+	public Float div(Integer i1, Float i2) {
+		return i1 / i2;
+	}
+
 	@FunctionMethod("/")
 	public Float div(Float i1, Float i2) {
 		return i1 / i2;
 	}
-	
+
 	@FunctionMethod("%")
 	public Integer mod(Integer i1, Integer i2) {
 		return i1 % i2;
 	}
-	
+
+	@FunctionMethod("%")
+	public Float mod(Integer i1, Float i2) {
+		return i1 % i2;
+	}
+
+	@FunctionMethod("%")
+	public Float mod(Float i1, Integer i2) {
+		return i1 % i2;
+	}
+
 	@FunctionMethod("%")
 	public Float mod(Float i1, Float i2) {
 		return i1 % i2;
 	}
-	
+
 	@FunctionMethod("<<")
 	public Integer left(Integer i1, Integer i2) {
 		return i1 << i2;
 	}
-	
+
 	@FunctionMethod(">>")
 	public Integer right(Integer i1, Integer i2) {
 		return i1 >> i2;
 	}
-	
+
 	@FunctionMethod("&")
 	public Integer bitwiseAnd(Integer i1, Integer i2) {
 		return i1 & i2;
 	}
-	
+
 	@FunctionMethod("|")
 	public Integer bitwiseOr(Integer i1, Integer i2) {
 		return i1 | i2;
 	}
-	
+
 	@FunctionMethod("^")
 	public Integer bitwiseXor(Integer i1, Integer i2) {
 		return i1 ^ i2;
 	}
-	
+
 	@FunctionMethod("^")
 	public Long bitwiseXor(Long l1, Long l2) {
-		return l1 ^ l2 ;
+		return l1 ^ l2;
 	}
-	
+
 	@FunctionMethod("==")
 	public Boolean equals(Boolean b1, Boolean b2) {
 		return b1.equals(b2);
@@ -150,31 +196,71 @@ public class CoreFunction extends Function {
 		return i1.intValue() == i2.intValue();
 	}
 
+	@FunctionMethod("==")
+	public Boolean equals(Float i1, Integer i2) {
+		return i1.intValue() == i2.intValue();
+	}
+
+	@FunctionMethod("==")
+	public Boolean equals(Integer i1, Float i2) {
+		return i1.intValue() == i2.intValue();
+	}
+
 	@FunctionMethod("==")
 	public Boolean equals(Float i1, Float i2) {
 		return i1.floatValue() == i2.floatValue();
 	}
-	
+
+	@FunctionMethod("==")
+	public Boolean equals(String string1, String string2) {
+		return string1.equals(string2);
+	}
+
 	@FunctionMethod("!=")
 	public Boolean notEquals(Boolean b1, Boolean b2) {
 		return b1.booleanValue() != b2.booleanValue();
 	}
-	
+
 	@FunctionMethod("!=")
 	public Boolean notEquals(Integer i1, Integer i2) {
 		return i1.intValue() != i2.intValue();
 	}
-	
+
+	@FunctionMethod("!=")
+	public Boolean notEquals(Integer i1, Float i2) {
+		return i1.intValue() != i2.intValue();
+	}
+
+	@FunctionMethod("!=")
+	public Boolean notEquals(Float i1, Integer i2) {
+		return i1.intValue() != i2.intValue();
+	}
+
 	@FunctionMethod("!=")
 	public Boolean notEquals(Float i1, Float i2) {
 		return i1.floatValue() != i2.floatValue();
 	}
 
+	@FunctionMethod("!=")
+	public Boolean notEquals(String i1, String i2) {
+		return !i1.equals(i2);
+	}
+
 	@FunctionMethod(">=")
 	public Boolean greaterEqual(Integer i1, Integer i2) {
 		return i1 >= i2;
 	}
-	
+
+	@FunctionMethod(">=")
+	public Boolean greaterEqual(Integer i1, Float i2) {
+		return i1 >= i2;
+	}
+
+	@FunctionMethod(">=")
+	public Boolean greaterEqual(Float i1, Integer i2) {
+		return i1 >= i2;
+	}
+
 	@FunctionMethod(">=")
 	public Boolean greaterEqual(Float i1, Float i2) {
 		return i1 >= i2;
@@ -184,7 +270,17 @@ public class CoreFunction extends Function {
 	public Boolean smallerEqual(Integer i1, Integer i2) {
 		return i1 <= i2;
 	}
-	
+
+	@FunctionMethod("<=")
+	public Boolean smallerEqual(Integer i1, Float i2) {
+		return i1 <= i2;
+	}
+
+	@FunctionMethod("<=")
+	public Boolean smallerEqual(Float i1, Integer i2) {
+		return i1 <= i2;
+	}
+
 	@FunctionMethod("<=")
 	public Boolean smallerEqual(Float i1, Float i2) {
 		return i1 <= i2;
@@ -194,7 +290,17 @@ public class CoreFunction extends Function {
 	public Boolean greater(Integer i1, Integer i2) {
 		return i1 > i2;
 	}
-	
+
+	@FunctionMethod(">")
+	public Boolean greater(Float i1, Integer i2) {
+		return i1 > i2;
+	}
+
+	@FunctionMethod(">")
+	public Boolean greater(Integer i1, Float i2) {
+		return i1 > i2;
+	}
+
 	@FunctionMethod(">")
 	public Boolean greater(Float i1, Float i2) {
 		return i1 > i2;
@@ -204,7 +310,17 @@ public class CoreFunction extends Function {
 	public Boolean smaller(Integer i1, Integer i2) {
 		return i1 < i2;
 	}
-	
+
+	@FunctionMethod("<")
+	public Boolean smaller(Integer i1, Float i2) {
+		return i1 < i2;
+	}
+
+	@FunctionMethod("<")
+	public Boolean smaller(Float i1, Integer i2) {
+		return i1 < i2;
+	}
+
 	@FunctionMethod("<")
 	public Boolean smaller(Float i1, Float i2) {
 		return i1 < i2;
@@ -239,5 +355,4 @@ public class CoreFunction extends Function {
 	public Integer complement(Integer i) {
 		return ~i;
 	}
-	
 }

+ 98 - 24
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/stext/Function.java

@@ -13,40 +13,111 @@ package org.yakindu.sct.simulation.runtime.stext;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
 
 import org.yakindu.sct.simulation.runtime.EvaluationException;
 
+/**
+ * 
+ * @author axel terfloth
+ * @author andreas muelder
+ * 
+ */
 public class Function {
+	/**
+	 * Sorts a {@link Collection} of {@link Method} . The most specialized
+	 * parameter types are put first.
+	 * 
+	 * @author muelder
+	 * 
+	 */
+	public static class PolymorphicComparator implements Comparator<Method> {
+
+		public int compare(Method method1, Method method2) {
+			Class<?>[] parameterTypes1 = method1.getParameterTypes();
+			Class<?>[] parameterTypes2 = method2.getParameterTypes();
+
+			if (parameterTypes1.length != parameterTypes2.length)
+				return -1;
+
+			for (int i = 0; i < parameterTypes1.length; i++) {
+				final Class<?> class1 = parameterTypes1[i];
+				final Class<?> class2 = parameterTypes2[i];
+				if (class1.equals(class2))
+					continue;
+				if (class1.isAssignableFrom(class2)
+						|| Void.class.equals(class2)) {
+					return 1;
+				}
+				if (class2.isAssignableFrom(class1)
+						|| Void.class.equals(class1)) {
+					return -1;
+				}
+			}
+			return 0;
+		}
+	}
 
 	protected Method functionMethod;
 
 	/**
-	 * Looks up the appropriate function for the given parameter types. This lookup currently does not perform a polymophic lookup.
+	 * Looks up the appropriate function for the given parameter types. This
+	 * lookup currently does not perform a polymophic lookup.
 	 * 
 	 * @param name
 	 * @param paramTypes
 	 * @return
 	 */
-	public static Function lookup(Class<?> functionClass, String name, Class<?>[] paramTypes) {
+	public static Function lookup(Class<?> functionClass, String name,
+			Class<?>[] paramTypes) {
+
+		List<Method> functionMethods = getFunctionMethods(functionClass);
+		for (Method fMethod : functionMethods) {
+			FunctionMethod fAnno = fMethod.getAnnotation(FunctionMethod.class);
+			if ((name.equals(fMethod.getName())) || name.equals(fAnno.value())) {
+				if (isCallable(paramTypes, fMethod.getParameterTypes())) {
+					return createFunction(functionClass, fMethod);
+				}
+			}
+		}
+		return null;
+	}
+
+	private static List<Method> getFunctionMethods(Class<?> functionClass) {
+
+		List<Method> result = new ArrayList<Method>();
 		Method[] methods = functionClass.getDeclaredMethods();
 		for (int i = 0; i < methods.length; i++) {
 			Method fMethod = methods[i];
 			FunctionMethod fAnno = fMethod.getAnnotation(FunctionMethod.class);
 			if (fAnno != null) {
-				if ((name.equals(fMethod.getName())) || name.equals(fAnno.value())) {
-					if (Arrays.equals(paramTypes, fMethod.getParameterTypes())) {						
-						return createFunction(functionClass, fMethod);
-					}
-				}
+				result.add(fMethod);
 			}
 		}
-		
-		return null;
+		Collections.sort(result, new PolymorphicComparator());
+		return result;
 	}
 
-	
-	public static Function lookup(Class<?> functionClass, String name, Object[] params) {
+	private static boolean isCallable(Class<?>[] paramTypes,
+			Class<?>[] parameterTypes) {
+		if (paramTypes.length != parameterTypes.length)
+			return false;
+		for (int i = 0; i < paramTypes.length; i++) {
+			Class<?> class1 = paramTypes[i];
+			Class<?> class2 = parameterTypes[i];
+			if (!class2.isAssignableFrom(class1))
+				return false;
+		}
+		return true;
+
+	}
+
+	public static Function lookup(Class<?> functionClass, String name,
+			Object[] params) {
 		Class<?>[] paramTypes = new Class<?>[params.length];
 		for (int i = 0; i < params.length; i++) {
 			paramTypes[i] = params[i].getClass();
@@ -54,17 +125,23 @@ public class Function {
 		return lookup(functionClass, name, paramTypes);
 	}
 
+	protected static Function createFunction(Class<?> functionClass,
+			Method functionMethod) {
 
-	protected static Function createFunction(Class<?> functionClass, Method functionMethod) {
+		if (functionClass == null || functionMethod == null)
+			return null;
 
-		if ( functionClass == null || functionMethod == null ) return null;
-		
 		try {
 			Constructor<?> constr;
 			try {
-				constr = (Constructor<?>) functionClass.getConstructor(new Class<?>[0]);
+				constr = (Constructor<?>) functionClass
+						.getConstructor(new Class<?>[0]);
 			} catch (NoSuchMethodException e) {
-				throw new ExpressionRuntimeException("Missing default constructor in class " + functionClass.getName() + " while loading function " + functionMethod.getName() + " !");
+				throw new ExpressionRuntimeException(
+						"Missing default constructor in class "
+								+ functionClass.getName()
+								+ " while loading function "
+								+ functionMethod.getName() + " !");
 			}
 
 			Function func = (Function) constr.newInstance(new Object[0]);
@@ -74,18 +151,16 @@ public class Function {
 		} catch (ExpressionRuntimeException e) {
 			throw e;
 		} catch (Exception e) {
-			throw new ExpressionRuntimeException("Error loading function " + functionMethod.getName() + " from function class " + functionClass.getName() + " !", e);
+			throw new ExpressionRuntimeException("Error loading function "
+					+ functionMethod.getName() + " from function class "
+					+ functionClass.getName() + " !", e);
 		}
 	}
 
-	
-	
 	public Function() {
 		super();
 	}
-	
-	
-	
+
 	public Method getFunctionMethod() {
 		return functionMethod;
 	}
@@ -94,7 +169,6 @@ public class Function {
 		this.functionMethod = functionMethod;
 	}
 
-	
 	public Object execute(Object[] params) {
 		try {
 			return getFunctionMethod().invoke(this, params);

+ 1 - 1
plugins/org.yakindu.sct.ui.simulation/META-INF/MANIFEST.MF

@@ -12,7 +12,7 @@ Require-Bundle: org.eclipse.ui,
  org.eclipse.gmf.runtime.diagram.ui.resources.editor;bundle-version="1.4.1",
  org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
  org.eclipse.debug.ui;bundle-version="3.7.0",
- org.yakindu.sct.core.simulation;bundle-version="1.0.0",
+ org.yakindu.sct.simulation.core;bundle-version="1.0.0",
  org.eclipse.jdt.launching;bundle-version="3.6.0",
  org.eclipse.jdt.debug.ui;bundle-version="3.6.0"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5

+ 2 - 2
plugins/org.yakindu.sct.ui.simulation/src/org/yakindu/sct/ui/simulation/launch/StatechartLaunchShortcut.java

@@ -24,8 +24,8 @@ import org.eclipse.debug.ui.ILaunchShortcut;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IEditorPart;
-import org.yakindu.sct.core.simulation.launch.IStatechartLaunchConfigurationType;
-import org.yakindu.sct.core.simulation.launch.IStatechartLaunchParameters;
+import org.yakindu.sct.simulation.core.launch.IStatechartLaunchConfigurationType;
+import org.yakindu.sct.simulation.core.launch.IStatechartLaunchParameters;
 
 /**
  * 

+ 1 - 1
plugins/org.yakindu.sct.ui.simulation/src/org/yakindu/sct/ui/simulation/launch/tabs/StatechartLaunchConfigurationTab.java

@@ -32,7 +32,7 @@ import org.eclipse.swt.widgets.Group;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.dialogs.ResourceListSelectionDialog;
-import org.yakindu.sct.core.simulation.launch.IStatechartLaunchParameters;
+import org.yakindu.sct.simulation.core.launch.IStatechartLaunchParameters;
 
 /**
  *