Browse Source

Added exit() method to IStatemachine interface.
Extended ITimerService interface to gain the system time.

markus.muehlbrandt@gmail.com 12 years ago
parent
commit
d3c1f2f7f5

File diff suppressed because it is too large
+ 25 - 25
examples/org.yakindu.sct.examples.trafficlight/TrafficLightWaiting.sct


+ 5 - 0
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/IStatemachine.java

@@ -17,6 +17,11 @@ public interface IStatemachine {
 	*/
 	public void enter();
 
+	/**
+	* Exits the statemachine. Leaves the statemachine with a defined state.
+	*/
+	public void exit();
+
 	/**
 	* Start a run-to-completion cycle.
 	*/

+ 8 - 0
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/ITimerService.java

@@ -35,4 +35,12 @@ public interface ITimerService {
 	 * memory resources.
 	 */
 	public void cancel();
+
+	/**
+	 * Returns the system time in milliseconds.
+	 * 
+	 * @return the difference, measured in milliseconds, between the current
+	 *         time and a defined point of time in the past.
+	 */
+	public long getSystemTimeMillis();
 }

+ 4 - 3
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/TimerService.java

@@ -49,11 +49,12 @@ public class TimerService implements ITimerService {
 		timerTaskMap.remove(event);
 	}
 
-	/**
-	 * Cancels all running TimersTasks
-	 */
 	public void cancel() {
 		timer.cancel();
 		timer.purge();
 	}
+
+	public long getSystemTimeMillis() {
+		return System.currentTimeMillis();
+	}
 }

+ 2 - 2
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficLightWaitingStatemachine.java

@@ -190,7 +190,7 @@ public class TrafficLightWaitingStatemachine
 		if (timerService == null) {
 			throw new IllegalStateException("TimerService not set.");
 		}
-		cycleStartTime = System.currentTimeMillis();
+		cycleStartTime = timerService.getSystemTimeMillis();
 		entryAction();
 
 		sCITrafficLight.red = false;
@@ -1703,7 +1703,7 @@ public class TrafficLightWaitingStatemachine
 
 	public void runCycle() {
 
-		cycleStartTime = System.currentTimeMillis();
+		cycleStartTime = timerService.getSystemTimeMillis();
 
 		clearOutEvents();