浏览代码

Removed abstract statechart class.
Added support for valueof() and raised() expression.

markus.muehlbrandt@itemis.de 13 年之前
父节点
当前提交
b44047dbc0
共有 13 个文件被更改,包括 437 次插入499 次删除
  1. 2 2
      Examples/org.yakindu.sct.generator.java.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/InterfaceDefaultImpl.java
  2. 2 2
      Examples/org.yakindu.sct.generator.java.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/InterfacePedestrianImpl.java
  3. 2 2
      Examples/org.yakindu.sct.generator.java.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/InterfaceTrafficLightImpl.java
  4. 100 99
      Examples/org.yakindu.sct.generator.java.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/TrafficLightWaitingAbstractBaseStatemachine.java
  5. 0 30
      Examples/org.yakindu.sct.generator.java.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/TrafficLightWaitingCyleBasedStatemachine.java
  6. 3 3
      Examples/org.yakindu.sct.generator.java.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/CrossingDemo.java
  7. 0 339
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomBaseStatemachine.xpt
  8. 306 8
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomCycleBasedStatemachine.xpt
  9. 1 1
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomEventBasedStatemachine.xpt
  10. 2 2
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterfaceImpl.xpt
  11. 17 8
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Expression.ext
  12. 0 2
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Main.xpt
  13. 2 1
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Naming.ext

+ 2 - 2
Examples/org.yakindu.sct.generator.java.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/InterfaceDefaultImpl.java

@@ -18,10 +18,10 @@ public class InterfaceDefaultImpl implements InterfaceDefault {
 	private final Event EventKeypress2 = new Event("keypress2");
 	private final Event EventKeypress3 = new Event("keypress3");
 
-	private TrafficLightWaitingAbstractBaseStatemachine statemachine;
+	private TrafficLightWaitingCycleBasedStatemachine statemachine;
 
 	public InterfaceDefaultImpl(
-			TrafficLightWaitingAbstractBaseStatemachine statemachine) {
+			TrafficLightWaitingCycleBasedStatemachine statemachine) {
 		this.statemachine = statemachine;
 	}
 

+ 2 - 2
Examples/org.yakindu.sct.generator.java.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/InterfacePedestrianImpl.java

@@ -12,10 +12,10 @@ package org.yakindu.sct.runtime.java.trafficlightwaiting;
 
 public class InterfacePedestrianImpl implements InterfacePedestrian {
 
-	private TrafficLightWaitingAbstractBaseStatemachine statemachine;
+	private TrafficLightWaitingCycleBasedStatemachine statemachine;
 
 	public InterfacePedestrianImpl(
-			TrafficLightWaitingAbstractBaseStatemachine statemachine) {
+			TrafficLightWaitingCycleBasedStatemachine statemachine) {
 		this.statemachine = statemachine;
 	}
 

+ 2 - 2
Examples/org.yakindu.sct.generator.java.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/InterfaceTrafficLightImpl.java

@@ -12,10 +12,10 @@ package org.yakindu.sct.runtime.java.trafficlightwaiting;
 
 public class InterfaceTrafficLightImpl implements InterfaceTrafficLight {
 
-	private TrafficLightWaitingAbstractBaseStatemachine statemachine;
+	private TrafficLightWaitingCycleBasedStatemachine statemachine;
 
 	public InterfaceTrafficLightImpl(
-			TrafficLightWaitingAbstractBaseStatemachine statemachine) {
+			TrafficLightWaitingCycleBasedStatemachine statemachine) {
 		this.statemachine = statemachine;
 	}
 

+ 100 - 99
Examples/org.yakindu.sct.generator.java.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/TrafficLightWaitingAbstractBaseStatemachine.java

@@ -10,6 +10,7 @@
  */
 package org.yakindu.sct.runtime.java.trafficlightwaiting;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.EnumSet;
 import java.util.HashSet;
@@ -21,7 +22,7 @@ import org.yakindu.sct.runtime.java.ITimerHandler;
 import org.yakindu.sct.runtime.java.EventNotification;
 import org.yakindu.sct.runtime.java.Notification;
 
-public abstract class TrafficLightWaitingAbstractBaseStatemachine
+public class TrafficLightWaitingCycleBasedStatemachine
 		implements
 			ITimedStatemachine {
 
@@ -54,7 +55,7 @@ public abstract class TrafficLightWaitingAbstractBaseStatemachine
 
 	private final Set<State> activeStates = EnumSet.noneOf(State.class);
 
-	private final Collection<Event> occuredEvents;
+	private final ArrayList<Event> occuredEvents;
 
 	private final Collection<Event> outEvents;
 
@@ -62,10 +63,9 @@ public abstract class TrafficLightWaitingAbstractBaseStatemachine
 
 	private long cycleStartTime;
 
-	public TrafficLightWaitingAbstractBaseStatemachine(
-			Collection<Event> occuredEvents) {
-		this.occuredEvents = occuredEvents;
-		this.outEvents = new HashSet<Event>();
+	public TrafficLightWaitingCycleBasedStatemachine() {
+		occuredEvents = new ArrayList<Event>();
+		outEvents = new HashSet<Event>();
 		interfaceTrafficLight = new InterfaceTrafficLightImpl(this);
 		interfacePedestrian = new InterfacePedestrianImpl(this);
 		interfaceDefault = new InterfaceDefaultImpl(this);
@@ -80,7 +80,7 @@ public abstract class TrafficLightWaitingAbstractBaseStatemachine
 	}
 
 	protected boolean eventOccured() {
-		return !getOccuredEvents().isEmpty();
+		return !occuredEvents.isEmpty();
 	}
 
 	public void init() {
@@ -127,52 +127,47 @@ public abstract class TrafficLightWaitingAbstractBaseStatemachine
 		enterSequenceOn();
 	}
 
-	private boolean conditionOnTr0(Collection<?> events) {
-		return getOccuredEvents()
-				.contains(interfaceDefault.getEventKeypress3());
+	private boolean conditionOnTr0() {
+		return occuredEvents.contains(interfaceDefault.getEventKeypress3());
 	}
-	private boolean conditionOnTr1(Collection<?> events) {
-		return getOccuredEvents()
-				.contains(interfaceDefault.getEventKeypress2());
+	private boolean conditionOnTr1() {
+		return occuredEvents.contains(interfaceDefault.getEventKeypress2());
 	}
-	private boolean conditionStreetGreenTr0(Collection<?> events) {
-		return getOccuredEvents()
-				.contains(interfaceDefault.getEventKeypress1());
+	private boolean conditionStreetGreenTr0() {
+		return occuredEvents.contains(interfaceDefault.getEventKeypress1());
 	}
-	private boolean conditionPedWaitingTr0(Collection<?> events) {
-		return getOccuredEvents().contains(PedWaiting_time_event_0);
+	private boolean conditionPedWaitingTr0() {
+		return occuredEvents.contains(PedWaiting_time_event_0);
 	}
-	private boolean conditionWaitOnTr0(Collection<?> events) {
-		return getOccuredEvents().contains(WaitOn_time_event_0);
+	private boolean conditionWaitOnTr0() {
+		return occuredEvents.contains(WaitOn_time_event_0);
 	}
-	private boolean conditionWaitOffTr0(Collection<?> events) {
-		return getOccuredEvents().contains(WaitOff_time_event_0);
+	private boolean conditionWaitOffTr0() {
+		return occuredEvents.contains(WaitOff_time_event_0);
 	}
-	private boolean conditionStreetAttentionTr0(Collection<?> events) {
-		return getOccuredEvents().contains(StreetAttention_time_event_0);
+	private boolean conditionStreetAttentionTr0() {
+		return occuredEvents.contains(StreetAttention_time_event_0);
 	}
-	private boolean conditionStreetRedTr0(Collection<?> events) {
-		return getOccuredEvents().contains(StreetRed_time_event_0);
+	private boolean conditionStreetRedTr0() {
+		return occuredEvents.contains(StreetRed_time_event_0);
 	}
-	private boolean conditionPedestrianGreenTr0(Collection<?> events) {
-		return getOccuredEvents().contains(PedestrianGreen_time_event_0);
+	private boolean conditionPedestrianGreenTr0() {
+		return occuredEvents.contains(PedestrianGreen_time_event_0);
 	}
-	private boolean conditionPedestrianRedTr0(Collection<?> events) {
-		return getOccuredEvents().contains(PedestrianRed_time_event_0);
+	private boolean conditionPedestrianRedTr0() {
+		return occuredEvents.contains(PedestrianRed_time_event_0);
 	}
-	private boolean conditionStreetPrepareTr0(Collection<?> events) {
-		return getOccuredEvents().contains(StreetPrepare_time_event_0);
+	private boolean conditionStreetPrepareTr0() {
+		return occuredEvents.contains(StreetPrepare_time_event_0);
 	}
-	private boolean conditionFreezeTr0(Collection<?> events) {
-		return getOccuredEvents()
-				.contains(interfaceDefault.getEventKeypress3());
+	private boolean conditionFreezeTr0() {
+		return occuredEvents.contains(interfaceDefault.getEventKeypress3());
 	}
-	private boolean conditionOffTr0(Collection<?> events) {
-		return getOccuredEvents()
-				.contains(interfaceDefault.getEventKeypress2());
+	private boolean conditionOffTr0() {
+		return occuredEvents.contains(interfaceDefault.getEventKeypress2());
 	}
-	private boolean conditionBlinkYellowLr1(Collection<?> events) {
-		return getOccuredEvents().contains(BlinkYellow_time_event_0);
+	private boolean conditionBlinkYellowLr1() {
+		return occuredEvents.contains(BlinkYellow_time_event_0);
 	}
 	private void actionsOnTr0() {
 		exitSequenceOn();
@@ -423,8 +418,13 @@ public abstract class TrafficLightWaitingAbstractBaseStatemachine
 		if (activeStates.contains(State.StreetGreen)) {
 			exitSequenceStreetGreen();
 
-		} else if (activeStates.contains(State.PedWaiting)) {
-			exitSequencePedWaiting();
+		} else if (activeStates.contains(State.WaitOn)) {
+			exitSequenceWaitOn();
+			exitActionPedWaiting();
+
+		} else if (activeStates.contains(State.WaitOff)) {
+			exitSequenceWaitOff();
+			exitActionPedWaiting();
 
 		} else if (activeStates.contains(State.StreetAttention)) {
 			exitSequenceStreetAttention();
@@ -497,35 +497,35 @@ public abstract class TrafficLightWaitingAbstractBaseStatemachine
 		activeStates.remove(State.BlinkYellow);
 		exitActionBlinkYellow();
 	}
-	private void cycleOn(Collection<?> events) {
+	private void reactOn() {
 	}
-	private void cycleStreetGreen(Collection<?> events) {
-		if (conditionOnTr0(events)) {
+	private void reactStreetGreen() {
+		if (conditionOnTr0()) {
 			actionsOnTr0();
 		} else {
-			if (conditionOnTr1(events)) {
+			if (conditionOnTr1()) {
 				actionsOnTr1();
 			} else {
-				if (conditionStreetGreenTr0(events)) {
+				if (conditionStreetGreenTr0()) {
 					actionsStreetGreenTr0();
 				}
 
 			}
 		}
 	}
-	private void cyclePedWaiting(Collection<?> events) {
+	private void reactPedWaiting() {
 	}
-	private void cycleWaitOn(Collection<?> events) {
-		if (conditionOnTr0(events)) {
+	private void reactWaitOn() {
+		if (conditionOnTr0()) {
 			actionsOnTr0();
 		} else {
-			if (conditionOnTr1(events)) {
+			if (conditionOnTr1()) {
 				actionsOnTr1();
 			} else {
-				if (conditionPedWaitingTr0(events)) {
+				if (conditionPedWaitingTr0()) {
 					actionsPedWaitingTr0();
 				} else {
-					if (conditionWaitOnTr0(events)) {
+					if (conditionWaitOnTr0()) {
 						actionsWaitOnTr0();
 					}
 
@@ -534,17 +534,17 @@ public abstract class TrafficLightWaitingAbstractBaseStatemachine
 			}
 		}
 	}
-	private void cycleWaitOff(Collection<?> events) {
-		if (conditionOnTr0(events)) {
+	private void reactWaitOff() {
+		if (conditionOnTr0()) {
 			actionsOnTr0();
 		} else {
-			if (conditionOnTr1(events)) {
+			if (conditionOnTr1()) {
 				actionsOnTr1();
 			} else {
-				if (conditionPedWaitingTr0(events)) {
+				if (conditionPedWaitingTr0()) {
 					actionsPedWaitingTr0();
 				} else {
-					if (conditionWaitOffTr0(events)) {
+					if (conditionWaitOffTr0()) {
 						actionsWaitOffTr0();
 					}
 
@@ -553,140 +553,141 @@ public abstract class TrafficLightWaitingAbstractBaseStatemachine
 			}
 		}
 	}
-	private void cycleStreetAttention(Collection<?> events) {
-		if (conditionOnTr0(events)) {
+	private void reactStreetAttention() {
+		if (conditionOnTr0()) {
 			actionsOnTr0();
 		} else {
-			if (conditionOnTr1(events)) {
+			if (conditionOnTr1()) {
 				actionsOnTr1();
 			} else {
-				if (conditionStreetAttentionTr0(events)) {
+				if (conditionStreetAttentionTr0()) {
 					actionsStreetAttentionTr0();
 				}
 
 			}
 		}
 	}
-	private void cycleStreetRed(Collection<?> events) {
-		if (conditionOnTr0(events)) {
+	private void reactStreetRed() {
+		if (conditionOnTr0()) {
 			actionsOnTr0();
 		} else {
-			if (conditionOnTr1(events)) {
+			if (conditionOnTr1()) {
 				actionsOnTr1();
 			} else {
-				if (conditionStreetRedTr0(events)) {
+				if (conditionStreetRedTr0()) {
 					actionsStreetRedTr0();
 				}
 
 			}
 		}
 	}
-	private void cyclePedestrianGreen(Collection<?> events) {
-		if (conditionOnTr0(events)) {
+	private void reactPedestrianGreen() {
+		if (conditionOnTr0()) {
 			actionsOnTr0();
 		} else {
-			if (conditionOnTr1(events)) {
+			if (conditionOnTr1()) {
 				actionsOnTr1();
 			} else {
-				if (conditionPedestrianGreenTr0(events)) {
+				if (conditionPedestrianGreenTr0()) {
 					actionsPedestrianGreenTr0();
 				}
 
 			}
 		}
 	}
-	private void cyclePedestrianRed(Collection<?> events) {
-		if (conditionOnTr0(events)) {
+	private void reactPedestrianRed() {
+		if (conditionOnTr0()) {
 			actionsOnTr0();
 		} else {
-			if (conditionOnTr1(events)) {
+			if (conditionOnTr1()) {
 				actionsOnTr1();
 			} else {
-				if (conditionPedestrianRedTr0(events)) {
+				if (conditionPedestrianRedTr0()) {
 					actionsPedestrianRedTr0();
 				}
 
 			}
 		}
 	}
-	private void cycleStreetPrepare(Collection<?> events) {
-		if (conditionOnTr0(events)) {
+	private void reactStreetPrepare() {
+		if (conditionOnTr0()) {
 			actionsOnTr0();
 		} else {
-			if (conditionOnTr1(events)) {
+			if (conditionOnTr1()) {
 				actionsOnTr1();
 			} else {
-				if (conditionStreetPrepareTr0(events)) {
+				if (conditionStreetPrepareTr0()) {
 					actionsStreetPrepareTr0();
 				}
 
 			}
 		}
 	}
-	private void cycleFreeze(Collection<?> events) {
-		if (conditionFreezeTr0(events)) {
+	private void reactFreeze() {
+		if (conditionFreezeTr0()) {
 			actionsFreezeTr0();
 		}
 	}
-	private void cycleOff(Collection<?> events) {
+	private void reactOff() {
 	}
-	private void cycleBlinkYellow(Collection<?> events) {
-		if (conditionOffTr0(events)) {
+	private void reactBlinkYellow() {
+		if (conditionOffTr0()) {
 			actionsOffTr0();
 		} else {
-			if (conditionBlinkYellowLr1(events)) {
+			if (conditionBlinkYellowLr1()) {
 				actionsBlinkYellowLr1();
 			}
 
 		}
 	}
-	protected void runCycle(Collection<?> events) {
+	public void runCycle() {
 		cycleStartTime = System.currentTimeMillis();
-		getOutEvents().clear();
+		outEvents.clear();
 		for (State state : activeStates) {
 			switch (state) {
 				case On :
-					cycleOn(events);
+					reactOn();
 					break;
 				case StreetGreen :
-					cycleStreetGreen(events);
+					reactStreetGreen();
 					break;
 				case PedWaiting :
-					cyclePedWaiting(events);
+					reactPedWaiting();
 					break;
 				case WaitOn :
-					cycleWaitOn(events);
+					reactWaitOn();
 					break;
 				case WaitOff :
-					cycleWaitOff(events);
+					reactWaitOff();
 					break;
 				case StreetAttention :
-					cycleStreetAttention(events);
+					reactStreetAttention();
 					break;
 				case StreetRed :
-					cycleStreetRed(events);
+					reactStreetRed();
 					break;
 				case PedestrianGreen :
-					cyclePedestrianGreen(events);
+					reactPedestrianGreen();
 					break;
 				case PedestrianRed :
-					cyclePedestrianRed(events);
+					reactPedestrianRed();
 					break;
 				case StreetPrepare :
-					cycleStreetPrepare(events);
+					reactStreetPrepare();
 					break;
 				case Freeze :
-					cycleFreeze(events);
+					reactFreeze();
 					break;
 				case Off :
-					cycleOff(events);
+					reactOff();
 					break;
 				case BlinkYellow :
-					cycleBlinkYellow(events);
+					reactBlinkYellow();
 					break;
 				default :
 					// no state found
 			}
 		}
+		occuredEvents.clear();
 	}
 }

+ 0 - 30
Examples/org.yakindu.sct.generator.java.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/TrafficLightWaitingCyleBasedStatemachine.java

@@ -1,30 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     committers of YAKINDU - initial API and implementation
- */
-package org.yakindu.sct.runtime.java.trafficlightwaiting;
-
-import java.util.HashSet;
-
-import org.yakindu.sct.runtime.java.Event;
-
-public class TrafficLightWaitingCyleBasedStatemachine
-		extends
-			TrafficLightWaitingAbstractBaseStatemachine {
-
-	public TrafficLightWaitingCyleBasedStatemachine() {
-		super(new HashSet<Event>());
-	}
-
-	public void runCycle() {
-		runCycle(getOccuredEvents());
-		// remove all events
-		getOccuredEvents().clear();
-	}
-}

+ 3 - 3
Examples/org.yakindu.sct.generator.java.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/CrossingDemo.java

@@ -31,13 +31,13 @@ import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Shell;
 import org.yakindu.sct.runtime.java.TimerHandler;
-import org.yakindu.sct.runtime.java.trafficlightwaiting.TrafficLightWaitingCyleBasedStatemachine;
+import org.yakindu.sct.runtime.java.trafficlightwaiting.TrafficLightWaitingCycleBasedStatemachine;
 
 public class CrossingDemo {
 
 	public static void main(String[] args) {
 
-		final TrafficLightWaitingCyleBasedStatemachine statemachine = new TrafficLightWaitingCyleBasedStatemachine();
+		final TrafficLightWaitingCycleBasedStatemachine statemachine = new TrafficLightWaitingCycleBasedStatemachine();
 
 		// create display and shell
 		Display display = new Display();
@@ -125,7 +125,7 @@ public class CrossingDemo {
 	}
 
 	private static void createButtonComposite(
-			final TrafficLightWaitingCyleBasedStatemachine statemachine,
+			final TrafficLightWaitingCycleBasedStatemachine statemachine,
 			Shell shell) {
 		// create a composite to hold the buttons
 		Composite buttonComposite = new Composite(shell, SWT.NO_SCROLL);

+ 0 - 339
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomBaseStatemachine.xpt

@@ -1,339 +0,0 @@
-«REM»
-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
- 	
-@author Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-
-«IMPORT sexec»
-«IMPORT stext»
-«IMPORT sgraph»
-«IMPORT ecore»
-«IMPORT org::yakindu::sct::generator::java::templates»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::ExecutionModelExtensions»
-«EXTENSION org::yakindu::sct::generator::java::templates::Expression»
-«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
-
-«DEFINE ActionCode FOR Step-»
-// ActionCode for Step «toString()» not defined
-«ENDDEFINE»
-
-«DEFINE EntryCode FOR Step-»
-// EntryCode for Step «toString()» not defined
-«ENDDEFINE»
-
-«DEFINE ActionCode FOR StateSwitch-»
-	«FOREACH cases AS stateCase ITERATOR iter -»
-	«IF iter.counter1 > 1»else «ENDIF»if (activeStates.contains(State.«stateCase.state.getName()»)) {
-		«EXPAND ActionCode FOR stateCase.step»
-	}
-	«ENDFOREACH-»
-«ENDDEFINE»
-
-«DEFINE ActionCode FOR ScheduleTimeEvent-»
-getTimerHandler().setTimer(«timeEvent.getName()», «timeValue.toCode()», cycleStartTime);
-«ENDDEFINE»
-
-«DEFINE ActionCode FOR UnscheduleTimeEvent-»
-getTimerHandler().resetTimer(«timeEvent.getName()»);
-«ENDDEFINE»
-
-«DEFINE ActionCode FOR Execution-»
-	«statement.toCode()»
-«ENDDEFINE»
-
-«DEFINE ActionCode FOR Call-»
-«this.step.functionName()»();
-«ENDDEFINE»
-
-«DEFINE ActionCode FOR Sequence-»
-	«EXPAND ActionCode FOREACH this.steps»
-«ENDDEFINE»
-
-«DEFINE ActionCode FOR Check -»
-  «IF this != null -»
-«this.condition.toCode() -»
-  «ELSE -»
- true «
- ENDIF -»«
-  ENDDEFINE»
-
-«DEFINE ActionCode FOR CheckRef -»
-«IF this.check != null -»
-«this.check.functionName()»(events) «
-ELSE -»
-true 
-«ENDIF -»
-«ENDDEFINE»
-
-«DEFINE ActionCode FOR Reaction-»
-	«EXPAND ActionCode FOR this.effect-» 
-«ENDDEFINE»
-
-«DEFINE ActionCode FOR If-»
-if («EXPAND ActionCode FOR this.check») { 
-	«EXPAND ActionCode FOR this.thenStep-»
-}
-«IF elseStep != null-»
-else {
-	«EXPAND ActionCode FOR this.elseStep-»
-}
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE ActionCode FOR EnterState-»
-	activeStates.add(State.«state.getName()»);
-«ENDDEFINE»
-
-«DEFINE ActionCode FOR ExitState-»
-	activeStates.remove(State.«state.getName()»);
-«ENDDEFINE»
-
-«DEFINE ConditionMethodsImplement FOR ExecutionState-»
-	«FOREACH reactions AS r-»
-		«IF r.check != null -»
-	private boolean «r.check.functionName()»(Collection<?> events) {
-		«IF r.check.condition != null-»
-		return «r.check.condition.toCode()»;
-		«ELSE-»
-		return true;
-  	«ENDIF-»
-	}
-	«ENDIF -»
-  «ENDFOREACH-»
-«ENDDEFINE»
-
-«DEFINE StatementMethodsImplement FOR ExecutionState-»
-  «FOREACH reactions AS r-»
-	private void «r.effect.functionName()»() {
-		«EXPAND ActionCode FOR r.effect-»
-	}
-  «ENDFOREACH-»
-«ENDDEFINE»
-
-«DEFINE ReactMethodsImplement FOR ExecutionState-»
-	private void react«getName()»(Collection<?> events) {
-		«EXPAND ActionCode FOREACH reactSequence.steps-»
-	}
-«ENDDEFINE»
-
-«DEFINE EnterMethodImplement FOR ExecutionState-»
-	«IF this.entryAction != null-»
-	private void «entryAction.entryActionFunctionName()»() {
-		«EXPAND ActionCode FOR this.entryAction-»
-	}
-	«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE ExitMethodImplement FOR ExecutionState-»
-	«IF this.exitAction != null-»
-	private void «this.exitAction.exitActionFunctionName()»() {
-		«EXPAND ActionCode FOR this.exitAction-»
-	}
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE EnterSequenceImplement FOR ExecutionState»
-	«IF enterSequence.steps.size > 0 -»
-	private void «enterSequenceName()»() {
-		«EXPAND ActionCode FOREACH enterSequence.steps-»
-	}
-	«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE ExitSequenceImplement FOR ExecutionState-»
-	«IF exitSequence.steps.size > 0 -»
-	private void «exitSequenceName()»() {
-		«EXPAND ActionCode FOREACH exitSequence.steps-»
-	}
-	«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«FILE getImplementationPackagePath(entry)+"/"+getBaseStatemachineName()+'.java'-»
-«getLicenseHeader(entry)»
-package «getImplementationPackageName(entry)»;
-
-import java.util.Collection;
-import java.util.EnumSet;
-import java.util.HashSet;
-import java.util.Set;
-import «entry.getBasePackageName()».Event;
-«IF isTimedStatemachine()-»
-import «entry.getBasePackageName()».TimeEvent;
-import «entry.getBasePackageName()».ITimedStatemachine;
-import «entry.getBasePackageName()».ITimerHandler;
-import «entry.getBasePackageName()».EventNotification;
-import «entry.getBasePackageName()».Notification;
-«ELSE-»
-import «entry.getBasePackageName()».IStatemachine;
-«ENDIF-»
-«IF getInternalScopeValuedEvents().size > 0 -»
-import «entry.getBasePackageName()».ValuedEvent;
-«ENDIF-»
-
-public abstract class «getBaseStatemachineName()» implements «getStatemachineImplementationType()» {
-	
-	«FOREACH getInternalScopeEvents() AS event-»
-	private final «event.getEventType()» «event.getName()» = new «event.getEventType()»(«event.getCreationSignature()»); 
-	«ENDFOREACH-»
-	
-	«FOREACH getTimeEvents() AS timeEvent-»
-	private static final TimeEvent «timeEvent.getName()» = new TimeEvent("«timeEvent.getName()»", «timeEvent.periodic»); 
-	«ENDFOREACH»
-	
-	public enum State {
-		«FOREACH states AS state-»
-	      «state.getName()»,
-	    «ENDFOREACH-»
-	};
-	
-	«FOREACH scopes.typeSelect(InterfaceScope) AS interface-»
-	private «interface.getInterfaceImplName()» «interface.getInterfaceName().toFirstLower()»;
-	«ENDFOREACH-»
-	«FOREACH getInternalScopeVariables() AS variable-»
-	private «variable.type.getJavaType()» «variable.getValueName()»«variable.getInitialValueAssignment()»;
-	
-	«ENDFOREACH-»
-
-	private final Set<State> activeStates = EnumSet.noneOf(State.class);
-	
-	private final Collection<Event> occuredEvents;
-	
-	private final Collection<Event> outEvents;
-	
-	«IF isTimedStatemachine()-»
-	private ITimerHandler timerHandler;
-	
-	private long cycleStartTime;
-	«ENDIF-»
-	
-	public «getBaseStatemachineName()»(Collection<Event> occuredEvents) {
-		this.occuredEvents = occuredEvents;
-		this.outEvents = new HashSet<Event>();
-		«FOREACH getInterfaceScope() AS interface-»
-		«interface.getInterfaceName().toFirstLower()» = new «interface.getInterfaceImplName()»(this);
-		«ENDFOREACH-»
-	}
-	
-	protected Collection<Event> getOccuredEvents() {
-		return occuredEvents;
-	}
-	
-	protected Collection<Event> getOutEvents(){
-		return outEvents;
-	}
-	
-	protected boolean eventOccured() {
-		return !getOccuredEvents().isEmpty();
-	}
-	
-	
-	public void init() {
-		
-	}
-	
-	«IF isTimedStatemachine()-»
-	
-	public void setTimerHandler(ITimerHandler timerHandler) {
-		this.timerHandler = timerHandler;
-	}
-
-	
-	public ITimerHandler getTimerHandler() {
-		if (timerHandler == null) {
-			throw new NullPointerException("TimerHandler of statemachine \"+«name»+\" not set!");
-		}
-		return timerHandler;
-	}
-	
-	public void notify(Notification<?> notification) {
-		if (notification instanceof EventNotification) {
-			EventNotification eventNotification = (EventNotification) notification;
-			getOccuredEvents().add(eventNotification.getElement());
-		}
-	}
-	«ENDIF-»
-		
-	public Set<State> getActiveStates(){
-		return EnumSet.copyOf(activeStates);
-	}
-	
-	«FOREACH scopes.typeSelect(InterfaceScope) AS interface-»
-	public «interface.getInterfaceName()» get«interface.getInterfaceName()»() {
-		return «interface.getInterfaceName().toFirstLower()»;
-	}
-	
-	«ENDFOREACH-»
-	«REM»create getters and setters for events«ENDREM»
-	«FOREACH getInternalScopeEvents() AS event-»
-	private void raise«event.name.toFirstUpper()»() {
-		getOccuredEvents().add(«event.getName()»);
-	}
-	
-	«IF event.type != Type::void-»
-	private void raise«event.name.toFirstUpper()»(«event.type.getJavaType()» value) {
-		«event.getName()».setValue(value);
-		getOccuredEvents().add(«event.getName()»);
-	}
-	
-	«ENDIF-»
-	private «event.getEventType()» get«event.getName()»() {
-		return «event.getName()»;
-	}
-	
-	«ENDFOREACH-»
-	«REM»Create getters and setters for variables«ENDREM»
-	«FOREACH getInternalScopeVariables() AS variable-»
-	private «variable.type.getJavaType()» get«variable.getValueName().toFirstUpper()»() {
-		return «variable.getValueName()»;
-	}
-	
-	private void set«variable.getValueName().toFirstUpper()»(«variable.type.getJavaType()» value) {
-		«variable.getValueName()» = value;
-	}	
-	
-	«ENDFOREACH-»
-	«REM»Create enterSequences for statemachine«ENDREM»
-	«IF enterSequence.steps.size > 0 -»
-	public void «enterSequenceName()»() {
-		«IF isTimedStatemachine()-»
-		cycleStartTime = System.currentTimeMillis();
-		«ENDIF-»
-		«EXPAND ActionCode FOREACH enterSequence.steps-»
-	}
-	«ENDIF-»
-	
-«EXPAND ConditionMethodsImplement FOREACH this.states-»
-«EXPAND StatementMethodsImplement FOREACH this.states-»
-«EXPAND EnterMethodImplement FOREACH this.states-»
-«EXPAND ExitMethodImplement FOREACH this.states-»
-«EXPAND EnterSequenceImplement FOREACH this.states-»
-«EXPAND ExitSequenceImplement FOREACH this.states-»
-«EXPAND ReactMethodsImplement FOREACH this.states-»
-	protected void runCycle(Collection<?> events) {
-		«IF isTimedStatemachine()-»
-		cycleStartTime = System.currentTimeMillis();
-		«ENDIF-»
-		getOutEvents().clear();
-		for (State state : activeStates) {
-			switch (state) {
-			«FOREACH this.states AS state-»
-    		case «state.getName()»:
-        		react«state.getName()»(events);
-        		break;
-			«ENDFOREACH-»
-			default:
-				// no state found
-			}
-		}
-	}
-}
-«ENDFILE-»
-«ENDDEFINE»

+ 306 - 8
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomCycleBasedStatemachine.xpt

@@ -9,33 +9,331 @@ Contributors:
  	
 @author Markus Muehlbrandt - Initial contribution and API
 «ENDREM»
+
 «IMPORT sexec»
 «IMPORT stext»
 «IMPORT sgraph»
 «IMPORT ecore»
+«IMPORT org::yakindu::sct::generator::java::templates»
 
+«EXTENSION org::yakindu::sct::generator::java::templates::ExecutionModelExtensions»
 «EXTENSION org::yakindu::sct::generator::java::templates::Expression»
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow»
-«FILE getImplementationPackagePath(entry)+"/"+getCycleBasedStatemachineName() + '.java'»
+«DEFINE ActionCode FOR Step-»
+// ActionCode for Step «toString()» not defined
+«ENDDEFINE»
+
+«DEFINE EntryCode FOR Step-»
+// EntryCode for Step «toString()» not defined
+«ENDDEFINE»
+
+«DEFINE ActionCode FOR StateSwitch-»
+	«FOREACH cases AS stateCase ITERATOR iter -»
+	«IF iter.counter1 > 1»else «ENDIF»if (activeStates.contains(State.«stateCase.state.getName()»)) {
+		«EXPAND ActionCode FOR stateCase.step»
+	}
+	«ENDFOREACH-»
+«ENDDEFINE»
+
+«DEFINE ActionCode FOR ScheduleTimeEvent-»
+getTimerHandler().setTimer(«timeEvent.getName()», «timeValue.toCode()», cycleStartTime);
+«ENDDEFINE»
+
+«DEFINE ActionCode FOR UnscheduleTimeEvent-»
+getTimerHandler().resetTimer(«timeEvent.getName()»);
+«ENDDEFINE»
+
+«DEFINE ActionCode FOR Execution-»
+	«statement.toCode()»
+«ENDDEFINE»
+
+«DEFINE ActionCode FOR Call-»
+«this.step.functionName()»();
+«ENDDEFINE»
+
+«DEFINE ActionCode FOR Sequence-»
+	«EXPAND ActionCode FOREACH this.steps»
+«ENDDEFINE»
+
+«DEFINE ActionCode FOR Check -»
+  «IF this != null -»
+«this.condition.toCode() -»
+  «ELSE -»
+ true «
+ ENDIF -»«
+  ENDDEFINE»
+
+«DEFINE ActionCode FOR CheckRef -»
+«IF this.check != null -»
+«this.check.functionName()»() «
+ELSE -»
+true 
+«ENDIF -»
+«ENDDEFINE»
+
+«DEFINE ActionCode FOR Reaction-»
+	«EXPAND ActionCode FOR this.effect-» 
+«ENDDEFINE»
+
+«DEFINE ActionCode FOR If-»
+if («EXPAND ActionCode FOR this.check») { 
+	«EXPAND ActionCode FOR this.thenStep-»
+}
+«IF elseStep != null-»
+else {
+	«EXPAND ActionCode FOR this.elseStep-»
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE ActionCode FOR EnterState-»
+	activeStates.add(State.«state.getName()»);
+«ENDDEFINE»
+
+«DEFINE ActionCode FOR ExitState-»
+	activeStates.remove(State.«state.getName()»);
+«ENDDEFINE»
+
+«DEFINE ConditionMethodsImplement FOR ExecutionState-»
+	«FOREACH reactions AS r-»
+		«IF r.check != null -»
+	private boolean «r.check.functionName()»() {
+		«IF r.check.condition != null-»
+		return «r.check.condition.toCode()»;
+		«ELSE-»
+		return true;
+  	«ENDIF-»
+	}
+	«ENDIF -»
+  «ENDFOREACH-»
+«ENDDEFINE»
+
+«DEFINE StatementMethodsImplement FOR ExecutionState-»
+  «FOREACH reactions AS r-»
+	private void «r.effect.functionName()»() {
+		«EXPAND ActionCode FOR r.effect-»
+	}
+  «ENDFOREACH-»
+«ENDDEFINE»
+
+«DEFINE ReactMethodsImplement FOR ExecutionState-»
+	private void react«getName()»() {
+		«EXPAND ActionCode FOREACH reactSequence.steps-»
+	}
+«ENDDEFINE»
+
+«DEFINE EnterMethodImplement FOR ExecutionState-»
+	«IF this.entryAction != null-»
+	private void «entryAction.entryActionFunctionName()»() {
+		«EXPAND ActionCode FOR this.entryAction-»
+	}
+	«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE ExitMethodImplement FOR ExecutionState-»
+	«IF this.exitAction != null-»
+	private void «this.exitAction.exitActionFunctionName()»() {
+		«EXPAND ActionCode FOR this.exitAction-»
+	}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE EnterSequenceImplement FOR ExecutionState»
+	«IF enterSequence.steps.size > 0 -»
+	private void «enterSequenceName()»() {
+		«EXPAND ActionCode FOREACH enterSequence.steps-»
+	}
+	«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE ExitSequenceImplement FOR ExecutionState-»
+	«IF exitSequence.steps.size > 0 -»
+	private void «exitSequenceName()»() {
+		«EXPAND ActionCode FOREACH exitSequence.steps-»
+	}
+	«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
+«FILE getImplementationPackagePath(entry)+"/"+getCycleBasedStatemachineName()+'.java'-»
 «getLicenseHeader(entry)»
 package «getImplementationPackageName(entry)»;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EnumSet;
 import java.util.HashSet;
-
+import java.util.Set;
 import «entry.getBasePackageName()».Event;
+«IF isTimedStatemachine()-»
+import «entry.getBasePackageName()».TimeEvent;
+import «entry.getBasePackageName()».ITimedStatemachine;
+import «entry.getBasePackageName()».ITimerHandler;
+import «entry.getBasePackageName()».EventNotification;
+import «entry.getBasePackageName()».Notification;
+«ELSE-»
+import «entry.getBasePackageName()».IStatemachine;
+«ENDIF-»
+«IF getInternalScopeValuedEvents().size > 0 -»
+import «entry.getBasePackageName()».ValuedEvent;
+«ENDIF-»
 
-public class «getCycleBasedStatemachineName()» extends «getBaseStatemachineName()» {
+public class «getCycleBasedStatemachineName()» implements «getStatemachineImplementationType()» {
+	
+	«FOREACH getInternalScopeEvents() AS event-»
+	private final «event.getEventType()» «event.getName()» = new «event.getEventType()»(«event.getCreationSignature()»); 
+	«ENDFOREACH-»
+	
+	«FOREACH getTimeEvents() AS timeEvent-»
+	private static final TimeEvent «timeEvent.getName()» = new TimeEvent("«timeEvent.getName()»", «timeEvent.periodic»); 
+	«ENDFOREACH»
+	
+	public enum State {
+		«FOREACH states AS state-»
+	      «state.getName()»,
+	    «ENDFOREACH-»
+	};
+	
+	«FOREACH scopes.typeSelect(InterfaceScope) AS interface-»
+	private «interface.getInterfaceImplName()» «interface.getInterfaceName().toFirstLower()»;
+	«ENDFOREACH-»
+	«FOREACH getInternalScopeVariables() AS variable-»
+	private «variable.type.getJavaType()» «variable.getValueName()»«variable.getInitialValueAssignment()»;
+	
+	«ENDFOREACH-»
 
+	private final Set<State> activeStates = EnumSet.noneOf(State.class);
+	
+	private final ArrayList<Event> occuredEvents;
+	
+	private final Collection<Event> outEvents;
+	
+	«IF isTimedStatemachine()-»
+	private ITimerHandler timerHandler;
+	
+	private long cycleStartTime;
+	«ENDIF-»
+	
 	public «getCycleBasedStatemachineName()»() {
-		super(new HashSet<Event>());
+		occuredEvents = new ArrayList<Event>();
+		outEvents = new HashSet<Event>();
+		«FOREACH getInterfaceScope() AS interface-»
+		«interface.getInterfaceName().toFirstLower()» = new «interface.getInterfaceImplName()»(this);
+		«ENDFOREACH-»
+	}
+	
+	protected Collection<Event> getOccuredEvents() {
+		return occuredEvents;
+	}
+	
+	protected Collection<Event> getOutEvents(){
+		return outEvents;
+	}
+	
+	protected boolean eventOccured() {
+		return !occuredEvents.isEmpty();
+	}
+	
+	
+	public void init() {
+		
+	}
+	
+	«IF isTimedStatemachine()-»
+	public void setTimerHandler(ITimerHandler timerHandler) {
+		this.timerHandler = timerHandler;
 	}
 
+	
+	public ITimerHandler getTimerHandler() {
+		if (timerHandler == null) {
+			throw new NullPointerException("TimerHandler of statemachine \"+«name»+\" not set!");
+		}
+		return timerHandler;
+	}
+	
+	public void notify(Notification<?> notification) {
+		if (notification instanceof EventNotification) {
+			EventNotification eventNotification = (EventNotification) notification;
+			getOccuredEvents().add(eventNotification.getElement());
+		}
+	}
+	«ENDIF-»
+		
+	public Set<State> getActiveStates(){
+		return EnumSet.copyOf(activeStates);
+	}
+	
+	«FOREACH scopes.typeSelect(InterfaceScope) AS interface-»
+	public «interface.getInterfaceName()» get«interface.getInterfaceName()»() {
+		return «interface.getInterfaceName().toFirstLower()»;
+	}
+	
+	«ENDFOREACH-»
+	«REM»create getters and setters for events«ENDREM»
+	«FOREACH getInternalScopeEvents() AS event-»
+	private void raise«event.name.toFirstUpper()»() {
+		getOccuredEvents().add(«event.getName()»);
+	}
+	
+	«IF event.type != Type::void-»
+	private void raise«event.name.toFirstUpper()»(«event.type.getJavaType()» value) {
+		«event.getName()».setValue(value);
+		getOccuredEvents().add(«event.getName()»);
+	}
+	
+	«ENDIF-»
+	private «event.getEventType()» get«event.getName()»() {
+		return «event.getName()»;
+	}
+	
+	«ENDFOREACH-»
+	«REM»Create getters and setters for variables«ENDREM»
+	«FOREACH getInternalScopeVariables() AS variable-»
+	private «variable.type.getJavaType()» get«variable.getValueName().toFirstUpper()»() {
+		return «variable.getValueName()»;
+	}
+	
+	private void set«variable.getValueName().toFirstUpper()»(«variable.type.getJavaType()» value) {
+		«variable.getValueName()» = value;
+	}	
+	
+	«ENDFOREACH-»
+	«REM»Create enterSequences for statemachine«ENDREM»
+	«IF enterSequence.steps.size > 0 -»
+	public void «enterSequenceName()»() {
+		«IF isTimedStatemachine()-»
+		cycleStartTime = System.currentTimeMillis();
+		«ENDIF-»
+		«EXPAND ActionCode FOREACH enterSequence.steps-»
+	}
+	«ENDIF-»
+	
+«EXPAND ConditionMethodsImplement FOREACH this.states-»
+«EXPAND StatementMethodsImplement FOREACH this.states-»
+«EXPAND EnterMethodImplement FOREACH this.states-»
+«EXPAND ExitMethodImplement FOREACH this.states-»
+«EXPAND EnterSequenceImplement FOREACH this.states-»
+«EXPAND ExitSequenceImplement FOREACH this.states-»
+«EXPAND ReactMethodsImplement FOREACH this.states-»
 	public void runCycle() {
-		runCycle(getOccuredEvents());
-		// remove all events
-		getOccuredEvents().clear();
+		«IF isTimedStatemachine()-»
+		cycleStartTime = System.currentTimeMillis();
+		«ENDIF-»
+		outEvents.clear();
+		for (State state : activeStates) {
+			switch (state) {
+			«FOREACH this.states AS state-»
+    		case «state.getName()»:
+        		react«state.getName()»();
+        		break;
+			«ENDFOREACH-»
+			default:
+				// no state found
+			}
+		}
+		occuredEvents.clear();
 	}
 }
 «ENDFILE-»

+ 1 - 1
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomEventBasedStatemachine.xpt

@@ -28,7 +28,7 @@ import java.util.Queue;
 
 import «entry.getBasePackageName()».Event;
 
-public class «getEventBasedStatemachineName()» extends «getBaseStatemachineName()» {
+public class «getEventBasedStatemachineName()» extends «getCycleBasedStatemachineName()» {
 
 	public «getEventBasedStatemachineName()»() {
 		super(new LinkedList<Event>());

+ 2 - 2
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterfaceImpl.xpt

@@ -39,9 +39,9 @@ public class 
 	private final «event.getEventType()» «event.getName()» = new «event.getEventType()»(«event.getCreationSignature()»); 
 	«ENDFOREACH-»
 	
-	private «getBaseStatemachineName()» statemachine; 
+	private «getCycleBasedStatemachineName()» statemachine; 
 	
-	public «getInterfaceImplName()»(«getBaseStatemachineName()» statemachine) {
+	public «getInterfaceImplName()»(«getCycleBasedStatemachineName()» statemachine) {
 		this.statemachine = statemachine;
 	}
 	

+ 17 - 8
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Expression.ext

@@ -22,14 +22,17 @@ String toCode(Void void) :
 String toCode(Void o, String statechartReference) : 
 	""; //polymorphic placeholder (abstract rule)
 
-String toCode(Expression statement) : 
-	null; //polymorphic placeholder (abstract rule)
- 
+//polymorphic placeholder (abstract rule)
+String toCode(Expression expression) : 
+	"/* Unknown expression: "+expression+" */"; 
+
+//polymorphic placeholder (abstract rule) 
 String toCode(Statement statement) : 
-	null; //polymorphic placeholder (abstract rule)
+	"/* Unknown statement: "+statement+" */";
 
-String toCode(Literal statement) : 
-	null; //polymorphic placeholder (abstract rule)
+//polymorphic placeholder (abstract rule)
+String toCode(Literal literal) : 
+	"/* Unknown literal: "+literal+" */";
 
 String toCode(PrimitiveValueExpression primValue) :
 	primValue.value.toCode();
@@ -67,6 +70,12 @@ String toCode(IntLiteral expression) :
 String toCode(RealLiteral expression) :
 	expression.value.toString();
 
+String toCode(EventValueReferenceExpression expression):
+	expression.value.getContext().toFirstLower()+"get"+expression.value.getName()+"().getValue()";
+
+String toCode(EventRaisedReferenceExpression expression):
+	"occuredEvents.contains("+expression.value.getContext().toFirstLower()+"get"+expression.value.getName()+"())";
+
 /* Logical Expressions */
 String toCode(LogicalOrExpression expression) :
   	"("+expression.leftOperand.toCode() + " || " + expression.rightOperand.toCode()+")";
@@ -97,11 +106,11 @@ String toCode(NumericalMultiplyDivideExpression expression) :
 
 String toCode(ElementReferenceExpression exp) :
     if (EventDefinition.isInstance(exp.value)) then
-    	"getOccuredEvents().contains("+((EventDefinition)exp.value).getContext().toFirstLower()+"get"+((EventDefinition)exp.value).getName()+"())"
+    	"occuredEvents.contains("+((EventDefinition)exp.value).getContext().toFirstLower()+"get"+((EventDefinition)exp.value).getName()+"())"
     else if (VariableDefinition.isInstance(exp.value)) then
     	getContext((VariableDefinition)exp.value)+"getVar"+exp.value.name.toFirstUpper()+"()"
     else if (TimeEvent.isInstance(exp.value)) then
-    	"getOccuredEvents().contains("+getName((TimeEvent)exp.value)+")";
+    	"occuredEvents.contains("+getName((TimeEvent)exp.value)+")";
 
 String getOperator(AdditiveOperator operator) : 
     switch(operator) {

+ 0 - 2
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Main.xpt

@@ -51,8 +51,6 @@ Contributors:
 	«EXPAND CustomInterfaceImpl::file(entry) FOR scope»
 	«ENDFOREACH»
 	
-	«EXPAND CustomBaseStatemachine::file(entry) FOR this»
-	
 	«EXPAND CustomCycleBasedStatemachine::file(entry) FOR this»
 	
 	«REM»Exclude event based statemachines from generation

+ 2 - 1
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Naming.ext

@@ -23,7 +23,8 @@ String getStatemachineName(ExecutionFlow this) : (name.toLowerCase() == "default
 String getBaseStatemachineName(ExecutionFlow this) : name.toFirstUpper() + "AbstractBaseStatemachine";
 String getBaseStatemachineName(InterfaceScope this) : ((ExecutionFlow)eContainer).getBaseStatemachineName();
 String getEventBasedStatemachineName(ExecutionFlow this) : name.toFirstUpper() + "EventBasedStatemachine";
-String getCycleBasedStatemachineName(ExecutionFlow this) : name.toFirstUpper() + "CyleBasedStatemachine";
+String getCycleBasedStatemachineName(ExecutionFlow this) : name.toFirstUpper() + "CycleBasedStatemachine";
+String getCycleBasedStatemachineName(InterfaceScope this) : ((ExecutionFlow)eContainer).getCycleBasedStatemachineName();
 
 String getStatemachineImplementationType(ExecutionFlow this):
 	if isTimedStatemachine() then