Explorar el Código

removed metaDepth

Simon Van Mierlo hace 9 años
padre
commit
99ebe87311

BIN
doc/_build/doctrees/environment.pickle


BIN
doc/_build/doctrees/installation.doctree


BIN
doc/_build/doctrees/new_language.doctree


BIN
doc/_build/doctrees/overview.doctree


+ 1 - 1
doc/_build/html/_sources/installation.txt

@@ -35,5 +35,5 @@ To install AToMPM on Mac, follow these steps:
 To run AToMPM on Mac, follow these steps:
 
 * Execute `node httpwsd.js` in the main AToMPM folder
-* Execute `python mt\main.py` in the main AToMPM folder
+* Execute `python mt\\main.py` in the main AToMPM folder
 * Open a browser (preferably Chrome) and navigate to http://localhost:8124/atompm

+ 2 - 1
doc/_build/html/_sources/new_language.txt

@@ -149,6 +149,7 @@ A class or association can have attributes. These attributes are represented by
     * *int*: an integer
     * *float*: a floating-point number
     * *string*: a string
+    * *boolean*: a boolean
     * *code*: a block of code
     * *file<pattern>*: a string which specifies the locatation of a file (such as a model). Attribute values have to match the specified pattern.
     * *map<[keys...], [base-types...]>*: a dictionary with specified keys, and for each key, a value of the specified base-type.
@@ -229,7 +230,7 @@ The events that can trigger are:
 * **post-delete**, which triggers just after an instance is deleted
 * **post-edit**, which triggers just after an instance is edited
 
-.. note:: A constraint without a trigger specified triggers when the user presses the *verify* button on the *MainMenu* toolbar.
+.. note:: A constraint without a trigger is evaluated when the user presses the *verify* button on the *MainMenu* toolbar.
 
 .. _action-library:
 

+ 1 - 3
doc/_build/html/_sources/overview.txt

@@ -179,8 +179,6 @@ When in the **DRAWING EDGE** state (*i.e.*, when dragging to-be edge from source
 
 .. |drawing_edge| image:: img/drawing_edge.png
     :class: inline-image
-    
-.. image:: img/drawing_edge.png
 
 .. rst-class:: table-with-borders
 
@@ -249,4 +247,4 @@ Console
 
 The developer console (press F12 in Chrome/Firefox) contains many useful debugging messages. Especially when :ref:`executing-a-model-transformation`, the console contains useful information on which rules were executed and whether they failed or succeeded.
     
-.. image:: img/console.png.
+.. image:: img/console.png

+ 1 - 1
doc/_build/html/installation.html

@@ -84,7 +84,7 @@
 <p>To run AToMPM on Mac, follow these steps:</p>
 <ul class="simple">
 <li>Execute <cite>node httpwsd.js</cite> in the main AToMPM folder</li>
-<li>Execute <cite>python mtmain.py</cite> in the main AToMPM folder</li>
+<li>Execute <cite>python mt\main.py</cite> in the main AToMPM folder</li>
 <li>Open a browser (preferably Chrome) and navigate to <a class="reference external" href="http://localhost:8124/atompm">http://localhost:8124/atompm</a></li>
 </ul>
 </div>

+ 2 - 1
doc/_build/html/new_language.html

@@ -175,6 +175,7 @@
 <li><em>int</em>: an integer</li>
 <li><em>float</em>: a floating-point number</li>
 <li><em>string</em>: a string</li>
+<li><em>boolean</em>: a boolean</li>
 <li><em>code</em>: a block of code</li>
 <li><em>file&lt;pattern&gt;</em>: a string which specifies the locatation of a file (such as a model). Attribute values have to match the specified pattern.</li>
 <li><em>map&lt;[keys...], [base-types...]&gt;</em>: a dictionary with specified keys, and for each key, a value of the specified base-type.</li>
@@ -242,7 +243,7 @@
 </ul>
 <div class="admonition note">
 <p class="first admonition-title">Note</p>
-<p class="last">A constraint without a trigger specified triggers when the user presses the <em>verify</em> button on the <em>MainMenu</em> toolbar.</p>
+<p class="last">A constraint without a trigger is evaluated when the user presses the <em>verify</em> button on the <em>MainMenu</em> toolbar.</p>
 </div>
 </div>
 <div class="section" id="action-library">

+ 1 - 2
doc/_build/html/overview.html

@@ -236,7 +236,6 @@ also be deleted manually if visible.</td>
 </tbody>
 </table>
 <p>When in the <strong>DRAWING EDGE</strong> state (<em>i.e.</em>, when dragging to-be edge from source to target entities), <img alt="drawing_edge" class="inline-image" src="_images/drawing_edge.png" /></p>
-<img alt="_images/drawing_edge.png" src="_images/drawing_edge.png" />
 <table border="1" class="table-with-borders docutils">
 <colgroup>
 <col width="34%" />
@@ -330,7 +329,7 @@ shape.</td>
 <div class="section" id="console">
 <h3>Console<a class="headerlink" href="#console" title="Permalink to this headline">¶</a></h3>
 <p>The developer console (press F12 in Chrome/Firefox) contains many useful debugging messages. Especially when <a class="reference internal" href="executing_transformation.html#executing-a-model-transformation"><span class="std std-ref">Executing a Model Transformation</span></a>, the console contains useful information on which rules were executed and whether they failed or succeeded.</p>
-<img alt="_images/console.png." src="_images/console.png." />
+<img alt="_images/console.png" src="_images/console.png" />
 </div>
 </div>
 </div>

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 1 - 1
doc/_build/html/searchindex.js


+ 1 - 1
doc/installation.rst

@@ -35,5 +35,5 @@ To install AToMPM on Mac, follow these steps:
 To run AToMPM on Mac, follow these steps:
 
 * Execute `node httpwsd.js` in the main AToMPM folder
-* Execute `python mt\main.py` in the main AToMPM folder
+* Execute `python mt\\main.py` in the main AToMPM folder
 * Open a browser (preferably Chrome) and navigate to http://localhost:8124/atompm

+ 2 - 1
doc/new_language.rst

@@ -149,6 +149,7 @@ A class or association can have attributes. These attributes are represented by
     * *int*: an integer
     * *float*: a floating-point number
     * *string*: a string
+    * *boolean*: a boolean
     * *code*: a block of code
     * *file<pattern>*: a string which specifies the locatation of a file (such as a model). Attribute values have to match the specified pattern.
     * *map<[keys...], [base-types...]>*: a dictionary with specified keys, and for each key, a value of the specified base-type.
@@ -229,7 +230,7 @@ The events that can trigger are:
 * **post-delete**, which triggers just after an instance is deleted
 * **post-edit**, which triggers just after an instance is edited
 
-.. note:: A constraint without a trigger specified triggers when the user presses the *verify* button on the *MainMenu* toolbar.
+.. note:: A constraint without a trigger is evaluated when the user presses the *verify* button on the *MainMenu* toolbar.
 
 .. _action-library:
 

+ 1 - 3
doc/overview.rst

@@ -179,8 +179,6 @@ When in the **DRAWING EDGE** state (*i.e.*, when dragging to-be edge from source
 
 .. |drawing_edge| image:: img/drawing_edge.png
     :class: inline-image
-    
-.. image:: img/drawing_edge.png
 
 .. rst-class:: table-with-borders
 
@@ -249,4 +247,4 @@ Console
 
 The developer console (press F12 in Chrome/Firefox) contains many useful debugging messages. Especially when :ref:`executing-a-model-transformation`, the console contains useful information on which rules were executed and whether they failed or succeeded.
     
-.. image:: img/console.png.
+.. image:: img/console.png

+ 0 - 330
users/(default)/Formalisms/TrafficLight/Translational/TrafficLightAll.py

@@ -1,330 +0,0 @@
-from Tkinter import *  
-
-class TrafficLightGUI(Frame):
-
-  def __init__(self, behaviour, master=None, title="TrafficLight"):
-
-    self.behaviour=behaviour
-
-    # Initialize superclass
-    Frame.__init__(self, master)
-
-    # parent frame, destruction protocol
-    self.root=master
-    self.root.protocol("WM_DELETE_WINDOW", self.wmQuit)
-
-    # Initialize packer
-    self.pack(fill=BOTH, expand=1)
-
-    # Create all widgets in the Frame
-    self.__createWidgets()
-
-
-  def __createWidgets(self):
-
-    self.root.configure(bg="black")
-#   self.root.pack(side=LEFT, fill=BOTH, expand=1)
-
-    Label(self.root, text="", bg="black", 
-          height=2, width=10).pack(side=TOP, padx = 2, pady=2)
-
-    self.redLight=Label(self.root, text="", bg="red",
-                        relief=GROOVE, height=5, width=10)
-    self.redLight.pack(side=TOP, padx = 2, pady=4)
-
-    self.yellowLight=Label(self.root, text="", bg="black",
-                           relief=GROOVE, height=5, width=10)
-    self.yellowLight.pack(side=TOP, padx = 2, pady=4)
-
-    self.greenLight=Label(self.root, text="", bg="black",
-                          relief=GROOVE, height=5, width=10)
-    self.greenLight.pack(side=TOP, padx = 2, pady=4)
-
-    Label(self.root, text="",bg="black",
-          height=5, width=10).pack(side=TOP,padx=2,pady=2)
-
-# Begin generated code
-
-    Button(self.root, text="PoliceInterrupt",
-          command=self.PoliceInterruptPressed, width=10, wraplength=70).pack(side=TOP, fill=Y, padx=5, pady=2)
-
-    Button(self.root, text="Quit",
-          command=self.QuitPressed, width=10, wraplength=70).pack(side=TOP, fill=Y, padx = 5, pady = 2)
-# End generated code
-
-  # binding with behaviour
-
-# Begin generated code
-  def PoliceInterruptPressed(self):
-    self.behaviour.event("PoliceInterrupt")
-
-  def QuitPressed(self):
-    self.behaviour.event("Quit")
-# End generated code
-  
-  def wmQuit(self):
-    self.root.destroy()
-
-  # the behaviour can call these methods to change the GUI
-
-  def setGreenOn(self):
-      self.greenLight["bg"] = "green"
-
-  def setGreenOff(self):
-      self.greenLight["bg"] = "black"
-
-  def setRedOn(self):
-      self.redLight["bg"] = "red"
-
-  def setRedOff(self):
-      self.redLight["bg"] = "black"
-
-  def setYellowOn(self):
-      self.yellowLight["bg"] = "yellow"
-
-  def setYellowOff(self):
-      self.yellowLight["bg"] = "black"
-
-import sys
-
-class TrafficLightBehaviour:
-
-  def __init__(self, scale=1):
-
-    self.scale = scale
-    self.currentState = None 
-
-    self.scheduledTIMEOUT = None
-
-  def initModel(self, gui):
-
-    self.gui = gui
-
-    # Begin generated code
-    self.initState = "red"
-    self.gui.setYellowOff()   
-    self.gui.setGreenOff()   
-    self.gui.setRedOn()   
-    # If the target state has an outgoing timed transition,
-    # upon entering that target state, a timeout needs to be scheduled.
-    # Keep track of scheduledTIMEOUT to be able to cancel it later if interrupted 
-    # before the timeout expires
-    self.scheduledTIMEOUT =  self.gui.after(self.scale*3000, self.eventTIMEOUT) 
-    # End generated code
-
-    self.currentState = self.initState
-
-  def eventTIMEOUT(self):
-    self.event("TIMEOUT")
-
-  def event(self, eventName):
-    # Note that below, setting coloured lights can be optimized by checking source
-    # and target light settings and only updating those lights that changed.
-    # In the following, the more naieve approach of re-setting all lights is taken.
-
-    # Remove a scheduled timeout, if any,
-    # to ensure that if we interrupted a transition scheduled in the future
-    # that scheduled transition is removed
-    if self.scheduledTIMEOUT is not None:
-      self.gui.after_cancel(self.scheduledTIMEOUT)
-      self.scheduledTIMEOUT = None
-    # Switch based on all states
-    if False:
-      pass
-    # for all states in the automaton 
-    # Begin generated code
-    elif self.currentState == "blinkYellow":
-      if False:      
-        pass
-      # For all transitions from this state
-      elif eventName == "Quit":
-        self.currentState = "quit" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOff()   
-        self.gui.setGreenOff()   
-        self.gui.setRedOff()   
-      elif eventName == "PoliceInterrupt":
-        self.currentState = "red" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOff()   
-        self.gui.setGreenOff()   
-        self.gui.setRedOn()   
-        # If the target state has an outgoing timed transition,
-        # upon entering that target state, a timeout needs to be scheduled.
-        # Keep track of scheduledTIMEOUT to be able to cancel it later if interrupted 
-        # before the timeout expires
-        self.scheduledTIMEOUT =  self.gui.after(self.scale*3000, self.eventTIMEOUT) 
-      elif eventName == "TIMEOUT": 
-        self.currentState = "blinkBlack" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOff()   
-        self.gui.setGreenOff()   
-        self.gui.setRedOff()   
-        # If the target state has an outgoing timed transition,
-        # upon entering that target state, a timeout needs to be scheduled.
-        # Keep track of scheduledTIMEOUT to be able to cancel it later if interrupted 
-        # before the timeout expires
-        self.scheduledTIMEOUT =  self.gui.after(self.scale*500, self.eventTIMEOUT) 
-      else:
-        print("ERROR: unexpected event %s received\n" % eventName) 
-        sys.exit(1)
-    elif self.currentState == "blinkBlack":
-      if False:      
-        pass
-      # For all transitions from this state
-      elif eventName == "Quit":
-        self.currentState = "quit" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOff()   
-        self.gui.setGreenOff()   
-        self.gui.setRedOff()   
-      elif eventName == "PoliceInterrupt":
-        self.currentState = "red" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOff()   
-        self.gui.setGreenOff()   
-        self.gui.setRedOn()   
-        # If the target state has an outgoing timed transition,
-        # upon entering that target state, a timeout needs to be scheduled.
-        # Keep track of scheduledTIMEOUT to be able to cancel it later if interrupted 
-        # before the timeout expires
-        self.scheduledTIMEOUT =  self.gui.after(self.scale*3000, self.eventTIMEOUT) 
-      elif eventName == "TIMEOUT": 
-        self.currentState = "blinkYellow" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOn()   
-        self.gui.setGreenOff()   
-        self.gui.setRedOff()   
-        # If the target state has an outgoing timed transition,
-        # upon entering that target state, a timeout needs to be scheduled.
-        # Keep track of scheduledTIMEOUT to be able to cancel it later if interrupted 
-        # before the timeout expires
-        self.scheduledTIMEOUT =  self.gui.after(self.scale*500, self.eventTIMEOUT) 
-      else:
-        print("ERROR: unexpected event %s received\n" % eventName) 
-        sys.exit(1)
-    elif self.currentState == "red":
-      if False:      
-        pass
-      # For all transitions from this state
-      elif eventName == "Quit":
-        self.currentState = "quit" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOff()   
-        self.gui.setGreenOff()   
-        self.gui.setRedOff()   
-      elif eventName == "PoliceInterrupt":
-        self.currentState = "blinkYellow" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOn()   
-        self.gui.setGreenOff()   
-        self.gui.setRedOff()   
-        # If the target state has an outgoing timed transition,
-        # upon entering that target state, a timeout needs to be scheduled.
-        # Keep track of scheduledTIMEOUT to be able to cancel it later if interrupted 
-        # before the timeout expires
-        self.scheduledTIMEOUT =  self.gui.after(self.scale*500, self.eventTIMEOUT) 
-      elif eventName == "TIMEOUT": 
-        self.currentState = "green" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOff()   
-        self.gui.setGreenOn()   
-        self.gui.setRedOff()   
-        # If the target state has an outgoing timed transition,
-        # upon entering that target state, a timeout needs to be scheduled.
-        # Keep track of scheduledTIMEOUT to be able to cancel it later if interrupted 
-        # before the timeout expires
-        self.scheduledTIMEOUT =  self.gui.after(self.scale*2000, self.eventTIMEOUT) 
-      else:
-        print("ERROR: unexpected event %s received\n" % eventName) 
-        sys.exit(1)
-    elif self.currentState == "green":
-      if False:      
-        pass
-      # For all transitions from this state
-      elif eventName == "Quit":
-        self.currentState = "quit" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOff()   
-        self.gui.setGreenOff()   
-        self.gui.setRedOff()   
-      elif eventName == "PoliceInterrupt":
-        self.currentState = "blinkYellow" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOn()   
-        self.gui.setGreenOff()   
-        self.gui.setRedOff()   
-        # If the target state has an outgoing timed transition,
-        # upon entering that target state, a timeout needs to be scheduled.
-        # Keep track of scheduledTIMEOUT to be able to cancel it later if interrupted 
-        # before the timeout expires
-        self.scheduledTIMEOUT =  self.gui.after(self.scale*500, self.eventTIMEOUT) 
-      elif eventName == "TIMEOUT": 
-        self.currentState = "yellow" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOn()   
-        self.gui.setGreenOff()   
-        self.gui.setRedOff()   
-        # If the target state has an outgoing timed transition,
-        # upon entering that target state, a timeout needs to be scheduled.
-        # Keep track of scheduledTIMEOUT to be able to cancel it later if interrupted 
-        # before the timeout expires
-        self.scheduledTIMEOUT =  self.gui.after(self.scale*1000, self.eventTIMEOUT) 
-      else:
-        print("ERROR: unexpected event %s received\n" % eventName) 
-        sys.exit(1)
-    elif self.currentState == "yellow":
-      if False:      
-        pass
-      # For all transitions from this state
-      elif eventName == "Quit":
-        self.currentState = "quit" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOff()   
-        self.gui.setGreenOff()   
-        self.gui.setRedOff()   
-      elif eventName == "PoliceInterrupt":
-        self.currentState = "blinkYellow" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOn()   
-        self.gui.setGreenOff()   
-        self.gui.setRedOff()   
-        # If the target state has an outgoing timed transition,
-        # upon entering that target state, a timeout needs to be scheduled.
-        # Keep track of scheduledTIMEOUT to be able to cancel it later if interrupted 
-        # before the timeout expires
-        self.scheduledTIMEOUT =  self.gui.after(self.scale*500, self.eventTIMEOUT) 
-      elif eventName == "TIMEOUT": 
-        self.currentState = "red" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellowOff()   
-        self.gui.setGreenOff()   
-        self.gui.setRedOn()   
-        # If the target state has an outgoing timed transition,
-        # upon entering that target state, a timeout needs to be scheduled.
-        # Keep track of scheduledTIMEOUT to be able to cancel it later if interrupted 
-        # before the timeout expires
-        self.scheduledTIMEOUT =  self.gui.after(self.scale*3000, self.eventTIMEOUT) 
-      else:
-        print("ERROR: unexpected event %s received\n" % eventName) 
-        sys.exit(1)
-    elif self.currentState == "quit":
-      # if no outgoing transitions: no code generated
-      pass
-    # End generated code
-    else:
-      print("ERROR: unexpected currentState %s\n" % self.currentState) 
-      sys.exit(1)
-
-if __name__=="__main__":
-  behaviour=TrafficLightBehaviour()
-
-  root=Tk()
-  # Initialize the GUI with the behaviour model as a parameter 
-  gui=TrafficLightGUI(behaviour, root)
-
-  # Be sure to initialize the behaviour model after the GUI is created
-  behaviour.initModel(gui)
-
-  # The Tkinter main event loop
-  root.mainloop()

+ 0 - 4
users/(default)/Formalisms/TrafficLight/Translational/commands.txt

@@ -1,4 +0,0 @@
-load "traffic"
-dump
-context trafficLight
-load egl "traffic"

BIN
users/(default)/Formalisms/TrafficLight/Translational/metaDepth.jar


+ 0 - 2
users/(default)/Formalisms/TrafficLight/Translational/metadepth.dsls

@@ -1,2 +0,0 @@
-#
-#Tue Aug 26 10:03:27 CEST 2014

+ 0 - 7
users/(default)/Formalisms/TrafficLight/Translational/metadepth.properties

@@ -1,7 +0,0 @@
-#
-#Tue Aug 26 10:03:27 CEST 2014
-DIR=./
-OUT=bin/
-PATH=C\:\\Users\\Bart\\Documents\\_Research\\dsm-tp\\material\\motif\\solution\\Translational\\.
-URI=file\:/C\:/Users/Bart/Documents/_Research/dsm-tp/material/motif/solution/Translational/./
-SRL=serializers/

+ 0 - 8
users/(default)/Formalisms/TrafficLight/Translational/traffic.egl

@@ -1,8 +0,0 @@
-[%
-	var basePath : String := URI + DIR;
-	var filename : String := 'TrafficLight.py';
-	var filepath : String := URI + filename;
-	var t : Template := TemplateFactory.load(basePath + 'traffic_template.egl');  
-	t.process();
-	t.generate(filepath);
-%]

+ 0 - 126
users/(default)/Formalisms/TrafficLight/Translational/traffic.mdepth

@@ -1,126 +0,0 @@
-Model Traffic {
-	Node State {
-		name : String {id};
-		red : boolean = false;
-		green : boolean = false;
-		yellow : boolean = false;
-		timed : TimedTransition[0..1];
-		interrupts : InterruptTransition[*];
-	}
-
-	Node InitialState[1] : State {
-	}
-
-	Node Transition {
-		target : State;
-	}
-
-	Node TimedTransition : Transition {
-		after : int;
-	}
-
-	Node InterruptTransition : Transition {
-		interrupt : String;
-	}
-
-	Node Time[1] {
-		clock : int = 0;
-	}
-
-	Node Interrupt {
-		at : int;
-		event : String;
-		next : Interrupt[0..1];
-	}
-}
-
-Traffic trafficLight {
-	// standard routine
-	InitialState red {
-		name = "red";
-		red = true;
-		timed = toGreen;
-		interrupts = [policeManOn, terminate];
-}
-State green {
-	name = "green";
-	green = true;
-	timed = toYellow;
-		interrupts = [policeManOn, terminate];
-}
-State yellow {
-	name = "yellow";
-	yellow = true;
-	timed = toRed;
-		interrupts = [policeManOn, terminate];
-}
-TimedTransition toGreen {
-	after = 10000;
-	target = green;
-}
-TimedTransition toYellow {
-	after = 6000;
-	target = yellow;
-}
-TimedTransition toRed {
-	after = 2000;
-	target = red;
-}// blinking routine
-State blinkOn {
-	name = "blink";
-	yellow = true;
-	timed = toOff;
-	interrupts = [lightsOn, terminate];
-}
-State blinkOff {
-	name = "unblink";
-	timed = toOn;
-	interrupts = [lightsOn, terminate];
-}
-TimedTransition toOn {
-	after = 1000;
-	target = blinkOn;
-}
-TimedTransition toOff {
-	after = 1000;
-	target = blinkOff;
-}
-
-// transitions between routines
-InterruptTransition policeManOn {
-	interrupt = "Policeman";
-	target = blinkOn;
-}
-InterruptTransition lightsOn {
-	interrupt = "Light";
-	target = red;
-}
-
-// terminate
-State terminated {
-	name = "STOP";
-}
-InterruptTransition terminate {
-	interrupt = "stop";
-	target = terminated;
-}
-
-// environment
-Time t {
-}
-Interrupt i1 {
-	at = 40000;
-	event = "Policeman";
-	next = i2;
-}
-Interrupt i2 {
-	at = 	60000;
-	event = "Light";
-	next = i3;
-}
-Interrupt i3 {
-	at = 90000;
-	event = "stop";
-}
-
-}

+ 0 - 189
users/(default)/Formalisms/TrafficLight/Translational/traffic_template.egl

@@ -1,189 +0,0 @@
-from Tkinter import *  
-
-class TrafficLightGUI(Frame):
-
-  def __init__(self, behaviour, master=None, title="TrafficLight"):
-
-    self.behaviour=behaviour
-
-    # Initialize superclass
-    Frame.__init__(self, master)
-
-    # parent frame, destruction protocol
-    self.root=master
-    self.root.protocol("WM_DELETE_WINDOW", self.wmQuit)
-
-    # Initialize packer
-    self.pack(fill=BOTH, expand=1)
-
-    # Create all widgets in the Frame
-    self.__createWidgets()
-
-
-  def __createWidgets(self):
-
-    self.root.configure(bg="black")
-#   self.root.pack(side=LEFT, fill=BOTH, expand=1)
-
-    Label(self.root, text="", bg="black", 
-          height=2, width=10).pack(side=TOP, padx = 2, pady=2)
-
-    self.redLight=Label(self.root, text="", bg="red",
-                        relief=GROOVE, height=5, width=10)
-    self.redLight.pack(side=TOP, padx = 2, pady=4)
-
-    self.yellowLight=Label(self.root, text="", bg="black",
-                           relief=GROOVE, height=5, width=10)
-    self.yellowLight.pack(side=TOP, padx = 2, pady=4)
-
-    self.greenLight=Label(self.root, text="", bg="black",
-                          relief=GROOVE, height=5, width=10)
-    self.greenLight.pack(side=TOP, padx = 2, pady=4)
-
-    Label(self.root, text="",bg="black",
-          height=5, width=10).pack(side=TOP,padx=2,pady=2)
-
-[% for (interrupt in InterruptTransition.allInstances().collect(t | t.interrupt)) { %]
-    Button(self.root, text="[%=interrupt %]",
-          command=self.[%=interrupt %]Pressed, width=10, wraplength=70).pack(side=TOP, fill=Y, padx=5, pady=2)
-
-[% } %]
-
-[% for (interrupt in InterruptTransition.allInstances().collect(t | t.interrupt)) { %]
-
-  # binding with behaviour
-
-  def [%=interrupt %]Pressed(self):
-    self.behaviour.event("[%=interrupt %]")
-[% } %]
-  
-  def wmQuit(self):
-    self.root.destroy()
-
-  # the behaviour can call these methods to change the GUI
-
-  def setGreenOn(self):
-      self.greenLight["bg"] = "green"
-
-  def setGreenOff(self):
-      self.greenLight["bg"] = "black"
-
-  def setRedOn(self):
-      self.redLight["bg"] = "red"
-
-  def setRedOff(self):
-      self.redLight["bg"] = "black"
-
-  def setYellowOn(self):
-      self.yellowLight["bg"] = "yellow"
-
-  def setYellowOff(self):
-      self.yellowLight["bg"] = "black"
-
-import sys
-
-class TrafficLightBehaviour:
-
-  def __init__(self, scale=1):
-
-    self.scale = scale
-    self.currentState = None 
-
-    self.scheduledTIMEOUT = None
-
-  def initModel(self, gui):
-
-    self.gui = gui
-
-[% var initialState : InitialState := InitialState.allInstances().first(); %]
-
-    self.initState = "[%=initialState.name %]"
-    self.gui.setYellow[%=initialState.yellow.toString().replace('true', 'On').replace('false', 'Off') %]()   
-    self.gui.setGreen[%=initialState.green.toString().replace('true', 'On').replace('false', 'Off') %]()   
-    self.gui.setRed[%=initialState.red.toString().replace('true', 'On').replace('false', 'Off') %]()   
-[% if (initialState.timed.isDefined()) { %]
-    # If the target state has an outgoing timed transition,
-    # upon entering that target state, a timeout needs to be scheduled.
-    # Keep track of scheduledTIMEOUT to be able to cancel it later if interrupted 
-    # before the timeout expires
-    self.scheduledTIMEOUT =  self.gui.after(int(self.scale*[%=initialState.timed.after %]), self.eventTIMEOUT) 
-[% } %]
-    # End generated code
-
-    self.currentState = self.initState
-
-  def eventTIMEOUT(self):
-    self.event("TIMEOUT")
-
-  def event(self, eventName):
-    # Note that below, setting coloured lights can be optimized by checking source
-    # and target light settings and only updating those lights that changed.
-    # In the following, the more naieve approach of re-setting all lights is taken.
-
-    # Remove a scheduled timeout, if any,
-    # to ensure that if we interrupted a transition scheduled in the future
-    # that scheduled transition is removed
-    if self.scheduledTIMEOUT is not None:
-      self.gui.after_cancel(self.scheduledTIMEOUT)
-      self.scheduledTIMEOUT = None
-    # Switch based on all states
-    if False:
-      pass
-    # for all states in the automaton 
-    # Begin generated code
-[% for (state in State.allInstances()) { %]
-[%   ("compiling "+state).println(); %]
-    elif self.currentState == "[%=state.name %]":
-      if False:      
-        pass
-      # For all transitions from this state
-[%   for (transition in state.interrupts) { %]
-[%     ("compiling "+state+"."+transition).println(); %]
-      elif eventName == "[%=transition.interrupt %]":
-        self.currentState = "[%=transition.target.name %]" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellow[%=transition.target.yellow.toString().replace('true', 'On').replace('false', 'Off') %]()   
-        self.gui.setGreen[%=transition.target.green.toString().replace('true', 'On').replace('false', 'Off') %]()   
-        self.gui.setRed[%=transition.target.red.toString().replace('true', 'On').replace('false', 'Off') %]()
-[%     if (transition.target.timed.isDefined()) { %]
-        # If the target state has an outgoing timed transition,
-        # upon entering that target state, a timeout needs to be scheduled.
-        # Keep track of scheduledTIMEOUT to be able to cancel it later if interrupted 
-        # before the timeout expires
-        self.scheduledTIMEOUT =  self.gui.after(int(self.scale*[%=transition.target.timed.after %]), self.eventTIMEOUT) 
-[%     } %] 
-[%   } %]
-[%   if (state.timed.isDefined()) { %]
-[%       ("compiling "+state+"."+state.timed).println(); %]
-      elif eventName == "TIMEOUT": 
-        self.currentState = "[%=state.timed.target.name %]" # target of the transition 
-        # The visual representation associated with the target state
-        self.gui.setYellow[%=state.timed.target.yellow.toString().replace('true', 'On').replace('false', 'Off') %]()   
-        self.gui.setGreen[%=state.timed.target.green.toString().replace('true', 'On').replace('false', 'Off') %]()   
-        self.gui.setRed[%=state.timed.target.red.toString().replace('true', 'On').replace('false', 'Off') %]()
-        # If the target state has an outgoing timed transition,
-        # upon entering that target state, a timeout needs to be scheduled.
-        # Keep track of scheduledTIMEOUT to be able to cancel it later if interrupted 
-        # before the timeout expires
-[%     if (state.timed.target.timed.isDefined()) { %]
-        self.scheduledTIMEOUT =  self.gui.after(int(self.scale*[%=state.timed.target.timed.after %]), self.eventTIMEOUT) 
-[%     } %] 
-[%   } %] 
-[% } %]
-    # End generated code
-    else:
-      print("ERROR: unexpected currentState %s\n" % self.currentState) 
-      sys.exit(1)
-
-if __name__=="__main__":
-  behaviour=TrafficLightBehaviour(0.5)
-
-  root=Tk()
-  # Initialize the GUI with the behaviour model as a parameter 
-  gui=TrafficLightGUI(behaviour, root)
-
-  # Be sure to initialize the behaviour model after the GUI is created
-  behaviour.initModel(gui)
-
-  # The Tkinter main event loop
-  root.mainloop()