Browse Source

Refactoring of java code generator.

markus.muehlbrandt@gmail.com 13 years ago
parent
commit
9c22c1a32e
100 changed files with 6881 additions and 4323 deletions
  1. 5 2
      examples/org.yakindu.sct.examples.trafficlight/GenModelJava.sgen
  2. 1 3
      examples/org.yakindu.sct.examples.trafficlight/META-INF/MANIFEST.MF
  3. 1 1
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/IStatemachine.java
  4. 9 7
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/ITimedStatemachine.java
  5. 3 4
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/ITimerService.java
  6. 1 1
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/RuntimeService.java
  7. 18 25
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/TimeEvent.java
  8. 5 9
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/TimerService.java
  9. 47 0
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/ITrafficlightwaitingStatemachine.java
  10. 1295 0
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficlightwaitingStatemachine.java
  11. 0 46
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/Event.java
  12. 0 31
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/EventNotification.java
  13. 0 118
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/EventVector.java
  14. 0 25
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/INotificationListener.java
  15. 0 26
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/INotificationSender.java
  16. 0 18
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/ITimerNotificationListener.java
  17. 0 30
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/Notification.java
  18. 0 47
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/NotificationSender.java
  19. 0 8
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/NotificationType.java
  20. 0 31
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/RuntimeCycleNotification.java
  21. 0 45
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/ValuedEvent.java
  22. 0 50
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/VariableNotification.java
  23. 0 13
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/DefaultInterface.java
  24. 0 19
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/DefaultInterfaceEventBasedImpl.java
  25. 0 34
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/DefaultInterfaceImpl.java
  26. 0 11
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/IDefaultInterfaceImpl.java
  27. 0 5
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/IInterfacePedestrianImpl.java
  28. 0 5
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/IInterfaceTrafficLightImpl.java
  29. 0 11
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/InterfacePedestrian.java
  30. 0 33
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/InterfacePedestrianImpl.java
  31. 0 11
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/InterfaceTrafficLight.java
  32. 0 33
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/InterfaceTrafficLightImpl.java
  33. 0 1228
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/TrafficLightWaitingCycleBasedStatemachine.java
  34. 0 53
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/TrafficLightWaitingEventBasedStatemachine.java
  35. 20 26
      examples/org.yakindu.sct.examples.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/CrossingDemoBase.java
  36. 26 25
      examples/org.yakindu.sct.examples.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/CrossingDemoCycleBased.java
  37. 46 47
      examples/org.yakindu.sct.examples.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/CrossingDemoEventBased.java
  38. 8 8
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/extensions/ExecutionModelExtensions.java
  39. 7 10
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/extensions/JavaExtensions.java
  40. 89 278
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomCycleBasedStatemachine.xpt
  41. 0 63
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomEventBasedInterfaceImpl.xpt
  42. 0 102
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomEventBasedStatemachine.xpt
  43. 0 46
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomIInterfaceImpl.xpt
  44. 0 78
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterface.xpt
  45. 0 230
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterfaceImpl.xpt
  46. 0 46
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomStatemachineCreationFactory.xpt
  47. 0 66
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Event.xpt
  48. 0 51
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/EventNotification.xpt
  49. 0 138
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/EventVector.xpt
  50. 3 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ExecutionModelExtensions.ext
  51. 6 4
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Expression.ext
  52. 0 30
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/IGenericAccessInterface.xpt
  53. 0 24
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/IGenericAccessStatemachine.xpt
  54. 0 45
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/INotificationListener.xpt
  55. 0 46
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/INotificationSender.xpt
  56. 0 28
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/IStatemachineCreationFactory.xpt
  57. 9 4
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimedStatemachine.xpt
  58. 0 38
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimerNotificationListener.xpt
  59. 3 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimerService.xpt
  60. 5 50
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Main.xpt
  61. 50 12
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Naming.ext
  62. 0 50
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Notification.xpt
  63. 0 67
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/NotificationSender.xpt
  64. 0 28
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/NotificationType.xpt
  65. 0 51
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/RuntimeCycleNotification.xpt
  66. 179 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/StatemachineCycleBased.xpt
  67. 86 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/StatemachineInterface.xpt
  68. 143 0
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/StatemachineInterfaceImpl.xpt
  69. 17 25
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/TimeEvent.xpt
  70. 4 9
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/TimerService.xpt
  71. 0 65
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ValuedEvent.xpt
  72. 0 70
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/VariableNotification.xpt
  73. 24 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/IStatemachine.java
  74. 30 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/ITimedStatemachine.java
  75. 38 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/ITimerService.java
  76. 28 11
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/RuntimeService.java
  77. 58 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/TimeEvent.java
  78. 9 21
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/TimerService.java
  79. 68 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/interfacetest/IInterfacetestStatemachine.java
  80. 430 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/interfacetest/InterfacetestStatemachine.java
  81. 31 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_deephistory/ITest_deephistoryStatemachine.java
  82. 119 114
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_deephistory/Test_DeepHistoryCycleBasedStatemachine.java
  83. 51 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_expression/ITest_expressionStatemachine.java
  84. 406 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_expression/Test_expressionStatemachine.java
  85. 50 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_hierarchy/ITest_hierarchyStatemachine.java
  86. 1328 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_hierarchy/Test_hierarchyStatemachine.java
  87. 32 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_localactions/ITest_localactionsStatemachine.java
  88. 306 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_localactions/Test_localactionsStatemachine.java
  89. 46 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_parallelregions/ITest_parallelregionsStatemachine.java
  90. 1116 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_parallelregions/Test_parallelregionsStatemachine.java
  91. 29 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_shallowhistory/ITest_shallowhistoryStatemachine.java
  92. 111 113
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_shallowhistory/Test_ShallowHistoryCycleBasedStatemachine.java
  93. 53 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_transition/ITest_transitionStatemachine.java
  94. 432 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_transition/Test_transitionStatemachine.java
  95. 0 31
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/Event.java
  96. 0 27
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/EventNotification.java
  97. 0 122
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/EventVector.java
  98. 0 22
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/IGenericAccessInterface.java
  99. 0 16
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/IGenericAccessStatemachine.java
  100. 0 0
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/INotificationListener.java

+ 5 - 2
examples/org.yakindu.sct.examples.trafficlight/GenModelJava.sgen

@@ -7,9 +7,12 @@ GeneratorModel for yakindu::java {
 			targetFolder = "src-gen"
 		}
 
+		feature Naming {
+			basePackage = "org.yakindu.sct.examples.trafficlight.cyclebased"
+		}
 
 		feature GeneralFeatures {
-			EventBasedStatemachine = true
+			EventBasedStatemachine = false
 			InterfaceObserverSupport = false
 			TimerService = true
 			RuntimeService = true
@@ -35,7 +38,7 @@ http://www.eclipse.org/legal/epl-v10.html
 
 Contributors:
     committers of YAKINDU - initial API and implementation
-â"
+�"
 		}
 		
 	}

+ 1 - 3
examples/org.yakindu.sct.examples.trafficlight/META-INF/MANIFEST.MF

@@ -3,8 +3,6 @@ Bundle-ManifestVersion: 2
 Bundle-Name: Trafficlight
 Bundle-SymbolicName: org.yakindu.sct.examples.trafficlight
 Bundle-Version: 1.0.0.qualifier
-Export-Package: org.yakindu.sct.examples.java.trafficlight,
- org.yakindu.sct.runtime.java,
- org.yakindu.sct.runtime.java.trafficlightwaiting
+Export-Package: org.yakindu.sct.examples.java.trafficlight
 Require-Bundle: org.eclipse.draw2d;bundle-version="3.7.0"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5

+ 1 - 1
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/IStatemachine.java

@@ -1,4 +1,4 @@
-package org.yakindu.sct.runtime.java;
+package org.yakindu.sct.examples.trafficlight.cyclebased;
 
 /**
  * Basic interface for statemachines.

+ 9 - 7
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/ITimedStatemachine.java

@@ -1,14 +1,9 @@
-package org.yakindu.sct.runtime.java;
-
-import org.yakindu.sct.runtime.java.ITimerNotificationListener;
+package org.yakindu.sct.examples.trafficlight.cyclebased;
 
 /**
  * Interface for state machines which use timed event triggers.
  */
-public interface ITimedStatemachine
-		extends
-			IStatemachine,
-			ITimerNotificationListener {
+public interface ITimedStatemachine {
 
 	/**
 	 * Set the {@link ITimerService} for the state machine. It must be set
@@ -25,4 +20,11 @@ public interface ITimedStatemachine
 	 * @return {@link ITimerService}
 	 */
 	public ITimerService getTimerService();
+
+	/**
+	 * Callback method if a {@link TimeEvent} occurred.
+	 * 
+	 * @param timeEvent
+	 */
+	public void onTimeEventRaised(TimeEvent timeEvent);
 }

+ 3 - 4
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/ITimerService.java

@@ -1,4 +1,4 @@
-package org.yakindu.sct.runtime.java;
+package org.yakindu.sct.examples.trafficlight.cyclebased;
 
 /**
  * Interface a timer service has to implement. Use to implement your own timer
@@ -20,8 +20,7 @@ public interface ITimerService {
 	 *            run cycle was called. Can be used to produce a more accurate
 	 *            timing behavior.
 	 */
-	public void setTimer(TimeEvent<? extends Enum<?>> event, long time,
-			long cycleStartTime);
+	public void setTimer(TimeEvent event, long time, long cycleStartTime);
 
 	/**
 	 * Unset the given {@link TimeEvent}. Use to unset cyclic repeated time
@@ -29,7 +28,7 @@ public interface ITimerService {
 	 * 
 	 * @param event
 	 */
-	public void resetTimer(TimeEvent<? extends Enum<?>> event);
+	public void resetTimer(TimeEvent event);
 
 	/**
 	 * Cancel timer service. Use this to end possible timing threads and free

+ 1 - 1
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/RuntimeService.java

@@ -1,4 +1,4 @@
-package org.yakindu.sct.runtime.java;
+package org.yakindu.sct.examples.trafficlight.cyclebased;
 
 import java.util.LinkedList;
 import java.util.List;

+ 18 - 25
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/TimeEvent.java

@@ -1,4 +1,4 @@
-package org.yakindu.sct.runtime.java;
+package org.yakindu.sct.examples.trafficlight.cyclebased;
 
 /**
  * Event that reflects a time event. It's internally used by
@@ -8,42 +8,27 @@ package org.yakindu.sct.runtime.java;
  * 
  * @param <T>
  */
-public class TimeEvent<T extends Enum<T>> extends ValuedEvent<T, Boolean> {
+public class TimeEvent {
 
-	private long time = -1;
+	private boolean periodic;
 
 	private ITimedStatemachine statemachine;
 
+	int index;
+
 	/**
 	 * Constructor for a time event.
 	 * 
-	 * @param id
-	 *            : The event id.
-	 * @param offset
-	 *            : Offset which is added to the index position within the state
-	 *            machine's {@link EventVector}.
 	 * @param periodic
 	 *            : Set to {@code true} if event should be repeated
 	 *            periodically.
-	 */
-	public TimeEvent(T id, int offset, boolean periodic) {
-		super(id, offset, periodic);
-	}
-
-	/**
-	 * Sets the time delay after the event is called.
 	 * 
-	 * @param time
+	 * @param index
+	 *            : Index position within the state machine's timeEvent array.
 	 */
-	public void setTime(long time) {
-		this.time = time;
-	}
-
-	/**
-	 * Returns the time delay after the event is called.
-	 */
-	public long getTime() {
-		return time;
+	public TimeEvent(boolean periodic, int index) {
+		this.periodic = periodic;
+		this.index = index;
 	}
 
 	/**
@@ -62,4 +47,12 @@ public class TimeEvent<T extends Enum<T>> extends ValuedEvent<T, Boolean> {
 	public void setStatemachine(ITimedStatemachine statemachine) {
 		this.statemachine = statemachine;
 	}
+
+	public boolean isPeriodic() {
+		return periodic;
+	}
+
+	public int getIndex() {
+		return index;
+	}
 }

+ 5 - 9
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/TimerService.java

@@ -1,4 +1,4 @@
-package org.yakindu.sct.runtime.java;
+package org.yakindu.sct.examples.trafficlight.cyclebased;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -13,10 +13,9 @@ public class TimerService implements ITimerService {
 
 	private final Timer timer = new Timer();
 
-	private final Map<TimeEvent<? extends Enum<?>>, TimerTask> timerTaskMap = new HashMap<TimeEvent<? extends Enum<?>>, TimerTask>();
+	private final Map<TimeEvent, TimerTask> timerTaskMap = new HashMap<TimeEvent, TimerTask>();
 
-	public void setTimer(final TimeEvent<? extends Enum<?>> event, long time,
-			long cycleStartTime) {
+	public void setTimer(final TimeEvent event, long time, long cycleStartTime) {
 		// Reset existing TimerTask for event. This step isn't necessary if
 		// timer tasks are properly reset by sexec model.
 		if (timerTaskMap.containsKey(event)) {
@@ -31,11 +30,8 @@ public class TimerService implements ITimerService {
 			}
 		});
 
-		// set time field of event
-		event.setTime(time);
-
 		// start scheduling the timer
-		if (event.getValue()) {
+		if (event.isPeriodic()) {
 			timer.scheduleAtFixedRate(timerTaskMap.get(event),
 					time - (System.currentTimeMillis() - cycleStartTime), time);
 		} else {
@@ -44,7 +40,7 @@ public class TimerService implements ITimerService {
 		}
 	}
 
-	public void resetTimer(TimeEvent<? extends Enum<?>> event) {
+	public void resetTimer(TimeEvent event) {
 		if (timerTaskMap.containsKey(event) && timerTaskMap.get(event) != null) {
 			timerTaskMap.get(event).cancel();
 			timer.purge();

+ 47 - 0
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/ITrafficlightwaitingStatemachine.java

@@ -0,0 +1,47 @@
+package org.yakindu.sct.examples.trafficlight.cyclebased.trafficlightwaiting;
+
+import org.yakindu.sct.examples.trafficlight.cyclebased.IStatemachine;
+import org.yakindu.sct.examples.trafficlight.cyclebased.ITimedStatemachine;
+
+public interface ITrafficlightwaitingStatemachine
+		extends
+			ITimedStatemachine,
+			IStatemachine {
+
+	public interface InterfaceTrafficLight {
+
+		public boolean getRed();
+		public void setRed(boolean value);
+		public boolean getYellow();
+		public void setYellow(boolean value);
+		public boolean getGreen();
+		public void setGreen(boolean value);
+
+	}
+
+	public interface InterfacePedestrian {
+
+		public boolean getRequest();
+		public void setRequest(boolean value);
+		public boolean getRed();
+		public void setRed(boolean value);
+		public boolean getGreen();
+		public void setGreen(boolean value);
+
+	}
+
+	public interface DefaultInterface {
+
+		public void raisePedestrianRequest();
+
+		public void raiseOnOff();
+
+	}
+
+	public InterfaceTrafficLight getInterfaceTrafficLight();
+
+	public InterfacePedestrian getInterfacePedestrian();
+
+	public DefaultInterface getDefaultInterface();
+
+}

File diff suppressed because it is too large
+ 1295 - 0
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficlightwaitingStatemachine.java


+ 0 - 46
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/Event.java

@@ -1,46 +0,0 @@
-package org.yakindu.sct.runtime.java;
-
-/**
- * 
- * Basic event class.
- * 
- * @param <T>
- */
-public class Event<T extends Enum<T>> {
-
-	private T id;
-
-	private int offset;
-
-	/**
-	 * Creates an event with the given id and an offset. The offset represents
-	 * the start index of the events position in the {@link EventVector} of the
-	 * statemachine.
-	 * 
-	 * @param id
-	 * @param offset
-	 */
-	public Event(T id, int offset) {
-		this.id = id;
-		this.offset = offset;
-	}
-
-	/**
-	 * Returns the event identifier.
-	 * 
-	 * @return
-	 */
-	public T getId() {
-		return id;
-	}
-
-	/**
-	 * Returns the position of the event in the statemachines
-	 * {@link EventVector}
-	 * 
-	 * @return {@code int}
-	 */
-	public int getIndex() {
-		return offset + id.ordinal();
-	}
-}

+ 0 - 31
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/EventNotification.java

@@ -1,31 +0,0 @@
-package org.yakindu.sct.runtime.java;
-
-import org.yakindu.sct.runtime.java.Event;
-
-/**
- * 
- * Class to transmit an event within a notification.
- * 
- * 
- */
-public class EventNotification extends Notification {
-
-	private Event<? extends Enum<?>> event;
-
-	/**
-	 * Initializes the notification with an {@link Event}.
-	 * @param event
-	 */
-	public EventNotification(Event<? extends Enum<?>> event) {
-		super(NotificationType.EventNotification);
-		this.event = event;
-	}
-
-	/**
-	 * Returns the contained {@code Event}.
-	 * @return {@link Event}
-	 */
-	public Event<? extends Enum<?>> getEvent() {
-		return event;
-	}
-}

+ 0 - 118
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/EventVector.java

@@ -1,118 +0,0 @@
-package org.yakindu.sct.runtime.java;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-/**
- * 
- * The {@code EventVector} stores the events that occurred during a cycle.
- * 
- * @param <E>
- */
-public class EventVector<E extends Event<? extends Enum<?>>>
-		implements
-			Collection<E> {
-
-	private boolean events[];
-
-	public EventVector(int size) {
-		events = new boolean[size];
-	}
-
-	public int size() {
-		return events.length;
-	}
-
-	public boolean isEmpty() {
-		for (int i = 0; i < events.length; i++) {
-			if (events[i]) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	@SuppressWarnings("unchecked")
-	public boolean contains(Object o) {
-		if (o instanceof Event) {
-			Event<? extends Enum<?>> event = (Event<? extends Enum<?>>) o;
-			return events[event.getIndex()];
-		}
-		return false;
-	}
-
-	public Iterator<E> iterator() {
-		throw new UnsupportedOperationException("Iterator not supported!");
-	}
-
-	public Object[] toArray() {
-		throw new UnsupportedOperationException("toArray not supported!");
-	}
-
-	public <T> T[] toArray(T[] a) {
-		throw new UnsupportedOperationException("toArray not supported!");
-	}
-
-	public boolean add(E e) {
-		if (e.getIndex() > -1 && e.getIndex() < events.length) {
-			events[e.getIndex()] = true;
-			return true;
-		}
-		return false;
-	}
-
-	@SuppressWarnings("rawtypes")
-	public boolean remove(Object o) {
-		if (o instanceof Event) {
-			Event event = (Event) o;
-			if (event.getIndex() > -1 && event.getIndex() < events.length) {
-				events[event.getIndex()] = true;
-				return true;
-			}
-		}
-		return false;
-	}
-
-	@SuppressWarnings("rawtypes")
-	public boolean containsAll(Collection<?> c) {
-		for (Object o : c) {
-			if (o instanceof Event) {
-				Event event = (Event) o;
-				if (!events[event.getIndex()]) {
-					return false;
-				}
-			} else {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	public boolean addAll(Collection<? extends E> c) {
-		for (E event : c) {
-			if (!add(event)) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	public boolean removeAll(Collection<?> c) {
-		for (Object o : c) {
-			if (!remove(o)) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	public boolean retainAll(Collection<?> c) {
-		throw new UnsupportedOperationException("retainAll not supported!");
-	}
-
-	public void clear() {
-		for (int i = 0; i < events.length; i++) {
-			events[i] = false;
-		}
-	}
-}

+ 0 - 25
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/INotificationListener.java

@@ -1,25 +0,0 @@
-package org.yakindu.sct.runtime.java;
-
-/**
- * Interface a statemachine observer has to implement to receive notifications
- * on event and variable changes.
- * 
- * 
- */
-public interface INotificationListener {
-
-	/**
-	 * Callback for a {@link EventNotification}
-	 * 
-	 * @param notification
-	 */
-	public void onEventRaised(EventNotification notification);
-
-	/**
-	 * Callback for a {@link VariableNotification}
-	 * 
-	 * @param notification
-	 */
-	public void onVariableChanged(VariableNotification<?> notification);
-
-}

+ 0 - 26
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/INotificationSender.java

@@ -1,26 +0,0 @@
-package org.yakindu.sct.runtime.java;
-
-/**
- * Interface a notification sender has to implement.
- * 
- */
-public interface INotificationSender {
-
-	/**
-	 * Registers a notification listener.
-	 * 
-	 * @param listener
-	 *            {@link INotificationListener}
-	 * @return {@code true} if correct registered.
-	 */
-	public boolean addNotificationListener(INotificationListener listener);
-
-	/**
-	 * Unregisters a notification listener.
-	 * 
-	 * @param listener
-	 *            {@link INotificationListener}
-	 * @return {@code true} if correct unregistered.
-	 */
-	public boolean removeNotificationListener(INotificationListener listener);
-}

+ 0 - 18
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/ITimerNotificationListener.java

@@ -1,18 +0,0 @@
-package org.yakindu.sct.runtime.java;
-
-/**
- * 
- * Interface for {@link TimeEvent} listeners. These listers can be registered at
- * a {@link ITimerService}. Used by {@link ITimedStatemachine} to register
- * itself at the {@link ITimerService}.
- * 
- */
-public interface ITimerNotificationListener {
-
-	/**
-	 * Callback method if a {@link TimeEvent} occurred.
-	 * @param timeEvent
-	 */
-	public void onTimeEventRaised(TimeEvent<? extends Enum<?>> timeEvent);
-
-}

+ 0 - 30
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/Notification.java

@@ -1,30 +0,0 @@
-package org.yakindu.sct.runtime.java;
-
-/**
- * 
- * Basic class to represent a notification.
- * 
- * 
- */
-public class Notification {
-
-	private NotificationType notificationType;
-
-	/**
-	 * Creates a notification with the given {@link NotificationType}
-	 * 
-	 * @param notificationType
-	 */
-	public Notification(NotificationType notificationType) {
-		this.notificationType = notificationType;
-	}
-
-	/**
-	 * Returns the {@link NotificationType} of notification.
-	 * 
-	 * @return {@link NotificationType}
-	 */
-	public NotificationType getNotificationType() {
-		return notificationType;
-	}
-}

+ 0 - 47
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/NotificationSender.java

@@ -1,47 +0,0 @@
-package org.yakindu.sct.runtime.java;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Implementation of a notification sender. This implementation is used by the
- * statemachine and the generated interfaces to notify registered observers.
- * Inherit from this class if necessary.
- * 
- */
-public class NotificationSender implements INotificationSender {
-
-	private Set<INotificationListener> listeners = new HashSet<INotificationListener>();
-
-	public boolean addNotificationListener(INotificationListener listener) {
-		return listeners.add(listener);
-	}
-
-	public boolean removeNotificationListener(INotificationListener listener) {
-		return listeners.remove(listener);
-	}
-
-	/**
-	 * Notify all registered listeners with the given {@link EventNotification}
-	 * 
-	 * @param notification
-	 */
-	protected void notifyListenersOnEventRaised(EventNotification notification) {
-		for (INotificationListener listener : listeners) {
-			listener.onEventRaised(notification);
-		}
-	}
-
-	/**
-	 * Notify all registered listeners with the given
-	 * {@link VariableNotification}
-	 * 
-	 * @param notification
-	 */
-	protected void notifyListenersOnVariableChanged(
-			VariableNotification<?> notification) {
-		for (INotificationListener listener : listeners) {
-			listener.onVariableChanged(notification);
-		}
-	}
-}

+ 0 - 8
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/NotificationType.java

@@ -1,8 +0,0 @@
-package org.yakindu.sct.runtime.java;
-
-/**
- * Enum to define possible notification types.
- */
-public enum NotificationType {
-	EventNotification, VariableNotification, RuntimeCycleNotification
-}

+ 0 - 31
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/RuntimeCycleNotification.java

@@ -1,31 +0,0 @@
-package org.yakindu.sct.runtime.java;
-
-/**
- * This notification type is thrown by the runtime service if a statemachine
- * cycle is executed.
- * 
- */
-public class RuntimeCycleNotification extends Notification {
-
-	private IStatemachine statemachine;
-
-	/**
-	 * Initializes notification with the given statemachine.
-	 * 
-	 * @param statemachine
-	 */
-	public RuntimeCycleNotification(IStatemachine statemachine) {
-		super(NotificationType.RuntimeCycleNotification);
-		this.statemachine = statemachine;
-	}
-
-	/**
-	 * Get the statemachine on which a run to completion step was executed by
-	 * the runtime service.
-	 * 
-	 * @return
-	 */
-	public IStatemachine getStatemachine() {
-		return statemachine;
-	}
-}

+ 0 - 45
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/ValuedEvent.java

@@ -1,45 +0,0 @@
-package org.yakindu.sct.runtime.java;
-
-/**
- * An Event that contains values.
- * 
- * @param <T>
- * @param <D>
- */
-public class ValuedEvent<T extends Enum<T>, D> extends Event<T> {
-
-	private D value;
-
-	/**
-	 * Creates an event with the given id and an offset. The offset represents
-	 * the start index of the events position in the {@link EventVector} of the
-	 * statemachine.
-	 * 
-	 * @param id
-	 * @param offset
-	 * @param value
-	 */
-	public ValuedEvent(T name, int offset, D value) {
-		super(name, offset);
-		this.value = value;
-	}
-
-	/**
-	 * Returns the value hold by the event.
-	 */
-	public D getValue() {
-		return value;
-	}
-
-	/**
-	 * Store a new value in the event.
-	 * 
-	 * @param value
-	 */
-	public void setValue(D value) {
-		if (value == null) {
-			throw new IllegalArgumentException();
-		}
-		this.value = value;
-	}
-}

+ 0 - 50
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/VariableNotification.java

@@ -1,50 +0,0 @@
-package org.yakindu.sct.runtime.java;
-
-/**
- * Class to transmit a variable within a notification.
- * 
- */
-public class VariableNotification<T> extends Notification {
-
-	private T oldValue;
-	private T newValue;
-	private Enum<?> id;
-
-	/**
-	 * Constructor for VariableNotification.
-	 * 
-	 * @param id
-	 *            : the variable id
-	 * @param newValue
-	 *            : new variable value
-	 * @param oldValue
-	 *            : old variable value
-	 */
-	public VariableNotification(Enum<?> id, T newValue, T oldValue) {
-		super(NotificationType.VariableNotification);
-		this.id = id;
-		this.oldValue = oldValue;
-		this.newValue = newValue;
-	}
-
-	/**
-	 * Returns the variable identifier.
-	 */
-	public Enum<?> getId() {
-		return id;
-	}
-
-	/**
-	 * Returns the new value.
-	 */
-	public T getNewValue() {
-		return newValue;
-	}
-
-	/**
-	 * Returns the old value.
-	 */
-	public T getOldValue() {
-		return oldValue;
-	}
-}

+ 0 - 13
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/DefaultInterface.java

@@ -1,13 +0,0 @@
-package org.yakindu.sct.runtime.java.trafficlightwaiting;
-
-public interface DefaultInterface {
-
-	public enum Events {
-		PedestrianRequest, OnOff,
-	}
-
-	public void raisePedestrianRequest();
-
-	public void raiseOnOff();
-
-}

+ 0 - 19
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/DefaultInterfaceEventBasedImpl.java

@@ -1,19 +0,0 @@
-package org.yakindu.sct.runtime.java.trafficlightwaiting;
-
-public class DefaultInterfaceEventBasedImpl extends DefaultInterfaceImpl {
-
-	public DefaultInterfaceEventBasedImpl(
-			TrafficLightWaitingCycleBasedStatemachine statemachine) {
-		super(statemachine);
-	}
-
-	public void raisePedestrianRequest() {
-		super.raisePedestrianRequest();
-		statemachine.runCycle();
-	}
-	public void raiseOnOff() {
-		super.raiseOnOff();
-		statemachine.runCycle();
-	}
-
-}

+ 0 - 34
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/DefaultInterfaceImpl.java

@@ -1,34 +0,0 @@
-package org.yakindu.sct.runtime.java.trafficlightwaiting;
-
-import org.yakindu.sct.runtime.java.Event;
-
-public class DefaultInterfaceImpl implements IDefaultInterfaceImpl {
-	protected final Event<Events> PedestrianRequest = new Event<Events>(
-			Events.PedestrianRequest, 0);
-	protected final Event<Events> OnOff = new Event<Events>(Events.OnOff, 0);
-
-	protected TrafficLightWaitingCycleBasedStatemachine statemachine;
-
-	public DefaultInterfaceImpl(
-			TrafficLightWaitingCycleBasedStatemachine statemachine) {
-
-		this.statemachine = statemachine;
-	}
-
-	public void raisePedestrianRequest() {
-		statemachine.getOccuredEvents().add(getEventPedestrianRequest());
-	}
-
-	public Event<Events> getEventPedestrianRequest() {
-		return PedestrianRequest;
-	}
-
-	public void raiseOnOff() {
-		statemachine.getOccuredEvents().add(getEventOnOff());
-	}
-
-	public Event<Events> getEventOnOff() {
-		return OnOff;
-	}
-
-}

+ 0 - 11
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/IDefaultInterfaceImpl.java

@@ -1,11 +0,0 @@
-package org.yakindu.sct.runtime.java.trafficlightwaiting;
-
-import org.yakindu.sct.runtime.java.Event;
-
-public interface IDefaultInterfaceImpl extends DefaultInterface {
-
-	public Event<Events> getEventPedestrianRequest();
-
-	public Event<Events> getEventOnOff();
-
-}

+ 0 - 5
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/IInterfacePedestrianImpl.java

@@ -1,5 +0,0 @@
-package org.yakindu.sct.runtime.java.trafficlightwaiting;
-
-public interface IInterfacePedestrianImpl extends InterfacePedestrian {
-
-}

+ 0 - 5
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/IInterfaceTrafficLightImpl.java

@@ -1,5 +0,0 @@
-package org.yakindu.sct.runtime.java.trafficlightwaiting;
-
-public interface IInterfaceTrafficLightImpl extends InterfaceTrafficLight {
-
-}

+ 0 - 11
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/InterfacePedestrian.java

@@ -1,11 +0,0 @@
-package org.yakindu.sct.runtime.java.trafficlightwaiting;
-
-public interface InterfacePedestrian {
-
-	public boolean getVarRequest();
-	public void setVarRequest(boolean value);
-	public boolean getVarRed();
-	public void setVarRed(boolean value);
-	public boolean getVarGreen();
-	public void setVarGreen(boolean value);
-}

+ 0 - 33
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/InterfacePedestrianImpl.java

@@ -1,33 +0,0 @@
-package org.yakindu.sct.runtime.java.trafficlightwaiting;
-
-public class InterfacePedestrianImpl implements IInterfacePedestrianImpl {
-
-	public InterfacePedestrianImpl() {
-	}
-
-	private boolean varRequest;
-	public boolean getVarRequest() {
-		return varRequest;
-	}
-
-	public void setVarRequest(boolean value) {
-		varRequest = value;
-	}
-	private boolean varRed;
-	public boolean getVarRed() {
-		return varRed;
-	}
-
-	public void setVarRed(boolean value) {
-		varRed = value;
-	}
-	private boolean varGreen;
-	public boolean getVarGreen() {
-		return varGreen;
-	}
-
-	public void setVarGreen(boolean value) {
-		varGreen = value;
-	}
-
-}

+ 0 - 11
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/InterfaceTrafficLight.java

@@ -1,11 +0,0 @@
-package org.yakindu.sct.runtime.java.trafficlightwaiting;
-
-public interface InterfaceTrafficLight {
-
-	public boolean getVarRed();
-	public void setVarRed(boolean value);
-	public boolean getVarYellow();
-	public void setVarYellow(boolean value);
-	public boolean getVarGreen();
-	public void setVarGreen(boolean value);
-}

+ 0 - 33
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/InterfaceTrafficLightImpl.java

@@ -1,33 +0,0 @@
-package org.yakindu.sct.runtime.java.trafficlightwaiting;
-
-public class InterfaceTrafficLightImpl implements IInterfaceTrafficLightImpl {
-
-	public InterfaceTrafficLightImpl() {
-	}
-
-	private boolean varRed;
-	public boolean getVarRed() {
-		return varRed;
-	}
-
-	public void setVarRed(boolean value) {
-		varRed = value;
-	}
-	private boolean varYellow;
-	public boolean getVarYellow() {
-		return varYellow;
-	}
-
-	public void setVarYellow(boolean value) {
-		varYellow = value;
-	}
-	private boolean varGreen;
-	public boolean getVarGreen() {
-		return varGreen;
-	}
-
-	public void setVarGreen(boolean value) {
-		varGreen = value;
-	}
-
-}

File diff suppressed because it is too large
+ 0 - 1228
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/TrafficLightWaitingCycleBasedStatemachine.java


+ 0 - 53
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/runtime/java/trafficlightwaiting/TrafficLightWaitingEventBasedStatemachine.java

@@ -1,53 +0,0 @@
-package org.yakindu.sct.runtime.java.trafficlightwaiting;
-
-import java.util.LinkedList;
-
-import org.yakindu.sct.runtime.java.Event;
-
-import org.yakindu.sct.runtime.java.TimeEvent;
-
-public class TrafficLightWaitingEventBasedStatemachine
-		extends
-			TrafficLightWaitingCycleBasedStatemachine {
-
-	private LinkedList<Event<? extends Enum<?>>> eventQueue;
-
-	private DefaultInterfaceEventBasedImpl defaultInterface;
-
-	public TrafficLightWaitingEventBasedStatemachine() {
-		eventQueue = new LinkedList<Event<? extends Enum<?>>>();
-		defaultInterface = new DefaultInterfaceEventBasedImpl(this);
-	}
-
-	public DefaultInterface getDefaultInterface() {
-		return defaultInterface;
-	}
-
-	protected IDefaultInterfaceImpl getDefaultInterfaceImpl() {
-		return defaultInterface;
-	}
-
-	public void onTimeEventRaised(TimeEvent<? extends Enum<?>> timeEvent) {
-		super.onTimeEventRaised(timeEvent);
-		runCycle();
-	}
-
-	@Override
-	protected LinkedList<Event<? extends Enum<?>>> getOccuredEvents() {
-		return eventQueue;
-	}
-
-	@Override
-	protected boolean eventOccured() {
-		return !eventQueue.isEmpty();
-	}
-
-	@Override
-	public void runCycle() {
-		if (eventOccured()) {
-			Event<? extends Enum<?>> event = getOccuredEvents().poll();
-			super.getOccuredEvents().add(event);
-			super.runCycle();
-		}
-	}
-}

+ 20 - 26
examples/org.yakindu.sct.examples.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/CrossingDemoBase.java

@@ -12,16 +12,15 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Shell;
-import org.yakindu.sct.runtime.java.trafficlightwaiting.TrafficLightWaitingCycleBasedStatemachine;
 
 /**
- * This class cares about setting up the UI of the pesestrian crossing and delegates the state machine handling to the concrete subcasses.
+ * This class cares about setting up the UI of the pesestrian crossing and
+ * delegates the state machine handling to the concrete subcasses.
  * 
  * @author terfloth
  */
 public abstract class CrossingDemoBase {
 
-	protected TrafficLightWaitingCycleBasedStatemachine statemachine;
 	protected Shell shell;
 	protected Display display;
 	protected CrossingFigure crossing;
@@ -32,38 +31,36 @@ public abstract class CrossingDemoBase {
 		super();
 	}
 
-	
 	protected abstract void setUpAndRunStatemachine();
+
 	protected abstract void tearDownStatemachine();
 
 	protected abstract void readStatemachineOutput();
 
 	protected abstract void pedestrianRequestButtonClicked();
-	protected abstract void onOffButtonClicked();
 
+	protected abstract void onOffButtonClicked();
 
 	public void runTrafficLight() {
-	
+
 		setUpAndRunStatemachine();
 		createUIContent();
-	
+
 		shell.open();
 		while (!shell.isDisposed()) {
 			// update traffic lights
 			readStatemachineOutput();
-	
+
 			crossing.repaint();
-	
+
 			if (!display.readAndDispatch()) {
 				display.sleep();
 			}
 		}
-		
+
 		tearDownStatemachine();
 	}
 
-
-	
 	protected void createUIContent() {
 		display = Display.getDefault();
 		shell = new Shell(display);
@@ -72,17 +69,17 @@ public abstract class CrossingDemoBase {
 		GridLayout shellLayout = new GridLayout();
 		shellLayout.numColumns = 1;
 		shell.setLayout(shellLayout);
-	
+
 		LightweightSystem lws = createLightweightsystem(shell);
-		createButtonComposite(statemachine, shell);
-	
+		createButtonComposite(shell);
+
 		crossing = new CrossingFigure();
 		lws.setContents(crossing);
 		trafficLightFigure = new TrafficLightFigure();
 		crossing.add(trafficLightFigure);
 		crossing.getLayoutManager().setConstraint(trafficLightFigure,
 				new Rectangle(275, 75, 35, 90));
-	
+
 		pedestrianLightFigure = new PedestrianLightFigure();
 		crossing.add(pedestrianLightFigure);
 		crossing.getLayoutManager().setConstraint(pedestrianLightFigure,
@@ -90,7 +87,7 @@ public abstract class CrossingDemoBase {
 	}
 
 	protected LightweightSystem createLightweightsystem(Shell shell) {
-	
+
 		FigureCanvas canvas = new FigureCanvas(shell);
 		GridData canvasGridData = new GridData();
 		canvasGridData.horizontalAlignment = GridData.FILL;
@@ -102,7 +99,7 @@ public abstract class CrossingDemoBase {
 		return lws;
 	}
 
-	protected void createButtonComposite(final TrafficLightWaitingCycleBasedStatemachine statemachine, Shell shell) {
+	protected void createButtonComposite(Shell shell) {
 		// create a composite to hold the buttons
 		Composite buttonComposite = new Composite(shell, SWT.NO_SCROLL);
 		GridData buttonCompositeGridData = new GridData();
@@ -112,29 +109,26 @@ public abstract class CrossingDemoBase {
 		FillLayout buttonCompositeLayout = new FillLayout();
 		buttonCompositeLayout.type = SWT.HORIZONTAL;
 		buttonComposite.setLayout(new FillLayout());
-	
+
 		// create a button and event handlers
-		
+
 		Button pedestrianRequest = new Button(buttonComposite, SWT.PUSH);
 		pedestrianRequest.setText("pedestrian request");
 		pedestrianRequest.addListener(SWT.Selection, new Listener() {
-			public void handleEvent(
-					final org.eclipse.swt.widgets.Event event) {
+			public void handleEvent(final org.eclipse.swt.widgets.Event event) {
 				pedestrianRequestButtonClicked();
 			}
 
 		});
-		
+
 		Button onOff = new Button(buttonComposite, SWT.PUSH);
 		onOff.setText("on / off");
 		onOff.addListener(SWT.Selection, new Listener() {
-			public void handleEvent(
-					final org.eclipse.swt.widgets.Event event) {
+			public void handleEvent(final org.eclipse.swt.widgets.Event event) {
 				onOffButtonClicked();
 			}
 
 		});
 	}
 
-
 }

+ 26 - 25
examples/org.yakindu.sct.examples.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/CrossingDemoCycleBased.java

@@ -10,30 +10,32 @@
  */
 package org.yakindu.sct.examples.java.trafficlight;
 
+import org.yakindu.sct.examples.trafficlight.cyclebased.TimerService;
+import org.yakindu.sct.examples.trafficlight.cyclebased.trafficlightwaiting.TrafficlightwaitingStatemachine;
+
 /**
- * Example to show how to integrate the generated statemachine code into existing projects.
+ * Example to show how to integrate the generated statemachine code into
+ * existing projects.
  * 
  * @author a.nyssen - initial API and implementation
  * @author m.muehlbrandt - adaptions to new statemachine code.
  * @author terfloth - refactoring
  */
-import org.yakindu.sct.runtime.java.TimerService;
-import org.yakindu.sct.runtime.java.trafficlightwaiting.TrafficLightWaitingCycleBasedStatemachine;
 
 public class CrossingDemoCycleBased extends CrossingDemoBase {
 
-	
+	private TrafficlightwaitingStatemachine statemachine;
+
 	public static void main(String[] args) {
-		
+
 		new CrossingDemoCycleBased().runTrafficLight();
 	}
 
-	
 	@Override
 	protected void setUpAndRunStatemachine() {
-		
-		statemachine = new TrafficLightWaitingCycleBasedStatemachine();
-		
+
+		statemachine = new TrafficlightwaitingStatemachine();
+
 		Thread thread = new Thread() {
 			@Override
 			public void run() {
@@ -57,38 +59,37 @@ public class CrossingDemoCycleBased extends CrossingDemoBase {
 		thread.start();
 	}
 
-
 	@Override
 	protected void tearDownStatemachine() {
 		// End TimerHandler and timing thread.
-		statemachine.getTimerService() .cancel();
+		statemachine.getTimerService().cancel();
 	}
 
-
 	@Override
 	protected void readStatemachineOutput() {
-		trafficLightFigure.setRed(statemachine.getInterfaceTrafficLight().getVarRed());
-		trafficLightFigure.setYellow(statemachine.getInterfaceTrafficLight().getVarYellow());
-		trafficLightFigure.setGreen(statemachine.getInterfaceTrafficLight().getVarGreen());
-	
-		pedestrianLightFigure.setWhite(statemachine.getInterfacePedestrian().getVarRequest());
-		pedestrianLightFigure.setRed(statemachine.getInterfacePedestrian().getVarRed());
-		pedestrianLightFigure.setGreen(statemachine.getInterfacePedestrian().getVarGreen());
-	}
+		trafficLightFigure.setRed(statemachine.getInterfaceTrafficLight()
+				.getRed());
+		trafficLightFigure.setYellow(statemachine.getInterfaceTrafficLight()
+				.getYellow());
+		trafficLightFigure.setGreen(statemachine.getInterfaceTrafficLight()
+				.getGreen());
 
+		pedestrianLightFigure.setWhite(statemachine.getInterfacePedestrian()
+				.getRequest());
+		pedestrianLightFigure.setRed(statemachine.getInterfacePedestrian()
+				.getRed());
+		pedestrianLightFigure.setGreen(statemachine.getInterfacePedestrian()
+				.getGreen());
+	}
 
 	@Override
 	protected void pedestrianRequestButtonClicked() {
 		statemachine.raisePedestrianRequest(); // raise event in statemachine
 	}
 
-
 	@Override
 	protected void onOffButtonClicked() {
 		statemachine.raiseOnOff(); // raise event in statemachine
 	}
-	
-	
-	
-	
+
 }

+ 46 - 47
examples/org.yakindu.sct.examples.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/CrossingDemoEventBased.java

@@ -11,58 +11,57 @@
 package org.yakindu.sct.examples.java.trafficlight;
 
 /**
- * Example to show how to integrate the generated statemachine code into existing projects.
- * It uses the event based statemachine approach and the generated RuntimeService to execute it.
+ * Example to show how to integrate the generated statemachine code into
+ * existing projects. It uses the event based statemachine approach and the
+ * generated RuntimeService to execute it.
  * 
  * @author a.nyssen - initial API and implementation
  * @author m.muehlbrandt - adaptions to new statemachine code.
  * @author terfloth - refactoring
  */
-import org.yakindu.sct.runtime.java.TimerService;
-import org.yakindu.sct.runtime.java.trafficlightwaiting.TrafficLightWaitingEventBasedStatemachine;
-
-public class CrossingDemoEventBased extends CrossingDemoBase {
-
-	public static void main(String[] args) {
-
-		new CrossingDemoCycleBased().runTrafficLight();
-	}
-
-	@Override
-	protected void setUpAndRunStatemachine() {
-
-		statemachine = new TrafficLightWaitingEventBasedStatemachine();
-
-		statemachine.setTimerService(new TimerService());
-		statemachine.enter();
-	}
-	
-	@Override
-	protected void tearDownStatemachine() {
-		// End TimerHandler and timing thread.
-		statemachine.getTimerService().cancel();
-	}
-
-	@Override
-	protected void readStatemachineOutput() {
-		trafficLightFigure.setRed(statemachine.getInterfaceTrafficLight().getVarRed());
-		trafficLightFigure.setYellow(statemachine.getInterfaceTrafficLight().getVarYellow());
-		trafficLightFigure.setGreen(statemachine.getInterfaceTrafficLight().getVarGreen());
-	
-		pedestrianLightFigure.setWhite(statemachine.getInterfacePedestrian().getVarRequest());
-		pedestrianLightFigure.setRed(statemachine.getInterfacePedestrian().getVarRed());
-		pedestrianLightFigure.setGreen(statemachine.getInterfacePedestrian().getVarGreen());
-	}
-
-	@Override
-	protected void pedestrianRequestButtonClicked() {
-		statemachine.raisePedestrianRequest(); // raise event in statemachine
-	}
-
-	@Override
-	protected void onOffButtonClicked() {
-		statemachine.raiseOnOff(); // raise event in statemachine
-	}
 
+// FIXME: commented out because templates for event based statemachine are currently under refactoring.
+public class CrossingDemoEventBased // extends CrossingDemoBase
+{
 
+	// public static void main(String[] args) {
+	//
+	// new CrossingDemoCycleBased().runTrafficLight();
+	// }
+	//
+	// @Override
+	// protected void setUpAndRunStatemachine() {
+	//
+	// statemachine = new TrafficLightWaitingEventBasedStatemachine();
+	//
+	// statemachine.setTimerService(new TimerService());
+	// statemachine.enter();
+	// }
+	//
+	// @Override
+	// protected void tearDownStatemachine() {
+	// // End TimerHandler and timing thread.
+	// statemachine.getTimerService().cancel();
+	// }
+	//
+	// @Override
+	// protected void readStatemachineOutput() {
+	// trafficLightFigure.setRed(statemachine.getInterfaceTrafficLight().getVarRed());
+	// trafficLightFigure.setYellow(statemachine.getInterfaceTrafficLight().getVarYellow());
+	// trafficLightFigure.setGreen(statemachine.getInterfaceTrafficLight().getVarGreen());
+	//
+	// pedestrianLightFigure.setWhite(statemachine.getInterfacePedestrian().getVarRequest());
+	// pedestrianLightFigure.setRed(statemachine.getInterfacePedestrian().getVarRed());
+	// pedestrianLightFigure.setGreen(statemachine.getInterfacePedestrian().getVarGreen());
+	// }
+	//
+	// @Override
+	// protected void pedestrianRequestButtonClicked() {
+	// statemachine.raisePedestrianRequest(); // raise event in statemachine
+	// }
+	//
+	// @Override
+	// protected void onOffButtonClicked() {
+	// statemachine.raiseOnOff(); // raise event in statemachine
+	// }
 }

+ 8 - 8
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/extensions/ExecutionModelExtensions.java

@@ -6,15 +6,15 @@ import org.yakindu.sct.model.sgraph.Scope;
 public class ExecutionModelExtensions {
 
 	public static final int getOffset(Scope scope) {
-		int offset = 0;
+//		int offset = 0;
 		ExecutionFlow exFlow = (ExecutionFlow) scope.eContainer();
 		int scopeIndex = exFlow.getScopes().indexOf(scope);
-		if (scopeIndex > 0) {
-			for (int i = 0; i < scopeIndex; i++) {
-				Scope iterScope = exFlow.getScopes().get(i);
-				offset += iterScope.getEvents().size();
-			}
-		}
-		return offset;
+//		if (scopeIndex > 0) {
+//			for (int i = 0; i < scopeIndex; i++) {
+//				Scope iterScope = exFlow.getScopes().get(i);
+//				offset += iterScope.getEvents().size();
+//			}
+//		}
+		return scopeIndex;
 	}
 }

+ 7 - 10
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/extensions/JavaExtensions.java

@@ -19,23 +19,20 @@ public class JavaExtensions implements IJavaFeatureConstants {
 			ExecutionFlow flow, GeneratorEntry entry) {
 
 		String interfaces = "";
-
+		
 		if (hasGenericInterfaceSupport(entry)) {
 			interfaces += "IGenericAccessStatemachine, ";
 		}
 		
-		if (hasDefaultInterface(flow)) {
-			interfaces += "DefaultInterface,";
-		}
+//		if (hasDefaultInterface(flow)) {
+//			interfaces += "DefaultInterface,";
+//		}
 
 		if (isTimedStatemachine(flow)) {
-			interfaces += "ITimedStatemachine";
+			interfaces += "ITimedStatemachine,";
 		}
-
-		else {
-			interfaces += "IStatemachine";
-		}
-
+		
+		interfaces += "IStatemachine";
 		return interfaces;
 	}
 

+ 89 - 278
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomCycleBasedStatemachine.xpt

@@ -18,6 +18,67 @@ Contributors:
 «EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
 «EXTENSION org::yakindu::sct::generator::java::templates::Naming»
 
+«DEFINE Imports(sgen::GeneratorEntry entry)  FOR ExecutionFlow»
+«IF createInterfaceObserverSupport(entry) && hasOutgoingEvents()-»
+import java.util.LinkedList;
+import java.util.List;
+«ENDIF-»
+«IF isTimedStatemachine()-»
+	import «entry.getBasePackageName()».TimeEvent;
+	import «entry.getBasePackageName()».ITimerService;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE FieldDeclarations(sgen::GeneratorEntry entry) FOR ExecutionFlow»
+	«FOREACH getInternalScopeEvents() AS event-»
+		private final boolean «event.getEventIdentifier()»;
+		
+		«IF !event.type.isVoid()-»
+		private final «event.type.getJavaType()» «event.getEventValueIdentifier()»;
+		
+		«ENDIF-»
+	«ENDFOREACH-»
+	
+	«FOREACH getTimeEvents() AS timeEvent-»
+	private final TimeEvent «timeEvent.getEventIdentifier()» = new TimeEvent(«timeEvent.periodic», «getTimeEvents().indexOf(timeEvent)»); 
+	«ENDFOREACH»
+	
+	«IF isTimedStatemachine()-»
+	private final boolean[] timeEvents = new boolean[«getTimeEvents().size»];
+	«ENDIF-»
+	
+	«FOREACH this.scopes.typeSelect(InterfaceScope) AS scope-»
+		«EXPAND StatemachineInterfaceImpl::InterfaceImpl(entry) FOR scope-»
+		
+		private «scope.getInterfaceImplName()» «scope.getInterfaceIdentifier()»;
+	«ENDFOREACH-»
+	
+	public enum State {
+		«FOREACH states AS state-»
+	      «state.getName()»,
+	    «ENDFOREACH-»
+	    «getNullStateName()»
+	};
+	
+	«FOREACH getInternalScopeVariables() AS variable-»
+	private «variable.type.getJavaType()» «variable.getValueName()»«variable.getInitialValueAssignment()»;
+	
+	«ENDFOREACH-»
+	«IF hasHistory()-»
+	private State[] historyVector = new State[«historyVector.size»];
+	
+	«ENDIF-»
+	private final State[] stateVector = new State[«stateVector.size»];
+	
+	private int nextStateIndex;
+	
+	«IF isTimedStatemachine()-»
+	private ITimerService timerService;
+	
+	private long cycleStartTime;
+	«ENDIF-»
+«ENDDEFINE»
+
 «DEFINE ActionCode FOR Step-»
 // ActionCode for Step «toString()» not defined
 «ENDDEFINE»
@@ -45,12 +106,12 @@ Contributors:
 
 «DEFINE ActionCode FOR ScheduleTimeEvent-»
 «getComment()-»
-getTimerService().setTimer(«timeEvent.getEventName()», «timeValue.toCode()», cycleStartTime);
+getTimerService().setTimer(«timeEvent.getEventIdentifier()», «timeValue.toCode()», cycleStartTime);
 «ENDDEFINE»
 
 «DEFINE ActionCode FOR UnscheduleTimeEvent-»
 «getComment()-»
-getTimerService().resetTimer(«timeEvent.getEventName()»);
+getTimerService().resetTimer(«timeEvent.getEventIdentifier()»);
 «ENDDEFINE»
 
 «DEFINE ActionCode FOR Execution-»
@@ -222,27 +283,30 @@ else {
 	
 		«IF !event.type.isVoid()-»
 			private void raise«event.getEventName()»(«event.type.getJavaType()» value) {
-				«event.getEventName()».setValue(value);
-				getOccuredEvents().add(«event.getEventName()»);
+				«event.getEventValueIdentifier()» = value;
+				«event.getEventIdentifier()» = true;
+			}
+			
+			private «event.type.getJavaType()» get«event.getEventName()»Value() {
+				«event.getIllegalAccessValidation()»
+				return «event.getEventValueIdentifier()»;
 			}
+			
 		«ELSE-»
 			private void raise«event.getEventName()»() {
-				getOccuredEvents().add(«event.getEventName()»);
+				«event.getEventIdentifier()» = true;
 			}
+			
 		«ENDIF-»
-		private «event.getEventType()» «event.getter()» {
-			return «event.getEventName()»;
-		}
-	
 	«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 «variable.type.getJavaType()» get«variable.getVarName()»() {
+		return «variable.getVariableIdentifier()»;
 	}
 	
 	private void set«variable.getValueName().toFirstUpper()»(«variable.type.getJavaType()» value) {
-		«variable.getValueName()» = value;
+		«variable.getVariableIdentifier()» = value;
 	}	
 	
 	«ENDFOREACH-»
@@ -254,308 +318,55 @@ else {
 	«IF event.direction == Direction::IN-»
 		«IF !event.type.isVoid()-»
 		public void raise«event.getEventName()»(«event.type.getJavaType()» value) {
-			getDefaultInterface().raise«event.getEventName()»(value);
+			«getInterfaceIdentifier()».raise«event.getEventName()»(value);
 		}
 		«ELSE»
 		public void raise«event.getEventName()»() {
-			getDefaultInterface().raise«event.getEventName()»();
+			«getInterfaceIdentifier()».raise«event.getEventName()»();
 		}
 		«ENDIF-»
 	«ENDIF-»
 	
 	«IF event.direction ==  Direction::OUT-»
 	public boolean isRaised«event.getEventName()»() {
-		return getOutEvents().contains(«event.getter()»);
+		return «getInterfaceIdentifier()».isRaised«event.getEventName()»();
 	}
-	
-	public «event.getEventType()» «event.getter()» {
-		return getDefaultInterface().«event.getter()»;
+	«IF !event.type.isVoid()-»
+	public «event.type.getJavaType()» get«event.getEventName()»Value() {
+		return «getInterfaceIdentifier()».get«event.getEventName()»Value();
 	}
+	«ENDIF»
 	«ENDIF-»
 	«ENDFOREACH-»
 	
 	«FOREACH declarations.typeSelect(VariableDefinition) AS variable-»
 	public «variable.type.getJavaType()» «variable.getter()» {
-		return getDefaultInterface().«variable.getter()»;
+		return «getInterfaceIdentifier()».«variable.getter()»;
 	}
 	
 	public void set«variable.getValueName().toFirstUpper()»(«variable.type.getJavaType()» value) {
-		getDefaultInterface().set«variable.getValueName().toFirstUpper()»(value);
+		«getInterfaceIdentifier()».set«variable.getValueName().toFirstUpper()»(value);
 	}	
 	«ENDFOREACH-»
 	
 	«IF (hasVariables() || hasIncomingEvents()) && entry.createGenericInterfaceSupport()-»
 	public boolean raiseEvent(String name) {
-		return getDefaultInterface().raiseEvent(name);
+		return «getInterfaceIdentifier()».raiseEvent(name);
 	}
 	
 	«IF hasIncomingEvents()-»
 	@SuppressWarnings("unchecked")
 	«ENDIF-»
 	public boolean raiseEvent(String name, Object value) {
-		return getDefaultInterface().raiseEvent(name, value);
+		return «getInterfaceIdentifier()».raiseEvent(name, value);
 	}
 
 	public boolean setVariable(String name, Object value) {
-		return getDefaultInterface().setVariable(name, value);
+		return «getInterfaceIdentifier()».setVariable(name, value);
 	}
 	
 	public Object getVariable(String name) {
-		return getDefaultInterface().getVariable(name);
+		return «getInterfaceIdentifier()».getVariable(name);
 	}
 	«ENDIF-»
 «ENDDEFINE»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«FILE getImplementationPackagePath(entry)+"/"+getCycleBasedStatemachineName()+'.java'-»
-«getLicenseHeader(entry)»
-package «getImplementationPackageName(entry)»;
-
-import java.util.Collection;
-import java.util.HashSet;
-import «entry.getBasePackageName()».Event;
-import «entry.getBasePackageName()».EventVector;
-«IF entry.createGenericInterfaceSupport()-»
-	import java.util.HashMap;
-	import java.util.Map;
-	import «entry.getBasePackageName()».IGenericAccessStatemachine;
-	import «entry.getBasePackageName()».IGenericAccessInterface;
-«ENDIF-»
-«IF isTimedStatemachine()-»
-	import «entry.getBasePackageName()».TimeEvent;
-	import «entry.getBasePackageName()».ITimedStatemachine;
-	import «entry.getBasePackageName()».ITimerService;
-«ELSE-»
-	import «entry.getBasePackageName()».IStatemachine;
-«ENDIF-»
-«IF !getInternalScopeValuedEvents().isEmpty  || hasDefaultInterfaceValuedEvents()-»
-	import «entry.getBasePackageName()».ValuedEvent;
-«ENDIF-»
-«IF getStatemachineExtension(entry) != null-»
-	import «entry.getBasePackageName()».NotificationSender;
-«ENDIF-»
-
-public class «getCycleBasedStatemachineName()» «getStatemachineExtension(entry)» implements «getStatemachineInterfaceTypes(entry)» {
-	
-	«IF getInternalScopeEvents().size > 0-»
-	private enum Events {
-	«FOREACH getInternalScopeEvents() AS event-»
-		«event.getEventName()»,
-	«ENDFOREACH-»
-	}
-	«ENDIF-»
-	
-	«IF isTimedStatemachine()-»
-	private enum TimeEvents {
-	«FOREACH getTimeEvents() AS timeEvent-»
-		«timeEvent.getEventName().toFirstUpper()»,
-	«ENDFOREACH-»
-	}
-	«ENDIF-»
-	
-	«FOREACH getInternalScopeEvents() AS event-»
-	private final «event.getEventType()» «event.getEventName()» = new «event.getEventType()»(«event.getCreationSignature()»); 
-	«ENDFOREACH-»
-	
-	«FOREACH getTimeEvents() AS timeEvent-»
-	private static final TimeEvent<TimeEvents> «timeEvent.getEventName()» = new TimeEvent<TimeEvents>(TimeEvents.«timeEvent.getEventName().toFirstUpper()»,«((Scope)timeEvent.eContainer).getOffset()», «timeEvent.periodic»); 
-	«ENDFOREACH»
-	
-	public enum State {
-		«FOREACH states AS state-»
-	      «state.getName()»,
-	    «ENDFOREACH-»
-	    «getNullStateName()»
-	};
-	
-	«IF entry.createGenericInterfaceSupport()-»
-		protected Map<String,IGenericAccessInterface> interfaceMap;
-	«ELSE-»
-		«FOREACH scopes.typeSelect(InterfaceScope) AS interface-»
-		private «interface.getInterfaceImplName()» «interface.getInterfaceName().toFirstLower()»;
-		«ENDFOREACH-»
-	«ENDIF-»
-	
-	«FOREACH getInternalScopeVariables() AS variable-»
-	private «variable.type.getJavaType()» «variable.getValueName()»«variable.getInitialValueAssignment()»;
-	
-	«ENDFOREACH-»
-	
-	«IF hasHistory()-»
-	private State[] historyVector = new State[«historyVector.size»];
-	«ENDIF-»
-
-	private final State[] stateVector = new State[«stateVector.size»];
-	
-	private int nextStateIndex;
-	
-	private final EventVector<Event<? extends Enum<?>>> occuredEvents;
-	
-	private final Collection<Event<? extends Enum<?>>> outEvents;
-	
-	«IF isTimedStatemachine()-»
-	private ITimerService timerService;
-	
-	private long cycleStartTime;
-	«ENDIF-»
-	
-	public «getCycleBasedStatemachineName()»() {
-		occuredEvents = new EventVector<Event<? extends Enum<?>>>(«getEventsCount()»);
-		outEvents = new HashSet<Event<? extends Enum<?>>>();
-		«IF entry.createGenericInterfaceSupport()-»
-			interfaceMap = new HashMap<String, IGenericAccessInterface>();
-			«FOREACH getInterfaceScope() AS interface-»
-			interfaceMap.put("«interface.getInterfaceName()»", new «interface.getInterfaceImplName()»(«interface.getInterfaceParameter()»));
-			«ENDFOREACH-»
-		«ELSE-»
-			«FOREACH getInterfaceScope() AS interface-»
-			«interface.getInterfaceName().toFirstLower()» = new «interface.getInterfaceImplName()»(«interface.getInterfaceParameter()»);
-			«ENDFOREACH-»
-		«ENDIF-»
-		«FOREACH getTimeEvents() AS timeEvent-»
-			«timeEvent.getEventName()».setStatemachine(this);
-		«ENDFOREACH»
-	}
-	
-	protected Collection<Event<? extends Enum<?>>> getOccuredEvents() {
-		return occuredEvents;
-	}
-	
-	protected Collection<Event<? extends Enum<?>>> getOutEvents(){
-		return outEvents;
-	}
-	
-	protected boolean eventOccured() {
-		return !occuredEvents.isEmpty();
-	}
-	
-	public void init() {
-		«IF isTimedStatemachine()-»
-		assert timerService != null;
-		«ENDIF-»
-		for (int i = 0; i < «stateVector.size»; i++) {
-			stateVector[i] = State.$NullState$;
-		}
-		
-		«IF hasHistory()-»
-		for (int i = 0; i < «historyVector.size»; i++) {
-			historyVector[i] = State.$NullState$;
-		}
-		«ENDIF-»
-		
-		occuredEvents.clear();
-	}
-	
-	public boolean isStateActive(State state){
-		for (int i=0;i<stateVector.length;i++){
-			if (stateVector[i]==state) {
-				return true;
-			}
-		}
-		return false;
-	}
-	
-	«IF isTimedStatemachine()-»
-	public void setTimerService(ITimerService timerService) {
-		this.timerService = timerService;
-	}
-
-	
-	public ITimerService getTimerService() {
-		assert timerService != null;
-		return timerService;
-	}
-	
-	public void onTimeEventRaised(TimeEvent<? extends Enum<?>> timeEvent) {
-		getOccuredEvents().add(timeEvent);
-	}
-	«ENDIF-»
-	
-	«IF entry.createGenericInterfaceSupport()-»
-	public IGenericAccessInterface getInterface(String name) {
-		return interfaceMap.get(name);
-	}
-	
-	protected Map<String, IGenericAccessInterface> getInterfaceMap() {
-		return interfaceMap;
-	}
-	«ENDIF-»
-	
-	«FOREACH scopes.typeSelect(InterfaceScope) AS interface-»
-	public «interface.getInterfaceName()» get«interface.getInterfaceName()»() {
-		«IF entry.createGenericInterfaceSupport()-»
-		return («interface.getInterfaceName()») getInterface("«interface.getInterfaceName()»");
-		«ELSE-»
-		return «interface.getInterfaceName().toFirstLower()»;
-		«ENDIF-»
-	}
-	
-	
-	protected «interface.getIInterfaceImplName()» get«interface.getInterfaceImplName()»() {
-		«IF entry.createGenericInterfaceSupport()-»
-		return («interface.getIInterfaceImplName()») getInterface("«interface.getInterfaceName()»");
-		«ELSE-»
-		return «interface.getInterfaceName().toFirstLower()»;
-		«ENDIF-»
-	}
-	«ENDFOREACH-»
-	
-	«EXPAND InternalScopeMethods FOR this»
-	«EXPAND DefaultInterfaceMethods(entry) FOREACH getDefaultInterface()»
-	«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-»
-	
-	«IF exitSequence.steps.size > 0-»
-		public void «exitSequenceName()»(){
-			«EXPAND ActionCode FOREACH exitSequence.steps-»
-		}
-	«ENDIF»
-	
-
-«EXPAND ConditionMethodsImplement FOR this-»
-«EXPAND ConditionMethodsImplement FOREACH this.states-»
-«EXPAND ConditionMethodsImplement FOREACH this.nodes-»
-«EXPAND StatementMethodsImplement FOR this-»
-«EXPAND StatementMethodsImplement FOREACH this.states-»
-«EXPAND StatementMethodsImplement FOREACH this.nodes-»
-«EXPAND EnterMethodImplement FOREACH this.states-»
-«EXPAND ExitMethodImplement FOREACH this.states-»
-«EXPAND EnterSequenceImplement FOREACH this.states-»
-«EXPAND ExitSequenceImplement FOREACH this.states-»
-«EXPAND EnterSequenceImplement FOREACH this.regions-»
-«EXPAND ExitSequenceImplement FOREACH this.regions-»
-«EXPAND DeepEnterSequenceImplement FOREACH this.regions-»
-«EXPAND ShallowEnterSequenceImplement FOREACH this.regions-»
-«EXPAND ReactMethodsImplement FOREACH this.states-»
-«EXPAND ReactMethodsImplement FOREACH this.nodes-»
-	public void runCycle() {
-		«IF isTimedStatemachine()-»
-		cycleStartTime = System.currentTimeMillis();
-		«ENDIF-»
-		outEvents.clear();
-		
-		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
-			
-			switch (stateVector[nextStateIndex]) {
-			«FOREACH this.states AS state-»
-    		case «state.getName()»:
-        		react«state.getName()»();
-        		break;
-			«ENDFOREACH-»
-			default:
-				// «getNullStateName()»
-			}
-		}
-		
-		occuredEvents.clear();
-	}
-}
-«ENDFILE-»
-«ENDDEFINE»

+ 0 - 63
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomEventBasedInterfaceImpl.xpt

@@ -1,63 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT stext»
-«IMPORT types»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::ExecutionModelExtensions»
-«EXTENSION org::yakindu::sct::generator::java::templates::TypeModelExtensions»
-«EXTENSION org::yakindu::sct::generator::java::templates::Expression»
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR InterfaceScope»
-«FILE getImplementationPackagePath(entry)+"/"+getEventBasedInterfaceImplName() + '.java'-»
-«getLicenseHeader(entry)»
-package «getImplementationPackageName(entry)»;
-
-public class «getEventBasedInterfaceImplName()» extends «getInterfaceImplName()» {
-			
-	public «getEventBasedInterfaceImplName()»(«getCycleBasedStatemachineName()» statemachine) {
-		super(statemachine);
-	}
-		
-	«FOREACH declarations.typeSelect(EventDefinition) AS event-»
-		«IF !event.type.isVoid()-»
-		public void raise«event.getEventName()»(«event.type.getJavaType()» value) {
-			super.raise«event.getEventName()»(value);
-			statemachine.runCycle();
-		}
-		«ELSE-»
-		public void raise«event.getEventName()»() {
-			super.raise«event.getEventName()»();
-		statemachine.runCycle();
-		}
-		«ENDIF-»
-	«ENDFOREACH-»
-	
-	«IF entry.createGenericInterfaceSupport()-»
-	public boolean raiseEvent(String name) {
-		boolean raised = super.raiseEvent(name);
-		if (raised) {
-			statemachine.runCycle();
-		}
-		return raised;
-	}
-	
-	public boolean raiseEvent(String name, Object value) {
-		boolean raised = super.raiseEvent(name, value);
-		if (raised) {
-			statemachine.runCycle();
-		}
-		return raised;
-	}
-	«ENDIF-»
-}
-«ENDFILE-»
-«ENDDEFINE»

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

@@ -1,102 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-«IMPORT stext»
-«IMPORT sgraph»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::ExecutionModelExtensions»
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow»
-«FILE getImplementationPackagePath(entry)+"/"+getEventBasedStatemachineName()+'.java'-»
-«getLicenseHeader(entry)»
-package «getImplementationPackageName(entry)»;
-
-import java.util.LinkedList;
-
-import «entry.getBasePackageName()».Event;
-
-«IF isTimedStatemachine()-»
-	import «entry.getBasePackageName()».TimeEvent;
-«ENDIF-»
-
-public class «getEventBasedStatemachineName()» extends «getCycleBasedStatemachineName()» {
-
-	private LinkedList<Event<? extends Enum<?>>> eventQueue;
-	
-	«IF !entry.createGenericInterfaceSupport()-»
-		«FOREACH scopes.typeSelect(InterfaceScope) AS interface-»
-			«IF interface.hasIncomingEvents()-»
-			private «interface.getEventBasedInterfaceImplName()» «interface.getInterfaceName().toFirstLower()»;
-			«ENDIF-»
-		«ENDFOREACH-»
-	«ENDIF-»
-	
-	public «getEventBasedStatemachineName()»() {
-		eventQueue = new LinkedList<Event<? extends Enum<?>>>();
-		«IF entry.createGenericInterfaceSupport()-»
-			//Replace interface map entries of cycle based statemachine super class
-			«FOREACH getInterfaceScope() AS interface-»
-				«IF interface.hasIncomingEvents()-»
-				getInterfaceMap().put("«interface.getInterfaceName()»", new «interface.getEventBasedInterfaceImplName()»(«interface.getInterfaceParameter()»));
-				«ENDIF-»
-			«ENDFOREACH-»
-		«ELSE-»
-			«FOREACH getInterfaceScope() AS interface-»
-				«IF interface.hasIncomingEvents()-»
-				«interface.getInterfaceName().toFirstLower()» = new «interface.getEventBasedInterfaceImplName()»(«interface.getInterfaceParameter()»);
-				«ENDIF-»		
-			«ENDFOREACH-»
-		«ENDIF-»
-	}
-	
-	«IF !entry.createGenericInterfaceSupport()-»
-		«FOREACH scopes.typeSelect(InterfaceScope) AS interface-»
-		«IF interface.hasIncomingEvents()-»
-		public «interface.getInterfaceName()» get«interface.getInterfaceName()»() {
-			return «interface.getInterfaceName().toFirstLower()»;
-		}
-		
-		protected «interface.getIInterfaceImplName()» get«interface.getInterfaceImplName()»() {
-			return «interface.getInterfaceName().toFirstLower()»;
-		}
-		«ENDIF-»
-		«ENDFOREACH-»
-	«ENDIF-»
-	
-	«IF isTimedStatemachine()-»	
-	public void onTimeEventRaised(TimeEvent<? extends Enum<?>> timeEvent) {
-		super.onTimeEventRaised(timeEvent);
-		runCycle();
-	}
-	«ENDIF-»
-	
-	@Override
-	protected LinkedList<Event<? extends Enum<?>>> getOccuredEvents() {
-		return eventQueue;
-	}
-	
-	@Override
-	protected boolean eventOccured() {
-		return !eventQueue.isEmpty();
-	}
-	
-	@Override
-	public void runCycle() {
-		if (eventOccured()) {
-			Event<? extends Enum<?>> event = getOccuredEvents().poll();
-			super.getOccuredEvents().add(event);
-			super.runCycle();
-		}
-	}
-}
-«ENDFILE-»
-«ENDDEFINE»

+ 0 - 46
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomIInterfaceImpl.xpt

@@ -1,46 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT stext»
-«IMPORT types»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::ExecutionModelExtensions»
-«EXTENSION org::yakindu::sct::generator::java::templates::TypeModelExtensions»
-«EXTENSION org::yakindu::sct::generator::java::templates::Expression»
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR InterfaceScope»
-«FILE getImplementationPackagePath(entry)+"/"+getIInterfaceImplName() + '.java'-»
-«getLicenseHeader(entry)»
-package «getImplementationPackageName(entry)»;
-
-«IF hasUnvaluedEvents()-»
-import «entry.getBasePackageName()».Event;
-«ENDIF-»
-«IF hasIncomingValuedEvents()-»
-import «entry.getBasePackageName()».ValuedEvent;
-«ENDIF-»
-
-public interface «getIInterfaceImplName()» extends «getInterfaceName()» {
-		
-	«FOREACH declarations.typeSelect(EventDefinition) AS event-»
-	«IF event.direction == Direction::OUT-»
-		«IF !event.type.isVoid()-»
-		public void raise«event.getEventName()»(«event.type.getJavaType()» value);
-		«ELSE»
-		public void raise«event.getEventName()»();
-		«ENDIF-»
-	«ELSE-»
-		public «event.getEventType()» «event.getter()»;
-	«ENDIF»
-	«ENDFOREACH»
-}
-«ENDFILE-»
-«ENDDEFINE»

+ 0 - 78
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomInterface.xpt

@@ -1,78 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT stext»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::ExecutionModelExtensions»
-«EXTENSION org::yakindu::sct::generator::java::templates::TypeModelExtensions»
-«EXTENSION org::yakindu::sct::generator::java::templates::Expression»
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR InterfaceScope-»
-«FILE getImplementationPackagePath(entry)+"/"+getInterfaceName() + '.java'-»
-«getLicenseHeader(entry)»
-package «getImplementationPackageName(entry)»;
-
-«IF hasOutgoingVoidEvents()-»
-import «entry.getBasePackageName()».Event;
-«ENDIF-»
-«IF (hasOutgoingEvents() || hasVariables()) && entry.createInterfaceObserverSupport()-»
-import «entry.getBasePackageName()».INotificationSender;
-«ENDIF-»
-«IF (hasVariables() || hasIncomingEvents()) && entry.createGenericInterfaceSupport()-»
-import «entry.getBasePackageName()».IGenericAccessInterface;
-«ENDIF-»
-«IF hasOutgoingValuedEvents()-»
-import «entry.getBasePackageName()».ValuedEvent;
-«ENDIF-»
-
-
-public interface «getInterfaceName()»«getInterfaceExtension(entry)» {
-	
-	«IF declarations.typeSelect(EventDefinition).size > 0-»
-	public enum Events {
-	«FOREACH declarations.typeSelect(EventDefinition) AS event-»
-		«event.getEventName()»,
-	«ENDFOREACH-»
-	}
-	«ENDIF-»
-	
-	«IF entry.createInterfaceObserverSupport() && declarations.typeSelect(VariableDefinition).size > 0-»
-	public enum Variables {
-		«FOREACH declarations.typeSelect(VariableDefinition) AS variable-»
-		«variable.name»,
-		«ENDFOREACH-»
-	}
-	«ENDIF-»
-	
-	«FOREACH declarations.typeSelect(EventDefinition) AS event-»
-	«IF  event.direction ==  Direction::IN-»
-		«IF !event.type.isVoid()-»
-			public void raise«event.getEventName()»(«event.type.getJavaType()» value);
-		«ELSE»
-			public void raise«event.getEventName()»();
-		«ENDIF-»
-	«ELSEIF event.direction ==  Direction::OUT-»
-	public boolean isRaised«event.getEventName()»();
-		
-	public «event.getEventType()» getEvent«event.getEventName()»();
-	
-	«ENDIF-»
-	«ENDFOREACH-»
-	
-	«FOREACH declarations.typeSelect(VariableDefinition) AS variable-»
-	public «variable.type.getJavaType()» get«variable.getValueName().toFirstUpper()»();
-	«IF  !variable.readonly-»
-	public void set«variable.getValueName().toFirstUpper()»(«variable.type.getJavaType()» value);	
-	«ENDIF-»
-	«ENDFOREACH-»
-}
-«ENDFILE-»
-«ENDDEFINE»

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

@@ -1,230 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT stext»
-«IMPORT types»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::ExecutionModelExtensions»
-«EXTENSION org::yakindu::sct::generator::java::templates::TypeModelExtensions»
-«EXTENSION org::yakindu::sct::generator::java::templates::Expression»
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR InterfaceScope»
-«FILE getImplementationPackagePath(entry)+"/"+getInterfaceImplName() + '.java'-»
-«getLicenseHeader(entry)»
-package «getImplementationPackageName(entry)»;
-
-«IF (hasVariables() || hasIncomingEvents()) && entry.createGenericInterfaceSupport()-»
-import java.util.HashMap;
-import java.util.Map;
-«ENDIF-»
-«IF hasUnvaluedEvents()-»
-import «entry.getBasePackageName()».Event;
-«ENDIF-»
-«IF (hasVariables() || hasOutgoingEvents()) && entry.createInterfaceObserverSupport()-»
-import «entry.getBasePackageName()».NotificationSender;
-«IF hasOutgoingEvents()-»
-import «entry.getBasePackageName()».EventNotification;
-«ENDIF-»
-«IF hasVariables() && entry.createInterfaceObserverSupport()-»
-import «entry.getBasePackageName()».VariableNotification;
-«ENDIF-»
-«ENDIF-»
-«IF hasValuedEvents() || entry.createGenericInterfaceSupport()-»
-import «entry.getBasePackageName()».ValuedEvent;
-«ENDIF-»
-
-public class «getInterfaceImplName()»«getInterfaceImplExtension(entry)» implements «getIInterfaceImplName()» {
-	«IF entry.createGenericInterfaceSupport()-»
-		«IF hasVariables()-»
-		protected Map<String,Object> variableMap;
-		«ENDIF-»
-		«IF hasOutgoingEvents()-»
-		protected Map<String, Event<Events>> outEventMap;
-		«ENDIF-»
-		«IF hasIncomingEvents()-»
-		protected Map<String, Event<Events>> inEventMap;
-		«ENDIF-»
-	«ELSE-»
-		«FOREACH declarations.typeSelect(EventDefinition) AS event-»
-		protected final «event.getEventType()» «event.getEventName()» = new «event.getEventType()»(«event.getCreationSignature()»);
-		«ENDFOREACH-»
-	«ENDIF-» 
-	
-	«IF hasEvents()-»
-		protected «getCycleBasedStatemachineName()-» statemachine;
-		
-		public «getInterfaceImplName()»(«getCycleBasedStatemachineName()» statemachine) {
-			
-			this.statemachine = statemachine;
-	«ELSE-»
-		public «getInterfaceImplName()»() {
-	«ENDIF-»
-		«IF entry.createGenericInterfaceSupport()-»
-			«IF hasVariables()-»
-			variableMap = new HashMap<String, Object>();
-				«FOREACH declarations.typeSelect(VariableDefinition) AS variable-»
-				variableMap.put("«variable.name»", new «variable.type.getJavaClassType()»(«variable.type.getInitialValue()»));
-				«ENDFOREACH-»
-			«ENDIF-»
-			
-			«IF hasIncomingEvents()-»
-			inEventMap = new HashMap<String, Event<Events>>();
-			«ENDIF-»
-			
-			«IF hasOutgoingEvents()-»
-			outEventMap = new HashMap<String, Event<Events>>();
-			«ENDIF-»
-			
-			«FOREACH declarations.typeSelect(EventDefinition) AS event-»
-			«IF event.direction == Direction::IN-»
-			inEventMap.put("«event.name»", new «event.getEventType()»(«event.getCreationSignature()»));
-			«ELSE-»
-			outEventMap.put("«event.name»", new «event.getEventType()»(«event.getCreationSignature()»));
-			«ENDIF-»
-			«ENDFOREACH-»	
-		«ENDIF-»
-	}
-		
-	«FOREACH declarations.typeSelect(EventDefinition) AS event-»
-	
-	«IF !event.type.isVoid()-»
-	public void raise«event.getEventName()»(«event.type.getJavaType()» value) {
-		«event.getter()».setValue(value);
-		statemachine.getOccuredEvents().add(«event.getter()»);
-		«IF event.direction ==  Direction::OUT-»
-		statemachine.getOutEvents().add(«event.getter()»);
-		«IF entry.createInterfaceObserverSupport()-»
-			notifyListenersOnEventRaised(new EventNotification(«event.getter()»));
-		«ENDIF-»
-		«ENDIF-»
-	}
-	«ELSE»
-	public void raise«event.getEventName()»() {
-		statemachine.getOccuredEvents().add(«event.getter()»);
-		«IF event.direction ==  Direction::OUT-»
-			statemachine.getOutEvents().add(«event.getter()»);
-			«IF entry.createInterfaceObserverSupport()-»
-			notifyListenersOnEventRaised(new EventNotification(«event.getter()»));
-			«ENDIF-»
-		«ENDIF-»
-	}
-	«ENDIF-»
-	
-	«IF !event.type.isVoid() && entry.createGenericInterfaceSupport()-»
-	@SuppressWarnings("unchecked")
-	«ENDIF-»
-	public «event.getEventType()» «event.getter()» {
-		«IF entry.createGenericInterfaceSupport()-»
-			«IF event.type.isVoid()-»
-				«IF event.direction == Direction::IN-»
-				return inEventMap.get("«event.name»");
-				«ELSE-»
-				return outEventMap.get("«event.name»");
-				«ENDIF-»
-			«ELSE-»
-				«IF event.direction == Direction::OUT-»
-				return («event.getEventType()») outEventMap.get("«event.name»");
-				«ELSE-»
-				return («event.getEventType()») inEventMap.get("«event.name»");
-				«ENDIF-»
-			«ENDIF-»
-		«ELSE-»
-		return «event.getEventName()»;
-		«ENDIF-»
-	}
-	
-	«IF event.direction ==  Direction::OUT-»
-	public boolean isRaised«event.getEventName()»() {
-		return statemachine.getOutEvents().contains(«event.getter()»);
-	}
-	«ENDIF-»
-	«ENDFOREACH-»
-	
-	«FOREACH declarations.typeSelect(VariableDefinition) AS variable-»
-	«IF !entry.createGenericInterfaceSupport()-»
-		private «variable.type.getJavaType()» «variable.getValueName()»«variable.getInitialValueAssignment()»;
-	«ENDIF-»
-	public «variable.type.getJavaType()» «variable.getter()» {
-		«IF entry.createGenericInterfaceSupport()-»
-		return («variable.type.getJavaClassType()») variableMap.get("«variable.name»");
-		«ELSE-»
-		return «variable.getValueName()»;
-		«ENDIF-»
-	}
-	
-	public void set«variable.getValueName().toFirstUpper()»(«variable.type.getJavaType()» value) {
-		«IF entry.createInterfaceObserverSupport()-»
-		«variable.type.getJavaType()» oldValue = «variable.getter()»;
-		«ENDIF-»
-		«IF entry.createGenericInterfaceSupport()-»
-		variableMap.put("«variable.name»", new «variable.type.getJavaClassType()»(value));
-		«ELSE-»
-		«variable.getValueName()» = value;
-		«ENDIF-»
-		«IF entry.createInterfaceObserverSupport()-»
-			notifyListenersOnVariableChanged(new VariableNotification<«variable.type.getJavaClassType()»>(Variables.«variable.name», «variable.getter()», oldValue));
-		«ENDIF-»
-	}	
-	«ENDFOREACH-»
-	
-	«IF (hasVariables() || hasIncomingEvents()) && entry.createGenericInterfaceSupport()-»
-	public boolean raiseEvent(String name) {
-		«IF hasIncomingEvents()-»
-		if (inEventMap.get(name) != null) {
-			return statemachine.getOccuredEvents().add(inEventMap.get(name));
-		}
-		«ENDIF-»
-		return false;
-	}
-	
-	«IF hasIncomingEvents()-»
-	@SuppressWarnings("unchecked")
-	«ENDIF-»
-	public boolean raiseEvent(String name, Object value) {
-		«IF hasIncomingEvents()-»
-		if (inEventMap.get(name) != null
-				&& inEventMap.get(name) instanceof ValuedEvent) {
-			ValuedEvent<?, ?> event = (ValuedEvent<?, ?>) inEventMap.get(name);
-			if (event.getValue().getClass() == value.getClass()) {
-				((ValuedEvent<Events, Object>) event).setValue(value);
-				return statemachine.getOccuredEvents()
-						.add(inEventMap.get(name));
-			}
-		}
-		«ENDIF-»
-		return false;
-	}
-
-	public boolean setVariable(String name, Object value) {
-		«IF hasVariables()-»
-		if (variableMap.get(name) != null
-				&& variableMap.get(name).getClass() == value.getClass()) {
-			Object oldValue = variableMap.get(name);
-			variableMap.put(name, value);
-			notifyListenersOnVariableChanged(new VariableNotification<Object>(
-					Variables.valueOf(name), variableMap.get(name), oldValue));
-			return true;
-		}
-		«ENDIF-»
-		return false;
-	}
-	
-	public Object getVariable(String name) {
-		«IF hasVariables()-»
-		return variableMap.get(name);
-		«ELSE-»
-		return null;
-		«ENDIF-»
-	}
-	«ENDIF-»
-}
-«ENDFILE-»
-«ENDDEFINE»

+ 0 - 46
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomStatemachineCreationFactory.xpt

@@ -1,46 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«FILE getImplementationPackagePath(entry)+'/'+getStatemachineFactoryName()+'.java'-»
-«getLicenseHeader(entry)»
-package «getImplementationPackageName(entry)»;
-
-import «entry.getBasePackageName()».IStatemachine;
-import «entry.getBasePackageName()».IStatemachineCreationFactory;
-
-public class «getStatemachineFactoryName()» implements IStatemachineCreationFactory {
-	
-	public final static IStatemachineCreationFactory INSTANCE = new «getStatemachineFactoryName()»();
-	
-	public IStatemachine createCycleBasedStatemachine() {
-		return new «getCycleBasedStatemachineName()»();
-	}
-	
-	public IStatemachine createActiveEventBasedStatemachine() {
-		«IF entry.createEventBasedStatemachine()-»
-		return new «getEventBasedStatemachineName()»();
-		«ELSE-»
-		throw new UnsupportedOperationException(
-				"Creating active event based statemachine of type \"«getStatemachineFactoryName()»\" is not supported by this factory");
-		«ENDIF-»
-	}
-	
-	public IStatemachine createPassiveEventBasedStatemachine() {
-		throw new UnsupportedOperationException(
-				"Creating passive event based statemachine of type \"«getStatemachineFactoryName()»\" is not supported by this factory");
-	}
-}
-«ENDFILE-»
-«ENDDEFINE»

+ 0 - 66
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Event.xpt

@@ -1,66 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«IF name != null-»
-«FILE entry.getBasePackagePath()+'/Event.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-/**
- * 
- * Basic event class.
- * 
- * @param <T>
- */
-public class Event<T extends Enum<T>> {
-
-	private T id;
-
-	private int offset;
-
-	/**
-	 * Creates an event with the given id and an offset. The offset represents
-	 * the start index of the events position in the {@link EventVector} of the
-	 * statemachine.
-	 * 
-	 * @param id
-	 * @param offset
-	 */
-	public Event(T id, int offset) {
-		this.id = id;
-		this.offset = offset;
-	}
-
-	/**
-	 * Returns the event identifier.
-	 * 
-	 * @return
-	 */
-	public T getId() {
-		return id;
-	}
-
-	/**
-	 * Returns the position of the event in the statemachines
-	 * {@link EventVector}
-	 * 
-	 * @return {@code int}
-	 */
-	public int getIndex() {
-		return offset + id.ordinal();
-	}
-}
-«ENDFILE-»
-«ENDIF-»
-«ENDDEFINE»

+ 0 - 51
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/EventNotification.xpt

@@ -1,51 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«IF name != null-»
-«FILE entry.getBasePackagePath()+'/EventNotification.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-import «entry.getBasePackageName()».Event;
-
-/**
- * 
- * Class to transmit an event within a notification.
- * 
- * 
- */
-public class EventNotification extends Notification {
-
-	private Event<? extends Enum<?>> event;
-	
-	/**
-	 * Initializes the notification with an {@link Event}.
-	 * @param event
-	 */
-	public EventNotification(Event<? extends Enum<?>> event) {
-		super(NotificationType.EventNotification);
-		this.event = event;
-	}
-	
-	/**
-	 * Returns the contained {@code Event}.
-	 * @return {@link Event}
-	 */
-	public Event<? extends Enum<?>> getEvent() {
-		return event;
-	}
-}
-«ENDFILE-»
-«ENDIF-»
-«ENDDEFINE»

+ 0 - 138
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/EventVector.xpt

@@ -1,138 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«IF name != null-»
-«FILE entry.getBasePackagePath()+'/EventVector.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-/**
- * 
- * The {@code EventVector} stores the events that occurred during a cycle.
- * 
- * @param <E>
- */
-public class EventVector<E extends Event<? extends Enum<?>>> implements
-		Collection<E> {
-
-	private boolean events[];
-
-	public EventVector(int size) {
-		events = new boolean[size];
-	}
-	
-	public int size() {
-		return events.length;
-	}
-	
-	public boolean isEmpty() {
-		for (int i = 0; i < events.length; i++) {
-			if (events[i]) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	@SuppressWarnings("unchecked")
-	public boolean contains(Object o) {
-		if (o instanceof Event) {
-			Event<? extends Enum<?>> event = (Event<? extends Enum<?>>) o;
-			return events[event.getIndex()];
-		}
-		return false;
-	}
-	
-	public Iterator<E> iterator() {
-		throw new UnsupportedOperationException("Iterator not supported!");
-	}
-	
-	public Object[] toArray() {
-		throw new UnsupportedOperationException("toArray not supported!");
-	}
-	
-	public <T> T[] toArray(T[] a) {
-		throw new UnsupportedOperationException("toArray not supported!");
-	}
-	
-	public boolean add(E e) {
-		if (e.getIndex() > -1 && e.getIndex() < events.length) {
-			events[e.getIndex()] = true;
-			return true;
-		}
-		return false;
-	}
-
-	@SuppressWarnings("rawtypes")
-	public boolean remove(Object o) {
-		if (o instanceof Event) {
-			Event event = (Event) o;
-			if (event.getIndex() > -1 && event.getIndex() < events.length) {
-				events[event.getIndex()] = true;
-				return true;
-			}
-		}
-		return false;
-	}
-
-	@SuppressWarnings("rawtypes")
-	public boolean containsAll(Collection<?> c) {
-		for (Object o : c) {
-			if (o instanceof Event) {
-				Event event = (Event) o;
-				if (!events[event.getIndex()]) {
-					return false;
-				}
-			}
-			else {
-				return false;
-			}
-		}
-		return true;
-	}
-	
-	public boolean addAll(Collection<? extends E> c) {
-		for (E event : c) {
-			if (!add(event)) {
-				return false;
-			}
-		}
-		return true;
-	}
-	
-	public boolean removeAll(Collection<?> c) {
-		for (Object o : c) {
-			if (!remove(o)) {
-				return false;
-			}
-		}
-		return true;
-	}
-	
-	public boolean retainAll(Collection<?> c) {
-		throw new UnsupportedOperationException("retainAll not supported!");
-	}
-
-	public void clear() {
-		for (int i = 0; i < events.length; i++) {
-			events[i] = false;
-		}
-	}
-}
-«ENDFILE-»
-«ENDIF-»
-«ENDDEFINE»

+ 3 - 0
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ExecutionModelExtensions.ext

@@ -51,6 +51,9 @@ boolean hasIncomingValuedEvents(Scope this) :
 boolean hasOutgoingEvents(Scope this) :
 	!declarations.typeSelect(EventDefinition).select(event|event.direction == Direction::OUT).isEmpty;
 
+boolean hasOutgoingEvents(ExecutionFlow this):
+	!getInterfaceScopeEvents().select(event|event.direction == Direction::OUT).isEmpty;
+
 boolean hasOutgoingVoidEvents(Scope this) :
 	!declarations.typeSelect(EventDefinition).select(event|event.direction == Direction::OUT).select(event|event.type.isVoid()).isEmpty;
 	

+ 6 - 4
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Expression.ext

@@ -8,7 +8,7 @@
   	Joern Seger - Initial contribution and API
   	Markus Muehlbrandt - Java adaptions
  */
- import ecore;
+import ecore;
 import stext;
 import sexec;
 import sgraph;
@@ -86,7 +86,7 @@ String toCode(StringLiteral expression) :
 	"\"" + expression.value.toString() + "\"";
 
 String toCode(EventValueReferenceExpression expression):
-	expression.value.getContext().toFirstLower()+"getEvent"+expression.value.getEventName()+"().getValue()";
+	expression.value.getContext().toFirstLower()+expression.value.getEventValueIdentifier();
 
 /* Logical Expressions */
 String toCode(LogicalOrExpression expression) :
@@ -123,11 +123,13 @@ String toCode(NumericalUnaryExpression expression) :
     getOperator(expression.operator) + " ( " + expression.operand.toCode() + " ) ";
 
 String toCode(TimeEvent exp) :
-	"occuredEvents.contains("+getEventName(exp)+")";
+	"timeEvents["+getEventIdentifier(exp)+".getIndex()]";
+	
 String toCode(VariableDefinition exp) :
 	getContext(exp)+"get"+exp.getVarName()+"()";
+	
 String toCode(EventDefinition exp) :
-	"occuredEvents.contains("+exp.getContext().toFirstLower()+exp.getter()+")";
+	exp.getContext()+exp.getEventIdentifier();
 
 String toCode(ActiveStateReferenceExpression this):
 	"isStateActive(State."+this.value.getName()+")";

+ 0 - 30
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/IGenericAccessInterface.xpt

@@ -1,30 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«FILE entry.getBasePackagePath()+'/IGenericAccessInterface.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-public interface IGenericAccessInterface {
-
-	public boolean raiseEvent(String name);
-	
-	public boolean raiseEvent(String name, Object value);
-	
-	public boolean setVariable(String name, Object value);
-	
-	public Object getVariable(String name);
-}
-«ENDFILE-»
-«ENDDEFINE»

+ 0 - 24
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/IGenericAccessStatemachine.xpt

@@ -1,24 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«FILE entry.getBasePackagePath()+'/IGenericAccessStatemachine.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-public interface IGenericAccessStatemachine {
-	
-	public IGenericAccessInterface getInterface(String name);
-}
-«ENDFILE-»
-«ENDDEFINE»

+ 0 - 45
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/INotificationListener.xpt

@@ -1,45 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«IF name != null-»
-«FILE entry.getBasePackagePath()+'/INotificationListener.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-/**
- * Interface a statemachine observer has to implement to receive notifications
- * on event and variable changes.
- * 
- * 
- */
-public interface INotificationListener {
-
-	/**
-	 * Callback for a {@link EventNotification}
-	 * 
-	 * @param notification
-	 */
-	public void onEventRaised(EventNotification notification);
-
-	/**
-	 * Callback for a {@link VariableNotification}
-	 * 
-	 * @param notification
-	 */
-	public void onVariableChanged(VariableNotification<?> notification);
-
-}
-«ENDFILE-»
-«ENDIF-»
-«ENDDEFINE»

+ 0 - 46
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/INotificationSender.xpt

@@ -1,46 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«IF name != null-»
-«FILE entry.getBasePackagePath()+'/INotificationSender.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-/**
- * Interface a notification sender has to implement.
- * 
- */
-public interface INotificationSender {
-
-	/**
-	 * Registers a notification listener.
-	 * 
-	 * @param listener
-	 *            {@link INotificationListener}
-	 * @return {@code true} if correct registered.
-	 */
-	public boolean addNotificationListener(INotificationListener listener);
-	
-	/**
-	 * Unregisters a notification listener.
-	 * 
-	 * @param listener
-	 *            {@link INotificationListener}
-	 * @return {@code true} if correct unregistered.
-	 */
-	public boolean removeNotificationListener(INotificationListener listener);
-}
-«ENDFILE-»
-«ENDIF-»
-«ENDDEFINE»

+ 0 - 28
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/IStatemachineCreationFactory.xpt

@@ -1,28 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«FILE entry.getBasePackagePath()+'/IStatemachineCreationFactory.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-public interface IStatemachineCreationFactory {
-		
-	public IStatemachine createCycleBasedStatemachine();
-	
-	public IStatemachine createActiveEventBasedStatemachine();
-	
-	public IStatemachine createPassiveEventBasedStatemachine();
-}
-«ENDFILE-»
-«ENDDEFINE»

+ 9 - 4
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimedStatemachine.xpt

@@ -16,13 +16,10 @@ Contributors:
 «getLicenseHeader(entry)»
 package «entry.getBasePackageName()»;
 
-import «entry.getBasePackageName()».ITimerNotificationListener;
-
 /**
  * Interface for state machines which use timed event triggers.
  */
-public interface ITimedStatemachine extends IStatemachine,
-		ITimerNotificationListener {
+public interface ITimedStatemachine {
 
 	/**
 	 * Set the {@link ITimerService} for the state machine. It must be set
@@ -39,6 +36,14 @@ public interface ITimedStatemachine extends IStatemachine,
 	 * @return {@link ITimerService}
 	 */
 	public ITimerService getTimerService();
+
+	/**
+	 * Callback method if a {@link TimeEvent} occurred.
+	 * 
+	 * @param timeEvent
+	 */
+	public void onTimeEventRaised(TimeEvent timeEvent);
 }
+
 «ENDFILE-»
 «ENDDEFINE»

+ 0 - 38
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimerNotificationListener.xpt

@@ -1,38 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«IF name != null-»
-«FILE entry.getBasePackagePath()+'/ITimerNotificationListener.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-/**
- * 
- * Interface for {@link TimeEvent} listeners. These listers can be registered at
- * a {@link ITimerService}. Used by {@link ITimedStatemachine} to register
- * itself at the {@link ITimerService}.
- * 
- */
-public interface ITimerNotificationListener {
-	
-	/**
-	 * Callback method if a {@link TimeEvent} occurred.
-	 * @param timeEvent
-	 */
-	public void onTimeEventRaised(TimeEvent<? extends Enum<?>> timeEvent);
-
-}
-«ENDFILE-»
-«ENDIF-»
-«ENDDEFINE»

+ 3 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ITimerService.xpt

@@ -36,8 +36,7 @@ public interface ITimerService {
 	 *            run cycle was called. Can be used to produce a more accurate
 	 *            timing behavior.
 	 */
-	public void setTimer(TimeEvent<? extends Enum<?>> event, long time,
-			long cycleStartTime);
+	public void setTimer(TimeEvent event, long time, long cycleStartTime);
 
 	/**
 	 * Unset the given {@link TimeEvent}. Use to unset cyclic repeated time
@@ -45,7 +44,7 @@ public interface ITimerService {
 	 * 
 	 * @param event
 	 */
-	public void resetTimer(TimeEvent<? extends Enum<?>> event);
+	public void resetTimer(TimeEvent event);
 
 	/**
 	 * Cancel timer service. Use this to end possible timing threads and free
@@ -53,5 +52,6 @@ public interface ITimerService {
 	 */
 	public void cancel();
 }
+
 «ENDFILE-»
 «ENDDEFINE»

+ 5 - 50
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Main.xpt

@@ -22,66 +22,21 @@ Contributors:
 	
 	«EXPAND ITimedStatemachine::file(entry) FOR this»
 	
-	«EXPAND ITimerService::file(entry) FOR this»
+	«EXPAND TimeEvent::file(entry) FOR this»
 	
-	«EXPAND ITimerNotificationListener::file(entry) FOR this»
+	«EXPAND ITimerService::file(entry) FOR this»
 	
 	«IF entry.createTimerService()»
 		«EXPAND TimerService::file(entry) FOR this»
 	«ENDIF»
 	
-	«IF entry.createStatemachineFactory()»
-		«EXPAND IStatemachineCreationFactory::file(entry) FOR this»
-		«EXPAND CustomStatemachineCreationFactory::file(entry) FOR this»
-	«ENDIF»
-	
-	«IF entry.createGenericInterfaceSupport()»
-		«EXPAND IGenericAccessInterface::file(entry) FOR this»
-		«EXPAND IGenericAccessStatemachine::file(entry) FOR this»
-	«ENDIF»
-	
 	«IF entry.createRuntimeService()»
-		«EXPAND RuntimeService::file(entry) FOR this»
-		«EXPAND RuntimeCycleNotification::file(entry) FOR this»
-	«ENDIF»
-	
-	«EXPAND Event::file(entry) FOR this»
-	
-	«EXPAND EventVector::file(entry) FOR this»
-	
-	«EXPAND ValuedEvent::file(entry) FOR this»
-	
-	«EXPAND TimeEvent::file(entry) FOR this»
-	
-	«EXPAND EventNotification::file(entry) FOR this»
-	
-	«EXPAND VariableNotification::file(entry) FOR this»
-	
-	«EXPAND INotificationListener::file(entry) FOR this»
-	
-	«EXPAND INotificationSender::file(entry) FOR this»
-	
-	«EXPAND Notification::file(entry) FOR this»
-	
-	«EXPAND NotificationSender::file(entry) FOR this»
-	
-	«EXPAND NotificationType::file(entry) FOR this»
-	
-	«REM» concrete files «ENDREM»
-	«FOREACH this.scopes.typeSelect(InterfaceScope) AS scope»
-	«EXPAND CustomInterface::file(entry) FOR scope»
-	«EXPAND CustomIInterfaceImpl::file(entry) FOR scope»
-	«EXPAND CustomInterfaceImpl::file(entry) FOR scope»
-	«IF entry.createEventBasedStatemachine() && scope.hasIncomingEvents()»
-		«EXPAND CustomEventBasedInterfaceImpl::file(entry) FOR scope»
+		«EXPAND RuntimeService::file(entry) FOR this»
 	«ENDIF»
-	«ENDFOREACH»
 	
-	«EXPAND CustomCycleBasedStatemachine::file(entry) FOR this»
+	«EXPAND StatemachineInterface::file(entry) FOR this»
 	
-	«IF entry.createEventBasedStatemachine()»
-		«EXPAND CustomEventBasedStatemachine::file(entry) FOR this»
-	«ENDIF»
+	«EXPAND StatemachineCycleBased::file(entry) FOR this»
 
 «ENDDEFINE»
 

+ 50 - 12
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Naming.ext

@@ -27,14 +27,23 @@ String getStatemachineName(String name) :
 	JAVA org.yakindu.sct.generator.java.features.JavaFeatureConstants.getValidStatemachineName(java.lang.String);
 
 String getStatemachineName(ExecutionFlow this) : 
-	 name.getStatemachineName();
+	 name.getStatemachineName().toFirstUpper();
+
+String getStatemachineClassName(ExecutionFlow this) : 
+	getStatemachineName() + "Statemachine";
+
+String getStatemachineInterfaceName(ExecutionFlow this) :
+	"I" + getStatemachineClassName();
 
 String getEventBasedStatemachineName(ExecutionFlow this) : name.toFirstUpper() + "EventBasedStatemachine";
 String getCycleBasedStatemachineName(ExecutionFlow this) : name.toFirstUpper() + "CycleBasedStatemachine";
 String getCycleBasedStatemachineName(InterfaceScope this) : ((ExecutionFlow)eContainer).getCycleBasedStatemachineName();
+String getCycleBasedStatemachineInterfaceName(ExecutionFlow this): "I" + getCycleBasedStatemachineName();
+
+
 String getStatemachineFactoryName(ExecutionFlow this) : name.getStatemachineName().toFirstUpper() + "StatemachineFactory";
 
-String getStatemachineInterfaceTypes(ExecutionFlow this, GeneratorEntry entry):
+String getStatemachineInterfaceExtensions(ExecutionFlow this, GeneratorEntry entry):
 	JAVA org.yakindu.sct.generator.java.extensions.JavaExtensions.getStatemachineInterfaceTypes(org.yakindu.sct.model.sexec.ExecutionFlow, org.yakindu.sct.model.sgen.GeneratorEntry);
 
 String getInterfaceName(InterfaceScope this) :  
@@ -42,7 +51,12 @@ String getInterfaceName(InterfaceScope this) :
 		"Interface" + name.toFirstUpper()
 	else
 		"DefaultInterface";
-		 
+
+String getInterfaceListenerName(InterfaceScope this) :
+	getInterfaceName()+"Listener";
+
+String getInterfaceIdentifier(InterfaceScope this) : getInterfaceName().toFirstLower();
+	 
 String getInterfaceImplName(InterfaceScope this) :  getInterfaceName() + "Impl";
 
 String getIInterfaceImplName(InterfaceScope this) : "I" + getInterfaceName() + "Impl";
@@ -74,7 +88,16 @@ String getInitialValueAssignment(VariableDefinition this) :
 	else
 		null;
 
-String getValueName(VariableDefinition this) : "var" + name.toFirstUpper();
+String getIllegalAccessEventIdentifier(EventDefinition this) :
+	if (direction == Direction::OUT) then 
+		getOutEventIdentifier()
+	else 
+		getEventIdentifier();
+
+String getIllegalAccessValidation(EventDefinition this) :
+	"if (!" + getIllegalAccessEventIdentifier() + ") throw new IllegalStateException(\"Illegal event value acces. Event " +getEventName() + " is not raised!\");";
+
+String getValueName(VariableDefinition this) : name.toFirstUpper();
 
 String getter(VariableDefinition this) : "get" + getValueName().toFirstUpper() + "()";
 
@@ -111,7 +134,7 @@ String getName(ExecutionFlow this) :
 	name.replaceAll(" ","").toFirstUpper();
 
 String getVarName(VariableDefinition this) :
-	"Var"+name.toFirstUpper();
+	name.toFirstUpper();
 String getVarName(EObject this) : "/* Variable expected, but got: "+this+" */";
 String getVarName(ElementReferenceExpression this) : this.reference.getVarName();
 String getVarName(FeatureCall this) : this.feature.getVarName();
@@ -125,16 +148,31 @@ String getEventName(EventDefinition this) :
 	getNameWA().toFirstUpper();
 
 String getEventName(EObject this) : "/* Event expected, but got: "+this+" */";
+String getEventValueIdentifier(EObject this) : "/* Event expected, but got: "+this+" */";
 String getEventName(ElementReferenceExpression this) : this.reference.getEventName();
+String getEventValueIdentifier(ElementReferenceExpression this) : this.reference.getEventValueIdentifier();
 String getEventName(FeatureCall this) : this.feature.getEventName();
+String getEventValueIdentifier(FeatureCall this) : this.feature.getEventValueIdentifier();
 String getEventName(Expression this) : "/* Event expected, but got Expression: "+this+" */";
 
 String getter(Event this) :
-	"getEvent"+this.getEventName()+"()";
+	"get"+this.getEventName()+"()";
 
 String getEventName(TimeEvent this) :
 	name.replaceAll(" ","").toFirstUpper();
-				
+
+String getEventIdentifier(Event this):
+	getEventName().toFirstLower();
+
+String getOutEventIdentifier(Event this):
+	getEventName().toFirstLower()+"Out";
+
+String getEventValueIdentifier(EventDefinition this):
+	getEventName().toFirstLower()+"Value";
+
+String getVariableIdentifier(VariableDefinition this):
+	getVarName().toFirstLower();
+	
 cached String functionName(Step step) : 
 	(step.isEffect()) ? step.actionFunctionName() : (
 	(step.isReactionCheck()) ? step.checkFunctionName() : (
@@ -187,12 +225,12 @@ ExecutionState state(Step this) : (ExecutionState) eContainer;
 
 String getContext(Variable this) : 
 	if (InterfaceScope.isInstance(eContainer)) then  
-		"get"+getInterfaceImplName((InterfaceScope)eContainer)+"()."
+		getInterfaceIdentifier((InterfaceScope)eContainer)+"."
 	else 
 		"";
 String getContext(VariableDefinition this) : 
 	if (InterfaceScope.isInstance(eContainer)) then  
-		"get"+getInterfaceImplName((InterfaceScope)eContainer)+"()."
+		getInterfaceIdentifier((InterfaceScope)eContainer)+"."
 	else 
 		"";
 		
@@ -210,18 +248,18 @@ String getContext(EObject this) :
 	
 String getContext(EventDefinition this) : 
 	if (InterfaceScope.isInstance(eContainer)) then  
-		"get"+getInterfaceImplName((InterfaceScope)eContainer)+"()."
+		getInterfaceIdentifier((InterfaceScope)eContainer)+"."
 	else 
 		"";
 String getContext(Event this) : 
 	if (InterfaceScope.isInstance(eContainer)) then  
-		"get"+getInterfaceImplName((InterfaceScope)eContainer)+"()."
+		getInterfaceIdentifier((InterfaceScope)eContainer)+"."
 	else 
 		"";
 		
 String getInterfaceExtension(Scope this, GeneratorEntry entry):
 	JAVA org.yakindu.sct.generator.java.extensions.JavaExtensions.getInterfaceExtensions(org.yakindu.sct.model.sgraph.Scope, org.yakindu.sct.model.sgen.GeneratorEntry);
-		
+
 String getInterfaceImplExtension(Scope this, GeneratorEntry entry):
 	if ((hasVariables() || hasOutgoingEvents()) && entry.createInterfaceObserverSupport()) then
 		" extends NotificationSender"

+ 0 - 50
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Notification.xpt

@@ -1,50 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«IF name != null-»
-«FILE entry.getBasePackagePath()+'/Notification.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-/**
- * 
- * Basic class to represent a notification.
- * 
- * 
- */
-public class Notification {
-
-	private NotificationType notificationType;
-
-	/**
-	 * Creates a notification with the given {@link NotificationType}
-	 * 
-	 * @param notificationType
-	 */
-	public Notification(NotificationType notificationType) {
-		this.notificationType = notificationType;
-	}
-
-	/**
-	 * Returns the {@link NotificationType} of notification.
-	 * 
-	 * @return {@link NotificationType}
-	 */
-	public NotificationType getNotificationType() {
-		return notificationType;
-	}
-}
-«ENDFILE-»
-«ENDIF-»
-«ENDDEFINE»

+ 0 - 67
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/NotificationSender.xpt

@@ -1,67 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«IF name != null-»
-«FILE entry.getBasePackagePath()+'/NotificationSender.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Implementation of a notification sender. This implementation is used by the
- * statemachine and the generated interfaces to notify registered observers.
- * Inherit from this class if necessary.
- * 
- */
-public class NotificationSender implements INotificationSender {
-
-	private Set<INotificationListener> listeners = new HashSet<INotificationListener>();
-
-	public boolean addNotificationListener(INotificationListener listener) {
-		return listeners.add(listener);
-	}
-
-	public boolean removeNotificationListener(INotificationListener listener) {
-		return listeners.remove(listener);
-	}
-
-	/**
-	 * Notify all registered listeners with the given {@link EventNotification}
-	 * 
-	 * @param notification
-	 */
-	protected void notifyListenersOnEventRaised(EventNotification notification) {
-		for (INotificationListener listener : listeners) {
-			listener.onEventRaised(notification);
-		}
-	}
-
-	/**
-	 * Notify all registered listeners with the given
-	 * {@link VariableNotification}
-	 * 
-	 * @param notification
-	 */
-	protected void notifyListenersOnVariableChanged(
-			VariableNotification<?> notification) {
-		for (INotificationListener listener : listeners) {
-			listener.onVariableChanged(notification);
-		}
-	}
-}
-«ENDFILE-»
-«ENDIF-»
-«ENDDEFINE»

+ 0 - 28
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/NotificationType.xpt

@@ -1,28 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«IF name != null-»
-«FILE entry.getBasePackagePath()+'/NotificationType.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-/**
- * Enum to define possible notification types.
- */
-public enum NotificationType {
-	EventNotification, VariableNotification, RuntimeCycleNotification
-}
-«ENDFILE-»
-«ENDIF-»
-«ENDDEFINE»

+ 0 - 51
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/RuntimeCycleNotification.xpt

@@ -1,51 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«IF name != null-»
-«FILE entry.getBasePackagePath()+'/RuntimeCycleNotification.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-/**
- * This notification type is thrown by the runtime service if a statemachine
- * cycle is executed.
- * 
- */
-public class RuntimeCycleNotification extends Notification {
-
-	private IStatemachine statemachine;
-
-	/**
-	 * Initializes notification with the given statemachine.
-	 * 
-	 * @param statemachine
-	 */
-	public RuntimeCycleNotification(IStatemachine statemachine) {
-		super(NotificationType.RuntimeCycleNotification);
-		this.statemachine = statemachine;
-	}
-
-	/**
-	 * Get the statemachine on which a run to completion step was executed by
-	 * the runtime service.
-	 * 
-	 * @return
-	 */
-	public IStatemachine getStatemachine() {
-		return statemachine;
-	}
-}
-«ENDFILE-»
-«ENDIF-»
-«ENDDEFINE»

+ 179 - 0
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/StatemachineCycleBased.xpt

@@ -0,0 +1,179 @@
+«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:
+	Markus Muehlbrandt - Initial contribution and API
+«ENDREM»
+
+«IMPORT sexec»
+«IMPORT stext»
+«IMPORT sgraph»
+
+«EXTENSION org::yakindu::sct::generator::java::templates::ExecutionModelExtensions»
+«EXTENSION org::yakindu::sct::generator::java::templates::TypeModelExtensions»
+«EXTENSION org::yakindu::sct::generator::java::templates::Expression»
+«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
+«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
+
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
+«FILE getImplementationPackagePath(entry)+"/"+getStatemachineClassName()+'.java'-»
+«getLicenseHeader(entry)»
+package «getImplementationPackageName(entry)»;
+
+«EXPAND CoreStatemachine::Imports(entry) FOR this»
+
+public class «getStatemachineClassName()» implements «getStatemachineInterfaceName()» {
+	
+	«EXPAND CoreStatemachine::FieldDeclarations(entry) FOR this»
+	
+	public «getStatemachineClassName()»() {
+		
+		«FOREACH getInterfaceScope() AS interface-»
+		«interface.getInterfaceIdentifier()» = new «interface.getInterfaceImplName()»();
+		«ENDFOREACH-»
+		
+		«FOREACH getTimeEvents() AS timeEvent-»
+			«timeEvent.getEventIdentifier()».setStatemachine(this);
+		«ENDFOREACH»
+	}
+	
+	public void init() {
+		«IF isTimedStatemachine()-»
+		if (timerService == null) {
+			throw new IllegalStateException("TimerService not set.");
+		}
+		«ENDIF-»
+		for (int i = 0; i < «stateVector.size»; i++) {
+			stateVector[i] = State.$NullState$;
+		}
+		
+		«IF hasHistory()-»
+		for (int i = 0; i < «historyVector.size»; i++) {
+			historyVector[i] = State.$NullState$;
+		}
+		«ENDIF-»
+		clearEvents();
+		clearOutEvents();
+	}
+	
+	protected void clearEvents() {
+		«FOREACH getInterfaceScope() AS interface-»
+			«IF interface.hasEvents()-»
+				«interface.getInterfaceIdentifier()».clearEvents();
+			«ENDIF-»
+		«ENDFOREACH-»
+		
+		«IF isTimedStatemachine()-»
+		for (int i=0; i<timeEvents.length; i++) {
+			timeEvents[i] = false;
+		}
+		«ENDIF-»
+	}
+	
+	protected void clearOutEvents() {
+		«FOREACH getInterfaceScope() AS interface-»
+			«IF interface.hasOutgoingEvents()-»
+				«interface.getInterfaceIdentifier()».clearOutEvents();
+			«ENDIF-»
+		«ENDFOREACH-»
+	}
+	
+	public boolean isStateActive(State state){
+		for (int i=0;i<stateVector.length;i++){
+			if (stateVector[i]==state) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	«IF isTimedStatemachine()-»
+	public void setTimerService(ITimerService timerService) {
+		this.timerService = timerService;
+	}
+
+	
+	public ITimerService getTimerService() {
+		return timerService;
+	}
+	
+	public void onTimeEventRaised(TimeEvent timeEvent) {
+		timeEvents[timeEvent.getIndex()] = true;
+	}
+	«ENDIF-»
+	
+	«FOREACH scopes.typeSelect(InterfaceScope) AS interface-»
+	public «interface.getInterfaceName()» get«interface.getInterfaceName()»() {
+		return «interface.getInterfaceName().toFirstLower()»;
+	}
+	«ENDFOREACH-»
+	
+	«EXPAND CoreStatemachine::InternalScopeMethods FOR this»
+	
+	«EXPAND CoreStatemachine::DefaultInterfaceMethods(entry) FOREACH getDefaultInterface()»
+	«REM»Create enterSequences for statemachine«ENDREM»
+	«IF enterSequence.steps.size > 0 -»
+		public void «enterSequenceName()»() {
+			«IF isTimedStatemachine()-»
+			if (timerService == null) {
+				throw new IllegalStateException("TimerService not set.");
+			}
+			cycleStartTime = System.currentTimeMillis();
+			«ENDIF-»
+			«EXPAND CoreStatemachine::ActionCode FOREACH enterSequence.steps-»
+		}
+	«ENDIF-»
+	
+	«IF exitSequence.steps.size > 0-»
+		public void «exitSequenceName()»(){
+			«EXPAND CoreStatemachine::ActionCode FOREACH exitSequence.steps-»
+		}
+	«ENDIF»
+	
+
+«EXPAND CoreStatemachine::ConditionMethodsImplement FOR this-»
+«EXPAND CoreStatemachine::ConditionMethodsImplement FOREACH this.states-»
+«EXPAND CoreStatemachine::ConditionMethodsImplement FOREACH this.nodes-»
+«EXPAND CoreStatemachine::StatementMethodsImplement FOR this-»
+«EXPAND CoreStatemachine::StatementMethodsImplement FOREACH this.states-»
+«EXPAND CoreStatemachine::StatementMethodsImplement FOREACH this.nodes-»
+«EXPAND CoreStatemachine::EnterMethodImplement FOREACH this.states-»
+«EXPAND CoreStatemachine::ExitMethodImplement FOREACH this.states-»
+«EXPAND CoreStatemachine::EnterSequenceImplement FOREACH this.states-»
+«EXPAND CoreStatemachine::ExitSequenceImplement FOREACH this.states-»
+«EXPAND CoreStatemachine::EnterSequenceImplement FOREACH this.regions-»
+«EXPAND CoreStatemachine::ExitSequenceImplement FOREACH this.regions-»
+«EXPAND CoreStatemachine::DeepEnterSequenceImplement FOREACH this.regions-»
+«EXPAND CoreStatemachine::ShallowEnterSequenceImplement FOREACH this.regions-»
+«EXPAND CoreStatemachine::ReactMethodsImplement FOREACH this.states-»
+«EXPAND CoreStatemachine::ReactMethodsImplement FOREACH this.nodes-»
+	
+	public void runCycle() {
+	
+		«IF isTimedStatemachine()-»
+		cycleStartTime = System.currentTimeMillis();
+		
+		«ENDIF-»
+		clearOutEvents();
+		
+		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
+			
+			switch (stateVector[nextStateIndex]) {
+			«FOREACH this.states AS state-»
+    		case «state.getName()»:
+        		react«state.getName()»();
+        		break;
+			«ENDFOREACH-»
+			default:
+				// «getNullStateName()»
+			}
+		}
+		
+		clearEvents();
+	}
+}
+«ENDFILE-»
+«ENDDEFINE»

+ 86 - 0
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/StatemachineInterface.xpt

@@ -0,0 +1,86 @@
+«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:
+	Markus Muehlbrandt - Initial contribution and API
+«ENDREM»
+
+«IMPORT sexec»
+«IMPORT stext»
+«IMPORT sgraph»
+
+«EXTENSION org::yakindu::sct::generator::java::templates::ExecutionModelExtensions»
+«EXTENSION org::yakindu::sct::generator::java::templates::TypeModelExtensions»
+«EXTENSION org::yakindu::sct::generator::java::templates::Expression»
+«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
+«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
+
+«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
+«FILE getImplementationPackagePath(entry)+"/"+getStatemachineInterfaceName()+'.java'-»
+«getLicenseHeader(entry)»
+package «getImplementationPackageName(entry)»;
+
+«IF createInterfaceObserverSupport(entry) && hasOutgoingEvents()-»
+import java.util.List;
+«ENDIF-»
+import «entry.getBasePackageName()».IStatemachine;
+«IF isTimedStatemachine()-»
+	import «entry.getBasePackageName()».ITimedStatemachine;
+«ENDIF-»
+
+public interface «getStatemachineInterfaceName()» extends «getStatemachineInterfaceExtensions(entry)» {
+	
+	«FOREACH scopes.typeSelect(InterfaceScope) AS interface»
+	public interface «interface.getInterfaceName()»{
+		«FOREACH interface.declarations.typeSelect(EventDefinition) AS event-»
+		«IF  event.direction ==  Direction::IN-»
+			«IF !event.type.isVoid()-»
+				public void raise«event.getEventName()»(«event.type.getJavaType()» value);
+			«ELSE»
+				public void raise«event.getEventName()»();
+			«ENDIF-»
+		«ELSEIF event.direction ==  Direction::OUT-»
+			public boolean isRaised«event.getEventName()»();
+		
+			«IF !event.type.isVoid()-»
+				public «event.type.getJavaType()» get«event.getEventName()»Value();
+			«ENDIF-»	
+		«ENDIF-»
+		«ENDFOREACH-»
+		
+		«FOREACH interface.declarations.typeSelect(VariableDefinition) AS variable-»
+			public «variable.type.getJavaType()» get«variable.getVarName()»();
+			«IF  !variable.readonly-»
+				public void set«variable.getVarName()»(«variable.type.getJavaType()» value);	
+			«ENDIF-»
+		«ENDFOREACH-»
+		
+		«IF createInterfaceObserverSupport(entry) && hasOutgoingEvents(interface)-»
+		public List<«interface.getInterfaceListenerName()»> getListeners();
+		«ENDIF-»
+	}
+	
+	«IF createInterfaceObserverSupport(entry) && hasOutgoingEvents(interface)-»
+		public interface «interface.getInterfaceListenerName()» {
+			«FOREACH interface.declarations.typeSelect(EventDefinition) AS event-»
+			«IF  event.direction ==  Direction::OUT-»
+				«IF !event.type.isVoid()-»
+				public void on«event.getEventName()»Raised(«event.type.getJavaType()» value);
+				«ELSE»
+				public void on«event.getEventName()»Raised();
+				«ENDIF-»	
+			«ENDIF-»
+			«ENDFOREACH-»
+		}
+		«ENDIF-»
+	«ENDFOREACH»
+	
+	«FOREACH scopes.typeSelect(InterfaceScope) AS interface»
+	public «interface.getInterfaceName()» get«interface.getInterfaceName()»();
+	«ENDFOREACH»
+}
+«ENDFILE-»
+«ENDDEFINE»

+ 143 - 0
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/StatemachineInterfaceImpl.xpt

@@ -0,0 +1,143 @@
+«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:
+	Markus Muehlbrandt - Initial contribution and API
+«ENDREM»
+«IMPORT stext»
+«IMPORT types»
+
+«EXTENSION org::yakindu::sct::generator::java::templates::ExecutionModelExtensions»
+«EXTENSION org::yakindu::sct::generator::java::templates::TypeModelExtensions»
+«EXTENSION org::yakindu::sct::generator::java::templates::Expression»
+«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
+«EXTENSION org::yakindu::sct::generator::java::templates::Naming»
+
+«DEFINE InterfaceImpl(sgen::GeneratorEntry entry) FOR InterfaceScope»
+private final class «getInterfaceImplName()» implements «getInterfaceName()» {
+	
+	«IF createInterfaceObserverSupport(entry) && hasOutgoingEvents()-»
+		private List<«getInterfaceListenerName()»> listeners = new LinkedList<«getInterfaceListenerName()»>();
+		
+		public List<«getInterfaceListenerName()»> getListeners() {
+			return listeners;
+		}
+	«ENDIF-»
+	
+	«FOREACH declarations.typeSelect(EventDefinition) AS event-»
+		
+		private boolean «event.getEventIdentifier()»;
+		
+		«IF event.direction == Direction::OUT-»
+			private boolean «event.getOutEventIdentifier()»;
+		«ENDIF-»
+		
+		«IF !event.type.isVoid()-»
+			private «event.type.getJavaType()» «event.getEventValueIdentifier()»;
+		«ENDIF-»
+		
+		«IF event.direction == Direction::IN-»
+			«IF !event.type.isVoid()-»
+				public void raise«event.getEventName()»(«event.type.getJavaType()» value) {
+					«event.getEventIdentifier()» = true;
+					«event.getEventValueIdentifier()» = value;
+				}
+				
+				private «event.type.getJavaType()» get«event.getEventName()»Value() {
+					«event.getIllegalAccessValidation()»
+					return «event.getEventValueIdentifier()»;
+				}
+				
+			«ELSE-»
+				public void raise«event.getEventName()»() {
+					«event.getEventIdentifier()» = true;
+				}
+				
+			«ENDIF-»
+		«ENDIF-»
+		
+		«IF event.direction == Direction::OUT-»
+			
+			public boolean isRaised«event.getEventName()»() {
+				return «event.getOutEventIdentifier()»;
+			}
+			
+			«IF !event.type.isVoid()-»
+				private void raise«event.getEventName()»(«event.type.getJavaType()» value) {
+					«event.getOutEventIdentifier()» = true;
+					«event.getEventIdentifier()» = true;
+					«event.getEventValueIdentifier()» = value;
+					«IF createInterfaceObserverSupport(entry)-»
+					for («getInterfaceListenerName()» listener : listeners) {
+						listener.on«event.getEventName()»Raised(value);
+					}
+					«ENDIF-»
+				}
+				
+				public «event.type.getJavaType()» get«event.getEventName()»Value() {
+					«event.getIllegalAccessValidation()»
+					return «event.getEventValueIdentifier()»;
+				}
+			«ELSE-»
+				private void raise«event.getEventName()»() {
+					«event.getOutEventIdentifier()» = true;
+					«event.getEventIdentifier()» = true;
+					«IF createInterfaceObserverSupport(entry)-»
+						for («getInterfaceListenerName()» listener : listeners) {
+							listener.on«event.getEventName()»Raised();
+						}
+					«ENDIF-»
+				}
+			«ENDIF-»
+		«ENDIF-»
+		«REM»
+		«IF event.direction == Direction::LOCAL-»
+			«IF !event.type.isVoid()-»
+				private «event.type.getJavaType()» get«event.getEventName()»Value() {
+					«event.getIllegalAccessValidation()»
+					return «event.getEventValueIdentifier()»;
+				}
+				
+			«ENDIF-»
+		«ENDIF-»
+		«ENDREM»
+	«ENDFOREACH-»
+	
+	«FOREACH declarations.typeSelect(VariableDefinition) AS variable-»
+			
+			private «variable.type.getJavaType()» «variable.getVariableIdentifier()»«variable.getInitialValueAssignment()»;
+			
+			public «variable.type.getJavaType()» get«variable.getVarName()»() {
+				return «variable.getVariableIdentifier()»;
+			}
+			
+			«IF  !variable.readonly-»
+				public void set«variable.getVarName()»(«variable.type.getJavaType()» value) {
+					«variable.getVariableIdentifier()» = value;
+				}
+			«ENDIF-»
+	«ENDFOREACH-»
+	
+	«IF hasEvents()-»
+		public void clearEvents() {
+		«FOREACH declarations.typeSelect(EventDefinition) AS event-»
+			«event.getEventIdentifier()» = false;
+		«ENDFOREACH-»
+		}
+		
+	«ENDIF-»
+	«IF hasOutgoingEvents()-»
+		public void clearOutEvents() {
+		«FOREACH declarations.typeSelect(EventDefinition) AS event-»
+			«IF event.direction == Direction::OUT-»
+				«event.getOutEventIdentifier()» = false;
+			«ENDIF-»
+		«ENDFOREACH-»
+		}
+		
+	«ENDIF-»
+}
+«ENDDEFINE»

+ 17 - 25
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/TimeEvent.xpt

@@ -25,42 +25,27 @@ package 
  * 
  * @param <T>
  */
-public class TimeEvent<T extends Enum<T>> extends ValuedEvent<T, Boolean> {
+public class TimeEvent {
 
-	private long time = -1;
+	private boolean periodic;
 
 	private ITimedStatemachine statemachine;
+	
+	int index;
 
 	/**
 	 * Constructor for a time event.
 	 * 
-	 * @param id
-	 *            : The event id.
-	 * @param offset
-	 *            : Offset which is added to the index position within the state
-	 *            machine's {@link EventVector}.
 	 * @param periodic
 	 *            : Set to {@code true} if event should be repeated
 	 *            periodically.
-	 */
-	public TimeEvent(T id, int offset, boolean periodic) {
-		super(id, offset, periodic);
-	}
-
-	/**
-	 * Sets the time delay after the event is called.
 	 * 
-	 * @param time
+	 * @param index
+	 *            : Index position within the state machine's timeEvent array.
 	 */
-	public void setTime(long time) {
-		this.time = time;
-	}
-
-	/**
-	 * Returns the time delay after the event is called.
-	 */
-	public long getTime() {
-		return time;
+	public TimeEvent(boolean periodic, int index) {
+		this.periodic = periodic;
+		this.index = index;
 	}
 
 	/**
@@ -79,8 +64,15 @@ public class TimeEvent<T extends Enum<T>> extends ValuedEvent<T, Boolean> {
 	public void setStatemachine(ITimedStatemachine statemachine) {
 		this.statemachine = statemachine;
 	}
-}
 
+	public boolean isPeriodic() {
+		return periodic;
+	}
+
+	public int getIndex() {
+		return index;
+	}
+}
 «ENDFILE-»
 «ENDIF-»
 «ENDDEFINE»

+ 4 - 9
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/TimerService.xpt

@@ -22,8 +22,6 @@ import java.util.Map;
 import java.util.Timer;
 import java.util.TimerTask;
 
-«REM»import «entry.getBasePackageName()».EventNotification;«ENDREM»
-
 /**
  * Default timer service implementation.
  * 
@@ -32,9 +30,9 @@ public class TimerService implements ITimerService {
 
 	private final Timer timer = new Timer();
 
-	private final Map<TimeEvent<? extends Enum<?>>, TimerTask> timerTaskMap = new HashMap<TimeEvent<? extends Enum<?>>, TimerTask>();
+	private final Map<TimeEvent, TimerTask> timerTaskMap = new HashMap<TimeEvent, TimerTask>();
 
-	public void setTimer(final TimeEvent<? extends Enum<?>> event, long time,
+	public void setTimer(final TimeEvent event, long time,
 			long cycleStartTime) {
 		// Reset existing TimerTask for event. This step isn't necessary if
 		// timer tasks are properly reset by sexec model.
@@ -50,11 +48,8 @@ public class TimerService implements ITimerService {
 			}
 		});
 
-		// set time field of event
-		event.setTime(time);
-
 		// start scheduling the timer
-		if (event.getValue()) {
+		if (event.isPeriodic()) {
 			timer.scheduleAtFixedRate(timerTaskMap.get(event),
 					time - (System.currentTimeMillis() - cycleStartTime), time);
 		} else {
@@ -63,7 +58,7 @@ public class TimerService implements ITimerService {
 		}
 	}
 
-	public void resetTimer(TimeEvent<? extends Enum<?>> event) {
+	public void resetTimer(TimeEvent event) {
 		if (timerTaskMap.containsKey(event) && timerTaskMap.get(event) != null) {
 			timerTaskMap.get(event).cancel();
 			timer.purge();

+ 0 - 65
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/ValuedEvent.xpt

@@ -1,65 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«IF name != null-»
-«FILE entry.getBasePackagePath()+'/ValuedEvent.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-/**
- * An Event that contains values.
- * 
- * @param <T>
- * @param <D>
- */
-public class ValuedEvent<T extends Enum<T>, D> extends Event<T> {
-
-	private D value;
-
-	/**
-	 * Creates an event with the given id and an offset. The offset represents
-	 * the start index of the events position in the {@link EventVector} of the
-	 * statemachine.
-	 * 
-	 * @param id
-	 * @param offset
-	 * @param value
-	 */
-	public ValuedEvent(T name, int offset, D value) {
-		super(name, offset);
-		this.value = value;
-	}
-
-	/**
-	 * Returns the value hold by the event.
-	 */	
-	public D getValue() {
-		return value;
-	}
-
-	/**
-	 * Store a new value in the event.
-	 * 
-	 * @param value
-	 */
-	public void setValue(D value) {
-		if (value == null) {
-			throw new IllegalArgumentException();
-		}
-		this.value = value;
-	}
-}
-«ENDFILE-»
-«ENDIF-»
-«ENDDEFINE»

+ 0 - 70
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/VariableNotification.xpt

@@ -1,70 +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:
-	Markus Muehlbrandt - Initial contribution and API
-«ENDREM»
-«IMPORT sexec»
-
-«EXTENSION org::yakindu::sct::generator::java::templates::GenmodelEntries»
-
-«DEFINE file(sgen::GeneratorEntry entry) FOR ExecutionFlow-»
-«IF name != null-»
-«FILE entry.getBasePackagePath()+'/VariableNotification.java'-»
-«getLicenseHeader(entry)»
-package «entry.getBasePackageName()»;
-
-/**
- * Class to transmit a variable within a notification.
- * 
- */
-public class VariableNotification<T> extends Notification {
-
-	private T oldValue;
-	private T newValue;
-	private Enum<?> id;
-
-	/**
-	 * Constructor for VariableNotification.
-	 * 
-	 * @param id
-	 *            : the variable id
-	 * @param newValue
-	 *            : new variable value
-	 * @param oldValue
-	 *            : old variable value
-	 */
-	public VariableNotification(Enum<?> id, T newValue, T oldValue) {
-		super(NotificationType.VariableNotification);
-		this.id = id;
-		this.oldValue = oldValue;
-		this.newValue = newValue;
-	}
-
-	/**
-	 * Returns the variable identifier.
-	 */
-	public Enum<?> getId() {
-		return id;
-	}
-	
-	/**
-	 * Returns the new value.
-	 */
-	public T getNewValue() {
-		return newValue;
-	}
-	
-	/**
-	 * Returns the old value.
-	 */
-	public T getOldValue() {
-		return oldValue;
-	}
-}
-«ENDFILE-»
-«ENDIF-»
-«ENDDEFINE»

+ 24 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/IStatemachine.java

@@ -0,0 +1,24 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased;
+
+/**
+ * Basic interface for statemachines.
+ * 
+ * 
+ */
+public interface IStatemachine {
+
+	/**
+	 * Initializes the statemachine. Use to init internal variables etc.
+	 */
+	public void init();
+
+	/**
+	 * Start a run-to-completion cycle.
+	 */
+	public void runCycle();
+
+	/**
+	 * Enters the statemachine. Sets the statemachine in a defined state.
+	 */
+	public void enter();
+}

+ 30 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/ITimedStatemachine.java

@@ -0,0 +1,30 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased;
+
+/**
+ * Interface for state machines which use timed event triggers.
+ */
+public interface ITimedStatemachine {
+
+	/**
+	 * Set the {@link ITimerService} for the state machine. It must be set
+	 * externally on a timed state machine before a run cycle can be correct
+	 * executed.
+	 * 
+	 * @param timerService
+	 */
+	public void setTimerService(ITimerService timerService);
+
+	/**
+	 * Returns the currently used timer service.
+	 * 
+	 * @return {@link ITimerService}
+	 */
+	public ITimerService getTimerService();
+
+	/**
+	 * Callback method if a {@link TimeEvent} occurred.
+	 * 
+	 * @param timeEvent
+	 */
+	public void onTimeEventRaised(TimeEvent timeEvent);
+}

+ 38 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/ITimerService.java

@@ -0,0 +1,38 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased;
+
+/**
+ * Interface a timer service has to implement. Use to implement your own timer
+ * service. A timer service has to be added to a timed state machine.
+ * 
+ */
+public interface ITimerService {
+
+	/**
+	 * Starts the timing for a given {@link TimeEvent}.
+	 * 
+	 * @param event
+	 *            : The TimeEvent the timer service should throw if timed out.
+	 * @param time
+	 *            : Time in milliseconds after the given time event should be
+	 *            triggered
+	 * @param cycleStartTime
+	 *            : The absolute start time in milliseconds at which the last
+	 *            run cycle was called. Can be used to produce a more accurate
+	 *            timing behavior.
+	 */
+	public void setTimer(TimeEvent event, long time, long cycleStartTime);
+
+	/**
+	 * Unset the given {@link TimeEvent}. Use to unset cyclic repeated time
+	 * events.
+	 * 
+	 * @param event
+	 */
+	public void resetTimer(TimeEvent event);
+
+	/**
+	 * Cancel timer service. Use this to end possible timing threads and free
+	 * memory resources.
+	 */
+	public void cancel();
+}

+ 28 - 11
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/RuntimeService.java

@@ -1,14 +1,4 @@
-/**
-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;
+package org.yakindu.sct.generator.java.runtime.cyclebased;
 
 import java.util.LinkedList;
 import java.util.List;
@@ -16,6 +6,11 @@ import java.util.Timer;
 import java.util.TimerTask;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
+/**
+ * Runtime service for state machines to execute a run to completion step
+ * periodically.
+ * 
+ */
 public class RuntimeService {
 
 	private Timer timer = new Timer();
@@ -36,10 +31,23 @@ public class RuntimeService {
 		}
 	};
 
+	/**
+	 * Create runtime service.
+	 * 
+	 * @param cyclePeriod
+	 *            : The period with which the registered state machines run
+	 *            cycle method is called.
+	 */
 	public RuntimeService(long cyclePeriod) {
 		timer.scheduleAtFixedRate(timerTask, 0, cyclePeriod);
 	}
 
+	/**
+	 * Adds the given state machine to runtime service.
+	 * 
+	 * @param statemachine
+	 * @return {@code true} if state machine is added properly.
+	 */
 	public boolean addStatemachine(IStatemachine statemachine) {
 		lock.writeLock().lock();
 		boolean ret = statemachineSet.add(statemachine);
@@ -47,6 +55,12 @@ public class RuntimeService {
 		return ret;
 	}
 
+	/**
+	 * Removes the given state machine from runtime service.
+	 * 
+	 * @param statemachine
+	 * @return {@code true} if state machine is removed properly.
+	 */
 	public boolean removeStatemachine(IStatemachine statemachine) {
 		lock.writeLock().lock();
 		boolean ret = statemachineSet.remove(statemachine);
@@ -54,6 +68,9 @@ public class RuntimeService {
 		return ret;
 	}
 
+	/**
+	 * Ends the runtime service.
+	 */
 	public void cancel() {
 		timer.cancel();
 	}

+ 58 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/TimeEvent.java

@@ -0,0 +1,58 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased;
+
+/**
+ * Event that reflects a time event. It's internally used by
+ * {@link ITimedStatemachine}.
+ * 
+ * @author muehlbrandt
+ * 
+ * @param <T>
+ */
+public class TimeEvent {
+
+	private boolean periodic;
+
+	private ITimedStatemachine statemachine;
+
+	int index;
+
+	/**
+	 * Constructor for a time event.
+	 * 
+	 * @param periodic
+	 *            : Set to {@code true} if event should be repeated
+	 *            periodically.
+	 * 
+	 * @param index
+	 *            : Index position within the state machine's timeEvent array.
+	 */
+	public TimeEvent(boolean periodic, int index) {
+		this.periodic = periodic;
+		this.index = index;
+	}
+
+	/**
+	 * Returns the state machine reference of the event.
+	 * 
+	 */
+	public ITimedStatemachine getStatemachine() {
+		return statemachine;
+	}
+
+	/**
+	 * Sets the state machine reference of the event.
+	 * 
+	 * @param statemachine
+	 */
+	public void setStatemachine(ITimedStatemachine statemachine) {
+		this.statemachine = statemachine;
+	}
+
+	public boolean isPeriodic() {
+		return periodic;
+	}
+
+	public int getIndex() {
+		return index;
+	}
+}

+ 9 - 21
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/TimerService.java

@@ -1,30 +1,21 @@
-/**
-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;
+package org.yakindu.sct.generator.java.runtime.cyclebased;
 
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Timer;
 import java.util.TimerTask;
 
-import org.yakindu.sct.runtime.java.EventNotification;
-
+/**
+ * Default timer service implementation.
+ * 
+ */
 public class TimerService implements ITimerService {
 
 	private final Timer timer = new Timer();
 
-	private final Map<TimeEvent<? extends Enum<?>>, TimerTask> timerTaskMap = new HashMap<TimeEvent<? extends Enum<?>>, TimerTask>();
+	private final Map<TimeEvent, TimerTask> timerTaskMap = new HashMap<TimeEvent, TimerTask>();
 
-	public void setTimer(final TimeEvent<? extends Enum<?>> event, long time,
-			long cycleStartTime) {
+	public void setTimer(final TimeEvent event, long time, long cycleStartTime) {
 		// Reset existing TimerTask for event. This step isn't necessary if
 		// timer tasks are properly reset by sexec model.
 		if (timerTaskMap.containsKey(event)) {
@@ -39,11 +30,8 @@ public class TimerService implements ITimerService {
 			}
 		});
 
-		// set time field of event
-		event.setTime(time);
-
 		// start scheduling the timer
-		if (event.getValue()) {
+		if (event.isPeriodic()) {
 			timer.scheduleAtFixedRate(timerTaskMap.get(event),
 					time - (System.currentTimeMillis() - cycleStartTime), time);
 		} else {
@@ -52,7 +40,7 @@ public class TimerService implements ITimerService {
 		}
 	}
 
-	public void resetTimer(TimeEvent<? extends Enum<?>> event) {
+	public void resetTimer(TimeEvent event) {
 		if (timerTaskMap.containsKey(event) && timerTaskMap.get(event) != null) {
 			timerTaskMap.get(event).cancel();
 			timer.purge();

+ 68 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/interfacetest/IInterfacetestStatemachine.java

@@ -0,0 +1,68 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased.interfacetest;
+
+import java.util.List;
+import org.yakindu.sct.generator.java.runtime.cyclebased.IStatemachine;
+
+public interface IInterfacetestStatemachine extends IStatemachine {
+
+	public interface DefaultInterface {
+
+		public void raiseEvent1();
+		public boolean isRaisedEvent2();
+
+		public int getEvent2Value();
+
+		public boolean getVar1();
+		public void setVar1(boolean value);
+		public double getVar2();
+		public void setVar2(double value);
+		public int getVar3();
+		public void setVar3(int value);
+
+		public List<DefaultInterfaceListener> getListeners();
+	}
+
+	public interface DefaultInterfaceListener {
+		public void onEvent2Raised(int value);
+	}
+
+	public interface InterfaceOther {
+
+		public void raiseEvent3();
+		public boolean isRaisedEvent4();
+
+		public int getV1();
+		public void setV1(int value);
+
+		public List<InterfaceOtherListener> getListeners();
+	}
+
+	public interface InterfaceOtherListener {
+
+		public void onEvent4Raised();
+	}
+
+	public interface InterfaceThird {
+
+		public void raiseEvent5();
+		public boolean isRaisedEvent6();
+
+		public boolean getEvent6Value();
+
+		public double getV1();
+		public void setV1(double value);
+
+		public List<InterfaceThirdListener> getListeners();
+	}
+
+	public interface InterfaceThirdListener {
+		public void onEvent6Raised(boolean value);
+	}
+
+	public DefaultInterface getDefaultInterface();
+
+	public InterfaceOther getInterfaceOther();
+
+	public InterfaceThird getInterfaceThird();
+
+}

+ 430 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/interfacetest/InterfacetestStatemachine.java

@@ -0,0 +1,430 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased.interfacetest;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class InterfacetestStatemachine implements IInterfacetestStatemachine {
+
+	private final class DefaultInterfaceImpl implements DefaultInterface {
+
+		private List<DefaultInterfaceListener> listeners = new LinkedList<DefaultInterfaceListener>();
+
+		public List<DefaultInterfaceListener> getListeners() {
+			return listeners;
+		}
+
+		private boolean event1;
+
+		public void raiseEvent1() {
+			event1 = true;
+		}
+
+		private boolean event2;
+
+		private boolean event2Out;
+
+		private int event2Value;
+
+		public boolean isRaisedEvent2() {
+			return event2Out;
+		}
+
+		private void raiseEvent2(int value) {
+			event2Out = true;
+			event2 = true;
+			event2Value = value;
+			for (DefaultInterfaceListener listener : listeners) {
+				listener.onEvent2Raised(value);
+			}
+		}
+
+		public int getEvent2Value() {
+			if (!event2Out)
+				throw new IllegalStateException(
+						"Illegal event value acces. Event Event2 is not raised!");
+			return event2Value;
+		}
+
+		private boolean var1;
+
+		public boolean getVar1() {
+			return var1;
+		}
+
+		public void setVar1(boolean value) {
+			var1 = value;
+		}
+
+		private double var2 = 2.3;
+
+		public double getVar2() {
+			return var2;
+		}
+
+		public void setVar2(double value) {
+			var2 = value;
+		}
+
+		private int var3 = 1;
+
+		public int getVar3() {
+			return var3;
+		}
+
+		public void setVar3(int value) {
+			var3 = value;
+		}
+
+		public void clearEvents() {
+			event1 = false;
+			event2 = false;
+		}
+
+		public void clearOutEvents() {
+			event2Out = false;
+		}
+
+	}
+
+	private DefaultInterfaceImpl defaultInterface;
+
+	private final class InterfaceOtherImpl implements InterfaceOther {
+
+		private List<InterfaceOtherListener> listeners = new LinkedList<InterfaceOtherListener>();
+
+		public List<InterfaceOtherListener> getListeners() {
+			return listeners;
+		}
+
+		private boolean event3;
+
+		public void raiseEvent3() {
+			event3 = true;
+		}
+
+		private boolean event4;
+
+		private boolean event4Out;
+
+		public boolean isRaisedEvent4() {
+			return event4Out;
+		}
+
+		private void raiseEvent4() {
+			event4Out = true;
+			event4 = true;
+			for (InterfaceOtherListener listener : listeners) {
+				listener.onEvent4Raised();
+			}
+		}
+
+		private int v1 = 5;
+
+		public int getV1() {
+			return v1;
+		}
+
+		public void setV1(int value) {
+			v1 = value;
+		}
+
+		public void clearEvents() {
+			event3 = false;
+			event4 = false;
+		}
+
+		public void clearOutEvents() {
+			event4Out = false;
+		}
+
+	}
+
+	private InterfaceOtherImpl interfaceOther;
+
+	private final class InterfaceThirdImpl implements InterfaceThird {
+
+		private List<InterfaceThirdListener> listeners = new LinkedList<InterfaceThirdListener>();
+
+		public List<InterfaceThirdListener> getListeners() {
+			return listeners;
+		}
+
+		private boolean event5;
+
+		public void raiseEvent5() {
+			event5 = true;
+		}
+
+		private boolean event6;
+
+		private boolean event6Out;
+
+		private boolean event6Value;
+
+		public boolean isRaisedEvent6() {
+			return event6Out;
+		}
+
+		private void raiseEvent6(boolean value) {
+			event6Out = true;
+			event6 = true;
+			event6Value = value;
+			for (InterfaceThirdListener listener : listeners) {
+				listener.onEvent6Raised(value);
+			}
+		}
+
+		public boolean getEvent6Value() {
+			if (!event6Out)
+				throw new IllegalStateException(
+						"Illegal event value acces. Event Event6 is not raised!");
+			return event6Value;
+		}
+
+		private double v1;
+
+		public double getV1() {
+			return v1;
+		}
+
+		public void setV1(double value) {
+			v1 = value;
+		}
+
+		public void clearEvents() {
+			event5 = false;
+			event6 = false;
+		}
+
+		public void clearOutEvents() {
+			event6Out = false;
+		}
+
+	}
+
+	private InterfaceThirdImpl interfaceThird;
+
+	public enum State {
+		State1, State2, State3, State4, $NullState$
+	};
+
+	private final State[] stateVector = new State[1];
+
+	private int nextStateIndex;
+
+	public InterfacetestStatemachine() {
+
+		defaultInterface = new DefaultInterfaceImpl();
+		interfaceOther = new InterfaceOtherImpl();
+		interfaceThird = new InterfaceThirdImpl();
+
+	}
+
+	public void init() {
+		for (int i = 0; i < 1; i++) {
+			stateVector[i] = State.$NullState$;
+		}
+
+		clearEvents();
+		clearOutEvents();
+	}
+
+	protected void clearEvents() {
+		defaultInterface.clearEvents();
+		interfaceOther.clearEvents();
+		interfaceThird.clearEvents();
+
+	}
+
+	protected void clearOutEvents() {
+		defaultInterface.clearOutEvents();
+		interfaceOther.clearOutEvents();
+		interfaceThird.clearOutEvents();
+	}
+
+	public boolean isStateActive(State state) {
+		for (int i = 0; i < stateVector.length; i++) {
+			if (stateVector[i] == state) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public DefaultInterface getDefaultInterface() {
+		return defaultInterface;
+	}
+	public InterfaceOther getInterfaceOther() {
+		return interfaceOther;
+	}
+	public InterfaceThird getInterfaceThird() {
+		return interfaceThird;
+	}
+
+	public void raiseEvent1() {
+		defaultInterface.raiseEvent1();
+	}
+
+	public boolean isRaisedEvent2() {
+		return defaultInterface.isRaisedEvent2();
+	}
+	public int getEvent2Value() {
+		return defaultInterface.getEvent2Value();
+	}
+
+	public boolean getVar1() {
+		return defaultInterface.getVar1();
+	}
+
+	public void setVar1(boolean value) {
+		defaultInterface.setVar1(value);
+	}
+	public double getVar2() {
+		return defaultInterface.getVar2();
+	}
+
+	public void setVar2(double value) {
+		defaultInterface.setVar2(value);
+	}
+	public int getVar3() {
+		return defaultInterface.getVar3();
+	}
+
+	public void setVar3(int value) {
+		defaultInterface.setVar3(value);
+	}
+
+	public void enter() {
+		defaultInterface.setVar2(2.3);
+		defaultInterface.setVar3(1);
+		interfaceOther.setV1(5);
+
+		// unknown function type org.yakindu.sct.model.sexec.impl.SequenceImpl@524c4135 (name: entryAction) (comment: Entry action for statechart 'InterfaceTest'.)();
+		nextStateIndex = 0;
+		stateVector[0] = State.State1;
+
+	}
+
+	public void exit() {
+		//Handle exit of all possible states (of mainRegion) at position 0...
+		switch (stateVector[0]) {
+
+			case State1 :
+				stateVector[0] = State.$NullState$;
+
+				break;
+
+			case State2 :
+				stateVector[0] = State.$NullState$;
+				interfaceOther.setV1(10);
+
+				break;
+
+			case State3 :
+				stateVector[0] = State.$NullState$;
+
+				break;
+
+			case State4 :
+				stateVector[0] = State.$NullState$;
+
+				break;
+
+			default :
+				break;
+		}
+
+		// unknown function type org.yakindu.sct.model.sexec.impl.SequenceImpl@2b29bb9a (name: exitAction) (comment: Exit action for state 'InterfaceTest'.)();
+	}
+
+	private void reactState1() {
+		if ((defaultInterface.event1 && (defaultInterface.getVar2() > 0))) {
+			stateVector[0] = State.$NullState$;
+
+			defaultInterface.raiseEvent2(22);
+
+			nextStateIndex = 0;
+			stateVector[0] = State.State2;
+
+		} else {
+			if ((interfaceOther.event3 && (defaultInterface.getVar3() == 1))) {
+				stateVector[0] = State.$NullState$;
+
+				interfaceOther.raiseEvent4();
+
+				nextStateIndex = 0;
+				stateVector[0] = State.State3;
+
+			} else {
+				if ((interfaceThird.event5 && (defaultInterface.getVar1() == true))) {
+					stateVector[0] = State.$NullState$;
+
+					interfaceThird.raiseEvent6(true);
+
+					nextStateIndex = 0;
+					stateVector[0] = State.State4;
+
+				}
+			}
+		}
+
+	}
+	private void reactState2() {
+		if (defaultInterface.event1) {
+			stateVector[0] = State.$NullState$;
+			interfaceOther.setV1(10);
+
+			nextStateIndex = 0;
+			stateVector[0] = State.State1;
+
+		}
+
+	}
+	private void reactState3() {
+		if (interfaceOther.event3) {
+			stateVector[0] = State.$NullState$;
+
+			nextStateIndex = 0;
+			stateVector[0] = State.State1;
+
+		}
+
+	}
+	private void reactState4() {
+		if (interfaceThird.event5) {
+			stateVector[0] = State.$NullState$;
+
+			nextStateIndex = 0;
+			stateVector[0] = State.State1;
+
+		}
+
+	}
+
+	public void runCycle() {
+
+		clearOutEvents();
+
+		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
+
+			switch (stateVector[nextStateIndex]) {
+				case State1 :
+					reactState1();
+					break;
+				case State2 :
+					reactState2();
+					break;
+				case State3 :
+					reactState3();
+					break;
+				case State4 :
+					reactState4();
+					break;
+				default :
+					// $NullState$
+			}
+		}
+
+		clearEvents();
+	}
+}

+ 31 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_deephistory/ITest_deephistoryStatemachine.java

@@ -0,0 +1,31 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased.test_deephistory;
+
+import org.yakindu.sct.generator.java.runtime.cyclebased.IStatemachine;
+
+public interface ITest_deephistoryStatemachine extends IStatemachine {
+
+	public interface DefaultInterface {
+
+		public void raiseEvent1();
+
+		public void raiseEvent2();
+
+		public void raiseEvent3();
+
+		public void raiseEvent4();
+
+		public void raiseEvent5();
+
+		public void raiseEvent6();
+
+		public void raiseEvent7();
+
+		public void raiseEvent8();
+
+		public void raiseEvent9();
+
+	}
+
+	public DefaultInterface getDefaultInterface();
+
+}

+ 119 - 114
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_deephistory/Test_DeepHistoryCycleBasedStatemachine.java

@@ -1,65 +1,95 @@
-/**
-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.test_deephistory;
-
-import java.util.Collection;
-import java.util.HashSet;
-import org.yakindu.sct.runtime.java.Event;
-import org.yakindu.sct.runtime.java.EventVector;
-import java.util.HashMap;
-import java.util.Map;
-import org.yakindu.sct.runtime.java.IGenericAccessStatemachine;
-import org.yakindu.sct.runtime.java.IGenericAccessInterface;
-import org.yakindu.sct.runtime.java.IStatemachine;
-
-public class Test_DeepHistoryCycleBasedStatemachine
+package org.yakindu.sct.generator.java.runtime.cyclebased.test_deephistory;
+
+public class Test_deephistoryStatemachine
 		implements
-			IGenericAccessStatemachine,
-			DefaultInterface,
-			IStatemachine {
+			ITest_deephistoryStatemachine {
 
-	public enum State {
-		State1, State2, State3, State4, State6, State7, State8, State9, State5, $NullState$
-	};
+	private final class DefaultInterfaceImpl implements DefaultInterface {
 
-	protected Map<String, IGenericAccessInterface> interfaceMap;
+		private boolean event1;
 
-	private State[] historyVector = new State[3];
+		public void raiseEvent1() {
+			event1 = true;
+		}
 
-	private final State[] stateVector = new State[1];
+		private boolean event2;
 
-	private int nextStateIndex;
+		public void raiseEvent2() {
+			event2 = true;
+		}
 
-	private final EventVector<Event<? extends Enum<?>>> occuredEvents;
+		private boolean event3;
 
-	private final Collection<Event<? extends Enum<?>>> outEvents;
+		public void raiseEvent3() {
+			event3 = true;
+		}
 
-	public Test_DeepHistoryCycleBasedStatemachine() {
-		occuredEvents = new EventVector<Event<? extends Enum<?>>>(9);
-		outEvents = new HashSet<Event<? extends Enum<?>>>();
-		interfaceMap = new HashMap<String, IGenericAccessInterface>();
-		interfaceMap.put("DefaultInterface", new DefaultInterfaceImpl(this));
+		private boolean event4;
 
-	}
+		public void raiseEvent4() {
+			event4 = true;
+		}
 
-	protected Collection<Event<? extends Enum<?>>> getOccuredEvents() {
-		return occuredEvents;
-	}
+		private boolean event5;
+
+		public void raiseEvent5() {
+			event5 = true;
+		}
+
+		private boolean event6;
+
+		public void raiseEvent6() {
+			event6 = true;
+		}
+
+		private boolean event7;
+
+		public void raiseEvent7() {
+			event7 = true;
+		}
+
+		private boolean event8;
+
+		public void raiseEvent8() {
+			event8 = true;
+		}
+
+		private boolean event9;
+
+		public void raiseEvent9() {
+			event9 = true;
+		}
+
+		public void clearEvents() {
+			event1 = false;
+			event2 = false;
+			event3 = false;
+			event4 = false;
+			event5 = false;
+			event6 = false;
+			event7 = false;
+			event8 = false;
+			event9 = false;
+		}
 
-	protected Collection<Event<? extends Enum<?>>> getOutEvents() {
-		return outEvents;
 	}
 
-	protected boolean eventOccured() {
-		return !occuredEvents.isEmpty();
+	private DefaultInterfaceImpl defaultInterface;
+
+	public enum State {
+		State1, State2, State3, State4, State6, State7, State8, State9, State5, $NullState$
+	};
+
+	private State[] historyVector = new State[3];
+
+	private final State[] stateVector = new State[1];
+
+	private int nextStateIndex;
+
+	public Test_deephistoryStatemachine() {
+
+		defaultInterface = new DefaultInterfaceImpl();
+
 	}
 
 	public void init() {
@@ -70,8 +100,16 @@ public class Test_DeepHistoryCycleBasedStatemachine
 		for (int i = 0; i < 3; i++) {
 			historyVector[i] = State.$NullState$;
 		}
+		clearEvents();
+		clearOutEvents();
+	}
+
+	protected void clearEvents() {
+		defaultInterface.clearEvents();
 
-		occuredEvents.clear();
+	}
+
+	protected void clearOutEvents() {
 	}
 
 	public boolean isStateActive(State state) {
@@ -83,76 +121,49 @@ public class Test_DeepHistoryCycleBasedStatemachine
 		return false;
 	}
 
-	public IGenericAccessInterface getInterface(String name) {
-		return interfaceMap.get(name);
-	}
-
-	protected Map<String, IGenericAccessInterface> getInterfaceMap() {
-		return interfaceMap;
-	}
-
 	public DefaultInterface getDefaultInterface() {
-		return (DefaultInterface) getInterface("DefaultInterface");
-	}
-
-	protected IDefaultInterfaceImpl getDefaultInterfaceImpl() {
-		return (IDefaultInterfaceImpl) getInterface("DefaultInterface");
+		return defaultInterface;
 	}
 
 	public void raiseEvent1() {
-		getDefaultInterface().raiseEvent1();
+		defaultInterface.raiseEvent1();
 	}
 
 	public void raiseEvent2() {
-		getDefaultInterface().raiseEvent2();
+		defaultInterface.raiseEvent2();
 	}
 
 	public void raiseEvent3() {
-		getDefaultInterface().raiseEvent3();
+		defaultInterface.raiseEvent3();
 	}
 
 	public void raiseEvent4() {
-		getDefaultInterface().raiseEvent4();
+		defaultInterface.raiseEvent4();
 	}
 
 	public void raiseEvent5() {
-		getDefaultInterface().raiseEvent5();
+		defaultInterface.raiseEvent5();
 	}
 
 	public void raiseEvent6() {
-		getDefaultInterface().raiseEvent6();
+		defaultInterface.raiseEvent6();
 	}
 
 	public void raiseEvent7() {
-		getDefaultInterface().raiseEvent7();
+		defaultInterface.raiseEvent7();
 	}
 
 	public void raiseEvent8() {
-		getDefaultInterface().raiseEvent8();
+		defaultInterface.raiseEvent8();
 	}
 
 	public void raiseEvent9() {
-		getDefaultInterface().raiseEvent9();
-	}
-
-	public boolean raiseEvent(String name) {
-		return getDefaultInterface().raiseEvent(name);
-	}
-
-	@SuppressWarnings("unchecked")
-	public boolean raiseEvent(String name, Object value) {
-		return getDefaultInterface().raiseEvent(name, value);
-	}
-
-	public boolean setVariable(String name, Object value) {
-		return getDefaultInterface().setVariable(name, value);
-	}
-
-	public Object getVariable(String name) {
-		return getDefaultInterface().getVariable(name);
+		defaultInterface.raiseEvent9();
 	}
 
 	public void enter() {
+
+		// unknown function type org.yakindu.sct.model.sexec.impl.SequenceImpl@65536eb4 (name: entryAction) (comment: Entry action for statechart 'Test_DeepHistory'.)();
 		nextStateIndex = 0;
 		stateVector[0] = State.State1;
 
@@ -216,6 +227,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 				break;
 		}
 
+		// unknown function type org.yakindu.sct.model.sexec.impl.SequenceImpl@46bac287 (name: exitAction) (comment: Exit action for state 'Test_DeepHistory'.)();
 	}
 
 	private void deepEnterSequenceState2Region0() {
@@ -306,7 +318,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 	}
 
 	private void reactState1() {
-		if (occuredEvents.contains(getDefaultInterfaceImpl().getEventEvent1())) {
+		if (defaultInterface.event1) {
 			stateVector[0] = State.$NullState$;
 
 			//Enter the region with deep history
@@ -325,7 +337,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 	private void reactState2() {
 	}
 	private void reactState3() {
-		if (occuredEvents.contains(getDefaultInterfaceImpl().getEventEvent2())) {
+		if (defaultInterface.event2) {
 
 			historyVector[0] = stateVector[0];
 			//Handle exit of all possible states (of region0) at position 0...
@@ -374,8 +386,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 			stateVector[0] = State.State1;
 
 		} else {
-			if (occuredEvents.contains(getDefaultInterfaceImpl()
-					.getEventEvent3())) {
+			if (defaultInterface.event3) {
 				stateVector[0] = State.$NullState$;
 
 				nextStateIndex = 0;
@@ -389,7 +400,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 	private void reactState4() {
 	}
 	private void reactState6() {
-		if (occuredEvents.contains(getDefaultInterfaceImpl().getEventEvent2())) {
+		if (defaultInterface.event2) {
 
 			historyVector[0] = stateVector[0];
 			//Handle exit of all possible states (of region0) at position 0...
@@ -438,8 +449,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 			stateVector[0] = State.State1;
 
 		} else {
-			if (occuredEvents.contains(getDefaultInterfaceImpl()
-					.getEventEvent4())) {
+			if (defaultInterface.event4) {
 
 				historyVector[1] = stateVector[0];
 				//Handle exit of all possible states (of region0) at position 0...
@@ -472,8 +482,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 				stateVector[0] = State.State5;
 
 			} else {
-				if (occuredEvents.contains(getDefaultInterfaceImpl()
-						.getEventEvent5())) {
+				if (defaultInterface.event5) {
 					stateVector[0] = State.$NullState$;
 
 					nextStateIndex = 0;
@@ -489,7 +498,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 	private void reactState7() {
 	}
 	private void reactState8() {
-		if (occuredEvents.contains(getDefaultInterfaceImpl().getEventEvent2())) {
+		if (defaultInterface.event2) {
 
 			historyVector[0] = stateVector[0];
 			//Handle exit of all possible states (of region0) at position 0...
@@ -538,8 +547,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 			stateVector[0] = State.State1;
 
 		} else {
-			if (occuredEvents.contains(getDefaultInterfaceImpl()
-					.getEventEvent4())) {
+			if (defaultInterface.event4) {
 
 				historyVector[1] = stateVector[0];
 				//Handle exit of all possible states (of region0) at position 0...
@@ -572,8 +580,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 				stateVector[0] = State.State5;
 
 			} else {
-				if (occuredEvents.contains(getDefaultInterfaceImpl()
-						.getEventEvent6())) {
+				if (defaultInterface.event6) {
 
 					historyVector[2] = stateVector[0];
 					//Handle exit of all possible states (of region0) at position 0...
@@ -597,8 +604,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 					stateVector[0] = State.State6;
 
 				} else {
-					if (occuredEvents.contains(getDefaultInterfaceImpl()
-							.getEventEvent7())) {
+					if (defaultInterface.event7) {
 						stateVector[0] = State.$NullState$;
 
 						nextStateIndex = 0;
@@ -614,7 +620,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 
 	}
 	private void reactState9() {
-		if (occuredEvents.contains(getDefaultInterfaceImpl().getEventEvent2())) {
+		if (defaultInterface.event2) {
 
 			historyVector[0] = stateVector[0];
 			//Handle exit of all possible states (of region0) at position 0...
@@ -663,8 +669,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 			stateVector[0] = State.State1;
 
 		} else {
-			if (occuredEvents.contains(getDefaultInterfaceImpl()
-					.getEventEvent4())) {
+			if (defaultInterface.event4) {
 
 				historyVector[1] = stateVector[0];
 				//Handle exit of all possible states (of region0) at position 0...
@@ -697,8 +702,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 				stateVector[0] = State.State5;
 
 			} else {
-				if (occuredEvents.contains(getDefaultInterfaceImpl()
-						.getEventEvent6())) {
+				if (defaultInterface.event6) {
 
 					historyVector[2] = stateVector[0];
 					//Handle exit of all possible states (of region0) at position 0...
@@ -722,8 +726,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 					stateVector[0] = State.State6;
 
 				} else {
-					if (occuredEvents.contains(getDefaultInterfaceImpl()
-							.getEventEvent8())) {
+					if (defaultInterface.event8) {
 						stateVector[0] = State.$NullState$;
 
 						nextStateIndex = 0;
@@ -739,7 +742,7 @@ public class Test_DeepHistoryCycleBasedStatemachine
 
 	}
 	private void reactState5() {
-		if (occuredEvents.contains(getDefaultInterfaceImpl().getEventEvent2())) {
+		if (defaultInterface.event2) {
 
 			historyVector[0] = stateVector[0];
 			//Handle exit of all possible states (of region0) at position 0...
@@ -792,8 +795,10 @@ public class Test_DeepHistoryCycleBasedStatemachine
 		}
 
 	}
+
 	public void runCycle() {
-		outEvents.clear();
+
+		clearOutEvents();
 
 		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
 
@@ -830,6 +835,6 @@ public class Test_DeepHistoryCycleBasedStatemachine
 			}
 		}
 
-		occuredEvents.clear();
+		clearEvents();
 	}
 }

+ 51 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_expression/ITest_expressionStatemachine.java

@@ -0,0 +1,51 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased.test_expression;
+
+import java.util.List;
+import org.yakindu.sct.generator.java.runtime.cyclebased.IStatemachine;
+
+public interface ITest_expressionStatemachine extends IStatemachine {
+
+	public interface DefaultInterface {
+		public void raiseEvent1(int value);
+		public boolean isRaisedEvent2();
+
+		public double getEvent2Value();
+
+		public void raiseEvent3();
+
+		public int getVar1();
+		public void setVar1(int value);
+		public int getVar2();
+		public void setVar2(int value);
+		public double getVar3();
+		public void setVar3(double value);
+		public double getVar4();
+		public void setVar4(double value);
+		public boolean getVar5();
+		public void setVar5(boolean value);
+		public String getVar6();
+		public void setVar6(String value);
+
+		public List<DefaultInterfaceListener> getListeners();
+	}
+
+	public interface DefaultInterfaceListener {
+		public void onEvent2Raised(double value);
+	}
+
+	public interface InterfaceOther {
+
+		public boolean getVar1();
+		public void setVar1(boolean value);
+		public double getVar2();
+		public void setVar2(double value);
+		public int getVar3();
+		public void setVar3(int value);
+
+	}
+
+	public DefaultInterface getDefaultInterface();
+
+	public InterfaceOther getInterfaceOther();
+
+}

+ 406 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_expression/Test_expressionStatemachine.java

@@ -0,0 +1,406 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased.test_expression;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class Test_expressionStatemachine
+		implements
+			ITest_expressionStatemachine {
+
+	private final class DefaultInterfaceImpl implements DefaultInterface {
+
+		private List<DefaultInterfaceListener> listeners = new LinkedList<DefaultInterfaceListener>();
+
+		public List<DefaultInterfaceListener> getListeners() {
+			return listeners;
+		}
+
+		private boolean event1;
+
+		private int event1Value;
+
+		public void raiseEvent1(int value) {
+			event1 = true;
+			event1Value = value;
+		}
+
+		private int getEvent1Value() {
+			if (!event1)
+				throw new IllegalStateException(
+						"Illegal event value acces. Event Event1 is not raised!");
+			return event1Value;
+		}
+
+		private boolean event2;
+
+		private boolean event2Out;
+
+		private double event2Value;
+
+		public boolean isRaisedEvent2() {
+			return event2Out;
+		}
+
+		private void raiseEvent2(double value) {
+			event2Out = true;
+			event2 = true;
+			event2Value = value;
+			for (DefaultInterfaceListener listener : listeners) {
+				listener.onEvent2Raised(value);
+			}
+		}
+
+		public double getEvent2Value() {
+			if (!event2Out)
+				throw new IllegalStateException(
+						"Illegal event value acces. Event Event2 is not raised!");
+			return event2Value;
+		}
+
+		private boolean event3;
+
+		public void raiseEvent3() {
+			event3 = true;
+		}
+
+		private int var1 = 6;
+
+		public int getVar1() {
+			return var1;
+		}
+
+		public void setVar1(int value) {
+			var1 = value;
+		}
+
+		private int var2 = 123;
+
+		public int getVar2() {
+			return var2;
+		}
+
+		public void setVar2(int value) {
+			var2 = value;
+		}
+
+		private double var3 = 19.4;
+
+		public double getVar3() {
+			return var3;
+		}
+
+		public void setVar3(double value) {
+			var3 = value;
+		}
+
+		private double var4 = 43.3;
+
+		public double getVar4() {
+			return var4;
+		}
+
+		public void setVar4(double value) {
+			var4 = value;
+		}
+
+		private boolean var5 = false;
+
+		public boolean getVar5() {
+			return var5;
+		}
+
+		public void setVar5(boolean value) {
+			var5 = value;
+		}
+
+		private String var6 = "foo";
+
+		public String getVar6() {
+			return var6;
+		}
+
+		public void setVar6(String value) {
+			var6 = value;
+		}
+
+		public void clearEvents() {
+			event1 = false;
+			event2 = false;
+			event3 = false;
+		}
+
+		public void clearOutEvents() {
+			event2Out = false;
+		}
+
+	}
+
+	private DefaultInterfaceImpl defaultInterface;
+
+	private final class InterfaceOtherImpl implements InterfaceOther {
+
+		private boolean var1;
+
+		public boolean getVar1() {
+			return var1;
+		}
+
+		public void setVar1(boolean value) {
+			var1 = value;
+		}
+
+		private double var2;
+
+		public double getVar2() {
+			return var2;
+		}
+
+		public void setVar2(double value) {
+			var2 = value;
+		}
+
+		private int var3;
+
+		public int getVar3() {
+			return var3;
+		}
+
+		public void setVar3(int value) {
+			var3 = value;
+		}
+
+	}
+
+	private InterfaceOtherImpl interfaceOther;
+
+	public enum State {
+		State1, State2, $NullState$
+	};
+
+	private final State[] stateVector = new State[1];
+
+	private int nextStateIndex;
+
+	public Test_expressionStatemachine() {
+
+		defaultInterface = new DefaultInterfaceImpl();
+		interfaceOther = new InterfaceOtherImpl();
+
+	}
+
+	public void init() {
+		for (int i = 0; i < 1; i++) {
+			stateVector[i] = State.$NullState$;
+		}
+
+		clearEvents();
+		clearOutEvents();
+	}
+
+	protected void clearEvents() {
+		defaultInterface.clearEvents();
+
+	}
+
+	protected void clearOutEvents() {
+		defaultInterface.clearOutEvents();
+	}
+
+	public boolean isStateActive(State state) {
+		for (int i = 0; i < stateVector.length; i++) {
+			if (stateVector[i] == state) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public DefaultInterface getDefaultInterface() {
+		return defaultInterface;
+	}
+	public InterfaceOther getInterfaceOther() {
+		return interfaceOther;
+	}
+
+	public void raiseEvent1(int value) {
+		defaultInterface.raiseEvent1(value);
+	}
+
+	public boolean isRaisedEvent2() {
+		return defaultInterface.isRaisedEvent2();
+	}
+	public double getEvent2Value() {
+		return defaultInterface.getEvent2Value();
+	}
+
+	public void raiseEvent3() {
+		defaultInterface.raiseEvent3();
+	}
+
+	public int getVar1() {
+		return defaultInterface.getVar1();
+	}
+
+	public void setVar1(int value) {
+		defaultInterface.setVar1(value);
+	}
+	public int getVar2() {
+		return defaultInterface.getVar2();
+	}
+
+	public void setVar2(int value) {
+		defaultInterface.setVar2(value);
+	}
+	public double getVar3() {
+		return defaultInterface.getVar3();
+	}
+
+	public void setVar3(double value) {
+		defaultInterface.setVar3(value);
+	}
+	public double getVar4() {
+		return defaultInterface.getVar4();
+	}
+
+	public void setVar4(double value) {
+		defaultInterface.setVar4(value);
+	}
+	public boolean getVar5() {
+		return defaultInterface.getVar5();
+	}
+
+	public void setVar5(boolean value) {
+		defaultInterface.setVar5(value);
+	}
+	public String getVar6() {
+		return defaultInterface.getVar6();
+	}
+
+	public void setVar6(String value) {
+		defaultInterface.setVar6(value);
+	}
+
+	public void enter() {
+		defaultInterface.setVar1(6);
+		defaultInterface.setVar2(123);
+		defaultInterface.setVar3(19.4);
+		defaultInterface.setVar4(43.3);
+		defaultInterface.setVar5(false);
+		defaultInterface.setVar6("foo");
+
+		// unknown function type org.yakindu.sct.model.sexec.impl.SequenceImpl@1272a24f (name: entryAction) (comment: Entry action for statechart 'Test_Expression'.)();
+		defaultInterface.setVar3(defaultInterface.getVar3()
+				+ ((defaultInterface.getVar2() * defaultInterface.getVar3())));
+
+		nextStateIndex = 0;
+		stateVector[0] = State.State1;
+
+	}
+
+	public void exit() {
+		//Handle exit of all possible states (of mainRegion) at position 0...
+		switch (stateVector[0]) {
+
+			case State1 :
+				stateVector[0] = State.$NullState$;
+				defaultInterface.setVar2(1);
+
+				defaultInterface.setVar4(22.3);
+
+				break;
+
+			case State2 :
+				stateVector[0] = State.$NullState$;
+
+				break;
+
+			default :
+				break;
+		}
+
+		// unknown function type org.yakindu.sct.model.sexec.impl.SequenceImpl@53511634 (name: exitAction) (comment: Exit action for state 'Test_Expression'.)();
+	}
+
+	private void reactState1() {
+		if ((defaultInterface.event1 && ((interfaceOther.getVar1() == true) || (defaultInterface
+				.getVar5() == false)))) {
+			stateVector[0] = State.$NullState$;
+			defaultInterface.setVar2(1);
+
+			defaultInterface.setVar4(22.3);
+
+			interfaceOther.setVar1(false);
+
+			defaultInterface.setVar3(defaultInterface.getVar3() / (5));
+
+			defaultInterface.setVar1(defaultInterface.getVar1() + (1));
+
+			nextStateIndex = 0;
+			stateVector[0] = State.State2;
+
+		} else {
+			if ((defaultInterface.event1 && (defaultInterface.getVar6() == null
+					? "foo" == null
+					: defaultInterface.getVar6().equals("foo")))) {
+				stateVector[0] = State.$NullState$;
+				defaultInterface.setVar2(1);
+
+				defaultInterface.setVar4(22.3);
+
+				defaultInterface.setVar6("bar");
+
+				defaultInterface.setVar3(defaultInterface.getVar3() / (5));
+
+				defaultInterface.setVar1(defaultInterface.getVar1() + (1));
+
+				nextStateIndex = 0;
+				stateVector[0] = State.State2;
+
+			}
+		}
+
+	}
+	private void reactState2() {
+		if ((defaultInterface.event1 && (defaultInterface.getVar3() > 0))) {
+			stateVector[0] = State.$NullState$;
+
+			defaultInterface.setVar5(true);
+
+			defaultInterface
+					.setVar3(defaultInterface.getVar3()
+							+ ((defaultInterface.getVar2() * defaultInterface
+									.getVar3())));
+
+			nextStateIndex = 0;
+			stateVector[0] = State.State1;
+
+		} else {
+			defaultInterface.setVar1(defaultInterface.getVar1() + (1));
+			/* toCode not defined for: org.yakindu.sct.model.stext.stext.impl.OperationDefinitionImpl@314788d8 (name: op1) */
+			/* toCode not defined for: org.yakindu.sct.model.stext.stext.impl.OperationDefinitionImpl@3778b148 (name: op2) */
+
+		}
+
+	}
+
+	public void runCycle() {
+
+		clearOutEvents();
+
+		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
+
+			switch (stateVector[nextStateIndex]) {
+				case State1 :
+					reactState1();
+					break;
+				case State2 :
+					reactState2();
+					break;
+				default :
+					// $NullState$
+			}
+		}
+
+		clearEvents();
+	}
+}

+ 50 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_hierarchy/ITest_hierarchyStatemachine.java

@@ -0,0 +1,50 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased.test_hierarchy;
+
+import org.yakindu.sct.generator.java.runtime.cyclebased.IStatemachine;
+
+public interface ITest_hierarchyStatemachine extends IStatemachine {
+
+	public interface DefaultInterface {
+
+		public void raiseEvent1();
+
+		public void raiseEvent2();
+
+		public void raiseEvent3();
+
+		public void raiseEvent4();
+
+		public void raiseEvent5();
+
+		public void raiseEvent6();
+
+		public void raiseEvent7();
+
+		public void raiseEvent8();
+
+		public void raiseEvent9();
+
+		public void raiseEvent10();
+
+		public void raiseEvent11();
+
+		public void raiseEvent12();
+
+		public void raiseEvent13();
+
+		public void raiseEvent14();
+
+		public void raiseEvent15();
+
+		public void raiseEvent16();
+
+		public int getS1();
+		public void setS1(int value);
+		public int getS2();
+		public void setS2(int value);
+
+	}
+
+	public DefaultInterface getDefaultInterface();
+
+}

File diff suppressed because it is too large
+ 1328 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_hierarchy/Test_hierarchyStatemachine.java


+ 32 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_localactions/ITest_localactionsStatemachine.java

@@ -0,0 +1,32 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased.test_localactions;
+
+import org.yakindu.sct.generator.java.runtime.cyclebased.IStatemachine;
+import org.yakindu.sct.generator.java.runtime.cyclebased.ITimedStatemachine;
+
+public interface ITest_localactionsStatemachine
+		extends
+			ITimedStatemachine,
+			IStatemachine {
+
+	public interface DefaultInterface {
+
+		public void raiseEvent1();
+
+		public void raiseEvent2();
+
+		public void raiseEvent3();
+
+		public void raiseEvent4();
+
+		public int getI();
+		public void setI(int value);
+		public int getJ();
+		public void setJ(int value);
+		public int getC();
+		public void setC(int value);
+
+	}
+
+	public DefaultInterface getDefaultInterface();
+
+}

+ 306 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_localactions/Test_localactionsStatemachine.java

@@ -0,0 +1,306 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased.test_localactions;
+
+import org.yakindu.sct.generator.java.runtime.cyclebased.TimeEvent;
+import org.yakindu.sct.generator.java.runtime.cyclebased.ITimerService;
+
+public class Test_localactionsStatemachine
+		implements
+			ITest_localactionsStatemachine {
+
+	private final TimeEvent state1_time_event_0 = new TimeEvent(true, 0);
+	private final TimeEvent state2_time_event_0 = new TimeEvent(false, 1);
+
+	private final boolean[] timeEvents = new boolean[2];
+
+	private final class DefaultInterfaceImpl implements DefaultInterface {
+
+		private boolean event1;
+
+		public void raiseEvent1() {
+			event1 = true;
+		}
+
+		private boolean event2;
+
+		public void raiseEvent2() {
+			event2 = true;
+		}
+
+		private boolean event3;
+
+		public void raiseEvent3() {
+			event3 = true;
+		}
+
+		private boolean event4;
+
+		public void raiseEvent4() {
+			event4 = true;
+		}
+
+		private int i;
+
+		public int getI() {
+			return i;
+		}
+
+		public void setI(int value) {
+			i = value;
+		}
+
+		private int j;
+
+		public int getJ() {
+			return j;
+		}
+
+		public void setJ(int value) {
+			j = value;
+		}
+
+		private int c;
+
+		public int getC() {
+			return c;
+		}
+
+		public void setC(int value) {
+			c = value;
+		}
+
+		public void clearEvents() {
+			event1 = false;
+			event2 = false;
+			event3 = false;
+			event4 = false;
+		}
+
+	}
+
+	private DefaultInterfaceImpl defaultInterface;
+
+	public enum State {
+		State1, State2, $NullState$
+	};
+
+	private final State[] stateVector = new State[1];
+
+	private int nextStateIndex;
+
+	private ITimerService timerService;
+
+	private long cycleStartTime;
+
+	public Test_localactionsStatemachine() {
+
+		defaultInterface = new DefaultInterfaceImpl();
+
+		state1_time_event_0.setStatemachine(this);
+		state2_time_event_0.setStatemachine(this);
+
+	}
+
+	public void init() {
+		if (timerService == null) {
+			throw new IllegalStateException("TimerService not set.");
+		}
+		for (int i = 0; i < 1; i++) {
+			stateVector[i] = State.$NullState$;
+		}
+
+		clearEvents();
+		clearOutEvents();
+	}
+
+	protected void clearEvents() {
+		defaultInterface.clearEvents();
+
+		for (int i = 0; i < timeEvents.length; i++) {
+			timeEvents[i] = false;
+		}
+	}
+
+	protected void clearOutEvents() {
+	}
+
+	public boolean isStateActive(State state) {
+		for (int i = 0; i < stateVector.length; i++) {
+			if (stateVector[i] == state) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public void setTimerService(ITimerService timerService) {
+		this.timerService = timerService;
+	}
+
+	public ITimerService getTimerService() {
+		return timerService;
+	}
+
+	public void onTimeEventRaised(TimeEvent timeEvent) {
+		timeEvents[timeEvent.getIndex()] = true;
+	}
+
+	public DefaultInterface getDefaultInterface() {
+		return defaultInterface;
+	}
+
+	public void raiseEvent1() {
+		defaultInterface.raiseEvent1();
+	}
+
+	public void raiseEvent2() {
+		defaultInterface.raiseEvent2();
+	}
+
+	public void raiseEvent3() {
+		defaultInterface.raiseEvent3();
+	}
+
+	public void raiseEvent4() {
+		defaultInterface.raiseEvent4();
+	}
+
+	public int getI() {
+		return defaultInterface.getI();
+	}
+
+	public void setI(int value) {
+		defaultInterface.setI(value);
+	}
+	public int getJ() {
+		return defaultInterface.getJ();
+	}
+
+	public void setJ(int value) {
+		defaultInterface.setJ(value);
+	}
+	public int getC() {
+		return defaultInterface.getC();
+	}
+
+	public void setC(int value) {
+		defaultInterface.setC(value);
+	}
+
+	public void enter() {
+		if (timerService == null) {
+			throw new IllegalStateException("TimerService not set.");
+		}
+		cycleStartTime = System.currentTimeMillis();
+
+		// unknown function type org.yakindu.sct.model.sexec.impl.SequenceImpl@13965637 (name: entryAction) (comment: Entry action for statechart 'Test_LocalActions'.)();
+		getTimerService().setTimer(state1_time_event_0, 100, cycleStartTime);
+		defaultInterface.setI(1);
+
+		nextStateIndex = 0;
+		stateVector[0] = State.State1;
+
+	}
+
+	public void exit() {
+		//Handle exit of all possible states (of mainRegion) at position 0...
+		switch (stateVector[0]) {
+
+			case State1 :
+				stateVector[0] = State.$NullState$;
+				getTimerService().resetTimer(state1_time_event_0);
+				defaultInterface.setI(0);
+
+				break;
+
+			case State2 :
+				stateVector[0] = State.$NullState$;
+				getTimerService().resetTimer(state2_time_event_0);
+				defaultInterface.setJ(0);
+
+				break;
+
+			default :
+				break;
+		}
+
+		// unknown function type org.yakindu.sct.model.sexec.impl.SequenceImpl@3f3ab1c5 (name: exitAction) (comment: Exit action for state 'Test_LocalActions'.)();
+	}
+
+	private void reactState1() {
+		if (defaultInterface.event1) {
+			stateVector[0] = State.$NullState$;
+			getTimerService().resetTimer(state1_time_event_0);
+			defaultInterface.setI(0);
+
+			getTimerService()
+					.setTimer(state2_time_event_0, 200, cycleStartTime);
+			defaultInterface.setJ(1);
+
+			nextStateIndex = 0;
+			stateVector[0] = State.State2;
+
+		} else {
+			defaultInterface.setI(2);
+
+			if (defaultInterface.event2) {
+				defaultInterface.setI(3);
+
+			}
+			if (timeEvents[state1_time_event_0.getIndex()]) {
+				defaultInterface.setC(defaultInterface.getC() + (1));
+
+			}
+
+		}
+
+	}
+	private void reactState2() {
+		if (defaultInterface.event3) {
+			stateVector[0] = State.$NullState$;
+			getTimerService().resetTimer(state2_time_event_0);
+			defaultInterface.setJ(0);
+
+			getTimerService()
+					.setTimer(state1_time_event_0, 100, cycleStartTime);
+			defaultInterface.setI(1);
+
+			nextStateIndex = 0;
+			stateVector[0] = State.State1;
+
+		} else {
+			if ((defaultInterface.event2 || defaultInterface.event4)) {
+				defaultInterface.setJ(2);
+
+			}
+			if (timeEvents[state2_time_event_0.getIndex()]) {
+				defaultInterface.setJ(3);
+
+			}
+
+		}
+
+	}
+
+	public void runCycle() {
+
+		cycleStartTime = System.currentTimeMillis();
+
+		clearOutEvents();
+
+		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
+
+			switch (stateVector[nextStateIndex]) {
+				case State1 :
+					reactState1();
+					break;
+				case State2 :
+					reactState2();
+					break;
+				default :
+					// $NullState$
+			}
+		}
+
+		clearEvents();
+	}
+}

+ 46 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_parallelregions/ITest_parallelregionsStatemachine.java

@@ -0,0 +1,46 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased.test_parallelregions;
+
+import org.yakindu.sct.generator.java.runtime.cyclebased.IStatemachine;
+
+public interface ITest_parallelregionsStatemachine extends IStatemachine {
+
+	public interface DefaultInterface {
+
+		public void raiseEvent1();
+
+		public void raiseEvent2();
+
+		public void raiseEvent3();
+
+		public void raiseEvent4();
+
+		public void raiseEvent5();
+
+		public void raiseEvent6();
+
+		public void raiseEvent7();
+
+		public void raiseEvent8();
+
+		public void raiseEvent9();
+
+		public void raiseEvent10();
+
+		public void raiseEvent11();
+
+		public void raiseEvent12();
+
+		public void raiseEvent13();
+
+		public void raiseEvent14();
+
+		public int getReg3();
+		public void setReg3(int value);
+		public int getHierarchy();
+		public void setHierarchy(int value);
+
+	}
+
+	public DefaultInterface getDefaultInterface();
+
+}

File diff suppressed because it is too large
+ 1116 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_parallelregions/Test_parallelregionsStatemachine.java


+ 29 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_shallowhistory/ITest_shallowhistoryStatemachine.java

@@ -0,0 +1,29 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased.test_shallowhistory;
+
+import org.yakindu.sct.generator.java.runtime.cyclebased.IStatemachine;
+
+public interface ITest_shallowhistoryStatemachine extends IStatemachine {
+
+	public interface DefaultInterface {
+
+		public void raiseEvent1();
+
+		public void raiseEvent2();
+
+		public void raiseEvent3();
+
+		public void raiseEvent4();
+
+		public void raiseEvent5();
+
+		public void raiseEvent6();
+
+		public void raiseEvent7();
+
+		public void raiseEvent8();
+
+	}
+
+	public DefaultInterface getDefaultInterface();
+
+}

+ 111 - 113
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_shallowhistory/Test_ShallowHistoryCycleBasedStatemachine.java

@@ -1,65 +1,88 @@
-/**
-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.test_shallowhistory;
-
-import java.util.Collection;
-import java.util.HashSet;
-import org.yakindu.sct.runtime.java.Event;
-import org.yakindu.sct.runtime.java.EventVector;
-import java.util.HashMap;
-import java.util.Map;
-import org.yakindu.sct.runtime.java.IGenericAccessStatemachine;
-import org.yakindu.sct.runtime.java.IGenericAccessInterface;
-import org.yakindu.sct.runtime.java.IStatemachine;
-
-public class Test_ShallowHistoryCycleBasedStatemachine
+package org.yakindu.sct.generator.java.runtime.cyclebased.test_shallowhistory;
+
+public class Test_shallowhistoryStatemachine
 		implements
-			IGenericAccessStatemachine,
-			DefaultInterface,
-			IStatemachine {
+			ITest_shallowhistoryStatemachine {
 
-	public enum State {
-		State1, State2, State3, State4, State6, State7, State8, State9, State5, $NullState$
-	};
+	private final class DefaultInterfaceImpl implements DefaultInterface {
 
-	protected Map<String, IGenericAccessInterface> interfaceMap;
+		private boolean event1;
 
-	private State[] historyVector = new State[2];
+		public void raiseEvent1() {
+			event1 = true;
+		}
 
-	private final State[] stateVector = new State[1];
+		private boolean event2;
 
-	private int nextStateIndex;
+		public void raiseEvent2() {
+			event2 = true;
+		}
 
-	private final EventVector<Event<? extends Enum<?>>> occuredEvents;
+		private boolean event3;
 
-	private final Collection<Event<? extends Enum<?>>> outEvents;
+		public void raiseEvent3() {
+			event3 = true;
+		}
 
-	public Test_ShallowHistoryCycleBasedStatemachine() {
-		occuredEvents = new EventVector<Event<? extends Enum<?>>>(8);
-		outEvents = new HashSet<Event<? extends Enum<?>>>();
-		interfaceMap = new HashMap<String, IGenericAccessInterface>();
-		interfaceMap.put("DefaultInterface", new DefaultInterfaceImpl(this));
+		private boolean event4;
 
-	}
+		public void raiseEvent4() {
+			event4 = true;
+		}
 
-	protected Collection<Event<? extends Enum<?>>> getOccuredEvents() {
-		return occuredEvents;
-	}
+		private boolean event5;
+
+		public void raiseEvent5() {
+			event5 = true;
+		}
+
+		private boolean event6;
+
+		public void raiseEvent6() {
+			event6 = true;
+		}
+
+		private boolean event7;
+
+		public void raiseEvent7() {
+			event7 = true;
+		}
+
+		private boolean event8;
+
+		public void raiseEvent8() {
+			event8 = true;
+		}
+
+		public void clearEvents() {
+			event1 = false;
+			event2 = false;
+			event3 = false;
+			event4 = false;
+			event5 = false;
+			event6 = false;
+			event7 = false;
+			event8 = false;
+		}
 
-	protected Collection<Event<? extends Enum<?>>> getOutEvents() {
-		return outEvents;
 	}
 
-	protected boolean eventOccured() {
-		return !occuredEvents.isEmpty();
+	private DefaultInterfaceImpl defaultInterface;
+
+	public enum State {
+		State1, State2, State3, State4, State6, State7, State8, State9, State5, $NullState$
+	};
+
+	private State[] historyVector = new State[2];
+
+	private final State[] stateVector = new State[1];
+
+	private int nextStateIndex;
+
+	public Test_shallowhistoryStatemachine() {
+
+		defaultInterface = new DefaultInterfaceImpl();
+
 	}
 
 	public void init() {
@@ -70,8 +93,16 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 		for (int i = 0; i < 2; i++) {
 			historyVector[i] = State.$NullState$;
 		}
+		clearEvents();
+		clearOutEvents();
+	}
+
+	protected void clearEvents() {
+		defaultInterface.clearEvents();
 
-		occuredEvents.clear();
+	}
+
+	protected void clearOutEvents() {
 	}
 
 	public boolean isStateActive(State state) {
@@ -83,72 +114,45 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 		return false;
 	}
 
-	public IGenericAccessInterface getInterface(String name) {
-		return interfaceMap.get(name);
-	}
-
-	protected Map<String, IGenericAccessInterface> getInterfaceMap() {
-		return interfaceMap;
-	}
-
 	public DefaultInterface getDefaultInterface() {
-		return (DefaultInterface) getInterface("DefaultInterface");
-	}
-
-	protected IDefaultInterfaceImpl getDefaultInterfaceImpl() {
-		return (IDefaultInterfaceImpl) getInterface("DefaultInterface");
+		return defaultInterface;
 	}
 
 	public void raiseEvent1() {
-		getDefaultInterface().raiseEvent1();
+		defaultInterface.raiseEvent1();
 	}
 
 	public void raiseEvent2() {
-		getDefaultInterface().raiseEvent2();
+		defaultInterface.raiseEvent2();
 	}
 
 	public void raiseEvent3() {
-		getDefaultInterface().raiseEvent3();
+		defaultInterface.raiseEvent3();
 	}
 
 	public void raiseEvent4() {
-		getDefaultInterface().raiseEvent4();
+		defaultInterface.raiseEvent4();
 	}
 
 	public void raiseEvent5() {
-		getDefaultInterface().raiseEvent5();
+		defaultInterface.raiseEvent5();
 	}
 
 	public void raiseEvent6() {
-		getDefaultInterface().raiseEvent6();
+		defaultInterface.raiseEvent6();
 	}
 
 	public void raiseEvent7() {
-		getDefaultInterface().raiseEvent7();
+		defaultInterface.raiseEvent7();
 	}
 
 	public void raiseEvent8() {
-		getDefaultInterface().raiseEvent8();
-	}
-
-	public boolean raiseEvent(String name) {
-		return getDefaultInterface().raiseEvent(name);
-	}
-
-	@SuppressWarnings("unchecked")
-	public boolean raiseEvent(String name, Object value) {
-		return getDefaultInterface().raiseEvent(name, value);
-	}
-
-	public boolean setVariable(String name, Object value) {
-		return getDefaultInterface().setVariable(name, value);
-	}
-
-	public Object getVariable(String name) {
-		return getDefaultInterface().getVariable(name);
+		defaultInterface.raiseEvent8();
 	}
 
 	public void enter() {
+
+		// unknown function type org.yakindu.sct.model.sexec.impl.SequenceImpl@33292437 (name: entryAction) (comment: Entry action for statechart 'Test_ShallowHistory'.)();
 		nextStateIndex = 0;
 		stateVector[0] = State.State1;
 
@@ -206,6 +210,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 				break;
 		}
 
+		// unknown function type org.yakindu.sct.model.sexec.impl.SequenceImpl@5994519c (name: exitAction) (comment: Exit action for state 'Test_ShallowHistory'.)();
 	}
 
 	private void shallowEnterSequenceState2Region0() {
@@ -268,7 +273,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 		}
 	}
 	private void reactState1() {
-		if (occuredEvents.contains(getDefaultInterfaceImpl().getEventEvent1())) {
+		if (defaultInterface.event1) {
 			stateVector[0] = State.$NullState$;
 
 			//Enter the region with shallow history
@@ -287,7 +292,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 	private void reactState2() {
 	}
 	private void reactState3() {
-		if (occuredEvents.contains(getDefaultInterfaceImpl().getEventEvent2())) {
+		if (defaultInterface.event2) {
 
 			historyVector[0] = stateVector[0];
 			//Handle exit of all possible states (of region0) at position 0...
@@ -330,8 +335,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 			stateVector[0] = State.State1;
 
 		} else {
-			if (occuredEvents.contains(getDefaultInterfaceImpl()
-					.getEventEvent3())) {
+			if (defaultInterface.event3) {
 				stateVector[0] = State.$NullState$;
 
 				nextStateIndex = 0;
@@ -345,7 +349,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 	private void reactState4() {
 	}
 	private void reactState6() {
-		if (occuredEvents.contains(getDefaultInterfaceImpl().getEventEvent2())) {
+		if (defaultInterface.event2) {
 
 			historyVector[0] = stateVector[0];
 			//Handle exit of all possible states (of region0) at position 0...
@@ -388,8 +392,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 			stateVector[0] = State.State1;
 
 		} else {
-			if (occuredEvents.contains(getDefaultInterfaceImpl()
-					.getEventEvent4())) {
+			if (defaultInterface.event4) {
 				//Handle exit of all possible states (of region0) at position 0...
 				switch (stateVector[0]) {
 
@@ -420,8 +423,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 				stateVector[0] = State.State5;
 
 			} else {
-				if (occuredEvents.contains(getDefaultInterfaceImpl()
-						.getEventEvent5())) {
+				if (defaultInterface.event5) {
 					stateVector[0] = State.$NullState$;
 
 					//Enter the region with shallow history
@@ -444,7 +446,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 	private void reactState7() {
 	}
 	private void reactState8() {
-		if (occuredEvents.contains(getDefaultInterfaceImpl().getEventEvent2())) {
+		if (defaultInterface.event2) {
 
 			historyVector[0] = stateVector[0];
 			//Handle exit of all possible states (of region0) at position 0...
@@ -487,8 +489,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 			stateVector[0] = State.State1;
 
 		} else {
-			if (occuredEvents.contains(getDefaultInterfaceImpl()
-					.getEventEvent4())) {
+			if (defaultInterface.event4) {
 				//Handle exit of all possible states (of region0) at position 0...
 				switch (stateVector[0]) {
 
@@ -519,8 +520,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 				stateVector[0] = State.State5;
 
 			} else {
-				if (occuredEvents.contains(getDefaultInterfaceImpl()
-						.getEventEvent6())) {
+				if (defaultInterface.event6) {
 
 					historyVector[1] = stateVector[0];
 					//Handle exit of all possible states (of region0) at position 0...
@@ -544,8 +544,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 					stateVector[0] = State.State6;
 
 				} else {
-					if (occuredEvents.contains(getDefaultInterfaceImpl()
-							.getEventEvent7())) {
+					if (defaultInterface.event7) {
 						stateVector[0] = State.$NullState$;
 
 						nextStateIndex = 0;
@@ -561,7 +560,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 
 	}
 	private void reactState9() {
-		if (occuredEvents.contains(getDefaultInterfaceImpl().getEventEvent2())) {
+		if (defaultInterface.event2) {
 
 			historyVector[0] = stateVector[0];
 			//Handle exit of all possible states (of region0) at position 0...
@@ -604,8 +603,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 			stateVector[0] = State.State1;
 
 		} else {
-			if (occuredEvents.contains(getDefaultInterfaceImpl()
-					.getEventEvent4())) {
+			if (defaultInterface.event4) {
 				//Handle exit of all possible states (of region0) at position 0...
 				switch (stateVector[0]) {
 
@@ -636,8 +634,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 				stateVector[0] = State.State5;
 
 			} else {
-				if (occuredEvents.contains(getDefaultInterfaceImpl()
-						.getEventEvent6())) {
+				if (defaultInterface.event6) {
 
 					historyVector[1] = stateVector[0];
 					//Handle exit of all possible states (of region0) at position 0...
@@ -661,8 +658,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 					stateVector[0] = State.State6;
 
 				} else {
-					if (occuredEvents.contains(getDefaultInterfaceImpl()
-							.getEventEvent8())) {
+					if (defaultInterface.event8) {
 						stateVector[0] = State.$NullState$;
 
 						nextStateIndex = 0;
@@ -678,7 +674,7 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 
 	}
 	private void reactState5() {
-		if (occuredEvents.contains(getDefaultInterfaceImpl().getEventEvent2())) {
+		if (defaultInterface.event2) {
 
 			historyVector[0] = stateVector[0];
 			//Handle exit of all possible states (of region0) at position 0...
@@ -725,8 +721,10 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 		}
 
 	}
+
 	public void runCycle() {
-		outEvents.clear();
+
+		clearOutEvents();
 
 		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
 
@@ -763,6 +761,6 @@ public class Test_ShallowHistoryCycleBasedStatemachine
 			}
 		}
 
-		occuredEvents.clear();
+		clearEvents();
 	}
 }

+ 53 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_transition/ITest_transitionStatemachine.java

@@ -0,0 +1,53 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased.test_transition;
+
+import java.util.List;
+import org.yakindu.sct.generator.java.runtime.cyclebased.IStatemachine;
+import org.yakindu.sct.generator.java.runtime.cyclebased.ITimedStatemachine;
+
+public interface ITest_transitionStatemachine
+		extends
+			ITimedStatemachine,
+			IStatemachine {
+
+	public interface InterfaceA {
+		public void raiseEvent1(int value);
+
+		public void raiseEvent2();
+
+		public void raiseEvent3();
+
+		public void raiseEvent4();
+		public boolean isRaisedEvent5();
+
+		public List<InterfaceAListener> getListeners();
+	}
+
+	public interface InterfaceAListener {
+
+		public void onEvent5Raised();
+	}
+
+	public interface DefaultInterface {
+		public void raiseEvent5(boolean value);
+
+		public void raiseEvent6();
+		public boolean isRaisedEvent7();
+
+		public int getI();
+		public void setI(int value);
+		public double getJ();
+		public void setJ(double value);
+
+		public List<DefaultInterfaceListener> getListeners();
+	}
+
+	public interface DefaultInterfaceListener {
+
+		public void onEvent7Raised();
+	}
+
+	public InterfaceA getInterfaceA();
+
+	public DefaultInterface getDefaultInterface();
+
+}

+ 432 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/generator/java/runtime/cyclebased/test_transition/Test_transitionStatemachine.java

@@ -0,0 +1,432 @@
+package org.yakindu.sct.generator.java.runtime.cyclebased.test_transition;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.yakindu.sct.generator.java.runtime.cyclebased.TimeEvent;
+import org.yakindu.sct.generator.java.runtime.cyclebased.ITimerService;
+
+public class Test_transitionStatemachine
+		implements
+			ITest_transitionStatemachine {
+
+	private final TimeEvent state1_time_event_0 = new TimeEvent(false, 0);
+	private final TimeEvent state1_time_event_1 = new TimeEvent(false, 1);
+
+	private final boolean[] timeEvents = new boolean[2];
+
+	private final class InterfaceAImpl implements InterfaceA {
+
+		private List<InterfaceAListener> listeners = new LinkedList<InterfaceAListener>();
+
+		public List<InterfaceAListener> getListeners() {
+			return listeners;
+		}
+
+		private boolean event1;
+
+		private int event1Value;
+
+		public void raiseEvent1(int value) {
+			event1 = true;
+			event1Value = value;
+		}
+
+		private int getEvent1Value() {
+			if (!event1)
+				throw new IllegalStateException(
+						"Illegal event value acces. Event Event1 is not raised!");
+			return event1Value;
+		}
+
+		private boolean event2;
+
+		public void raiseEvent2() {
+			event2 = true;
+		}
+
+		private boolean event3;
+
+		public void raiseEvent3() {
+			event3 = true;
+		}
+
+		private boolean event4;
+
+		public void raiseEvent4() {
+			event4 = true;
+		}
+
+		private boolean event5;
+
+		private boolean event5Out;
+
+		public boolean isRaisedEvent5() {
+			return event5Out;
+		}
+
+		private void raiseEvent5() {
+			event5Out = true;
+			event5 = true;
+			for (InterfaceAListener listener : listeners) {
+				listener.onEvent5Raised();
+			}
+		}
+
+		public void clearEvents() {
+			event1 = false;
+			event2 = false;
+			event3 = false;
+			event4 = false;
+			event5 = false;
+		}
+
+		public void clearOutEvents() {
+			event5Out = false;
+		}
+
+	}
+
+	private InterfaceAImpl interfaceA;
+
+	private final class DefaultInterfaceImpl implements DefaultInterface {
+
+		private List<DefaultInterfaceListener> listeners = new LinkedList<DefaultInterfaceListener>();
+
+		public List<DefaultInterfaceListener> getListeners() {
+			return listeners;
+		}
+
+		private boolean event5;
+
+		private boolean event5Value;
+
+		public void raiseEvent5(boolean value) {
+			event5 = true;
+			event5Value = value;
+		}
+
+		private boolean getEvent5Value() {
+			if (!event5)
+				throw new IllegalStateException(
+						"Illegal event value acces. Event Event5 is not raised!");
+			return event5Value;
+		}
+
+		private boolean event6;
+
+		public void raiseEvent6() {
+			event6 = true;
+		}
+
+		private boolean event7;
+
+		private boolean event7Out;
+
+		public boolean isRaisedEvent7() {
+			return event7Out;
+		}
+
+		private void raiseEvent7() {
+			event7Out = true;
+			event7 = true;
+			for (DefaultInterfaceListener listener : listeners) {
+				listener.onEvent7Raised();
+			}
+		}
+
+		private int i;
+
+		public int getI() {
+			return i;
+		}
+
+		public void setI(int value) {
+			i = value;
+		}
+
+		private double j;
+
+		public double getJ() {
+			return j;
+		}
+
+		public void setJ(double value) {
+			j = value;
+		}
+
+		public void clearEvents() {
+			event5 = false;
+			event6 = false;
+			event7 = false;
+		}
+
+		public void clearOutEvents() {
+			event7Out = false;
+		}
+
+	}
+
+	private DefaultInterfaceImpl defaultInterface;
+
+	public enum State {
+		State1, State2, $NullState$
+	};
+
+	private final State[] stateVector = new State[1];
+
+	private int nextStateIndex;
+
+	private ITimerService timerService;
+
+	private long cycleStartTime;
+
+	public Test_transitionStatemachine() {
+
+		interfaceA = new InterfaceAImpl();
+		defaultInterface = new DefaultInterfaceImpl();
+
+		state1_time_event_0.setStatemachine(this);
+		state1_time_event_1.setStatemachine(this);
+
+	}
+
+	public void init() {
+		if (timerService == null) {
+			throw new IllegalStateException("TimerService not set.");
+		}
+		for (int i = 0; i < 1; i++) {
+			stateVector[i] = State.$NullState$;
+		}
+
+		clearEvents();
+		clearOutEvents();
+	}
+
+	protected void clearEvents() {
+		interfaceA.clearEvents();
+		defaultInterface.clearEvents();
+
+		for (int i = 0; i < timeEvents.length; i++) {
+			timeEvents[i] = false;
+		}
+	}
+
+	protected void clearOutEvents() {
+		interfaceA.clearOutEvents();
+		defaultInterface.clearOutEvents();
+	}
+
+	public boolean isStateActive(State state) {
+		for (int i = 0; i < stateVector.length; i++) {
+			if (stateVector[i] == state) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public void setTimerService(ITimerService timerService) {
+		this.timerService = timerService;
+	}
+
+	public ITimerService getTimerService() {
+		return timerService;
+	}
+
+	public void onTimeEventRaised(TimeEvent timeEvent) {
+		timeEvents[timeEvent.getIndex()] = true;
+	}
+
+	public InterfaceA getInterfaceA() {
+		return interfaceA;
+	}
+	public DefaultInterface getDefaultInterface() {
+		return defaultInterface;
+	}
+
+	public void raiseEvent5(boolean value) {
+		defaultInterface.raiseEvent5(value);
+	}
+
+	public void raiseEvent6() {
+		defaultInterface.raiseEvent6();
+	}
+
+	public boolean isRaisedEvent7() {
+		return defaultInterface.isRaisedEvent7();
+	}
+
+	public int getI() {
+		return defaultInterface.getI();
+	}
+
+	public void setI(int value) {
+		defaultInterface.setI(value);
+	}
+	public double getJ() {
+		return defaultInterface.getJ();
+	}
+
+	public void setJ(double value) {
+		defaultInterface.setJ(value);
+	}
+
+	public void enter() {
+		if (timerService == null) {
+			throw new IllegalStateException("TimerService not set.");
+		}
+		cycleStartTime = System.currentTimeMillis();
+
+		// unknown function type org.yakindu.sct.model.sexec.impl.SequenceImpl@47df4d31 (name: entryAction) (comment: Entry action for statechart 'Test_Transition'.)();
+		getTimerService().setTimer(state1_time_event_0, (10 * 1000),
+				cycleStartTime);
+		getTimerService().setTimer(state1_time_event_1, 100, cycleStartTime);
+
+		nextStateIndex = 0;
+		stateVector[0] = State.State1;
+
+	}
+
+	public void exit() {
+		//Handle exit of all possible states (of region0) at position 0...
+		switch (stateVector[0]) {
+
+			case State1 :
+				stateVector[0] = State.$NullState$;
+				getTimerService().resetTimer(state1_time_event_0);
+				getTimerService().resetTimer(state1_time_event_1);
+
+				break;
+
+			case State2 :
+				stateVector[0] = State.$NullState$;
+
+				break;
+
+			default :
+				break;
+		}
+
+		// unknown function type org.yakindu.sct.model.sexec.impl.SequenceImpl@6a757be1 (name: exitAction) (comment: Exit action for state 'Test_Transition'.)();
+	}
+
+	private void reactState1() {
+		if (((interfaceA.event1 || interfaceA.event2) && (interfaceA.event1Value < 0))) {
+			stateVector[0] = State.$NullState$;
+			getTimerService().resetTimer(state1_time_event_0);
+			getTimerService().resetTimer(state1_time_event_1);
+
+			defaultInterface.setI(2);
+
+			nextStateIndex = 0;
+			stateVector[0] = State.State2;
+
+		} else {
+			if ((defaultInterface.getI() == 5)) {
+				stateVector[0] = State.$NullState$;
+				getTimerService().resetTimer(state1_time_event_0);
+				getTimerService().resetTimer(state1_time_event_1);
+
+				nextStateIndex = 0;
+				stateVector[0] = State.State2;
+
+			} else {
+				if ((interfaceA.event3 && (defaultInterface.getJ() < 20))) {
+					stateVector[0] = State.$NullState$;
+					getTimerService().resetTimer(state1_time_event_0);
+					getTimerService().resetTimer(state1_time_event_1);
+
+					nextStateIndex = 0;
+					stateVector[0] = State.State2;
+
+				} else {
+					if (((interfaceA.event3 || interfaceA.event4) && (defaultInterface
+							.getJ() > 30))) {
+						stateVector[0] = State.$NullState$;
+						getTimerService().resetTimer(state1_time_event_0);
+						getTimerService().resetTimer(state1_time_event_1);
+
+						nextStateIndex = 0;
+						stateVector[0] = State.State2;
+
+					} else {
+						if (timeEvents[state1_time_event_0.getIndex()]) {
+							stateVector[0] = State.$NullState$;
+							getTimerService().resetTimer(state1_time_event_0);
+							getTimerService().resetTimer(state1_time_event_1);
+
+							nextStateIndex = 0;
+							stateVector[0] = State.State2;
+
+						} else {
+							if (timeEvents[state1_time_event_1.getIndex()]) {
+								stateVector[0] = State.$NullState$;
+								getTimerService().resetTimer(
+										state1_time_event_0);
+								getTimerService().resetTimer(
+										state1_time_event_1);
+
+								nextStateIndex = 0;
+								stateVector[0] = State.State2;
+
+							} else {
+								if ((interfaceA.event1 && (interfaceA.event1Value > 5))) {
+									stateVector[0] = State.$NullState$;
+									getTimerService().resetTimer(
+											state1_time_event_0);
+									getTimerService().resetTimer(
+											state1_time_event_1);
+
+									defaultInterface.setI(1);
+
+									nextStateIndex = 0;
+									stateVector[0] = State.State2;
+
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+
+	}
+	private void reactState2() {
+		if (defaultInterface.event6) {
+			stateVector[0] = State.$NullState$;
+
+			getTimerService().setTimer(state1_time_event_0, (10 * 1000),
+					cycleStartTime);
+			getTimerService()
+					.setTimer(state1_time_event_1, 100, cycleStartTime);
+
+			nextStateIndex = 0;
+			stateVector[0] = State.State1;
+
+		}
+
+	}
+
+	public void runCycle() {
+
+		cycleStartTime = System.currentTimeMillis();
+
+		clearOutEvents();
+
+		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
+
+			switch (stateVector[nextStateIndex]) {
+				case State1 :
+					reactState1();
+					break;
+				case State2 :
+					reactState2();
+					break;
+				default :
+					// $NullState$
+			}
+		}
+
+		clearEvents();
+	}
+}

+ 0 - 31
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/Event.java

@@ -1,31 +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;
-
-public class Event<T extends Enum<T>> {
-
-	private T id;
-
-	private int offset;
-
-	public Event(T id, int offset) {
-		this.id = id;
-		this.offset = offset;
-	}
-
-	public T getId() {
-		return id;
-	}
-
-	public int getIndex() {
-		return offset + id.ordinal();
-	}
-}

+ 0 - 27
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/EventNotification.java

@@ -1,27 +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;
-
-import org.yakindu.sct.runtime.java.Event;
-
-public class EventNotification extends Notification {
-
-	private Event<? extends Enum<?>> event;
-
-	public EventNotification(Event<? extends Enum<?>> event) {
-		super(NotificationType.EventNotification);
-		this.event = event;
-	}
-
-	public Event<? extends Enum<?>> getEvent() {
-		return event;
-	}
-}

+ 0 - 122
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/EventVector.java

@@ -1,122 +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;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-public class EventVector<E extends Event<? extends Enum<?>>>
-		implements
-			Collection<E> {
-
-	private boolean events[];
-
-	public EventVector(int size) {
-		events = new boolean[size];
-	}
-
-	public int size() {
-		return events.length;
-	}
-
-	public boolean isEmpty() {
-		for (int i = 0; i < events.length; i++) {
-			if (events[i]) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	@SuppressWarnings("unchecked")
-	public boolean contains(Object o) {
-		if (o instanceof Event) {
-			Event<? extends Enum<?>> event = (Event<? extends Enum<?>>) o;
-			return events[event.getIndex()];
-		}
-		return false;
-	}
-
-	public Iterator<E> iterator() {
-		throw new UnsupportedOperationException("Iterator not supported!");
-	}
-
-	public Object[] toArray() {
-		throw new UnsupportedOperationException("toArray not supported!");
-	}
-
-	public <T> T[] toArray(T[] a) {
-		throw new UnsupportedOperationException("toArray not supported!");
-	}
-
-	public boolean add(E e) {
-		if (e.getIndex() > -1 && e.getIndex() < events.length) {
-			events[e.getIndex()] = true;
-			return true;
-		}
-		return false;
-	}
-
-	@SuppressWarnings("rawtypes")
-	public boolean remove(Object o) {
-		if (o instanceof Event) {
-			Event event = (Event) o;
-			if (event.getIndex() > -1 && event.getIndex() < events.length) {
-				events[event.getIndex()] = true;
-				return true;
-			}
-		}
-		return false;
-	}
-
-	@SuppressWarnings("rawtypes")
-	public boolean containsAll(Collection<?> c) {
-		for (Object o : c) {
-			if (o instanceof Event) {
-				Event event = (Event) o;
-				if (!events[event.getIndex()]) {
-					return false;
-				}
-			} else {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	public boolean addAll(Collection<? extends E> c) {
-		for (E event : c) {
-			if (!add(event)) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	public boolean removeAll(Collection<?> c) {
-		for (Object o : c) {
-			if (!remove(o)) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	public boolean retainAll(Collection<?> c) {
-		throw new UnsupportedOperationException("retainAll not supported!");
-	}
-
-	public void clear() {
-		for (int i = 0; i < events.length; i++) {
-			events[i] = false;
-		}
-	}
-}

+ 0 - 22
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/IGenericAccessInterface.java

@@ -1,22 +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;
-
-public interface IGenericAccessInterface {
-
-	public boolean raiseEvent(String name);
-
-	public boolean raiseEvent(String name, Object value);
-
-	public boolean setVariable(String name, Object value);
-
-	public Object getVariable(String name);
-}

+ 0 - 16
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/IGenericAccessStatemachine.java

@@ -1,16 +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;
-
-public interface IGenericAccessStatemachine {
-
-	public IGenericAccessInterface getInterface(String name);
-}

+ 0 - 0
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/INotificationListener.java


Some files were not shown because too many files changed in this diff