Sfoglia il codice sorgente

Added license header to example code.
Fixed generator bugs.

markus.muehlbrandt@itemis.de 13 anni fa
parent
commit
11a8cbb187
16 ha cambiato i file con 121 aggiunte e 214 eliminazioni
  1. 18 2
      Examples/org.yakindu.sct.generator.java.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/CrossingDemo.java
  2. 16 0
      Examples/org.yakindu.sct.generator.java.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/CrossingFigure.java
  3. 16 0
      Examples/org.yakindu.sct.generator.java.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/PedestrianLightFigure.java
  4. 16 0
      Examples/org.yakindu.sct.generator.java.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/TrafficLightFigure.java
  5. 11 2
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/CustomBaseStatemachine.xpt
  6. 1 1
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/templates/Expression.ext
  7. 1 1
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/ITimerHandler.java
  8. 7 6
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/TimerHandler.java
  9. 3 31
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/interfacetest/InterfaceTestAbstractBaseStatemachine.java
  10. 3 31
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_deephistory/Test_DeepHistoryAbstractBaseStatemachine.java
  11. 3 31
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_expression/Test_ExpressionAbstractBaseStatemachine.java
  12. 3 31
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_hierarchy/Test_HierarchyAbstractBaseStatemachine.java
  13. 8 8
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_localactions/Test_LocalActionsAbstractBaseStatemachine.java
  14. 3 31
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_parallelregions/Test_ParallelRegionsAbstractBaseStatemachine.java
  15. 3 31
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_shallowhistory/Test_ShallowHistoryAbstractBaseStatemachine.java
  16. 9 8
      test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_transition/Test_TransitionAbstractBaseStatemachine.java

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

@@ -1,5 +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.examples.java.trafficlight;
 
+/**
+ * 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.
+ */
 import java.lang.reflect.InvocationTargetException;
 
 import org.eclipse.draw2d.FigureCanvas;
@@ -20,7 +36,7 @@ import org.yakindu.sct.runtime.java.trafficlightwaitingsimple.TrafficLightWaitin
 public class CrossingDemo {
 
 	public static void main(String[] args) {
-		
+
 		final TrafficLightWaitingSimpleCyleBasedStatemachine statemachine = new TrafficLightWaitingSimpleCyleBasedStatemachine();
 
 		// create display and shell
@@ -46,7 +62,7 @@ public class CrossingDemo {
 		crossing.add(pl);
 		crossing.getLayoutManager().setConstraint(pl,
 				new Rectangle(50, 10, 70, 20));
-		
+
 		Thread thread = new Thread() {
 			@Override
 			public void run() {

+ 16 - 0
Examples/org.yakindu.sct.generator.java.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/CrossingFigure.java

@@ -1,3 +1,13 @@
+/**
+ * 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.examples.java.trafficlight;
 
 import org.eclipse.draw2d.ColorConstants;
@@ -6,6 +16,12 @@ import org.eclipse.draw2d.Graphics;
 import org.eclipse.draw2d.XYLayout;
 import org.eclipse.draw2d.geometry.Rectangle;
 
+/**
+ * Draw2d figure for the crossing. Used by CrossingDemo. 
+ * 
+ * @author a.nyssen
+ *
+ */
 public class CrossingFigure extends Figure {
 
 	public CrossingFigure() {

+ 16 - 0
Examples/org.yakindu.sct.generator.java.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/PedestrianLightFigure.java

@@ -1,3 +1,13 @@
+/**
+ * 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.examples.java.trafficlight;
 
 import org.eclipse.draw2d.ColorConstants;
@@ -6,6 +16,12 @@ import org.eclipse.draw2d.Graphics;
 import org.eclipse.draw2d.geometry.Insets;
 import org.eclipse.draw2d.geometry.Rectangle;
 
+/**
+ * Draw2d figure for the pedestrian traffic light. Used by CrossingDemo. 
+ * 
+ * @author a.nyssen
+ *
+ */
 public class PedestrianLightFigure extends Figure {
 
 	boolean white = false;

+ 16 - 0
Examples/org.yakindu.sct.generator.java.trafficlight/src/org/yakindu/sct/examples/java/trafficlight/TrafficLightFigure.java

@@ -1,3 +1,13 @@
+/**
+ * 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.examples.java.trafficlight;
 
 import org.eclipse.draw2d.ColorConstants;
@@ -6,6 +16,12 @@ import org.eclipse.draw2d.Graphics;
 import org.eclipse.draw2d.geometry.Insets;
 import org.eclipse.draw2d.geometry.Rectangle;
 
+/**
+ * Draw2d figure for the traffic light. Used by CrossingDemo. 
+ * 
+ * @author a.nyssen
+ *
+ */
 public class TrafficLightFigure extends Figure {
 
 	private boolean red = false;

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

@@ -280,15 +280,24 @@ public abstract class 
 	private «event.type.getJavaType()» get«event.getValueName().toFirstUpper()»() {
 		return «event.getName()».getValue();
 	}
+	
 	«ENDIF-»
 	«ENDFOREACH-»
-
+	«FOREACH getInternalScopeVariables() AS variable-»
+	private «variable.type.getJavaType()» get«variable.getValueName().toFirstUpper()»() {
+		return «variable.getValueName()»;
+	}
+	
+	private void set«variable.getValueName().toFirstUpper()»(«variable.type.getJavaType()» value) {
+		«variable.getValueName()» = value;
+	}	
+	
+	«ENDFOREACH-»
 «EXPAND ConditionMethodsImplement FOREACH this.states-»
 «EXPAND StatementMethodsImplement FOREACH this.states-»
 «EXPAND CycleMethodsImplement FOREACH this.states-»
 «EXPAND EnterMethodImplement FOREACH this.states-»
 «EXPAND ExitMethodImplement FOREACH this.states-»
-
 	protected void runCycle(Collection<?> events) {
 		«IF isTimedStatemachine()-»
 		cycleStartTime = System.currentTimeMillis();

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

@@ -64,7 +64,7 @@ String toCode(LogicalAndExpression expression) :
   	"("+expression.leftOperand.toCode() + " && " + expression.rightOperand.toCode()+")";
 
 String toCode(LogicalNotExpression expression) :
-  	" ^" + expression.operand.toCode();
+  	" !" + expression.operand.toCode();
 
 String toCode(LogicalRelationExpression expression) :
    "("+expression.leftOperand.toCode() + getOperator(expression.operator) + expression.rightOperand.toCode()+")";

+ 1 - 1
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/ITimerHandler.java

@@ -12,7 +12,7 @@ package org.yakindu.sct.runtime.java;
 
 public interface ITimerHandler {
 	
-	public void setTimer(TimeEvent event, long time);
+	public void setTimer(TimeEvent event, long time, long cycleStartTime);
 	
 	public void resetTimer(TimeEvent event);
 }

+ 7 - 6
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/TimerHandler.java

@@ -30,7 +30,7 @@ public class TimerHandler implements ITimerHandler {
 	}
 
 	@Override
-	public void setTimer(final TimeEvent 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.
 		if (timerTaskMap.containsKey(event)) {
@@ -48,12 +48,13 @@ public class TimerHandler implements ITimerHandler {
 		//set time field of event
 		event.setTime(time);
 		
-		//start scheduling the timer.
+		// start scheduling the timer
 		if (event.getValue()) {
-			timer.scheduleAtFixedRate(timerTaskMap.get(event), time, time);
-		}
-		else {
-			timer.schedule(timerTaskMap.get(event), time);
+			timer.scheduleAtFixedRate(timerTaskMap.get(event),
+					time - (System.currentTimeMillis() - cycleStartTime), time);
+		} else {
+			timer.schedule(timerTaskMap.get(event),
+					time - (System.currentTimeMillis() - cycleStartTime));
 		}
 	}
 

+ 3 - 31
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/interfacetest/InterfaceTestAbstractBaseStatemachine.java

@@ -15,12 +15,9 @@ import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Set;
 import org.yakindu.sct.runtime.java.Event;
-import org.yakindu.sct.runtime.java.ITimedStatemachine;
-import org.yakindu.sct.runtime.java.ITimerHandler;
-import org.yakindu.sct.runtime.java.EventNotification;
-import org.yakindu.sct.runtime.java.Notification;
+import org.yakindu.sct.runtime.java.IStatemachine;
 
-public abstract class InterfaceTestAbstractBaseStatemachine implements ITimedStatemachine {
+public abstract class InterfaceTestAbstractBaseStatemachine implements IStatemachine {
 	
 	
 	
@@ -35,8 +32,6 @@ public abstract class InterfaceTestAbstractBaseStatemachine implements ITimedSta
 	private InterfaceDefaultImpl interfaceDefault;
 	private InterfaceOtherImpl interfaceOther;
 	private InterfaceThirdImpl interfaceThird;
-	
-	
 
 	private final Set<State> activeStates = EnumSet.noneOf(State.class);
 	
@@ -44,7 +39,6 @@ public abstract class InterfaceTestAbstractBaseStatemachine implements ITimedSta
 	
 	private final Collection<Event> outEvents;
 	
-	private ITimerHandler timerHandler;
 	
 	public InterfaceTestAbstractBaseStatemachine(Collection<Event> occuredEvents) {
 		this.occuredEvents = occuredEvents;
@@ -76,28 +70,8 @@ public abstract class InterfaceTestAbstractBaseStatemachine implements ITimedSta
 	public void init() {
 		
 	}
-
-	@Override
-	public void setTimerHandler(ITimerHandler timerHandler) {
-		this.timerHandler = timerHandler;
-	}
-
-	@Override
-	public ITimerHandler getTimerHandler() {
-		if (timerHandler == null) {
-			throw new NullPointerException("TimerHandler of statemachine \"+InterfaceTest+\" not set!");
-		}
-		return timerHandler;
-	}
-	
-	@Override
-	public void notify(Notification<?> notification) {
-		if (notification instanceof EventNotification) {
-			EventNotification eventNotification = (EventNotification) notification;
-			getOccuredEvents().add(eventNotification.getElement());
-		}
-	}
 	
+		
 	public Set<State> getActiveStates(){
 		return EnumSet.copyOf(activeStates);
 	}
@@ -114,7 +88,6 @@ public abstract class InterfaceTestAbstractBaseStatemachine implements ITimedSta
 		return interfaceThird;
 	}
 	
-
 	private boolean conditionState1Tr0(Collection<?> events) {
 		return (getOccuredEvents().contains(interfaceDefault.getEventEvent1()) && (interfaceDefault.getVarVar2() > 0));
 	}
@@ -211,7 +184,6 @@ actionsState4Tr0();
 
 
 	}
-
 	protected void runCycle(Collection<?> events) {
 		getOutEvents().clear();
 		for (State state : activeStates) {

+ 3 - 31
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_deephistory/Test_DeepHistoryAbstractBaseStatemachine.java

@@ -15,12 +15,9 @@ import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Set;
 import org.yakindu.sct.runtime.java.Event;
-import org.yakindu.sct.runtime.java.ITimedStatemachine;
-import org.yakindu.sct.runtime.java.ITimerHandler;
-import org.yakindu.sct.runtime.java.EventNotification;
-import org.yakindu.sct.runtime.java.Notification;
+import org.yakindu.sct.runtime.java.IStatemachine;
 
-public abstract class Test_DeepHistoryAbstractBaseStatemachine implements ITimedStatemachine {
+public abstract class Test_DeepHistoryAbstractBaseStatemachine implements IStatemachine {
 	
 	
 	
@@ -38,8 +35,6 @@ public abstract class Test_DeepHistoryAbstractBaseStatemachine implements ITimed
 	};
 	
 	private InterfaceDefaultImpl interfaceDefault;
-	
-	
 
 	private final Set<State> activeStates = EnumSet.noneOf(State.class);
 	
@@ -47,7 +42,6 @@ public abstract class Test_DeepHistoryAbstractBaseStatemachine implements ITimed
 	
 	private final Collection<Event> outEvents;
 	
-	private ITimerHandler timerHandler;
 	
 	public Test_DeepHistoryAbstractBaseStatemachine(Collection<Event> occuredEvents) {
 		this.occuredEvents = occuredEvents;
@@ -77,28 +71,8 @@ public abstract class Test_DeepHistoryAbstractBaseStatemachine implements ITimed
 	public void init() {
 		
 	}
-
-	@Override
-	public void setTimerHandler(ITimerHandler timerHandler) {
-		this.timerHandler = timerHandler;
-	}
-
-	@Override
-	public ITimerHandler getTimerHandler() {
-		if (timerHandler == null) {
-			throw new NullPointerException("TimerHandler of statemachine \"+Test_DeepHistory+\" not set!");
-		}
-		return timerHandler;
-	}
-	
-	@Override
-	public void notify(Notification<?> notification) {
-		if (notification instanceof EventNotification) {
-			EventNotification eventNotification = (EventNotification) notification;
-			getOccuredEvents().add(eventNotification.getElement());
-		}
-	}
 	
+		
 	public Set<State> getActiveStates(){
 		return EnumSet.copyOf(activeStates);
 	}
@@ -107,7 +81,6 @@ public abstract class Test_DeepHistoryAbstractBaseStatemachine implements ITimed
 		return interfaceDefault;
 	}
 	
-
 	private boolean conditionState1Tr0(Collection<?> events) {
 		return getOccuredEvents().contains(interfaceDefault.getEventEvent1());
 	}
@@ -205,7 +178,6 @@ actionsState9Tr0();
 	}
 	private void cycleState5(Collection<?> events) {
 	}
-
 	protected void runCycle(Collection<?> events) {
 		getOutEvents().clear();
 		for (State state : activeStates) {

+ 3 - 31
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_expression/Test_ExpressionAbstractBaseStatemachine.java

@@ -15,12 +15,9 @@ import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Set;
 import org.yakindu.sct.runtime.java.Event;
-import org.yakindu.sct.runtime.java.ITimedStatemachine;
-import org.yakindu.sct.runtime.java.ITimerHandler;
-import org.yakindu.sct.runtime.java.EventNotification;
-import org.yakindu.sct.runtime.java.Notification;
+import org.yakindu.sct.runtime.java.IStatemachine;
 
-public abstract class Test_ExpressionAbstractBaseStatemachine implements ITimedStatemachine {
+public abstract class Test_ExpressionAbstractBaseStatemachine implements IStatemachine {
 	
 	
 	
@@ -31,8 +28,6 @@ public abstract class Test_ExpressionAbstractBaseStatemachine implements ITimedS
 	};
 	
 	private InterfaceDefaultImpl interfaceDefault;
-	
-	
 
 	private final Set<State> activeStates = EnumSet.noneOf(State.class);
 	
@@ -40,7 +35,6 @@ public abstract class Test_ExpressionAbstractBaseStatemachine implements ITimedS
 	
 	private final Collection<Event> outEvents;
 	
-	private ITimerHandler timerHandler;
 	
 	public Test_ExpressionAbstractBaseStatemachine(Collection<Event> occuredEvents) {
 		this.occuredEvents = occuredEvents;
@@ -70,28 +64,8 @@ public abstract class Test_ExpressionAbstractBaseStatemachine implements ITimedS
 	public void init() {
 		
 	}
-
-	@Override
-	public void setTimerHandler(ITimerHandler timerHandler) {
-		this.timerHandler = timerHandler;
-	}
-
-	@Override
-	public ITimerHandler getTimerHandler() {
-		if (timerHandler == null) {
-			throw new NullPointerException("TimerHandler of statemachine \"+Test_Expression+\" not set!");
-		}
-		return timerHandler;
-	}
-	
-	@Override
-	public void notify(Notification<?> notification) {
-		if (notification instanceof EventNotification) {
-			EventNotification eventNotification = (EventNotification) notification;
-			getOccuredEvents().add(eventNotification.getElement());
-		}
-	}
 	
+		
 	public Set<State> getActiveStates(){
 		return EnumSet.copyOf(activeStates);
 	}
@@ -100,7 +74,6 @@ public abstract class Test_ExpressionAbstractBaseStatemachine implements ITimedS
 		return interfaceDefault;
 	}
 	
-
 	private boolean conditionState1Tr0(Collection<?> events) {
 		return getOccuredEvents().contains(interfaceDefault.getEventEvent1());
 	}
@@ -127,7 +100,6 @@ if (conditionState2Tr0(events) ) {
 actionsState2Tr0();
 }
 	}
-
 	protected void runCycle(Collection<?> events) {
 		getOutEvents().clear();
 		for (State state : activeStates) {

+ 3 - 31
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_hierarchy/Test_HierarchyAbstractBaseStatemachine.java

@@ -15,12 +15,9 @@ import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Set;
 import org.yakindu.sct.runtime.java.Event;
-import org.yakindu.sct.runtime.java.ITimedStatemachine;
-import org.yakindu.sct.runtime.java.ITimerHandler;
-import org.yakindu.sct.runtime.java.EventNotification;
-import org.yakindu.sct.runtime.java.Notification;
+import org.yakindu.sct.runtime.java.IStatemachine;
 
-public abstract class Test_HierarchyAbstractBaseStatemachine implements ITimedStatemachine {
+public abstract class Test_HierarchyAbstractBaseStatemachine implements IStatemachine {
 	
 	
 	
@@ -39,8 +36,6 @@ public abstract class Test_HierarchyAbstractBaseStatemachine implements ITimedSt
 	};
 	
 	private InterfaceDefaultImpl interfaceDefault;
-	
-	
 
 	private final Set<State> activeStates = EnumSet.noneOf(State.class);
 	
@@ -48,7 +43,6 @@ public abstract class Test_HierarchyAbstractBaseStatemachine implements ITimedSt
 	
 	private final Collection<Event> outEvents;
 	
-	private ITimerHandler timerHandler;
 	
 	public Test_HierarchyAbstractBaseStatemachine(Collection<Event> occuredEvents) {
 		this.occuredEvents = occuredEvents;
@@ -79,28 +73,8 @@ public abstract class Test_HierarchyAbstractBaseStatemachine implements ITimedSt
 	public void init() {
 		
 	}
-
-	@Override
-	public void setTimerHandler(ITimerHandler timerHandler) {
-		this.timerHandler = timerHandler;
-	}
-
-	@Override
-	public ITimerHandler getTimerHandler() {
-		if (timerHandler == null) {
-			throw new NullPointerException("TimerHandler of statemachine \"+Test_Hierarchy+\" not set!");
-		}
-		return timerHandler;
-	}
-	
-	@Override
-	public void notify(Notification<?> notification) {
-		if (notification instanceof EventNotification) {
-			EventNotification eventNotification = (EventNotification) notification;
-			getOccuredEvents().add(eventNotification.getElement());
-		}
-	}
 	
+		
 	public Set<State> getActiveStates(){
 		return EnumSet.copyOf(activeStates);
 	}
@@ -109,7 +83,6 @@ public abstract class Test_HierarchyAbstractBaseStatemachine implements ITimedSt
 		return interfaceDefault;
 	}
 	
-
 	private boolean conditionState1Tr0(Collection<?> events) {
 		return getOccuredEvents().contains(interfaceDefault.getEventEvent1());
 	}
@@ -438,7 +411,6 @@ actionsState8Tr2();
 
 
 	}
-
 	protected void runCycle(Collection<?> events) {
 		getOutEvents().clear();
 		for (State state : activeStates) {

+ 8 - 8
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_localactions/Test_LocalActionsAbstractBaseStatemachine.java

@@ -34,8 +34,6 @@ public abstract class Test_LocalActionsAbstractBaseStatemachine implements ITime
 	};
 	
 	private InterfaceDefaultImpl interfaceDefault;
-	
-	
 
 	private final Set<State> activeStates = EnumSet.noneOf(State.class);
 	
@@ -45,6 +43,8 @@ public abstract class Test_LocalActionsAbstractBaseStatemachine implements ITime
 	
 	private ITimerHandler timerHandler;
 	
+	private long cycleStartTime;
+	
 	public Test_LocalActionsAbstractBaseStatemachine(Collection<Event> occuredEvents) {
 		this.occuredEvents = occuredEvents;
 		this.outEvents = new HashSet<Event>();
@@ -60,6 +60,7 @@ public abstract class Test_LocalActionsAbstractBaseStatemachine implements ITime
 	}
 		
 	public void entry() {
+		cycleStartTime = System.currentTimeMillis();
 	activeStates.add(State.State1);
 		entryActionsState1();
 		
@@ -74,7 +75,7 @@ public abstract class Test_LocalActionsAbstractBaseStatemachine implements ITime
 	public void init() {
 		
 	}
-
+	
 	@Override
 	public void setTimerHandler(ITimerHandler timerHandler) {
 		this.timerHandler = timerHandler;
@@ -95,7 +96,7 @@ public abstract class Test_LocalActionsAbstractBaseStatemachine implements ITime
 			getOccuredEvents().add(eventNotification.getElement());
 		}
 	}
-	
+		
 	public Set<State> getActiveStates(){
 		return EnumSet.copyOf(activeStates);
 	}
@@ -104,7 +105,6 @@ public abstract class Test_LocalActionsAbstractBaseStatemachine implements ITime
 		return interfaceDefault;
 	}
 	
-
 	private boolean conditionState1Tr0(Collection<?> events) {
 		return getOccuredEvents().contains(interfaceDefault.getEventEvent1());
 	}
@@ -182,13 +182,13 @@ actionsState2Lr3();
 }
 	}
 	private void entryActionsState1() {
-getTimerHandler().setTimer(State1_time_event_0, 100);
+getTimerHandler().setTimer(State1_time_event_0, 100, cycleStartTime);
 	interfaceDefault.setVarI(1);
 
 
 	}
 	private void entryActionsState2() {
-getTimerHandler().setTimer(State2_time_event_0, 200);
+getTimerHandler().setTimer(State2_time_event_0, 200, cycleStartTime);
 	interfaceDefault.setVarJ(1);
 
 
@@ -205,8 +205,8 @@ getTimerHandler().resetTimer(State2_time_event_0);
 
 
 	}
-
 	protected void runCycle(Collection<?> events) {
+		cycleStartTime = System.currentTimeMillis();
 		getOutEvents().clear();
 		for (State state : activeStates) {
 			switch (state) {

+ 3 - 31
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_parallelregions/Test_ParallelRegionsAbstractBaseStatemachine.java

@@ -15,12 +15,9 @@ import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Set;
 import org.yakindu.sct.runtime.java.Event;
-import org.yakindu.sct.runtime.java.ITimedStatemachine;
-import org.yakindu.sct.runtime.java.ITimerHandler;
-import org.yakindu.sct.runtime.java.EventNotification;
-import org.yakindu.sct.runtime.java.Notification;
+import org.yakindu.sct.runtime.java.IStatemachine;
 
-public abstract class Test_ParallelRegionsAbstractBaseStatemachine implements ITimedStatemachine {
+public abstract class Test_ParallelRegionsAbstractBaseStatemachine implements IStatemachine {
 	
 	
 	
@@ -38,8 +35,6 @@ public abstract class Test_ParallelRegionsAbstractBaseStatemachine implements IT
 	};
 	
 	private InterfaceDefaultImpl interfaceDefault;
-	
-	
 
 	private final Set<State> activeStates = EnumSet.noneOf(State.class);
 	
@@ -47,7 +42,6 @@ public abstract class Test_ParallelRegionsAbstractBaseStatemachine implements IT
 	
 	private final Collection<Event> outEvents;
 	
-	private ITimerHandler timerHandler;
 	
 	public Test_ParallelRegionsAbstractBaseStatemachine(Collection<Event> occuredEvents) {
 		this.occuredEvents = occuredEvents;
@@ -77,28 +71,8 @@ public abstract class Test_ParallelRegionsAbstractBaseStatemachine implements IT
 	public void init() {
 		
 	}
-
-	@Override
-	public void setTimerHandler(ITimerHandler timerHandler) {
-		this.timerHandler = timerHandler;
-	}
-
-	@Override
-	public ITimerHandler getTimerHandler() {
-		if (timerHandler == null) {
-			throw new NullPointerException("TimerHandler of statemachine \"+Test_ParallelRegions+\" not set!");
-		}
-		return timerHandler;
-	}
-	
-	@Override
-	public void notify(Notification<?> notification) {
-		if (notification instanceof EventNotification) {
-			EventNotification eventNotification = (EventNotification) notification;
-			getOccuredEvents().add(eventNotification.getElement());
-		}
-	}
 	
+		
 	public Set<State> getActiveStates(){
 		return EnumSet.copyOf(activeStates);
 	}
@@ -107,7 +81,6 @@ public abstract class Test_ParallelRegionsAbstractBaseStatemachine implements IT
 		return interfaceDefault;
 	}
 	
-
 	private boolean conditionState1Tr0(Collection<?> events) {
 		return getOccuredEvents().contains(interfaceDefault.getEventEvent1());
 	}
@@ -192,7 +165,6 @@ if (conditionState8Tr0(events) ) {
 actionsState8Tr0();
 }
 	}
-
 	protected void runCycle(Collection<?> events) {
 		getOutEvents().clear();
 		for (State state : activeStates) {

+ 3 - 31
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_shallowhistory/Test_ShallowHistoryAbstractBaseStatemachine.java

@@ -15,12 +15,9 @@ import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Set;
 import org.yakindu.sct.runtime.java.Event;
-import org.yakindu.sct.runtime.java.ITimedStatemachine;
-import org.yakindu.sct.runtime.java.ITimerHandler;
-import org.yakindu.sct.runtime.java.EventNotification;
-import org.yakindu.sct.runtime.java.Notification;
+import org.yakindu.sct.runtime.java.IStatemachine;
 
-public abstract class Test_ShallowHistoryAbstractBaseStatemachine implements ITimedStatemachine {
+public abstract class Test_ShallowHistoryAbstractBaseStatemachine implements IStatemachine {
 	
 	
 	
@@ -38,8 +35,6 @@ public abstract class Test_ShallowHistoryAbstractBaseStatemachine implements ITi
 	};
 	
 	private InterfaceDefaultImpl interfaceDefault;
-	
-	
 
 	private final Set<State> activeStates = EnumSet.noneOf(State.class);
 	
@@ -47,7 +42,6 @@ public abstract class Test_ShallowHistoryAbstractBaseStatemachine implements ITi
 	
 	private final Collection<Event> outEvents;
 	
-	private ITimerHandler timerHandler;
 	
 	public Test_ShallowHistoryAbstractBaseStatemachine(Collection<Event> occuredEvents) {
 		this.occuredEvents = occuredEvents;
@@ -77,28 +71,8 @@ public abstract class Test_ShallowHistoryAbstractBaseStatemachine implements ITi
 	public void init() {
 		
 	}
-
-	@Override
-	public void setTimerHandler(ITimerHandler timerHandler) {
-		this.timerHandler = timerHandler;
-	}
-
-	@Override
-	public ITimerHandler getTimerHandler() {
-		if (timerHandler == null) {
-			throw new NullPointerException("TimerHandler of statemachine \"+Test_ShallowHistory+\" not set!");
-		}
-		return timerHandler;
-	}
-	
-	@Override
-	public void notify(Notification<?> notification) {
-		if (notification instanceof EventNotification) {
-			EventNotification eventNotification = (EventNotification) notification;
-			getOccuredEvents().add(eventNotification.getElement());
-		}
-	}
 	
+		
 	public Set<State> getActiveStates(){
 		return EnumSet.copyOf(activeStates);
 	}
@@ -107,7 +81,6 @@ public abstract class Test_ShallowHistoryAbstractBaseStatemachine implements ITi
 		return interfaceDefault;
 	}
 	
-
 	private boolean conditionState1Tr0(Collection<?> events) {
 		return getOccuredEvents().contains(interfaceDefault.getEventEvent1());
 	}
@@ -205,7 +178,6 @@ actionsState9Tr0();
 	}
 	private void cycleState5(Collection<?> events) {
 	}
-
 	protected void runCycle(Collection<?> events) {
 		getOutEvents().clear();
 		for (State state : activeStates) {

+ 9 - 8
test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_transition/Test_TransitionAbstractBaseStatemachine.java

@@ -37,8 +37,6 @@ public abstract class Test_TransitionAbstractBaseStatemachine implements ITimedS
 	
 	private InterfaceAImpl interfaceA;
 	private InterfaceDefaultImpl interfaceDefault;
-	
-	
 
 	private final Set<State> activeStates = EnumSet.noneOf(State.class);
 	
@@ -48,6 +46,8 @@ public abstract class Test_TransitionAbstractBaseStatemachine implements ITimedS
 	
 	private ITimerHandler timerHandler;
 	
+	private long cycleStartTime;
+	
 	public Test_TransitionAbstractBaseStatemachine(Collection<Event> occuredEvents) {
 		this.occuredEvents = occuredEvents;
 		this.outEvents = new HashSet<Event>();
@@ -64,6 +64,7 @@ public abstract class Test_TransitionAbstractBaseStatemachine implements ITimedS
 	}
 		
 	public void entry() {
+		cycleStartTime = System.currentTimeMillis();
 	activeStates.add(State.State1);
 		entryActionsState1();
 		
@@ -78,7 +79,7 @@ public abstract class Test_TransitionAbstractBaseStatemachine implements ITimedS
 	public void init() {
 		
 	}
-
+	
 	@Override
 	public void setTimerHandler(ITimerHandler timerHandler) {
 		this.timerHandler = timerHandler;
@@ -99,7 +100,7 @@ public abstract class Test_TransitionAbstractBaseStatemachine implements ITimedS
 			getOccuredEvents().add(eventNotification.getElement());
 		}
 	}
-	
+		
 	public Set<State> getActiveStates(){
 		return EnumSet.copyOf(activeStates);
 	}
@@ -124,7 +125,7 @@ public abstract class Test_TransitionAbstractBaseStatemachine implements ITimedS
 	private int getEventValueEvent10() {
 		return EventEvent10.getValue();
 	}
-
+	
 	private boolean conditionState1Tr0(Collection<?> events) {
 		return (getOccuredEvents().contains(interfaceA.getEventEvent1()) || getOccuredEvents().contains(interfaceA.getEventEvent2()));
 	}
@@ -258,8 +259,8 @@ actionsState1Tr8();
 	private void cycleState2(Collection<?> events) {
 	}
 	private void entryActionsState1() {
-getTimerHandler().setTimer(State1_time_event_0, (10 * 1000));
-getTimerHandler().setTimer(State1_time_event_1, 100);
+getTimerHandler().setTimer(State1_time_event_0, (10 * 1000), cycleStartTime);
+getTimerHandler().setTimer(State1_time_event_1, 100, cycleStartTime);
 
 	}
 	private void exitActionsState1() {
@@ -267,8 +268,8 @@ getTimerHandler().resetTimer(State1_time_event_0);
 getTimerHandler().resetTimer(State1_time_event_1);
 
 	}
-
 	protected void runCycle(Collection<?> events) {
+		cycleStartTime = System.currentTimeMillis();
 		getOutEvents().clear();
 		for (State state : activeStates) {
 			switch (state) {