浏览代码

sum changes

Simon Van Mierlo 8 年之前
父节点
当前提交
b69deb6f85
共有 68 个文件被更改,包括 4681 次插入 和 376 次删除
  1. 二进制
      traffic_light/bin/traffic/light/trafficlightctrl/TrafficLightCtrlStatemachine.class
  2. 3 3
      traffic_light_basic/model/TrafficLightCtrl.sct
  3. 3 3
      traffic_light_basic/src-gen/traffic/light/trafficlightctrl/TrafficLightCtrlStatemachine.java
  4. 9 9
      traffic_light_history/model/TrafficLightCtrl.sct
  5. 1 1
      traffic_light_history/src-gen/traffic/light/trafficlightctrl/ITrafficLightCtrlStatemachine.java
  6. 2 2
      traffic_light_history/src-gen/traffic/light/trafficlightctrl/SynchronizedTrafficLightCtrlStatemachine.java
  7. 11 11
      traffic_light_history/src-gen/traffic/light/trafficlightctrl/TrafficLightCtrlStatemachine.java
  8. 1 1
      traffic_light_history/src/traffic/light/TrafficlightDemo.java
  9. 6 1
      traffic_light_test/src-gen/traffic/light/trafficlightctrltest/TrafficLightCtrlTestStatemachine.java
  10. 263 263
      traffic_light_timer/model/TrafficLightCtrl.sct
  11. 6 6
      traffic_light_timer/src-gen/traffic/light/trafficlightctrl/ITrafficLightCtrlStatemachine.java
  12. 8 8
      traffic_light_timer/src-gen/traffic/light/trafficlightctrl/SynchronizedTrafficLightCtrlStatemachine.java
  13. 35 32
      traffic_light_timer/src-gen/traffic/light/trafficlightctrl/TrafficLightCtrlStatemachine.java
  14. 2 2
      traffic_light_timer/src/traffic/light/CrossWalkPanel.java
  15. 12 12
      traffic_light_timer/src/traffic/light/TrafficlightDemo.java
  16. 8 0
      traffic_light_timer_simulation/.classpath
  17. 2 0
      traffic_light_timer_simulation/.gitignore
  18. 29 0
      traffic_light_timer_simulation/.project
  19. 3 0
      traffic_light_timer_simulation/.settings/org.eclipse.core.resources.prefs
  20. 2 0
      traffic_light_timer_simulation/.settings/org.eclipse.core.runtime.prefs
  21. 12 0
      traffic_light_timer_simulation/.settings/org.eclipse.jdt.core.prefs
  22. 17 0
      traffic_light_timer_simulation/README.TXT
  23. 二进制
      traffic_light_timer_simulation/images/TrafficLightCtrl.png
  24. 二进制
      traffic_light_timer_simulation/images/counter.jpg
  25. 二进制
      traffic_light_timer_simulation/images/counter_empty.png
  26. 393 0
      traffic_light_timer_simulation/images/counter_empty.svg
  27. 二进制
      traffic_light_timer_simulation/images/green_light.png
  28. 二进制
      traffic_light_timer_simulation/images/green_light.xcf
  29. 二进制
      traffic_light_timer_simulation/images/horizontal_bar.png
  30. 133 0
      traffic_light_timer_simulation/images/horizontal_bar.svg
  31. 二进制
      traffic_light_timer_simulation/images/horizontal_bar_green.png
  32. 127 0
      traffic_light_timer_simulation/images/horizontal_bar_green.svg
  33. 二进制
      traffic_light_timer_simulation/images/red_light.png
  34. 二进制
      traffic_light_timer_simulation/images/red_light.xcf
  35. 二进制
      traffic_light_timer_simulation/images/trafficlight.jpg
  36. 二进制
      traffic_light_timer_simulation/images/trafficlight_empty.jpg
  37. 二进制
      traffic_light_timer_simulation/images/trafficlight_green.jpg
  38. 二进制
      traffic_light_timer_simulation/images/trafficlight_red.jpg
  39. 二进制
      traffic_light_timer_simulation/images/trafficlight_yellow.jpg
  40. 二进制
      traffic_light_timer_simulation/images/vertical_bar.png
  41. 79 0
      traffic_light_timer_simulation/images/vertical_bar.svg
  42. 二进制
      traffic_light_timer_simulation/images/vertical_bar_green.png
  43. 74 0
      traffic_light_timer_simulation/images/vertical_bar_green.svg
  44. 二进制
      traffic_light_timer_simulation/images/yellow_light.png
  45. 二进制
      traffic_light_timer_simulation/images/yellow_light.xcf
  46. 33 0
      traffic_light_timer_simulation/index.html
  47. 12 0
      traffic_light_timer_simulation/metadata.json
  48. 702 0
      traffic_light_timer_simulation/model/TrafficLightCtrl.sct
  49. 26 0
      traffic_light_timer_simulation/model/TrafficLightCtrl.sgen
  50. 39 0
      traffic_light_timer_simulation/src-gen/traffic/light/IStatemachine.java
  51. 38 0
      traffic_light_timer_simulation/src-gen/traffic/light/ITimer.java
  52. 15 0
      traffic_light_timer_simulation/src-gen/traffic/light/ITimerCallback.java
  53. 207 0
      traffic_light_timer_simulation/src-gen/traffic/light/RuntimeService.java
  54. 115 0
      traffic_light_timer_simulation/src-gen/traffic/light/TimerService.java
  55. 63 0
      traffic_light_timer_simulation/src-gen/traffic/light/trafficlightctrl/ITrafficLightCtrlStatemachine.java
  56. 252 0
      traffic_light_timer_simulation/src-gen/traffic/light/trafficlightctrl/SynchronizedTrafficLightCtrlStatemachine.java
  57. 1250 0
      traffic_light_timer_simulation/src-gen/traffic/light/trafficlightctrl/TrafficLightCtrlStatemachine.java
  58. 51 0
      traffic_light_timer_simulation/src/traffic/light/ButtonPanel.java
  59. 220 0
      traffic_light_timer_simulation/src/traffic/light/Counter.java
  60. 40 0
      traffic_light_timer_simulation/src/traffic/light/CrossWalkPanel.java
  61. 151 0
      traffic_light_timer_simulation/src/traffic/light/MyTimerService.java
  62. 88 0
      traffic_light_timer_simulation/src/traffic/light/TrafficLight.java
  63. 116 0
      traffic_light_timer_simulation/src/traffic/light/TrafficlightDemo.java
  64. 6 6
      traffic_light_with_interrupts/model/TrafficLightCtrl.sct
  65. 1 1
      traffic_light_with_interrupts/src-gen/traffic/light/trafficlightctrl/ITrafficLightCtrlStatemachine.java
  66. 2 2
      traffic_light_with_interrupts/src-gen/traffic/light/trafficlightctrl/RunnableTrafficLightCtrlStatemachineWrapper.java
  67. 2 2
      traffic_light_with_interrupts/src-gen/traffic/light/trafficlightctrl/SynchronizedTrafficLightCtrlStatemachine.java
  68. 11 11
      traffic_light_with_interrupts/src-gen/traffic/light/trafficlightctrl/TrafficLightCtrlStatemachine.java

二进制
traffic_light/bin/traffic/light/trafficlightctrl/TrafficLightCtrlStatemachine.class


+ 3 - 3
traffic_light_basic/model/TrafficLightCtrl.sct

@@ -3,16 +3,16 @@
   <sgraph:Statechart xmi:id="_Kl0RwBYbEeee7sC6Py90Ig" specification="interface:&#xA;  out event displayRed&#xA;  out event displayGreen&#xA;  out event displayYellow" name="TrafficLightCtrl">
     <regions xmi:id="_KmaHoBYbEeee7sC6Py90Ig" name="main region">
       <vertices xsi:type="sgraph:State" xmi:id="_P8Pj4BYbEeee7sC6Py90Ig" specification="entry / raise displayYellow" name="Yellow" incomingTransitions="_P8XfxBYbEeee7sC6Py90Ig">
-        <outgoingTransitions xmi:id="_P8RZJBYbEeee7sC6Py90Ig" specification="after 2s" target="_P8bxIBYbEeee7sC6Py90Ig"/>
+        <outgoingTransitions xmi:id="_P8RZJBYbEeee7sC6Py90Ig" specification="after 5s" target="_P8bxIBYbEeee7sC6Py90Ig"/>
       </vertices>
       <vertices xsi:type="sgraph:State" xmi:id="_P8WRkBYbEeee7sC6Py90Ig" specification="entry / raise displayGreen" name="Green" incomingTransitions="_P8c_VBYbEeee7sC6Py90Ig">
-        <outgoingTransitions xmi:id="_P8XfxBYbEeee7sC6Py90Ig" specification="after 3s" target="_P8Pj4BYbEeee7sC6Py90Ig"/>
+        <outgoingTransitions xmi:id="_P8XfxBYbEeee7sC6Py90Ig" specification="after 55s" target="_P8Pj4BYbEeee7sC6Py90Ig"/>
       </vertices>
       <vertices xsi:type="sgraph:Entry" xmi:id="_P8bKEBYbEeee7sC6Py90Ig">
         <outgoingTransitions xmi:id="_P8bKERYbEeee7sC6Py90Ig" target="_P8bxIBYbEeee7sC6Py90Ig"/>
       </vertices>
       <vertices xsi:type="sgraph:State" xmi:id="_P8bxIBYbEeee7sC6Py90Ig" specification="entry / raise displayRed" name="Red" incomingTransitions="_P8bKERYbEeee7sC6Py90Ig _P8RZJBYbEeee7sC6Py90Ig">
-        <outgoingTransitions xmi:id="_P8c_VBYbEeee7sC6Py90Ig" specification="after 5s" target="_P8WRkBYbEeee7sC6Py90Ig"/>
+        <outgoingTransitions xmi:id="_P8c_VBYbEeee7sC6Py90Ig" specification="after 60s" target="_P8WRkBYbEeee7sC6Py90Ig"/>
       </vertices>
     </regions>
   </sgraph:Statechart>

+ 3 - 3
traffic_light_basic/src-gen/traffic/light/trafficlightctrl/TrafficLightCtrlStatemachine.java

@@ -229,21 +229,21 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 	
 	/* Entry action for state 'Yellow'. */
 	private void entryAction_main_region_Yellow() {
-		timer.setTimer(this, 0, 2 * 1000, false);
+		timer.setTimer(this, 0, 5 * 1000, false);
 		
 		sCInterface.raiseDisplayYellow();
 	}
 	
 	/* Entry action for state 'Green'. */
 	private void entryAction_main_region_Green() {
-		timer.setTimer(this, 1, 3 * 1000, false);
+		timer.setTimer(this, 1, 55 * 1000, false);
 		
 		sCInterface.raiseDisplayGreen();
 	}
 	
 	/* Entry action for state 'Red'. */
 	private void entryAction_main_region_Red() {
-		timer.setTimer(this, 2, 5 * 1000, false);
+		timer.setTimer(this, 2, 60 * 1000, false);
 		
 		sCInterface.raiseDisplayRed();
 	}

+ 9 - 9
traffic_light_history/model/TrafficLightCtrl.sct

@@ -1,30 +1,30 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:sgraph="http://www.yakindu.org/sct/sgraph/2.0.0">
-  <sgraph:Statechart xmi:id="_NPjBgBA-EeGQ0KsLDV4EFg" specification="interface:&#xD;&#xA;  in event police&#xD;&#xA;  out event displayRed&#xD;&#xA;  out event displayGreen&#xD;&#xA;  out event displayYellow&#xD;&#xA;  out event displayNone" name="TrafficLightCtrl">
+  <sgraph:Statechart xmi:id="_NPjBgBA-EeGQ0KsLDV4EFg" specification="interface:&#xD;&#xA;  in event police_interrupt&#xD;&#xA;  out event displayRed&#xD;&#xA;  out event displayGreen&#xD;&#xA;  out event displayYellow&#xD;&#xA;  out event displayNone" name="TrafficLightCtrl">
     <regions xmi:id="_YM2j4CQsEeeu6I-nNWXkgQ" name="main">
       <vertices xsi:type="sgraph:Entry" xmi:id="_YM2j4SQsEeeu6I-nNWXkgQ">
         <outgoingTransitions xmi:id="_YM2j4iQsEeeu6I-nNWXkgQ" specification="" target="_YM2j4yQsEeeu6I-nNWXkgQ"/>
       </vertices>
       <vertices xsi:type="sgraph:State" xmi:id="_YM2j4yQsEeeu6I-nNWXkgQ" name="normal" incomingTransitions="_YM2j4iQsEeeu6I-nNWXkgQ">
-        <outgoingTransitions xmi:id="_YM3K8SQsEeeu6I-nNWXkgQ" specification="police" target="_YM5ALSQsEeeu6I-nNWXkgQ"/>
+        <outgoingTransitions xmi:id="_YM3K8SQsEeeu6I-nNWXkgQ" specification="police_interrupt" target="_YM5ALSQsEeeu6I-nNWXkgQ"/>
         <regions xmi:id="_YM3yAyQsEeeu6I-nNWXkgQ" name="normal">
           <vertices xsi:type="sgraph:State" xmi:id="_YM3yBCQsEeeu6I-nNWXkgQ" specification="entry / raise displayYellow" name="Yellow" incomingTransitions="_YM4ZHCQsEeeu6I-nNWXkgQ">
-            <outgoingTransitions xmi:id="_YM3yDCQsEeeu6I-nNWXkgQ" specification="after 2s" target="_YM5AICQsEeeu6I-nNWXkgQ"/>
+            <outgoingTransitions xmi:id="_YM3yDCQsEeeu6I-nNWXkgQ" specification="after 5s" target="_YM5AICQsEeeu6I-nNWXkgQ"/>
           </vertices>
           <vertices xsi:type="sgraph:State" xmi:id="_YM4ZFCQsEeeu6I-nNWXkgQ" specification="entry / raise displayGreen" name="Green" incomingTransitions="_YM5AKCQsEeeu6I-nNWXkgQ">
-            <outgoingTransitions xmi:id="_YM4ZHCQsEeeu6I-nNWXkgQ" specification="after 3s" target="_YM3yBCQsEeeu6I-nNWXkgQ"/>
+            <outgoingTransitions xmi:id="_YM4ZHCQsEeeu6I-nNWXkgQ" specification="after 55s" target="_YM3yBCQsEeeu6I-nNWXkgQ"/>
           </vertices>
           <vertices xsi:type="sgraph:Entry" xmi:id="_YM4ZISQsEeeu6I-nNWXkgQ">
             <outgoingTransitions xmi:id="_YM4ZIiQsEeeu6I-nNWXkgQ" target="_YM5AICQsEeeu6I-nNWXkgQ"/>
           </vertices>
           <vertices xsi:type="sgraph:State" xmi:id="_YM5AICQsEeeu6I-nNWXkgQ" specification="entry / raise displayRed" name="Red" incomingTransitions="_YM4ZIiQsEeeu6I-nNWXkgQ _YM3yDCQsEeeu6I-nNWXkgQ">
-            <outgoingTransitions xmi:id="_YM5AKCQsEeeu6I-nNWXkgQ" specification="after 5s" target="_YM4ZFCQsEeeu6I-nNWXkgQ"/>
+            <outgoingTransitions xmi:id="_YM5AKCQsEeeu6I-nNWXkgQ" specification="after 60s" target="_YM4ZFCQsEeeu6I-nNWXkgQ"/>
           </vertices>
           <vertices xsi:type="sgraph:Entry" xmi:id="_gVVRcCQtEeeu6I-nNWXkgQ" name="hist" incomingTransitions="_YM5nMSQsEeeu6I-nNWXkgQ" kind="SHALLOW_HISTORY"/>
         </regions>
       </vertices>
       <vertices xsi:type="sgraph:State" xmi:id="_YM5ALSQsEeeu6I-nNWXkgQ" name="interrupted" incomingTransitions="_YM3K8SQsEeeu6I-nNWXkgQ">
-        <outgoingTransitions xmi:id="_YM5nMSQsEeeu6I-nNWXkgQ" specification="police" target="_gVVRcCQtEeeu6I-nNWXkgQ"/>
+        <outgoingTransitions xmi:id="_YM5nMSQsEeeu6I-nNWXkgQ" specification="police_interrupt" target="_gVVRcCQtEeeu6I-nNWXkgQ"/>
         <regions xmi:id="_YM5nNSQsEeeu6I-nNWXkgQ" name="interrupted">
           <vertices xsi:type="sgraph:State" xmi:id="_YM5nNiQsEeeu6I-nNWXkgQ" specification="entry / raise displayNone" name="Black" incomingTransitions="_YM5nTSQsEeeu6I-nNWXkgQ">
             <outgoingTransitions xmi:id="_YM5nPiQsEeeu6I-nNWXkgQ" specification="after 1s" target="_YM5nRSQsEeeu6I-nNWXkgQ"/>
@@ -164,7 +164,7 @@
           </children>
           <styles xsi:type="notation:ShapeStyle" xmi:id="_YM1WCSQsEeeu6I-nNWXkgQ" fontName="Verdana" fillColor="15981773" lineColor="12632256"/>
           <styles xsi:type="notation:FontStyle" xmi:id="_YM1WCiQsEeeu6I-nNWXkgQ"/>
-          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_YM1WCyQsEeeu6I-nNWXkgQ" x="13" y="44" width="344" height="330"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_YM1WCyQsEeeu6I-nNWXkgQ" x="13" y="44" width="350" height="340"/>
         </children>
         <children xmi:id="_YM1WDCQsEeeu6I-nNWXkgQ" type="State" element="_YM5ALSQsEeeu6I-nNWXkgQ">
           <children xsi:type="notation:DecorationNode" xmi:id="_YM1WDSQsEeeu6I-nNWXkgQ" type="StateName">
@@ -270,7 +270,7 @@
       <styles xsi:type="notation:ConnectorStyle" xmi:id="_YM8qjSQsEeeu6I-nNWXkgQ" routing="Rectilinear" lineColor="4210752"/>
       <styles xsi:type="notation:FontStyle" xmi:id="_YM8qjiQsEeeu6I-nNWXkgQ" fontName="Verdana"/>
       <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_YM8qjyQsEeeu6I-nNWXkgQ" points="[-5, -8, 7, -62]$[-5, 52, 7, -2]"/>
-      <targetAnchor xsi:type="notation:IdentityAnchor" xmi:id="_YM8qkCQsEeeu6I-nNWXkgQ" id="(0.49336550060313633,0.005)"/>
+      <targetAnchor xsi:type="notation:IdentityAnchor" xmi:id="_YM8qkCQsEeeu6I-nNWXkgQ" id="(0.4847852310274296,0.004850746268656716)"/>
     </edges>
     <edges xmi:id="_YM8qkSQsEeeu6I-nNWXkgQ" type="Transition" element="_YM4ZHCQsEeeu6I-nNWXkgQ" source="_YM1V5yQsEeeu6I-nNWXkgQ" target="_YM1V3CQsEeeu6I-nNWXkgQ">
       <children xsi:type="notation:DecorationNode" xmi:id="_YM8qkiQsEeeu6I-nNWXkgQ" type="TransitionExpression">
@@ -334,7 +334,7 @@
       <styles xsi:type="notation:ConnectorStyle" xmi:id="_YM8qwSQsEeeu6I-nNWXkgQ" routing="Rectilinear" lineColor="4210752"/>
       <styles xsi:type="notation:FontStyle" xmi:id="_YM8qwiQsEeeu6I-nNWXkgQ" fontName="Verdana"/>
       <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_YM8qwyQsEeeu6I-nNWXkgQ" points="[0, 53, -117, 0]$[117, 53, 0, 0]"/>
-      <sourceAnchor xsi:type="notation:IdentityAnchor" xmi:id="_YM8qxCQsEeeu6I-nNWXkgQ" id="(1.0,0.08706467661691543)"/>
+      <sourceAnchor xsi:type="notation:IdentityAnchor" xmi:id="_YM8qxCQsEeeu6I-nNWXkgQ" id="(0.9826086956521739,0.08446573104626125)"/>
       <targetAnchor xsi:type="notation:IdentityAnchor" xmi:id="_YM8qxSQsEeeu6I-nNWXkgQ" id="(0.0029239766081871343,0.17350157728706625)"/>
     </edges>
     <edges xmi:id="_YM9RkCQsEeeu6I-nNWXkgQ" type="Transition" element="_YM5nMSQsEeeu6I-nNWXkgQ" source="_YM1WDCQsEeeu6I-nNWXkgQ" target="_gVx9YCQtEeeu6I-nNWXkgQ">

+ 1 - 1
traffic_light_history/src-gen/traffic/light/trafficlightctrl/ITrafficLightCtrlStatemachine.java

@@ -8,7 +8,7 @@ public interface ITrafficLightCtrlStatemachine extends ITimerCallback,IStatemach
 
 	public interface SCInterface {
 	
-		public void raisePolice();
+		public void raisePolice_interrupt();
 		
 		public boolean isRaisedDisplayRed();
 		

+ 2 - 2
traffic_light_history/src-gen/traffic/light/trafficlightctrl/SynchronizedTrafficLightCtrlStatemachine.java

@@ -32,10 +32,10 @@ public class SynchronizedTrafficLightCtrlStatemachine implements ITrafficLightCt
 			}
 		}
 		
-		public void raisePolice() {
+		public void raisePolice_interrupt() {
 			
 			synchronized (statemachine) {
-				statemachine.getSCInterface().raisePolice();
+				statemachine.getSCInterface().raisePolice_interrupt();
 				statemachine.runCycle();
 			}
 		}

+ 11 - 11
traffic_light_history/src-gen/traffic/light/trafficlightctrl/TrafficLightCtrlStatemachine.java

@@ -12,10 +12,10 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 		public List<SCInterfaceListener> getListeners() {
 			return listeners;
 		}
-		private boolean police;
+		private boolean police_interrupt;
 		
-		public void raisePolice() {
-			police = true;
+		public void raisePolice_interrupt() {
+			police_interrupt = true;
 		}
 		
 		private boolean displayRed;
@@ -71,7 +71,7 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 		}
 		
 		protected void clearEvents() {
-			police = false;
+			police_interrupt = false;
 		}
 		protected void clearOutEvents() {
 		
@@ -227,8 +227,8 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 		return sCInterface;
 	}
 	
-	public void raisePolice() {
-		sCInterface.raisePolice();
+	public void raisePolice_interrupt() {
+		sCInterface.raisePolice_interrupt();
 	}
 	
 	public boolean isRaisedDisplayRed() {
@@ -248,7 +248,7 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 	}
 	
 	private boolean check_main_normal_tr0_tr0() {
-		return sCInterface.police;
+		return sCInterface.police_interrupt;
 	}
 	
 	private boolean check_main_normal_normal_Yellow_tr0_tr0() {
@@ -264,7 +264,7 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 	}
 	
 	private boolean check_main_interrupted_tr0_tr0() {
-		return sCInterface.police;
+		return sCInterface.police_interrupt;
 	}
 	
 	private boolean check_main_interrupted_interrupted_Black_tr0_tr0() {
@@ -312,21 +312,21 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 	
 	/* Entry action for state 'Yellow'. */
 	private void entryAction_main_normal_normal_Yellow() {
-		timer.setTimer(this, 0, 2 * 1000, false);
+		timer.setTimer(this, 0, 5 * 1000, false);
 		
 		sCInterface.raiseDisplayYellow();
 	}
 	
 	/* Entry action for state 'Green'. */
 	private void entryAction_main_normal_normal_Green() {
-		timer.setTimer(this, 1, 3 * 1000, false);
+		timer.setTimer(this, 1, 55 * 1000, false);
 		
 		sCInterface.raiseDisplayGreen();
 	}
 	
 	/* Entry action for state 'Red'. */
 	private void entryAction_main_normal_normal_Red() {
-		timer.setTimer(this, 2, 5 * 1000, false);
+		timer.setTimer(this, 2, 60 * 1000, false);
 		
 		sCInterface.raiseDisplayRed();
 	}

+ 1 - 1
traffic_light_history/src/traffic/light/TrafficlightDemo.java

@@ -77,7 +77,7 @@ public class TrafficlightDemo extends JFrame {
 		});
 		
 		buttonPanel.getPoliceInterrupt()
-				.addActionListener(e -> statemachine.getSCInterface().raisePolice());
+				.addActionListener(e -> statemachine.getSCInterface().raisePolice_interrupt());
 		
 		statemachine.init();
 	}

+ 6 - 1
traffic_light_test/src-gen/traffic/light/trafficlightctrltest/TrafficLightCtrlTestStatemachine.java

@@ -98,8 +98,8 @@ public class TrafficLightCtrlTestStatemachine implements ITrafficLightCtrlTestSt
 	private ITimer timer;
 	
 	private final boolean[] timeEvents = new boolean[10];
-	private boolean police;
 	
+	private boolean police;
 	public TrafficLightCtrlTestStatemachine() {
 		sCInterface = new SCInterfaceImpl();
 	}
@@ -109,6 +109,10 @@ public class TrafficLightCtrlTestStatemachine implements ITrafficLightCtrlTestSt
 		if (timer == null) {
 			throw new IllegalStateException("timer not set.");
 		}
+		if (this.sCInterface.operationCallback == null) {
+			throw new IllegalStateException("Operation callback for interface sCInterface must be set.");
+		}
+		
 		for (int i = 0; i < 3; i++) {
 			stateVector[i] = State.$NullState$;
 		}
@@ -251,6 +255,7 @@ public class TrafficLightCtrlTestStatemachine implements ITrafficLightCtrlTestSt
 		police = true;
 	}
 	
+	
 	public boolean isRaisedDisplayRed() {
 		return sCInterface.isRaisedDisplayRed();
 	}

文件差异内容过多而无法显示
+ 263 - 263
traffic_light_timer/model/TrafficLightCtrl.sct


+ 6 - 6
traffic_light_timer/src-gen/traffic/light/trafficlightctrl/ITrafficLightCtrlStatemachine.java

@@ -41,21 +41,21 @@ public interface ITrafficLightCtrlStatemachine extends ITimerCallback,IStatemach
 	
 	public interface SCITimer {
 	
-		public boolean isRaisedUpdateColor();
+		public boolean isRaisedUpdateTimerColour();
 		
-		public String getUpdateColorValue();
+		public String getUpdateTimerColourValue();
 		
-		public boolean isRaisedUpdateCounter();
+		public boolean isRaisedUpdateTimerValue();
 		
-		public long getUpdateCounterValue();
+		public long getUpdateTimerValueValue();
 		
 	public List<SCITimerListener> getListeners();
 	}
 	
 	public interface SCITimerListener {
 	
-		public void onUpdateColorRaised(String value);
-		public void onUpdateCounterRaised(long value);
+		public void onUpdateTimerColourRaised(String value);
+		public void onUpdateTimerValueRaised(long value);
 		}
 	
 	public SCITimer getSCITimer();

+ 8 - 8
traffic_light_timer/src-gen/traffic/light/trafficlightctrl/SynchronizedTrafficLightCtrlStatemachine.java

@@ -96,26 +96,26 @@ public class SynchronizedTrafficLightCtrlStatemachine implements ITrafficLightCt
 			}
 		}
 		
-		public boolean isRaisedUpdateColor() {
+		public boolean isRaisedUpdateTimerColour() {
 			synchronized(statemachine) {
-				return statemachine.getSCITimer().isRaisedUpdateColor();
+				return statemachine.getSCITimer().isRaisedUpdateTimerColour();
 			}
 		}
 		
-		public String getUpdateColorValue() {
+		public String getUpdateTimerColourValue() {
 			synchronized(statemachine) {
-				return statemachine.getSCITimer().getUpdateColorValue();
+				return statemachine.getSCITimer().getUpdateTimerColourValue();
 			}
 		}
-		public boolean isRaisedUpdateCounter() {
+		public boolean isRaisedUpdateTimerValue() {
 			synchronized(statemachine) {
-				return statemachine.getSCITimer().isRaisedUpdateCounter();
+				return statemachine.getSCITimer().isRaisedUpdateTimerValue();
 			}
 		}
 		
-		public long getUpdateCounterValue() {
+		public long getUpdateTimerValueValue() {
 			synchronized(statemachine) {
-				return statemachine.getSCITimer().getUpdateCounterValue();
+				return statemachine.getSCITimer().getUpdateTimerValueValue();
 			}
 		}
 	};

+ 35 - 32
traffic_light_timer/src-gen/traffic/light/trafficlightctrl/TrafficLightCtrlStatemachine.java

@@ -107,56 +107,56 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 		public List<SCITimerListener> getListeners() {
 			return listeners;
 		}
-		private boolean updateColor;
+		private boolean updateTimerColour;
 		
-		private String updateColorValue;
+		private String updateTimerColourValue;
 		
-		public boolean isRaisedUpdateColor() {
-			return updateColor;
+		public boolean isRaisedUpdateTimerColour() {
+			return updateTimerColour;
 		}
 		
-		protected void raiseUpdateColor(String value) {
-			updateColor = true;
-			updateColorValue = value;
+		protected void raiseUpdateTimerColour(String value) {
+			updateTimerColour = true;
+			updateTimerColourValue = value;
 			for (SCITimerListener listener : listeners) {
-				listener.onUpdateColorRaised(value);
+				listener.onUpdateTimerColourRaised(value);
 			}
 		}
 		
-		public String getUpdateColorValue() {
-			if (! updateColor ) 
-				throw new IllegalStateException("Illegal event value access. Event UpdateColor is not raised!");
-			return updateColorValue;
+		public String getUpdateTimerColourValue() {
+			if (! updateTimerColour ) 
+				throw new IllegalStateException("Illegal event value access. Event UpdateTimerColour is not raised!");
+			return updateTimerColourValue;
 		}
 		
-		private boolean updateCounter;
+		private boolean updateTimerValue;
 		
-		private long updateCounterValue;
+		private long updateTimerValueValue;
 		
-		public boolean isRaisedUpdateCounter() {
-			return updateCounter;
+		public boolean isRaisedUpdateTimerValue() {
+			return updateTimerValue;
 		}
 		
-		protected void raiseUpdateCounter(long value) {
-			updateCounter = true;
-			updateCounterValue = value;
+		protected void raiseUpdateTimerValue(long value) {
+			updateTimerValue = true;
+			updateTimerValueValue = value;
 			for (SCITimerListener listener : listeners) {
-				listener.onUpdateCounterRaised(value);
+				listener.onUpdateTimerValueRaised(value);
 			}
 		}
 		
-		public long getUpdateCounterValue() {
-			if (! updateCounter ) 
-				throw new IllegalStateException("Illegal event value access. Event UpdateCounter is not raised!");
-			return updateCounterValue;
+		public long getUpdateTimerValueValue() {
+			if (! updateTimerValue ) 
+				throw new IllegalStateException("Illegal event value access. Event UpdateTimerValue is not raised!");
+			return updateTimerValueValue;
 		}
 		
 		protected void clearEvents() {
 		}
 		protected void clearOutEvents() {
 		
-		updateColor = false;
-		updateCounter = false;
+		updateTimerColour = false;
+		updateTimerValue = false;
 		}
 		
 	}
@@ -191,12 +191,12 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 	private ITimer timer;
 	
 	private final boolean[] timeEvents = new boolean[7];
+	
 	private boolean resetTimer;
 	
 	private boolean disableTimer;
 	
 	private boolean enableTimer;
-	
 	private long counter;
 	
 	protected void setCounter(long value) {
@@ -365,14 +365,17 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 		resetTimer = true;
 	}
 	
+	
 	private void raiseDisableTimer() {
 		disableTimer = true;
 	}
 	
+	
 	private void raiseEnableTimer() {
 		enableTimer = true;
 	}
 	
+	
 	public void raisePolice_interrupt() {
 		sCInterface.raisePolice_interrupt();
 	}
@@ -508,14 +511,14 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 	
 	private void effect_main_main_timer_running_running_DecidingColor_tr0() {
 		exitSequence_main_main_timer_running_running_DecidingColor();
-		sCITimer.raiseUpdateColor("Green");
+		sCITimer.raiseUpdateTimerColour("Green");
 		
 		enterSequence_main_main_timer_running_running_Green_default();
 	}
 	
 	private void effect_main_main_timer_running_running_DecidingColor_tr1() {
 		exitSequence_main_main_timer_running_running_DecidingColor();
-		sCITimer.raiseUpdateColor("Red");
+		sCITimer.raiseUpdateTimerColour("Red");
 		
 		enterSequence_main_main_timer_running_running_Red_default();
 	}
@@ -588,14 +591,14 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 	private void entryAction_main_main_timer_running_running_Green() {
 		timer.setTimer(this, 5, 1 * 1000, false);
 		
-		sCITimer.raiseUpdateCounter(getCounter());
+		sCITimer.raiseUpdateTimerValue(getCounter());
 	}
 	
 	/* Entry action for state 'Red'. */
 	private void entryAction_main_main_timer_running_running_Red() {
 		timer.setTimer(this, 6, 1 * 1000, false);
 		
-		sCITimer.raiseUpdateCounter(getCounter());
+		sCITimer.raiseUpdateTimerValue(getCounter());
 	}
 	
 	/* Exit action for state 'main'. */
@@ -630,7 +633,7 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 	
 	/* Exit action for state 'running'. */
 	private void exitAction_main_main_timer_running() {
-		sCITimer.raiseUpdateCounter(-1);
+		sCITimer.raiseUpdateTimerValue(-1);
 	}
 	
 	/* Exit action for state 'Green'. */

+ 2 - 2
traffic_light_timer/src/traffic/light/CrossWalkPanel.java

@@ -16,11 +16,11 @@ public class CrossWalkPanel extends JPanel {
 		counter = new Counter();
 	}
 	
-	public TrafficLight getTrafficLight() {
+	public TrafficLight getTrafficLightVis() {
 		return trafficLight;
 	}
 	
-	public Counter getCounter() {
+	public Counter getCounterVis() {
 		return counter;
 	}
 

+ 12 - 12
traffic_light_timer/src/traffic/light/TrafficlightDemo.java

@@ -65,36 +65,36 @@ public class TrafficlightDemo extends JFrame {
 		statemachine.getSCITrafficLight().getListeners().add(new ITrafficLightCtrlStatemachine.SCITrafficLightListener() {			
 			@Override
 			public void onDisplayYellowRaised() {
-				setCarLights(false, true, false);
+				setLights(false, true, false);
 			}
 			
 			@Override
 			public void onDisplayRedRaised() {
-				setCarLights(true, false, false);
+				setLights(true, false, false);
 			}
 			
 			@Override
 			public void onDisplayNoneRaised() {
-				setCarLights(false, false, false);
+				setLights(false, false, false);
 			}
 			
 			@Override
 			public void onDisplayGreenRaised() {
-				setCarLights(false, false, true);
+				setLights(false, false, true);
 			}
 		});
 		
 		statemachine.getSCITimer().getListeners().add(new ITrafficLightCtrlStatemachine.SCITimerListener() {
 			
 			@Override
-			public void onUpdateCounterRaised(long value) {
-				crossing.getCounter().setCounterValue(value);
+			public void onUpdateTimerValueRaised(long value) {
+				crossing.getCounterVis().setCounterValue(value);
 				repaint();
 			}
 			
 			@Override
-			public void onUpdateColorRaised(String value) {
-				crossing.getCounter().setColor(value == "Red" ? Color.RED : Color.GREEN);
+			public void onUpdateTimerColourRaised(String value) {
+				crossing.getCounterVis().setColor(value == "Red" ? Color.RED : Color.GREEN);
 			}
 		});
 		
@@ -107,10 +107,10 @@ public class TrafficlightDemo extends JFrame {
 		statemachine.init();
 	}
 	
-	private void setCarLights(boolean red, boolean yellow, boolean green) {
-		crossing.getTrafficLight().setRed(red);
-		crossing.getTrafficLight().setYellow(yellow);
-		crossing.getTrafficLight().setGreen(green);
+	private void setLights(boolean red, boolean yellow, boolean green) {
+		crossing.getTrafficLightVis().setRed(red);
+		crossing.getTrafficLightVis().setYellow(yellow);
+		crossing.getTrafficLightVis().setGreen(green);
 		repaint();
 	}
 }

+ 8 - 0
traffic_light_timer_simulation/.classpath

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src-gen"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

+ 2 - 0
traffic_light_timer_simulation/.gitignore

@@ -0,0 +1,2 @@
+/bin/
+/target/

+ 29 - 0
traffic_light_timer_simulation/.project

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>traffic_light_timer_simulation</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.yakindu.sct.builder.SCTBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.yakindu.sct.builder.SCTNature</nature>
+		<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+	</natures>
+</projectDescription>

+ 3 - 0
traffic_light_timer_simulation/.settings/org.eclipse.core.resources.prefs

@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+encoding//model/TrafficLightCtrl.sct=UTF-8
+encoding/<project>=UTF-8

+ 2 - 0
traffic_light_timer_simulation/.settings/org.eclipse.core.runtime.prefs

@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n

+ 12 - 0
traffic_light_timer_simulation/.settings/org.eclipse.jdt.core.prefs

@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8

+ 17 - 0
traffic_light_timer_simulation/README.TXT

@@ -0,0 +1,17 @@
+The traffic light example project is based on Java and contains a small GUI 
+that demonstrate the state machine behaviour in /model/TrafficLightWaiting.sct. 
+This example combines generated java code with manual Java implementations (the GUI). 
+To start the application run src/trafficlight_example/TrafficlightDemo.java. 
+In Eclipse select the project in the project explorer and right-click to open the 
+context menu. Select 'Run As > Java Application'. The application will start and 
+everything else should be self explaining
+
+ATTENTION:
+
+1! The example REQUIRES a JAVA 8 JDK. 
+
+2! When you installed the example then Eclipse may show errors on the project. This 
+is likely due to a missing configuration of the JDK. In this case select 'Properties'
+from the context menu on the project and set the correct JDK in 'Java Build Path'. You 
+will find further help in the 'Java development user guide' section of the Eclipse help.
+

二进制
traffic_light_timer_simulation/images/TrafficLightCtrl.png


二进制
traffic_light_timer_simulation/images/counter.jpg


二进制
traffic_light_timer_simulation/images/counter_empty.png


文件差异内容过多而无法显示
+ 393 - 0
traffic_light_timer_simulation/images/counter_empty.svg


二进制
traffic_light_timer_simulation/images/green_light.png


二进制
traffic_light_timer_simulation/images/green_light.xcf


二进制
traffic_light_timer_simulation/images/horizontal_bar.png


文件差异内容过多而无法显示
+ 133 - 0
traffic_light_timer_simulation/images/horizontal_bar.svg


二进制
traffic_light_timer_simulation/images/horizontal_bar_green.png


+ 127 - 0
traffic_light_timer_simulation/images/horizontal_bar_green.svg

@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="210mm"
+   height="297mm"
+   viewBox="0 0 744.09448819 1052.3622047"
+   id="svg4420"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="horizontal_bar_green.svg">
+  <defs
+     id="defs4422">
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath4240-6-6-9">
+      <path
+         style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.56577283px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m 134.35663,122.50577 -1.99733,1.335 -2.27698,13.35001 1.2783,2.3585 2.03729,-1.246 2.35686,-13.66151 z"
+         id="path4242-7-9-6"
+         inkscape:connector-curvature="0" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath4240-6-6">
+      <path
+         style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.56577283px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m 134.35663,122.50577 -1.99733,1.335 -2.27698,13.35001 1.2783,2.3585 2.03729,-1.246 2.35686,-13.66151 z"
+         id="path4242-7-9"
+         inkscape:connector-curvature="0" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath4240-7-9-6">
+      <path
+         style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.56577283px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m 134.35663,122.50577 -1.99733,1.335 -2.27698,13.35001 1.2783,2.3585 2.03729,-1.246 2.35686,-13.66151 z"
+         id="path4242-8-7-8"
+         inkscape:connector-curvature="0" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath4240-7-9">
+      <path
+         style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.56577283px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m 134.35663,122.50577 -1.99733,1.335 -2.27698,13.35001 1.2783,2.3585 2.03729,-1.246 2.35686,-13.66151 z"
+         id="path4242-8-7"
+         inkscape:connector-curvature="0" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath4240-6">
+      <path
+         style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.56577283px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m 134.35663,122.50577 -1.99733,1.335 -2.27698,13.35001 1.2783,2.3585 2.03729,-1.246 2.35686,-13.66151 z"
+         id="path4242-7"
+         inkscape:connector-curvature="0" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath4240-7">
+      <path
+         style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.56577283px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m 134.35663,122.50577 -1.99733,1.335 -2.27698,13.35001 1.2783,2.3585 2.03729,-1.246 2.35686,-13.66151 z"
+         id="path4242-8"
+         inkscape:connector-curvature="0" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath4240">
+      <path
+         style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.56577283px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m 134.35663,122.50577 -1.99733,1.335 -2.27698,13.35001 1.2783,2.3585 2.03729,-1.246 2.35686,-13.66151 z"
+         id="path4242"
+         inkscape:connector-curvature="0" />
+    </clipPath>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="22.4"
+     inkscape:cx="397.89746"
+     inkscape:cy="809.17099"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1920"
+     inkscape:window-height="1017"
+     inkscape:window-x="1912"
+     inkscape:window-y="-8"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata4425">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Laag 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <path
+       style="fill:#00ff00;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 385.98214,241.15684 3.66072,-3.08035 24.91071,0.0446 3.21429,3.21428 -3.30357,3.30358 -25.35715,-0.0893 z"
+       id="path4148"
+       inkscape:connector-curvature="0"
+       inkscape:export-xdpi="90"
+       inkscape:export-ydpi="90" />
+  </g>
+</svg>

二进制
traffic_light_timer_simulation/images/red_light.png


二进制
traffic_light_timer_simulation/images/red_light.xcf


二进制
traffic_light_timer_simulation/images/trafficlight.jpg


二进制
traffic_light_timer_simulation/images/trafficlight_empty.jpg


二进制
traffic_light_timer_simulation/images/trafficlight_green.jpg


二进制
traffic_light_timer_simulation/images/trafficlight_red.jpg


二进制
traffic_light_timer_simulation/images/trafficlight_yellow.jpg


二进制
traffic_light_timer_simulation/images/vertical_bar.png


文件差异内容过多而无法显示
+ 79 - 0
traffic_light_timer_simulation/images/vertical_bar.svg


二进制
traffic_light_timer_simulation/images/vertical_bar_green.png


+ 74 - 0
traffic_light_timer_simulation/images/vertical_bar_green.svg

@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="210mm"
+   height="297mm"
+   viewBox="0 0 744.09448819 1052.3622047"
+   id="svg5025"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="vertical_bar_green.svg"
+   inkscape:export-filename="N:\Documents\Unief\Tools\yakindu-sct\ws\traffic_light_timer\images\vertical_bar_green.png"
+   inkscape:export-xdpi="90"
+   inkscape:export-ydpi="90">
+  <defs
+     id="defs5027">
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath4240-6">
+      <path
+         style="fill:#ff0000;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.56577283px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m 134.35663,122.50577 -1.99733,1.335 -2.27698,13.35001 1.2783,2.3585 2.03729,-1.246 2.35686,-13.66151 z"
+         id="path4242-7"
+         inkscape:connector-curvature="0" />
+    </clipPath>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="15.839192"
+     inkscape:cx="436.24136"
+     inkscape:cy="640.96635"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1916"
+     inkscape:window-height="1006"
+     inkscape:window-x="1914"
+     inkscape:window-y="1"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata5030">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Laag 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <path
+       style="fill:#00ff00;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 434.555,403.3392 3.85121,-2.27284 2.58851,3.4724 -4.35628,22.60216 -3.85121,2.02031 -2.52538,-3.66181 z"
+       id="path4136"
+       inkscape:connector-curvature="0" />
+  </g>
+</svg>

二进制
traffic_light_timer_simulation/images/yellow_light.png


二进制
traffic_light_timer_simulation/images/yellow_light.xcf


+ 33 - 0
traffic_light_timer_simulation/index.html

@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<title>Traffic Light (Java)</title>
+<link href="../css/style.css" rel="stylesheet">
+</head>
+<body class="body-container">
+
+  <h1>Traffic Light (Java)</h1>
+
+  <p>This example demonstrates how to to generate Javacode from a statechart. The procedure is explained in the documentation, chapter "Java code generator". </p>
+
+  <p>
+    <img class="standard-image" alt="The statechart"
+      src="images/TrafficLightCtrl.png" />
+  </p>
+
+  <p>In summary, there are two traffic lights: one for the traffic on the street, and
+    one for pedestrians who want to cross the street. They can push a button to
+    request their traffic light to turn green, which activates a blinking
+    wait-light first. The street's traffic light then goes through the standard
+    procedure, turning on the yellow light, followed by the red light, allowing
+    the pedestrians to cross safely. After some time, the pedestrians' traffic
+    light turns red again, and the cars are allowed to pass until the next
+    request is made by a pedestrian.</p>
+
+  <p>Additionally, the traffic light can be switched off completely. This
+    turns the yellow lights into a blinking mode, signaling that the traffic
+    light is indeed switched off and that the street should be crossed in a
+    careful manner.</p>
+</body>
+</html>

+ 12 - 0
traffic_light_timer_simulation/metadata.json

@@ -0,0 +1,12 @@
+{
+	"id": "org.yakindu.sct.examples.traffic_light_java",
+	"title": "Traffic Light (Java)",
+	"category": [
+		"open source",
+		"java",
+		"basic",
+		"interface",
+		"composite state",
+		"timer service"
+	]
+}

文件差异内容过多而无法显示
+ 702 - 0
traffic_light_timer_simulation/model/TrafficLightCtrl.sct


+ 26 - 0
traffic_light_timer_simulation/model/TrafficLightCtrl.sgen

@@ -0,0 +1,26 @@
+GeneratorModel for yakindu::java {
+
+	statechart TrafficLightCtrl {
+	 	
+		feature Outlet {
+			targetProject = "traffic_light_timer_simulation"
+			targetFolder = "src-gen"
+		}
+
+		feature Naming {
+			basePackage = "traffic.light"
+			implementationSuffix =""
+		}
+
+		feature GeneralFeatures {
+			RuntimeService = true
+			TimerService = true
+			InterfaceObserverSupport = true
+		}
+		
+		feature SynchronizedWrapper {
+			namePrefix =  "Synchronized" 
+			nameSuffix =  "" 
+		}
+	}
+}

+ 39 - 0
traffic_light_timer_simulation/src-gen/traffic/light/IStatemachine.java

@@ -0,0 +1,39 @@
+package traffic.light;
+
+/**
+ * Basic interface for state machines.
+ */
+public interface IStatemachine {
+
+	/**
+	 * Initializes the state machine. Used to initialize internal variables etc.
+	 */
+	public void init();
+
+	/**
+	 * Enters the state machine. Sets the state machine into a defined state.
+	 */
+	public void enter();
+
+	/**
+	 * Exits the state machine. Leaves the state machine with a defined state.
+	 */
+	public void exit();
+
+	/**
+	 * Checks whether the state machine is active. 
+	 * A state machine is active if it has been entered. It is inactive if it has not been entered at all or if it has been exited.
+	 */
+	public boolean isActive();
+
+	/**
+	 * Checks whether all active states are final. 
+	 * If there are no active states then the state machine is considered being incative. In this case this method returns <code>false</code>.
+	 */
+	public boolean isFinal();
+
+	/**
+	* Start a run-to-completion cycle.
+	*/
+	public void runCycle();
+}

+ 38 - 0
traffic_light_timer_simulation/src-gen/traffic/light/ITimer.java

@@ -0,0 +1,38 @@
+package traffic.light;
+
+/**
+ * Interface a timer has to implement. Use to implement your own timer
+ * service.
+ * 
+ */
+public interface ITimer {
+
+	/**
+	 * Starts the timing for a given time event id.
+	 * 
+	 * @param callback
+	 * 			  : The target callback where the time event has to be raised.
+	 * 
+	 * @param eventID
+	 *            : The eventID the timer should use if timed out.
+	 *            
+	 * @param time
+	 *            : Time in milliseconds after the given time event should be
+	 *            triggered
+	 *            
+	 * @param isPeriodic
+	 * 			  : Set to true if the time event should be triggered periodically
+	 */
+	public void setTimer(ITimerCallback callback, int eventID, long time, boolean isPeriodic);
+
+	/**
+	 * Unset a time event.
+	 * 
+	 * @param callback
+	 * 			: The target callback for which the time event has to be unset.
+	 * 
+	 * @param eventID
+	 * 			: The time event id.
+	 */
+	public void unsetTimer(ITimerCallback callback, int eventID);
+}

+ 15 - 0
traffic_light_timer_simulation/src-gen/traffic/light/ITimerCallback.java

@@ -0,0 +1,15 @@
+package traffic.light;
+
+/**
+* Interface for state machines which use timed event triggers.
+*/
+public interface ITimerCallback {
+	
+	/**
+	* Callback method if a time event occurred.
+	* 
+	* @param eventID
+	* 			:The id of the occurred event.
+	*/
+	public void timeElapsed(int eventID);
+}

+ 207 - 0
traffic_light_timer_simulation/src-gen/traffic/light/RuntimeService.java

@@ -0,0 +1,207 @@
+package traffic.light;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+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 static RuntimeService runtimeService;
+
+	private Timer timer = null;
+
+	private Map<Long, StatemachineTimerTask> timerTasks = new HashMap<Long, StatemachineTimerTask>();
+
+	private class StatemachineTimerTask extends TimerTask {
+
+		private List<IStatemachine> statemachineList = new LinkedList<IStatemachine>();
+
+		private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
+
+		private boolean isPaused = false;
+
+		@Override
+		public void run() {
+			lock.readLock().lock();
+			if (!isPaused) {
+				for (IStatemachine statemachine : statemachineList) {
+					statemachine.runCycle();
+				}
+			}
+			lock.readLock().unlock();
+		}
+
+		/**
+		 * Adds the given state machine to the TimerTask.
+		 *
+		 * @param statemachine
+		 * @return {@code true} if state machine is added properly.
+		 */
+		public boolean addStatemachine(IStatemachine statemachine) {
+			lock.writeLock().lock();
+			boolean ret = statemachineList.add(statemachine);
+			lock.writeLock().unlock();
+			return ret;
+		}
+
+		/**
+		 * Removes the given state machine from the TimerTask.
+		 *
+		 * @param statemachine
+		 * @return {@code true} if state machine is removed properly.
+		 */
+		public boolean removeStatemachine(IStatemachine statemachine) {
+			lock.writeLock().lock();
+			boolean ret = statemachineList.remove(statemachine);
+			lock.writeLock().unlock();
+			return ret;
+		}
+
+		public void pause() {
+			isPaused = true;
+		}
+
+		public void resume() {
+			isPaused = false;
+		}
+	}
+
+	private RuntimeService() {
+		// Not intended to be instantiated.
+	}
+
+	/**
+	 * Returns the {@code RuntimeService} instance as singleton.
+	 *
+	 * @return The singleton {@code RuntimeService} instance
+	 */
+	public static RuntimeService getInstance() {
+		if (runtimeService == null) {
+			runtimeService = new RuntimeService();
+		}
+		return runtimeService;
+	}
+
+	/**
+	 * Registers an {@link IStatemachine} for scheduled fixed rate execution
+	 *
+	 * @param statemachine
+	 *            - The state machine to execute
+	 * @param cyclePeriod
+	 *            - the fixed rate cycle period for scheduling
+	 * @return {@code true} if state machine is added properly.
+	 */
+	public boolean registerStatemachine(IStatemachine statemachine,
+			long cyclePeriod) {
+
+		if (timerTasks.containsKey(cyclePeriod)) {
+			// TimerTask for cycle time already existing -> add state machine
+			return timerTasks.get(cyclePeriod).addStatemachine(statemachine);
+		} else {
+			// Create new TimerTask for cycle period and add state machine
+			StatemachineTimerTask timerTask = new StatemachineTimerTask();
+			timerTasks.put(cyclePeriod, timerTask);
+			boolean ret = timerTask.addStatemachine(statemachine);
+			// Create a new Timer instance if runtime service was cancelled
+			// before
+			if (timer == null) {
+				timer = new Timer();
+			}
+			timer.scheduleAtFixedRate(timerTask, 0, cyclePeriod);
+			return ret;
+		}
+	}
+
+	/**
+	 * Removes the given state machine from runtime service.
+	 *
+	 * @param statemachine
+	 *            - the state machine to be removed
+	 * @param cyclePeriod
+	 *            - the scheduling cycle period of the state machine
+	 * @return {@code true} if state machine is removed properly.
+	 */
+	public boolean unregisterStatemachine(IStatemachine statemachine,
+			long cyclePeriod) {
+		if (timerTasks.containsKey(cyclePeriod)) {
+			boolean ret = timerTasks.get(cyclePeriod).removeStatemachine(
+					statemachine);
+
+			return ret;
+		}
+		return false;
+	}
+
+	/**
+	 * Cancels the execution of state machines for the given cycle period. This
+	 * stops the execution of state machines which are registered for the given
+	 * cycle period and cancels the executing {@link TimerTask}.
+	 *
+	 * @return {@code true} if poperly cancelled
+	 */
+	public boolean cancelAll(long cyclePeriod) {
+		if (timer != null && timerTasks.containsKey(cyclePeriod)) {
+			TimerTask task = timerTasks.get(cyclePeriod);
+			task.cancel();
+			timer.purge();
+			timerTasks.remove(cyclePeriod);
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Pauses the execution of all state machines which are registered for the
+	 * given cyclePeriod.
+	 *
+	 * @param cyclePeriod
+	 * @return {@code true} if properly paused
+	 *
+	 */
+	public boolean pauseAll(long cyclePeriod) {
+		if (timerTasks.containsKey(cyclePeriod)) {
+			timerTasks.get(cyclePeriod).pause();
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Resumes the execution of all state machines which are registered for the
+	 * given cyclePeriod.
+	 *
+	 * @param cyclePeriod
+	 * @return {@code true} if properly resumed
+	 *
+	 */
+	public boolean resumeAll(long cyclePeriod) {
+		if (timerTasks.containsKey(cyclePeriod)) {
+			timerTasks.get(cyclePeriod).resume();
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Cancels the execution of all registered state machines. This cancels the
+	 * executing {@link Timer} freeing all allocated resources and terminates
+	 * all existing execution threads.
+	 */
+	public void cancelTimer() {
+		if (timer != null) {
+			timer.cancel();
+			timer.purge();
+			timerTasks.clear();
+			timer = null;
+		}
+	}
+}

+ 115 - 0
traffic_light_timer_simulation/src-gen/traffic/light/TimerService.java

@@ -0,0 +1,115 @@
+package traffic.light;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * Default timer service implementation.
+ *
+ */
+public class TimerService implements ITimer {
+
+	private final Timer timer = new Timer();
+	
+	private final List<TimeEventTask> timerTaskList = new ArrayList<TimeEventTask>();
+	
+	private final Lock lock = new ReentrantLock();
+	
+	/**
+	 * Timer task that reflects a time event. It's internally used by
+	 * {@link TimerService}.
+	 *
+	 */
+	private class TimeEventTask extends TimerTask {
+	
+		private ITimerCallback callback;
+	
+		int eventID;
+	
+		/**
+		 * Constructor for a time event.
+		 *
+		 * @param callback
+		 *            : Object that implements ITimerCallback, is called
+		 *            when the timer expires.
+		 *
+		 * @param eventID
+		 *            : Index position within the state machine's timeEvent
+		 *            array.
+		 */
+		public TimeEventTask(ITimerCallback callback, int eventID) {
+			this.callback = callback;
+			this.eventID = eventID;
+		}
+	
+		public void run() {
+			callback.timeElapsed(eventID);
+		}
+		
+		@Override
+		public boolean equals(Object obj) {
+			if (obj instanceof TimeEventTask) {
+				return ((TimeEventTask) obj).callback.equals(callback)
+						&& ((TimeEventTask) obj).eventID == eventID;
+			}
+			return super.equals(obj);
+		}
+		
+		@Override
+		public int hashCode() {
+			int prime = 37;
+			int result = 1;
+			
+			int c = (int) this.eventID;
+			result = prime * result + c;
+			c = this.callback.hashCode();
+			result = prime * result + c;
+			return result;
+		}
+		
+	}
+	
+	public void setTimer(final ITimerCallback callback, final int eventID,
+			long time, boolean isPeriodic) {
+	
+		// Create a new TimerTask for given event and store it.
+		TimeEventTask timerTask = new TimeEventTask(callback, eventID);
+		lock.lock();
+		timerTaskList.add(timerTask);
+	
+		// start scheduling the timer
+		if (isPeriodic) {
+			timer.scheduleAtFixedRate(timerTask, time, time);
+		} else {
+			timer.schedule(timerTask, time);
+		}
+		lock.unlock();
+	}
+	
+	public void unsetTimer(ITimerCallback callback, int eventID) {
+		lock.lock();
+		int index = timerTaskList.indexOf(new TimeEventTask(callback, eventID));
+		if (index != -1) {
+			timerTaskList.get(index).cancel();
+			timer.purge();
+			timerTaskList.remove(index);
+		}
+		lock.unlock();
+	}
+	
+	/**
+	 * Cancel timer service. Use this to end possible timing threads and free
+	 * memory resources.
+	 */
+	public void cancel() {
+		lock.lock();
+		timer.cancel();
+		timer.purge();
+		lock.unlock();
+	}
+}
+

+ 63 - 0
traffic_light_timer_simulation/src-gen/traffic/light/trafficlightctrl/ITrafficLightCtrlStatemachine.java

@@ -0,0 +1,63 @@
+package traffic.light.trafficlightctrl;
+
+import java.util.List;
+import traffic.light.IStatemachine;
+import traffic.light.ITimerCallback;
+
+public interface ITrafficLightCtrlStatemachine extends ITimerCallback,IStatemachine {
+
+	public interface SCInterface {
+	
+		public void raisePolice_interrupt();
+		
+		public void raiseToggle();
+		
+	}
+	
+	public SCInterface getSCInterface();
+	
+	public interface SCITrafficLight {
+	
+		public boolean isRaisedDisplayRed();
+		
+		public boolean isRaisedDisplayGreen();
+		
+		public boolean isRaisedDisplayYellow();
+		
+		public boolean isRaisedDisplayNone();
+		
+	public List<SCITrafficLightListener> getListeners();
+	}
+	
+	public interface SCITrafficLightListener {
+	
+		public void onDisplayRedRaised();
+		public void onDisplayGreenRaised();
+		public void onDisplayYellowRaised();
+		public void onDisplayNoneRaised();
+		}
+	
+	public SCITrafficLight getSCITrafficLight();
+	
+	public interface SCITimer {
+	
+		public boolean isRaisedUpdateColor();
+		
+		public String getUpdateColorValue();
+		
+		public boolean isRaisedUpdateCounter();
+		
+		public long getUpdateCounterValue();
+		
+	public List<SCITimerListener> getListeners();
+	}
+	
+	public interface SCITimerListener {
+	
+		public void onUpdateColorRaised(String value);
+		public void onUpdateCounterRaised(long value);
+		}
+	
+	public SCITimer getSCITimer();
+	
+}

+ 252 - 0
traffic_light_timer_simulation/src-gen/traffic/light/trafficlightctrl/SynchronizedTrafficLightCtrlStatemachine.java

@@ -0,0 +1,252 @@
+package traffic.light.trafficlightctrl;
+import java.util.List;
+
+import traffic.light.ITimer;
+import traffic.light.ITimerCallback;
+import traffic.light.trafficlightctrl.TrafficLightCtrlStatemachine.State;
+
+/**
+ * Runnable wrapper of TrafficLightCtrlStatemachine. This wrapper provides a thread-safe
+ * instance of the state machine.
+ * 
+ * Please report bugs and issues...
+ */
+
+public class SynchronizedTrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachine {
+	
+	/**
+	 * The core state machine is simply wrapped and the event processing will be
+	 * delegated to that state machine instance. This instance will be created
+	 * implicitly.
+	 */
+	protected TrafficLightCtrlStatemachine statemachine = new TrafficLightCtrlStatemachine();
+	
+	/**
+	 * Interface object for SCInterface
+	 */		
+	protected class SynchronizedSCInterface implements SCInterface {
+		
+		public void raisePolice_interrupt() {
+			
+			synchronized (statemachine) {
+				statemachine.getSCInterface().raisePolice_interrupt();
+				statemachine.runCycle();
+			}
+		}
+		
+		public void raiseToggle() {
+			
+			synchronized (statemachine) {
+				statemachine.getSCInterface().raiseToggle();
+				statemachine.runCycle();
+			}
+		}
+		
+	};
+	
+	protected SCInterface sCInterface;
+	
+	/**
+	 * Interface object for SCITrafficLight
+	 */		
+	protected class SynchronizedSCITrafficLight implements SCITrafficLight {
+		
+		public List<SCITrafficLightListener> getListeners() {
+			synchronized(statemachine) {
+				return statemachine.getSCITrafficLight().getListeners();
+			}
+		}
+		
+		public boolean isRaisedDisplayRed() {
+			synchronized(statemachine) {
+				return statemachine.getSCITrafficLight().isRaisedDisplayRed();
+			}
+		}
+		
+		public boolean isRaisedDisplayGreen() {
+			synchronized(statemachine) {
+				return statemachine.getSCITrafficLight().isRaisedDisplayGreen();
+			}
+		}
+		
+		public boolean isRaisedDisplayYellow() {
+			synchronized(statemachine) {
+				return statemachine.getSCITrafficLight().isRaisedDisplayYellow();
+			}
+		}
+		
+		public boolean isRaisedDisplayNone() {
+			synchronized(statemachine) {
+				return statemachine.getSCITrafficLight().isRaisedDisplayNone();
+			}
+		}
+		
+	};
+	
+	protected SCITrafficLight sCITrafficLight;
+	
+	/**
+	 * Interface object for SCITimer
+	 */		
+	protected class SynchronizedSCITimer implements SCITimer {
+		
+		public List<SCITimerListener> getListeners() {
+			synchronized(statemachine) {
+				return statemachine.getSCITimer().getListeners();
+			}
+		}
+		
+		public boolean isRaisedUpdateColor() {
+			synchronized(statemachine) {
+				return statemachine.getSCITimer().isRaisedUpdateColor();
+			}
+		}
+		
+		public String getUpdateColorValue() {
+			synchronized(statemachine) {
+				return statemachine.getSCITimer().getUpdateColorValue();
+			}
+		}
+		public boolean isRaisedUpdateCounter() {
+			synchronized(statemachine) {
+				return statemachine.getSCITimer().isRaisedUpdateCounter();
+			}
+		}
+		
+		public long getUpdateCounterValue() {
+			synchronized(statemachine) {
+				return statemachine.getSCITimer().getUpdateCounterValue();
+			}
+		}
+	};
+	
+	protected SCITimer sCITimer;
+	
+	public SynchronizedTrafficLightCtrlStatemachine() {
+		sCInterface = new SynchronizedSCInterface();
+		sCITrafficLight = new SynchronizedSCITrafficLight();
+		sCITimer = new SynchronizedSCITimer();
+	}
+	
+	public synchronized SCInterface getSCInterface() {
+		return sCInterface;
+	}
+	public synchronized SCITrafficLight getSCITrafficLight() {
+		return sCITrafficLight;
+	}
+	public synchronized SCITimer getSCITimer() {
+		return sCITimer;
+	}
+	/*================ TIME EVENT HANDLING ================
+	
+	/** An external timer instance is required. */
+	protected ITimer externalTimer;
+	
+	/** Internally we use a timer proxy that queues time events together with other input events. */
+	protected ITimer timerProxy = new ITimer() {
+		/** Simply delegate to external timer with a modified callback. */
+		@Override
+		public void setTimer(ITimerCallback callback, int eventID, long time,
+				boolean isPeriodic) {
+			externalTimer.setTimer(SynchronizedTrafficLightCtrlStatemachine.this, eventID, time, isPeriodic);
+		}
+		
+		@Override
+		public void unsetTimer(ITimerCallback callback, int eventID) {
+			externalTimer.unsetTimer(SynchronizedTrafficLightCtrlStatemachine.this, eventID);
+		}
+	};
+	
+	/**
+	 * Set the {@link ITimer} for the state machine. It must be set externally
+	 * on a timed state machine before a run cycle can be correct executed.
+	 * 
+	 * @param timer
+	 */
+	public void setTimer(ITimer timer) {
+		synchronized(statemachine) {
+			this.externalTimer = timer;
+			/* the wrapped state machine uses timer proxy as timer */
+			statemachine.setTimer(timerProxy);
+		}
+	}
+	
+	/**
+	* Returns the currently used timer.
+	* 
+	* @return {@link ITimer}
+	*/
+	public ITimer getTimer() {
+		return externalTimer;
+	}
+	
+	public void timeElapsed(int eventID) {
+		synchronized (statemachine) {
+			statemachine.timeElapsed(eventID);
+		}
+	}
+	
+	/**
+	 * init() will be delegated thread-safely to the wrapped state machine.
+	 */
+	public void init() {
+		synchronized(statemachine) {
+			statemachine.init();
+		}
+	}
+	
+	/**
+	 * enter() will be delegated thread-safely to the wrapped state machine.
+	 */
+	public void enter() {
+		synchronized(statemachine) {
+			statemachine.enter();
+		}
+	}
+	
+	/**
+	 * exit() will be delegated thread-safely to the wrapped state machine.
+	 */
+	public void exit() {
+		synchronized(statemachine) {
+			statemachine.exit();
+		}
+	}
+	
+	/**
+	 * isActive() will be delegated thread-safely to the wrapped state machine.
+	 */
+	public boolean isActive() {
+		synchronized(statemachine) {
+			return statemachine.isActive();
+		}
+	}
+	
+	/**
+	 * isFinal() will be delegated thread-safely to the wrapped state machine.
+	 */
+	public boolean isFinal() {
+		synchronized(statemachine) {
+			return statemachine.isFinal();
+		}
+	}
+	
+	/**
+	 * isStateActive() will be delegated thread-safely to the wrapped state machine.
+	 */
+	public boolean isStateActive(State state) {
+		synchronized(statemachine) {
+			return statemachine.isStateActive(state);
+		}
+	}
+	
+	/**
+	 * runCycle() will be delegated thread-safely to the wrapped state machine.
+	 */ 
+	@Override
+	public void runCycle() {
+		synchronized (statemachine) {
+			statemachine.runCycle();
+		}
+	}
+}

文件差异内容过多而无法显示
+ 1250 - 0
traffic_light_timer_simulation/src-gen/traffic/light/trafficlightctrl/TrafficLightCtrlStatemachine.java


+ 51 - 0
traffic_light_timer_simulation/src/traffic/light/ButtonPanel.java

@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2016 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 traffic.light;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JButton;
+import javax.swing.JPanel;
+
+/**
+ * 
+ * @author Tesch
+ *
+ */
+
+public class ButtonPanel extends JPanel {
+
+	private static final long serialVersionUID = 1L;
+	private JButton policeInterrupt;
+	private JButton switchOnOff;
+
+	public ButtonPanel() {
+		createContents();
+	}
+
+	private void createContents() {
+		switchOnOff = new JButton();
+		switchOnOff.setText("ON/OFF");
+		policeInterrupt = new JButton();
+		policeInterrupt.setText("POLICE INTERRUPT");
+		add(BorderLayout.SOUTH, switchOnOff);
+		add(BorderLayout.SOUTH, policeInterrupt);
+	}
+
+	public JButton getSwitchOnOff() {
+		return switchOnOff;
+	}
+
+	public JButton getPoliceInterrupt() {
+		return policeInterrupt;
+	}
+
+}

+ 220 - 0
traffic_light_timer_simulation/src/traffic/light/Counter.java

@@ -0,0 +1,220 @@
+/**
+ * Copyright (c) 2016 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 traffic.light;
+
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+import javax.swing.JPanel;
+
+/**
+ * 
+ * @author Tesch
+ *
+ */
+
+public class Counter extends JPanel {
+
+	private long counterValue = -1;
+
+	private BufferedImage emptyCounter;
+	private BufferedImage verticalBar;
+	private BufferedImage horizontalBar;
+	private BufferedImage verticalBarGreen;
+	private BufferedImage horizontalBarGreen;
+	private Color color;
+	
+	private static final long serialVersionUID = 1L;
+	
+	public enum Color {
+		GREEN,
+		RED;
+	}
+	
+	public Counter() {
+		try {
+			emptyCounter = ImageIO.read(new File("images/counter_empty.png"));
+			verticalBar = ImageIO.read(new File("images/vertical_bar.png"));
+			horizontalBar = ImageIO.read(new File("images/horizontal_bar.png"));
+			verticalBarGreen = ImageIO.read(new File("images/vertical_bar_green.png"));
+			horizontalBarGreen = ImageIO.read(new File("images/horizontal_bar_green.png"));
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+	public long getCounterValue() {
+		return counterValue;
+	}
+
+	public void setCounterValue(long counterValue) {
+		this.counterValue = counterValue;
+	}
+	
+	public void setColor(Color color) {
+		this.color = color;
+	}
+	
+	public Color getColor() {
+		return color;
+	}
+	
+	private void upperRight(Graphics graphics, boolean left) {
+		int x = 158;
+		if (left) {
+			x -= 55;
+		}
+		int y = 407;
+		graphics.drawImage(this.color == Color.RED ? verticalBar : verticalBarGreen, x, y, null);
+	}
+	
+	private void lowerRight(Graphics graphics, boolean left) {
+		int x = 153;
+		if (left) {
+			x -= 55;
+		}
+		int y = 435;
+		graphics.drawImage(this.color == Color.RED ? verticalBar : verticalBarGreen, x, y, null);
+	}
+	
+	private void upperLeft(Graphics graphics, boolean left) {
+		int x = 128;
+		if (left) {
+			x -= 55;
+		}
+		int y = 407;
+		graphics.drawImage(this.color == Color.RED ? verticalBar : verticalBarGreen, x, y, null);
+	}
+
+	private void lowerLeft(Graphics graphics, boolean left) {
+		int x = 123;
+		if (left) {
+			x -= 55;
+		}
+		int y = 435;
+		graphics.drawImage(this.color == Color.RED ? verticalBar : verticalBarGreen, x, y, null);
+	}
+
+	private void top(Graphics graphics, boolean left) {
+		int x = 134;
+		if (left) {
+			x -= 55;
+		}
+		int y = 405;
+		graphics.drawImage(this.color == Color.RED ? horizontalBar : horizontalBarGreen, x, y, null);
+	}
+
+	private void mid(Graphics graphics, boolean left) {
+		int x = 130;
+		if (left) {
+			x -= 55;
+		}
+		int y = 433;
+		graphics.drawImage(this.color == Color.RED ? horizontalBar : horizontalBarGreen, x, y, null);
+	}
+
+	private void bot(Graphics graphics, boolean left) {
+		int x = 126;
+		if (left) {
+			x -= 55;
+		}
+		int y = 459;
+		graphics.drawImage(this.color == Color.RED ? horizontalBar : horizontalBarGreen, x, y, null);
+	}
+	
+	private void paintNumber(int value, Graphics graphics, boolean left) {		
+		switch (value) {
+			case 0:
+				this.top(graphics, left);
+				this.upperRight(graphics, left);
+				this.lowerRight(graphics, left);
+				this.upperLeft(graphics, left);
+				this.lowerLeft(graphics, left);
+				this.bot(graphics, left);
+				break;
+			case 1:
+				this.upperRight(graphics, left);
+				this.lowerRight(graphics, left);
+				break;
+			case 2:
+				this.top(graphics, left);
+				this.upperRight(graphics, left);
+				this.mid(graphics, left);
+				this.lowerLeft(graphics, left);
+				this.bot(graphics, left);
+				break;
+			case 3:
+				this.top(graphics, left);
+				this.upperRight(graphics, left);
+				this.mid(graphics, left);
+				this.lowerRight(graphics, left);
+				this.bot(graphics, left);
+				break;
+			case 4:
+				this.upperLeft(graphics, left);
+				this.mid(graphics, left);
+				this.upperRight(graphics, left);
+				this.lowerRight(graphics, left);
+				break;
+			case 5:
+				this.top(graphics, left);
+				this.upperLeft(graphics, left);
+				this.mid(graphics, left);
+				this.lowerRight(graphics, left);
+				this.bot(graphics, left);
+				break;
+			case 6:
+				this.upperLeft(graphics, left);
+				this.lowerLeft(graphics, left);
+				this.mid(graphics, left);
+				this.bot(graphics, left);
+				this.lowerRight(graphics, left);
+				break;
+			case 7:
+				this.top(graphics, left);
+				this.upperRight(graphics, left);
+				this.lowerRight(graphics, left);
+				break;
+			case 8:
+				this.top(graphics, left);
+				this.mid(graphics, left);
+				this.bot(graphics, left);
+				this.upperRight(graphics, left);
+				this.lowerRight(graphics, left);
+				this.upperLeft(graphics, left);
+				this.lowerLeft(graphics, left);
+				break;
+			case 9:
+				this.top(graphics, left);
+				this.mid(graphics, left);
+				this.upperRight(graphics, left);
+				this.lowerRight(graphics, left);
+				this.upperLeft(graphics, left);
+		}
+	}
+
+	@Override
+	public void paint(Graphics graphics) {
+		graphics.drawImage(emptyCounter, 65, 400, null);
+		
+		if (counterValue >= 0) {
+			int leftValue = (int) counterValue / 10;
+			int rightValue = (int) counterValue % 10;
+			
+			this.paintNumber(leftValue, graphics, true);
+			this.paintNumber(rightValue, graphics, false);
+		}
+	}
+
+}

+ 40 - 0
traffic_light_timer_simulation/src/traffic/light/CrossWalkPanel.java

@@ -0,0 +1,40 @@
+package traffic.light;
+
+import java.awt.Graphics;
+
+import javax.swing.JPanel;
+
+public class CrossWalkPanel extends JPanel {
+
+	private static final long serialVersionUID = -7137708533029709629L;
+	protected TrafficLight trafficLight;
+	protected Counter counter;
+	
+	public CrossWalkPanel() {
+		super();
+		trafficLight = new TrafficLight();
+		counter = new Counter();
+	}
+	
+	public TrafficLight getTrafficLight() {
+		return trafficLight;
+	}
+	
+	public Counter getCounter() {
+		return counter;
+	}
+
+	public void paint(Graphics g) {
+		paintTrafficLight(g);
+		paintCounter(g);
+		g.dispose();
+	}
+
+	protected void paintTrafficLight(Graphics g) {
+		trafficLight.paint(g);
+	}
+
+	protected void paintCounter(Graphics g) {
+		counter.paint(g);
+	}
+}

+ 151 - 0
traffic_light_timer_simulation/src/traffic/light/MyTimerService.java

@@ -0,0 +1,151 @@
+package traffic.light;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * Default timer service implementation.
+ *
+ */
+public class MyTimerService implements ITimer {
+
+	private final Timer timer = new Timer();
+	
+	private final List<TimeEventTask> timerTaskList = new ArrayList<TimeEventTask>();
+	
+	private final Lock lock = new ReentrantLock();
+	
+	private double realtime_scale = 1.0;
+	private long start_time = -1;
+	private long simulated_time = 0;
+	
+	public MyTimerService(double realtime_scale) {
+		this.realtime_scale = realtime_scale;
+		this.simulated_time = 0;
+	}
+	public MyTimerService() {}
+	
+	private void init() {
+		start_time = System.currentTimeMillis();
+	}
+	
+	/**
+	 * Timer task that reflects a time event. It's internally used by
+	 * {@link TimerService}.
+	 *
+	 */
+	private class TimeEventTask extends TimerTask {
+	
+		private ITimerCallback callback;
+	
+		int eventID;
+		
+		long next_time;
+	
+		/**
+		 * Constructor for a time event.
+		 *
+		 * @param callback
+		 *            : Object that implements ITimerCallback, is called
+		 *            when the timer expires.
+		 *
+		 * @param eventID
+		 *            : Index position within the state machine's timeEvent
+		 *            array.
+		 */
+		public TimeEventTask(ITimerCallback callback, int eventID, long next_time) {
+			this.callback = callback;
+			this.eventID = eventID;
+			this.next_time = next_time;
+		}
+		public TimeEventTask(ITimerCallback callback, int eventID) {
+			this(callback, eventID, 0);
+		}
+	
+		public void run() {
+			callback.timeElapsed(eventID);
+			MyTimerService.this.simulated_time = next_time;
+			// System.out.println("Executed at " +  (System.currentTimeMillis() - start_time));
+		}
+		
+		@Override
+		public boolean equals(Object obj) {
+			if (obj instanceof TimeEventTask) {
+				return ((TimeEventTask) obj).callback.equals(callback)
+						&& ((TimeEventTask) obj).eventID == eventID;
+			}
+			return super.equals(obj);
+		}
+		
+		@Override
+		public int hashCode() {
+			int prime = 37;
+			int result = 1;
+			
+			int c = (int) this.eventID;
+			result = prime * result + c;
+			c = this.callback.hashCode();
+			result = prime * result + c;
+			return result;
+		}
+		
+	}
+	
+	public void setTimer(final ITimerCallback callback, final int eventID,
+			long delay, boolean isPeriodic) {
+		
+		if (start_time == -1) {
+			// initialize if not already done
+			init();
+		} else if (timerTaskList.size() == 0) {
+			// if initialized and no delays present, then this timer was added right after an external interrupt. In that case: set simulated time by scaling from the wall-clock time.
+			simulated_time = (long) ((System.currentTimeMillis() - start_time) * realtime_scale);
+		}
+		
+		// create a new TimerTask for given event and store it.
+		TimeEventTask timerTask = new TimeEventTask(callback, eventID, simulated_time + delay);
+		lock.lock();
+		timerTaskList.add(timerTask);
+	
+		// start scheduling the timer
+		if (isPeriodic) {
+			timer.scheduleAtFixedRate(timerTask, (long) (delay / realtime_scale), (long) (delay / realtime_scale));
+		} else {			
+			long curr_wc_time = System.currentTimeMillis() - start_time;
+			long diff = (long) ((delay / realtime_scale) - curr_wc_time + (simulated_time / realtime_scale));
+			//System.out.println("WCT = " + curr_wc_time);
+			//System.out.println("ST = " + simulated_time);
+			//System.out.println("Scheduling at " + String.valueOf(curr_wc_time + Long.max(0, diff)));
+			//System.out.println("Delay = " + Long.max(0, diff));
+			timer.schedule(timerTask, Long.max(0, diff));
+		}
+		lock.unlock();
+	}
+	
+	public void unsetTimer(ITimerCallback callback, int eventID) {
+		lock.lock();
+		int index = timerTaskList.indexOf(new TimeEventTask(callback, eventID));
+		if (index != -1) {
+			timerTaskList.get(index).cancel();
+			timer.purge();
+			timerTaskList.remove(index);
+		}
+		lock.unlock();
+	}
+	
+	/**
+	 * Cancel timer service. Use this to end possible timing threads and free
+	 * memory resources.
+	 */
+	public void cancel() {
+		lock.lock();
+		timer.cancel();
+		timer.purge();
+		lock.unlock();
+	}
+}
+

+ 88 - 0
traffic_light_timer_simulation/src/traffic/light/TrafficLight.java

@@ -0,0 +1,88 @@
+/**
+ * Copyright (c) 2016 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 traffic.light;
+
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+import javax.swing.JPanel;
+
+/**
+ * 
+ * @author Tesch
+ *
+ */
+
+public class TrafficLight extends JPanel {
+
+	private boolean red = false;
+	private boolean yellow = false;
+	private boolean green = false;
+	private BufferedImage trafficLight;
+	private BufferedImage redLight;
+	private BufferedImage greenLight;
+	private BufferedImage yellowLight;
+	
+	public TrafficLight() {
+		try {
+			trafficLight = ImageIO.read(new File("images/trafficlight_empty.jpg"));
+			redLight = ImageIO.read(new File("images/red_light.png"));
+			greenLight = ImageIO.read(new File("images/green_light.png"));
+			yellowLight = ImageIO.read(new File("images/yellow_light.png"));
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+	public boolean isRed() {
+		return red;
+	}
+
+	public void setRed(boolean red) {
+		this.red = red;
+	}
+
+	public boolean isYellow() {
+		return yellow;
+	}
+
+	public void setYellow(boolean yellow) {
+		this.yellow = yellow;
+	}
+
+	public boolean isGreen() {
+		return green;
+	}
+
+	public void setGreen(boolean green) {
+		this.green = green;
+	}
+
+	private static final long serialVersionUID = 1L;
+
+	@Override
+	public void paint(Graphics graphics) {
+		graphics.drawImage(trafficLight, 25, 25, null);
+		if (green) {
+			graphics.drawImage(greenLight, 26, 236, null);
+		}
+		if (red) {
+			graphics.drawImage(redLight, 25, 25, null);
+		}
+		if (yellow) {
+			graphics.drawImage(yellowLight, 26, 140, null);
+		}
+	}
+
+}

+ 116 - 0
traffic_light_timer_simulation/src/traffic/light/TrafficlightDemo.java

@@ -0,0 +1,116 @@
+package traffic.light;
+
+import java.awt.BorderLayout;
+import java.awt.Graphics;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.JFrame;
+
+import traffic.light.Counter.Color;
+import traffic.light.trafficlightctrl.ITrafficLightCtrlStatemachine;
+import traffic.light.trafficlightctrl.SynchronizedTrafficLightCtrlStatemachine;
+
+public class TrafficlightDemo extends JFrame {
+
+	private static final long serialVersionUID = -8909693541678814631L;
+
+	protected SynchronizedTrafficLightCtrlStatemachine statemachine;
+
+	protected MyTimerService timer;
+
+	private CrossWalkPanel crossing;
+
+	private ButtonPanel buttonPanel;
+
+	public static void main(String[] args) {
+		TrafficlightDemo application = new TrafficlightDemo();
+		application.addWindowListener(new WindowAdapter() {			
+			@Override
+			public void windowClosing(WindowEvent e) {
+				System.exit(0);
+			}
+		});
+		application.createContents();
+		application.setupStatemachine();
+		application.run();
+	}
+
+	protected void run() {
+		statemachine.enter();
+		RuntimeService.getInstance().registerStatemachine(statemachine, 1);
+	}
+
+	protected void createContents() {
+		setLayout(new BorderLayout());
+		setTitle("Trafficlight");
+		crossing = new CrossWalkPanel();
+		add(BorderLayout.CENTER, crossing);
+		buttonPanel = new ButtonPanel();
+		add(BorderLayout.SOUTH, buttonPanel);
+		setSize(250, 550);
+		setVisible(true);
+	}
+
+	@Override
+	public void paint(Graphics g) {
+		super.paint(g);
+	}
+
+	protected void setupStatemachine() {
+		statemachine = new SynchronizedTrafficLightCtrlStatemachine();
+		timer = new MyTimerService(1.0);
+		statemachine.setTimer(timer);
+		
+		statemachine.getSCITrafficLight().getListeners().add(new ITrafficLightCtrlStatemachine.SCITrafficLightListener() {			
+			@Override
+			public void onDisplayYellowRaised() {
+				setCarLights(false, true, false);
+			}
+			
+			@Override
+			public void onDisplayRedRaised() {
+				setCarLights(true, false, false);
+			}
+			
+			@Override
+			public void onDisplayNoneRaised() {
+				setCarLights(false, false, false);
+			}
+			
+			@Override
+			public void onDisplayGreenRaised() {
+				setCarLights(false, false, true);
+			}
+		});
+		
+		statemachine.getSCITimer().getListeners().add(new ITrafficLightCtrlStatemachine.SCITimerListener() {
+			
+			@Override
+			public void onUpdateCounterRaised(long value) {
+				crossing.getCounter().setCounterValue(value);
+				repaint();
+			}
+			
+			@Override
+			public void onUpdateColorRaised(String value) {
+				crossing.getCounter().setColor(value == "Red" ? Color.RED : Color.GREEN);
+			}
+		});
+		
+		buttonPanel.getPoliceInterrupt()
+				.addActionListener(e -> statemachine.getSCInterface().raisePolice_interrupt());
+		
+		buttonPanel.getSwitchOnOff()
+				.addActionListener(e -> statemachine.getSCInterface().raiseToggle());
+		
+		statemachine.init();
+	}
+	
+	private void setCarLights(boolean red, boolean yellow, boolean green) {
+		crossing.getTrafficLight().setRed(red);
+		crossing.getTrafficLight().setYellow(yellow);
+		crossing.getTrafficLight().setGreen(green);
+		repaint();
+	}
+}

+ 6 - 6
traffic_light_with_interrupts/model/TrafficLightCtrl.sct

@@ -1,29 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:sgraph="http://www.yakindu.org/sct/sgraph/2.0.0">
-  <sgraph:Statechart xmi:id="_NPjBgBA-EeGQ0KsLDV4EFg" specification="interface:&#xD;&#xA;  in event police&#xD;&#xA;  out event displayRed&#xD;&#xA;  out event displayGreen&#xD;&#xA;  out event displayYellow&#xD;&#xA;  out event displayNone&#xD;&#xA;" name="TrafficLightCtrl">
+  <sgraph:Statechart xmi:id="_NPjBgBA-EeGQ0KsLDV4EFg" specification="interface:&#xD;&#xA;  in event police_interrupt&#xD;&#xA;  out event displayRed&#xD;&#xA;  out event displayGreen&#xD;&#xA;  out event displayYellow&#xD;&#xA;  out event displayNone&#xD;&#xA;" name="TrafficLightCtrl">
     <regions xmi:id="_NPjBgxA-EeGQ0KsLDV4EFg" name="main">
       <vertices xsi:type="sgraph:Entry" xmi:id="_rIjhEG9PEeaXwv4KCSuD6Q">
         <outgoingTransitions xmi:id="_2dvSoBU9Eeetu6TpqpTvnQ" specification="" target="_NPjBmBA-EeGQ0KsLDV4EFg"/>
       </vertices>
       <vertices xsi:type="sgraph:State" xmi:id="_NPjBmBA-EeGQ0KsLDV4EFg" name="normal" incomingTransitions="_2dvSoBU9Eeetu6TpqpTvnQ _byRQAB7JEeeMxp-88Ms92w">
-        <outgoingTransitions xmi:id="_j7FvcBVAEeetu6TpqpTvnQ" specification="police" target="_F7yDEBVAEeetu6TpqpTvnQ"/>
+        <outgoingTransitions xmi:id="_j7FvcBVAEeetu6TpqpTvnQ" specification="police_interrupt" target="_F7yDEBVAEeetu6TpqpTvnQ"/>
         <regions xmi:id="_vZz18BA_EeGQ0KsLDV4EFg" name="normal">
           <vertices xsi:type="sgraph:State" xmi:id="_K-JX7RBEEeGQ0KsLDV4EFg" specification="entry / raise displayYellow" name="Yellow" incomingTransitions="_I42jEBU-Eeetu6TpqpTvnQ">
-            <outgoingTransitions xmi:id="_KcvXsBU-Eeetu6TpqpTvnQ" specification="after 2s" target="_wI4T0PqBEeW6VYxAee_Daw"/>
+            <outgoingTransitions xmi:id="_KcvXsBU-Eeetu6TpqpTvnQ" specification="after 5s" target="_wI4T0PqBEeW6VYxAee_Daw"/>
           </vertices>
           <vertices xsi:type="sgraph:State" xmi:id="_TfjYTRBEEeGQ0KsLDV4EFg" specification="entry / raise displayGreen" name="Green" incomingTransitions="_G0eiAPqCEeW6VYxAee_Daw">
-            <outgoingTransitions xmi:id="_I42jEBU-Eeetu6TpqpTvnQ" specification="after 3s" target="_K-JX7RBEEeGQ0KsLDV4EFg"/>
+            <outgoingTransitions xmi:id="_I42jEBU-Eeetu6TpqpTvnQ" specification="after 55s" target="_K-JX7RBEEeGQ0KsLDV4EFg"/>
           </vertices>
           <vertices xsi:type="sgraph:Entry" xmi:id="_xz0nABBPEeGQ0KsLDV4EFg">
             <outgoingTransitions xmi:id="_yYuD0BBPEeGQ0KsLDV4EFg" target="_wI4T0PqBEeW6VYxAee_Daw"/>
           </vertices>
           <vertices xsi:type="sgraph:State" xmi:id="_wI4T0PqBEeW6VYxAee_Daw" specification="entry / raise displayRed" name="Red" incomingTransitions="_yYuD0BBPEeGQ0KsLDV4EFg _KcvXsBU-Eeetu6TpqpTvnQ">
-            <outgoingTransitions xmi:id="_G0eiAPqCEeW6VYxAee_Daw" specification="after 5s" target="_TfjYTRBEEeGQ0KsLDV4EFg"/>
+            <outgoingTransitions xmi:id="_G0eiAPqCEeW6VYxAee_Daw" specification="after 60s" target="_TfjYTRBEEeGQ0KsLDV4EFg"/>
           </vertices>
         </regions>
       </vertices>
       <vertices xsi:type="sgraph:State" xmi:id="_F7yDEBVAEeetu6TpqpTvnQ" name="interrupted" incomingTransitions="_j7FvcBVAEeetu6TpqpTvnQ">
-        <outgoingTransitions xmi:id="_byRQAB7JEeeMxp-88Ms92w" specification="police" target="_NPjBmBA-EeGQ0KsLDV4EFg"/>
+        <outgoingTransitions xmi:id="_byRQAB7JEeeMxp-88Ms92w" specification="police_interrupt" target="_NPjBmBA-EeGQ0KsLDV4EFg"/>
         <regions xmi:id="_F7z4QRVAEeetu6TpqpTvnQ" name="interrupted">
           <vertices xsi:type="sgraph:State" xmi:id="_F7z4QhVAEeetu6TpqpTvnQ" specification="entry / raise displayNone" name="Black" incomingTransitions="_UV144BVAEeetu6TpqpTvnQ">
             <outgoingTransitions xmi:id="_F70fZBVAEeetu6TpqpTvnQ" specification="after 1s" target="_F727kBVAEeetu6TpqpTvnQ"/>

+ 1 - 1
traffic_light_with_interrupts/src-gen/traffic/light/trafficlightctrl/ITrafficLightCtrlStatemachine.java

@@ -8,7 +8,7 @@ public interface ITrafficLightCtrlStatemachine extends ITimerCallback,IStatemach
 
 	public interface SCInterface {
 	
-		public void raisePolice();
+		public void raisePolice_interrupt();
 		
 		public boolean isRaisedDisplayRed();
 		

+ 2 - 2
traffic_light_with_interrupts/src-gen/traffic/light/trafficlightctrl/RunnableTrafficLightCtrlStatemachineWrapper.java

@@ -24,13 +24,13 @@ public class RunnableTrafficLightCtrlStatemachineWrapper extends SynchronizedTra
 	 * Interface object for SCInterface
 	 */		
 	protected SCInterface sCInterface = new SynchronizedSCInterface() {
-		public void raisePolice() {
+		public void raisePolice_interrupt() {
 			eventQueue.add( new Runnable() {
 				
 				@Override
 				public void run() {
 					synchronized (statemachine) {
-						statemachine.getSCInterface().raisePolice();
+						statemachine.getSCInterface().raisePolice_interrupt();
 						statemachine.runCycle();
 					}
 				}

+ 2 - 2
traffic_light_with_interrupts/src-gen/traffic/light/trafficlightctrl/SynchronizedTrafficLightCtrlStatemachine.java

@@ -32,10 +32,10 @@ public class SynchronizedTrafficLightCtrlStatemachine implements ITrafficLightCt
 			}
 		}
 		
-		public void raisePolice() {
+		public void raisePolice_interrupt() {
 			
 			synchronized (statemachine) {
-				statemachine.getSCInterface().raisePolice();
+				statemachine.getSCInterface().raisePolice_interrupt();
 				statemachine.runCycle();
 			}
 		}

+ 11 - 11
traffic_light_with_interrupts/src-gen/traffic/light/trafficlightctrl/TrafficLightCtrlStatemachine.java

@@ -12,10 +12,10 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 		public List<SCInterfaceListener> getListeners() {
 			return listeners;
 		}
-		private boolean police;
+		private boolean police_interrupt;
 		
-		public void raisePolice() {
-			police = true;
+		public void raisePolice_interrupt() {
+			police_interrupt = true;
 		}
 		
 		private boolean displayRed;
@@ -71,7 +71,7 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 		}
 		
 		protected void clearEvents() {
-			police = false;
+			police_interrupt = false;
 		}
 		protected void clearOutEvents() {
 		
@@ -223,8 +223,8 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 		return sCInterface;
 	}
 	
-	public void raisePolice() {
-		sCInterface.raisePolice();
+	public void raisePolice_interrupt() {
+		sCInterface.raisePolice_interrupt();
 	}
 	
 	public boolean isRaisedDisplayRed() {
@@ -244,7 +244,7 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 	}
 	
 	private boolean check_main_normal_tr0_tr0() {
-		return sCInterface.police;
+		return sCInterface.police_interrupt;
 	}
 	
 	private boolean check_main_normal_normal_Yellow_tr0_tr0() {
@@ -260,7 +260,7 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 	}
 	
 	private boolean check_main_interrupted_tr0_tr0() {
-		return sCInterface.police;
+		return sCInterface.police_interrupt;
 	}
 	
 	private boolean check_main_interrupted_interrupted_Black_tr0_tr0() {
@@ -308,21 +308,21 @@ public class TrafficLightCtrlStatemachine implements ITrafficLightCtrlStatemachi
 	
 	/* Entry action for state 'Yellow'. */
 	private void entryAction_main_normal_normal_Yellow() {
-		timer.setTimer(this, 0, 2 * 1000, false);
+		timer.setTimer(this, 0, 5 * 1000, false);
 		
 		sCInterface.raiseDisplayYellow();
 	}
 	
 	/* Entry action for state 'Green'. */
 	private void entryAction_main_normal_normal_Green() {
-		timer.setTimer(this, 1, 3 * 1000, false);
+		timer.setTimer(this, 1, 55 * 1000, false);
 		
 		sCInterface.raiseDisplayGreen();
 	}
 	
 	/* Entry action for state 'Red'. */
 	private void entryAction_main_normal_normal_Red() {
-		timer.setTimer(this, 2, 5 * 1000, false);
+		timer.setTimer(this, 2, 60 * 1000, false);
 		
 		sCInterface.raiseDisplayRed();
 	}