Browse Source

some changes

Simon Van Mierlo 8 years ago
parent
commit
b4e8423ef2

+ 81 - 81
examples/tanks/ai_controller.py

@@ -1,7 +1,7 @@
 """
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
 
-Date:   Wed Aug 17 13:32:51 2016
+Date:   Thu Nov 10 14:05:46 2016
 
 
 Model author: Glenn De Jonghe
 Model author: Glenn De Jonghe
 Model name:   AI Tank
 Model name:   AI Tank
@@ -48,79 +48,79 @@ class Main(RuntimeClassBase):
     def build_statechart_structure(self):
     def build_statechart_structure(self):
         
         
         # state <root>
         # state <root>
-        self.states[""] = State(0, self)
+        self.states[""] = State(0, "", self)
         
         
         # state /error
         # state /error
-        self.states["/error"] = State(1, self)
+        self.states["/error"] = State(1, "/error", self)
         
         
         # state /creation
         # state /creation
-        self.states["/creation"] = State(2, self)
+        self.states["/creation"] = State(2, "/creation", self)
         
         
         # state /creation/state_1
         # state /creation/state_1
-        self.states["/creation/state_1"] = State(3, self)
+        self.states["/creation/state_1"] = State(3, "/creation/state_1", self)
         
         
         # state /creation/state_2
         # state /creation/state_2
-        self.states["/creation/state_2"] = State(4, self)
+        self.states["/creation/state_2"] = State(4, "/creation/state_2", self)
         
         
         # state /creation/state_3
         # state /creation/state_3
-        self.states["/creation/state_3"] = State(5, self)
+        self.states["/creation/state_3"] = State(5, "/creation/state_3", self)
         
         
         # state /creation/state_4
         # state /creation/state_4
-        self.states["/creation/state_4"] = State(6, self)
+        self.states["/creation/state_4"] = State(6, "/creation/state_4", self)
         
         
         # state /creation/state_5
         # state /creation/state_5
-        self.states["/creation/state_5"] = State(7, self)
+        self.states["/creation/state_5"] = State(7, "/creation/state_5", self)
         
         
         # state /creation/state_6
         # state /creation/state_6
-        self.states["/creation/state_6"] = State(8, self)
+        self.states["/creation/state_6"] = State(8, "/creation/state_6", self)
         
         
         # state /creation/state_7
         # state /creation/state_7
-        self.states["/creation/state_7"] = State(9, self)
+        self.states["/creation/state_7"] = State(9, "/creation/state_7", self)
         
         
         # state /creation/state_8
         # state /creation/state_8
-        self.states["/creation/state_8"] = State(10, self)
+        self.states["/creation/state_8"] = State(10, "/creation/state_8", self)
         
         
         # state /creation/state_9
         # state /creation/state_9
-        self.states["/creation/state_9"] = State(11, self)
+        self.states["/creation/state_9"] = State(11, "/creation/state_9", self)
         
         
         # state /creation/state_10
         # state /creation/state_10
-        self.states["/creation/state_10"] = State(12, self)
+        self.states["/creation/state_10"] = State(12, "/creation/state_10", self)
         
         
         # state /creation/state_11
         # state /creation/state_11
-        self.states["/creation/state_11"] = State(13, self)
+        self.states["/creation/state_11"] = State(13, "/creation/state_11", self)
         
         
         # state /creation/state_12
         # state /creation/state_12
-        self.states["/creation/state_12"] = State(14, self)
+        self.states["/creation/state_12"] = State(14, "/creation/state_12", self)
         
         
         # state /creation/state_13
         # state /creation/state_13
-        self.states["/creation/state_13"] = State(15, self)
+        self.states["/creation/state_13"] = State(15, "/creation/state_13", self)
         
         
         # state /creation/state_14
         # state /creation/state_14
-        self.states["/creation/state_14"] = State(16, self)
+        self.states["/creation/state_14"] = State(16, "/creation/state_14", self)
         
         
         # state /creation/state_15
         # state /creation/state_15
-        self.states["/creation/state_15"] = State(17, self)
+        self.states["/creation/state_15"] = State(17, "/creation/state_15", self)
         
         
         # state /creation/state_16
         # state /creation/state_16
-        self.states["/creation/state_16"] = State(18, self)
+        self.states["/creation/state_16"] = State(18, "/creation/state_16", self)
         
         
         # state /creation/state_17
         # state /creation/state_17
-        self.states["/creation/state_17"] = State(19, self)
+        self.states["/creation/state_17"] = State(19, "/creation/state_17", self)
         
         
         # state /creation/state_18
         # state /creation/state_18
-        self.states["/creation/state_18"] = State(20, self)
+        self.states["/creation/state_18"] = State(20, "/creation/state_18", self)
         
         
         # state /creation/state_19
         # state /creation/state_19
-        self.states["/creation/state_19"] = State(21, self)
+        self.states["/creation/state_19"] = State(21, "/creation/state_19", self)
         
         
         # state /creation/state_20
         # state /creation/state_20
-        self.states["/creation/state_20"] = State(22, self)
+        self.states["/creation/state_20"] = State(22, "/creation/state_20", self)
         
         
         # state /creation/state_21
         # state /creation/state_21
-        self.states["/creation/state_21"] = State(23, self)
+        self.states["/creation/state_21"] = State(23, "/creation/state_21", self)
         
         
         # state /creation/end
         # state /creation/end
-        self.states["/creation/end"] = State(24, self)
+        self.states["/creation/end"] = State(24, "/creation/end", self)
         
         
         # add children
         # add children
         self.states[""].addChild(self.states["/error"])
         self.states[""].addChild(self.states["/error"])
@@ -394,13 +394,13 @@ class Radar(RuntimeClassBase):
     def build_statechart_structure(self):
     def build_statechart_structure(self):
         
         
         # state <root>
         # state <root>
-        self.states[""] = State(0, self)
+        self.states[""] = State(0, "", self)
         
         
         # state /no_enemy
         # state /no_enemy
-        self.states["/no_enemy"] = State(1, self)
+        self.states["/no_enemy"] = State(1, "/no_enemy", self)
         
         
         # state /enemy_in_sight
         # state /enemy_in_sight
-        self.states["/enemy_in_sight"] = State(2, self)
+        self.states["/enemy_in_sight"] = State(2, "/enemy_in_sight", self)
         
         
         # add children
         # add children
         self.states[""].addChild(self.states["/no_enemy"])
         self.states[""].addChild(self.states["/no_enemy"])
@@ -486,16 +486,16 @@ class EnemyTracker(RuntimeClassBase):
     def build_statechart_structure(self):
     def build_statechart_structure(self):
         
         
         # state <root>
         # state <root>
-        self.states[""] = State(0, self)
+        self.states[""] = State(0, "", self)
         
         
         # state /no_enemy
         # state /no_enemy
-        self.states["/no_enemy"] = State(1, self)
+        self.states["/no_enemy"] = State(1, "/no_enemy", self)
         
         
         # state /enemy_pos_known
         # state /enemy_pos_known
-        self.states["/enemy_pos_known"] = State(2, self)
+        self.states["/enemy_pos_known"] = State(2, "/enemy_pos_known", self)
         
         
         # state /enemy_pos_unsure
         # state /enemy_pos_unsure
-        self.states["/enemy_pos_unsure"] = State(3, self)
+        self.states["/enemy_pos_unsure"] = State(3, "/enemy_pos_unsure", self)
         
         
         # add children
         # add children
         self.states[""].addChild(self.states["/no_enemy"])
         self.states[""].addChild(self.states["/no_enemy"])
@@ -587,15 +587,15 @@ class PilotStrategy(RuntimeClassBase):
     def build_statechart_structure(self):
     def build_statechart_structure(self):
         
         
         # state <root>
         # state <root>
-        self.states[""] = State(0, self)
+        self.states[""] = State(0, "", self)
         
         
         # state /exploring
         # state /exploring
-        self.states["/exploring"] = State(1, self)
+        self.states["/exploring"] = State(1, "/exploring", self)
         self.states["/exploring"].setEnter(self._exploring_enter)
         self.states["/exploring"].setEnter(self._exploring_enter)
         self.states["/exploring"].setExit(self._exploring_exit)
         self.states["/exploring"].setExit(self._exploring_exit)
         
         
         # state /attacking
         # state /attacking
-        self.states["/attacking"] = State(2, self)
+        self.states["/attacking"] = State(2, "/attacking", self)
         self.states["/attacking"].setExit(self._attacking_exit)
         self.states["/attacking"].setExit(self._attacking_exit)
         
         
         # add children
         # add children
@@ -670,19 +670,19 @@ class ExplorePlanner(RuntimeClassBase):
     def build_statechart_structure(self):
     def build_statechart_structure(self):
         
         
         # state <root>
         # state <root>
-        self.states[""] = State(0, self)
+        self.states[""] = State(0, "", self)
         
         
         # state /idle
         # state /idle
-        self.states["/idle"] = State(1, self)
+        self.states["/idle"] = State(1, "/idle", self)
         
         
         # state /exploring
         # state /exploring
-        self.states["/exploring"] = State(2, self)
+        self.states["/exploring"] = State(2, "/exploring", self)
         
         
         # state /exploring/no_destination
         # state /exploring/no_destination
-        self.states["/exploring/no_destination"] = State(3, self)
+        self.states["/exploring/no_destination"] = State(3, "/exploring/no_destination", self)
         
         
         # state /exploring/destination_set
         # state /exploring/destination_set
-        self.states["/exploring/destination_set"] = State(4, self)
+        self.states["/exploring/destination_set"] = State(4, "/exploring/destination_set", self)
         
         
         # add children
         # add children
         self.states[""].addChild(self.states["/idle"])
         self.states[""].addChild(self.states["/idle"])
@@ -753,28 +753,28 @@ class AttackPlanner(RuntimeClassBase):
     def build_statechart_structure(self):
     def build_statechart_structure(self):
         
         
         # state <root>
         # state <root>
-        self.states[""] = State(0, self)
+        self.states[""] = State(0, "", self)
         
         
         # state /idle
         # state /idle
-        self.states["/idle"] = State(1, self)
+        self.states["/idle"] = State(1, "/idle", self)
         
         
         # state /action
         # state /action
-        self.states["/action"] = ParallelState(2, self)
+        self.states["/action"] = ParallelState(2, "/action", self)
         
         
         # state /action/movement
         # state /action/movement
-        self.states["/action/movement"] = State(3, self)
+        self.states["/action/movement"] = State(3, "/action/movement", self)
         
         
         # state /action/movement/following
         # state /action/movement/following
-        self.states["/action/movement/following"] = State(4, self)
+        self.states["/action/movement/following"] = State(4, "/action/movement/following", self)
         
         
         # state /action/shooting
         # state /action/shooting
-        self.states["/action/shooting"] = State(5, self)
+        self.states["/action/shooting"] = State(5, "/action/shooting", self)
         
         
         # state /action/shooting/loaded
         # state /action/shooting/loaded
-        self.states["/action/shooting/loaded"] = State(6, self)
+        self.states["/action/shooting/loaded"] = State(6, "/action/shooting/loaded", self)
         
         
         # state /action/shooting/reloading
         # state /action/shooting/reloading
-        self.states["/action/shooting/reloading"] = State(7, self)
+        self.states["/action/shooting/reloading"] = State(7, "/action/shooting/reloading", self)
         self.states["/action/shooting/reloading"].setEnter(self._action_shooting_reloading_enter)
         self.states["/action/shooting/reloading"].setEnter(self._action_shooting_reloading_enter)
         self.states["/action/shooting/reloading"].setExit(self._action_shooting_reloading_exit)
         self.states["/action/shooting/reloading"].setExit(self._action_shooting_reloading_exit)
         
         
@@ -906,13 +906,13 @@ class PathFinder(RuntimeClassBase):
     def build_statechart_structure(self):
     def build_statechart_structure(self):
         
         
         # state <root>
         # state <root>
-        self.states[""] = State(0, self)
+        self.states[""] = State(0, "", self)
         
         
         # state /idle
         # state /idle
-        self.states["/idle"] = State(1, self)
+        self.states["/idle"] = State(1, "/idle", self)
         
         
         # state /check_points
         # state /check_points
-        self.states["/check_points"] = State(2, self)
+        self.states["/check_points"] = State(2, "/check_points", self)
         
         
         # add children
         # add children
         self.states[""].addChild(self.states["/idle"])
         self.states[""].addChild(self.states["/idle"])
@@ -1060,22 +1060,22 @@ class Steering(RuntimeClassBase):
     def build_statechart_structure(self):
     def build_statechart_structure(self):
         
         
         # state <root>
         # state <root>
-        self.states[""] = State(0, self)
+        self.states[""] = State(0, "", self)
         
         
         # state /idle
         # state /idle
-        self.states["/idle"] = State(1, self)
+        self.states["/idle"] = State(1, "/idle", self)
         
         
         # state /steering
         # state /steering
-        self.states["/steering"] = State(2, self)
+        self.states["/steering"] = State(2, "/steering", self)
         
         
         # state /steering/forward_backward
         # state /steering/forward_backward
-        self.states["/steering/forward_backward"] = State(3, self)
+        self.states["/steering/forward_backward"] = State(3, "/steering/forward_backward", self)
         
         
         # state /steering/left_right
         # state /steering/left_right
-        self.states["/steering/left_right"] = State(4, self)
+        self.states["/steering/left_right"] = State(4, "/steering/left_right", self)
         
         
         # state /steering/wait
         # state /steering/wait
-        self.states["/steering/wait"] = State(5, self)
+        self.states["/steering/wait"] = State(5, "/steering/wait", self)
         self.states["/steering/wait"].setEnter(self._steering_wait_enter)
         self.states["/steering/wait"].setEnter(self._steering_wait_enter)
         self.states["/steering/wait"].setExit(self._steering_wait_exit)
         self.states["/steering/wait"].setExit(self._steering_wait_exit)
         
         
@@ -1248,19 +1248,19 @@ class TurretSteering(RuntimeClassBase):
     def build_statechart_structure(self):
     def build_statechart_structure(self):
         
         
         # state <root>
         # state <root>
-        self.states[""] = State(0, self)
+        self.states[""] = State(0, "", self)
         
         
         # state /idle
         # state /idle
-        self.states["/idle"] = State(1, self)
+        self.states["/idle"] = State(1, "/idle", self)
         
         
         # state /aiming
         # state /aiming
-        self.states["/aiming"] = State(2, self)
+        self.states["/aiming"] = State(2, "/aiming", self)
         
         
         # state /aiming/adjust
         # state /aiming/adjust
-        self.states["/aiming/adjust"] = State(3, self)
+        self.states["/aiming/adjust"] = State(3, "/aiming/adjust", self)
         
         
         # state /aiming/wait
         # state /aiming/wait
-        self.states["/aiming/wait"] = State(4, self)
+        self.states["/aiming/wait"] = State(4, "/aiming/wait", self)
         self.states["/aiming/wait"].setEnter(self._aiming_wait_enter)
         self.states["/aiming/wait"].setEnter(self._aiming_wait_enter)
         self.states["/aiming/wait"].setExit(self._aiming_wait_exit)
         self.states["/aiming/wait"].setExit(self._aiming_wait_exit)
         
         
@@ -1382,34 +1382,34 @@ class MotorControl(RuntimeClassBase):
     def build_statechart_structure(self):
     def build_statechart_structure(self):
         
         
         # state <root>
         # state <root>
-        self.states[""] = State(0, self)
+        self.states[""] = State(0, "", self)
         
         
         # state /control
         # state /control
-        self.states["/control"] = ParallelState(1, self)
+        self.states["/control"] = ParallelState(1, "/control", self)
         
         
         # state /control/left_right
         # state /control/left_right
-        self.states["/control/left_right"] = State(2, self)
+        self.states["/control/left_right"] = State(2, "/control/left_right", self)
         
         
         # state /control/left_right/stop
         # state /control/left_right/stop
-        self.states["/control/left_right/stop"] = State(3, self)
+        self.states["/control/left_right/stop"] = State(3, "/control/left_right/stop", self)
         
         
         # state /control/left_right/going_forward
         # state /control/left_right/going_forward
-        self.states["/control/left_right/going_forward"] = State(4, self)
+        self.states["/control/left_right/going_forward"] = State(4, "/control/left_right/going_forward", self)
         
         
         # state /control/left_right/going_backward
         # state /control/left_right/going_backward
-        self.states["/control/left_right/going_backward"] = State(5, self)
+        self.states["/control/left_right/going_backward"] = State(5, "/control/left_right/going_backward", self)
         
         
         # state /control/forward_backward
         # state /control/forward_backward
-        self.states["/control/forward_backward"] = State(6, self)
+        self.states["/control/forward_backward"] = State(6, "/control/forward_backward", self)
         
         
         # state /control/forward_backward/straight
         # state /control/forward_backward/straight
-        self.states["/control/forward_backward/straight"] = State(7, self)
+        self.states["/control/forward_backward/straight"] = State(7, "/control/forward_backward/straight", self)
         
         
         # state /control/forward_backward/turning_left
         # state /control/forward_backward/turning_left
-        self.states["/control/forward_backward/turning_left"] = State(8, self)
+        self.states["/control/forward_backward/turning_left"] = State(8, "/control/forward_backward/turning_left", self)
         
         
         # state /control/forward_backward/turning_right
         # state /control/forward_backward/turning_right
-        self.states["/control/forward_backward/turning_right"] = State(9, self)
+        self.states["/control/forward_backward/turning_right"] = State(9, "/control/forward_backward/turning_right", self)
         
         
         # add children
         # add children
         self.states[""].addChild(self.states["/control"])
         self.states[""].addChild(self.states["/control"])
@@ -1537,28 +1537,28 @@ class TurretControl(RuntimeClassBase):
     def build_statechart_structure(self):
     def build_statechart_structure(self):
         
         
         # state <root>
         # state <root>
-        self.states[""] = State(0, self)
+        self.states[""] = State(0, "", self)
         
         
         # state /turret
         # state /turret
-        self.states["/turret"] = ParallelState(1, self)
+        self.states["/turret"] = ParallelState(1, "/turret", self)
         
         
         # state /turret/rotation
         # state /turret/rotation
-        self.states["/turret/rotation"] = State(2, self)
+        self.states["/turret/rotation"] = State(2, "/turret/rotation", self)
         
         
         # state /turret/rotation/none
         # state /turret/rotation/none
-        self.states["/turret/rotation/none"] = State(3, self)
+        self.states["/turret/rotation/none"] = State(3, "/turret/rotation/none", self)
         
         
         # state /turret/rotation/turning_left
         # state /turret/rotation/turning_left
-        self.states["/turret/rotation/turning_left"] = State(4, self)
+        self.states["/turret/rotation/turning_left"] = State(4, "/turret/rotation/turning_left", self)
         
         
         # state /turret/rotation/turning_right
         # state /turret/rotation/turning_right
-        self.states["/turret/rotation/turning_right"] = State(5, self)
+        self.states["/turret/rotation/turning_right"] = State(5, "/turret/rotation/turning_right", self)
         
         
         # state /turret/shooting
         # state /turret/shooting
-        self.states["/turret/shooting"] = State(6, self)
+        self.states["/turret/shooting"] = State(6, "/turret/shooting", self)
         
         
         # state /turret/shooting/polling
         # state /turret/shooting/polling
-        self.states["/turret/shooting/polling"] = State(7, self)
+        self.states["/turret/shooting/polling"] = State(7, "/turret/shooting/polling", self)
         
         
         # add children
         # add children
         self.states[""].addChild(self.states["/turret"])
         self.states[""].addChild(self.states["/turret"])

+ 32 - 32
examples/tanks/player_controller.py

@@ -1,7 +1,7 @@
 """
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
 
-Date:   Wed Aug 17 13:32:51 2016
+Date:   Thu Nov 10 14:05:46 2016
 
 
 Model author: Glenn De Jonghe
 Model author: Glenn De Jonghe
 Model name:   Player Tank
 Model name:   Player Tank
@@ -43,22 +43,22 @@ class Main(RuntimeClassBase):
     def build_statechart_structure(self):
     def build_statechart_structure(self):
         
         
         # state <root>
         # state <root>
-        self.states[""] = State(0, self)
+        self.states[""] = State(0, "", self)
         
         
         # state /state_1
         # state /state_1
-        self.states["/state_1"] = State(1, self)
+        self.states["/state_1"] = State(1, "/state_1", self)
         
         
         # state /state_2
         # state /state_2
-        self.states["/state_2"] = State(2, self)
+        self.states["/state_2"] = State(2, "/state_2", self)
         
         
         # state /state_3
         # state /state_3
-        self.states["/state_3"] = State(3, self)
+        self.states["/state_3"] = State(3, "/state_3", self)
         
         
         # state /state_4
         # state /state_4
-        self.states["/state_4"] = State(4, self)
+        self.states["/state_4"] = State(4, "/state_4", self)
         
         
         # state /end
         # state /end
-        self.states["/end"] = State(5, self)
+        self.states["/end"] = State(5, "/end", self)
         
         
         # add children
         # add children
         self.states[""].addChild(self.states["/state_1"])
         self.states[""].addChild(self.states["/state_1"])
@@ -139,43 +139,43 @@ class Cannon(RuntimeClassBase):
     def build_statechart_structure(self):
     def build_statechart_structure(self):
         
         
         # state <root>
         # state <root>
-        self.states[""] = State(0, self)
+        self.states[""] = State(0, "", self)
         
         
         # state /container
         # state /container
-        self.states["/container"] = ParallelState(1, self)
+        self.states["/container"] = ParallelState(1, "/container", self)
         
         
         # state /container/rotating
         # state /container/rotating
-        self.states["/container/rotating"] = State(2, self)
+        self.states["/container/rotating"] = State(2, "/container/rotating", self)
         
         
         # state /container/rotating/none
         # state /container/rotating/none
-        self.states["/container/rotating/none"] = State(3, self)
+        self.states["/container/rotating/none"] = State(3, "/container/rotating/none", self)
         
         
         # state /container/rotating/left
         # state /container/rotating/left
-        self.states["/container/rotating/left"] = State(4, self)
+        self.states["/container/rotating/left"] = State(4, "/container/rotating/left", self)
         
         
         # state /container/rotating/both
         # state /container/rotating/both
-        self.states["/container/rotating/both"] = State(5, self)
+        self.states["/container/rotating/both"] = State(5, "/container/rotating/both", self)
         
         
         # state /container/rotating/right
         # state /container/rotating/right
-        self.states["/container/rotating/right"] = State(6, self)
+        self.states["/container/rotating/right"] = State(6, "/container/rotating/right", self)
         
         
         # state /container/shoot
         # state /container/shoot
-        self.states["/container/shoot"] = State(7, self)
+        self.states["/container/shoot"] = State(7, "/container/shoot", self)
         
         
         # state /container/shoot/hold
         # state /container/shoot/hold
-        self.states["/container/shoot/hold"] = State(8, self)
+        self.states["/container/shoot/hold"] = State(8, "/container/shoot/hold", self)
         
         
         # state /container/shoot/shoot
         # state /container/shoot/shoot
-        self.states["/container/shoot/shoot"] = State(9, self)
+        self.states["/container/shoot/shoot"] = State(9, "/container/shoot/shoot", self)
         
         
         # state /container/ammo
         # state /container/ammo
-        self.states["/container/ammo"] = State(10, self)
+        self.states["/container/ammo"] = State(10, "/container/ammo", self)
         
         
         # state /container/ammo/loaded
         # state /container/ammo/loaded
-        self.states["/container/ammo/loaded"] = State(11, self)
+        self.states["/container/ammo/loaded"] = State(11, "/container/ammo/loaded", self)
         
         
         # state /container/ammo/unloaded
         # state /container/ammo/unloaded
-        self.states["/container/ammo/unloaded"] = State(12, self)
+        self.states["/container/ammo/unloaded"] = State(12, "/container/ammo/unloaded", self)
         self.states["/container/ammo/unloaded"].setEnter(self._container_ammo_unloaded_enter)
         self.states["/container/ammo/unloaded"].setEnter(self._container_ammo_unloaded_enter)
         self.states["/container/ammo/unloaded"].setExit(self._container_ammo_unloaded_exit)
         self.states["/container/ammo/unloaded"].setExit(self._container_ammo_unloaded_exit)
         
         
@@ -326,40 +326,40 @@ class Body(RuntimeClassBase):
     def build_statechart_structure(self):
     def build_statechart_structure(self):
         
         
         # state <root>
         # state <root>
-        self.states[""] = State(0, self)
+        self.states[""] = State(0, "", self)
         
         
         # state /container
         # state /container
-        self.states["/container"] = ParallelState(1, self)
+        self.states["/container"] = ParallelState(1, "/container", self)
         
         
         # state /container/horizontal
         # state /container/horizontal
-        self.states["/container/horizontal"] = State(2, self)
+        self.states["/container/horizontal"] = State(2, "/container/horizontal", self)
         
         
         # state /container/horizontal/none
         # state /container/horizontal/none
-        self.states["/container/horizontal/none"] = State(3, self)
+        self.states["/container/horizontal/none"] = State(3, "/container/horizontal/none", self)
         
         
         # state /container/horizontal/left
         # state /container/horizontal/left
-        self.states["/container/horizontal/left"] = State(4, self)
+        self.states["/container/horizontal/left"] = State(4, "/container/horizontal/left", self)
         
         
         # state /container/horizontal/both
         # state /container/horizontal/both
-        self.states["/container/horizontal/both"] = State(5, self)
+        self.states["/container/horizontal/both"] = State(5, "/container/horizontal/both", self)
         
         
         # state /container/horizontal/right
         # state /container/horizontal/right
-        self.states["/container/horizontal/right"] = State(6, self)
+        self.states["/container/horizontal/right"] = State(6, "/container/horizontal/right", self)
         
         
         # state /container/vertical
         # state /container/vertical
-        self.states["/container/vertical"] = State(7, self)
+        self.states["/container/vertical"] = State(7, "/container/vertical", self)
         
         
         # state /container/vertical/none
         # state /container/vertical/none
-        self.states["/container/vertical/none"] = State(8, self)
+        self.states["/container/vertical/none"] = State(8, "/container/vertical/none", self)
         
         
         # state /container/vertical/down
         # state /container/vertical/down
-        self.states["/container/vertical/down"] = State(9, self)
+        self.states["/container/vertical/down"] = State(9, "/container/vertical/down", self)
         
         
         # state /container/vertical/both
         # state /container/vertical/both
-        self.states["/container/vertical/both"] = State(10, self)
+        self.states["/container/vertical/both"] = State(10, "/container/vertical/both", self)
         
         
         # state /container/vertical/up
         # state /container/vertical/up
-        self.states["/container/vertical/up"] = State(11, self)
+        self.states["/container/vertical/up"] = State(11, "/container/vertical/up", self)
         
         
         # add children
         # add children
         self.states[""].addChild(self.states["/container"])
         self.states[""].addChild(self.states["/container"])

+ 1 - 1
src/python_sccd/python_sccd_compiler/generic_generator.py

@@ -435,7 +435,7 @@ class GenericGenerator(Visitor):
                     clazz = "ShallowHistoryState"
                     clazz = "ShallowHistoryState"
             self.writer.addAssignment(
             self.writer.addAssignment(
                 index_expr,
                 index_expr,
-                GLC.NewExpression(clazz, [str(i), GLC.SelfExpression()])
+                GLC.NewExpression(clazz, [str(i), GLC.String(s.new_full_name), GLC.SelfExpression()])
             )
             )
             if not s.is_root:
             if not s.is_root:
                 if s.enter_action.action or s.has_timers:
                 if s.enter_action.action or s.has_timers:

+ 32 - 12
src/python_sccd/python_sccd_runtime/statecharts_core.py

@@ -14,6 +14,12 @@ from Queue import Queue, Empty
 from sccd.runtime.event_queue import EventQueue
 from sccd.runtime.event_queue import EventQueue
 import sccd.runtime.accurate_time as accurate_time
 import sccd.runtime.accurate_time as accurate_time
 
 
+DEBUG = False
+
+def print_debug(msg):
+    if DEBUG:
+        print msg
+
 class RuntimeException(Exception):
 class RuntimeException(Exception):
     """
     """
     Base class for runtime exceptions.
     Base class for runtime exceptions.
@@ -198,6 +204,9 @@ class ObjectManagerBase(object):
         source = parameters[0]
         source = parameters[0]
         association_name = parameters[1]
         association_name = parameters[1]
         
         
+        traversal_list = self.processAssociationReference(association_name)
+        instances = self.getInstances(source, traversal_list)
+        
         association = source.associations[association_name]
         association = source.associations[association_name]
         # association = self.instances_map[source].getAssociation(association_name)
         # association = self.instances_map[source].getAssociation(association_name)
         if association.allowedToAdd():
         if association.allowedToAdd():
@@ -224,18 +233,29 @@ class ObjectManagerBase(object):
         else:
         else:
             source = parameters[0]
             source = parameters[0]
             association_name = parameters[1]
             association_name = parameters[1]
+            
             traversal_list = self.processAssociationReference(association_name)
             traversal_list = self.processAssociationReference(association_name)
             instances = self.getInstances(source, traversal_list)
             instances = self.getInstances(source, traversal_list)
             # association = self.instances_map[source].getAssociation(traversal_list[0][0])
             # association = self.instances_map[source].getAssociation(traversal_list[0][0])
             association = source.associations[traversal_list[0][0]]
             association = source.associations[traversal_list[0][0]]
+            
             for i in instances:
             for i in instances:
                 try:
                 try:
+                    for assoc_name in i["instance"].associations:
+                        if assoc_name != 'parent':
+                            traversal_list = self.processAssociationReference(assoc_name)
+                            instances = self.getInstances(i["instance"], traversal_list)
+                            if len(instances) > 0:
+                                raise RuntimeException("Error removing instance from association %s, still %i children left connected with association %s" % (association_name, len(instances), assoc_name))
+                    del i["instance"].controller.input_ports[i["instance"].narrow_cast_port]
                     association.removeInstance(i["instance"])
                     association.removeInstance(i["instance"])
                     self.instances.discard(i["instance"])
                     self.instances.discard(i["instance"])
+                    self.eventless.discard(i["instance"])
                 except AssociationException as exception:
                 except AssociationException as exception:
                     raise RuntimeException("Error removing instance from association '" + association_name + "': " + str(exception))
                     raise RuntimeException("Error removing instance from association '" + association_name + "': " + str(exception))
                 i["instance"].user_defined_destructor()
                 i["instance"].user_defined_destructor()
                 i["instance"].stop()
                 i["instance"].stop()
+                
             source.addEvent(Event("instance_deleted", parameters = [parameters[1]]))
             source.addEvent(Event("instance_deleted", parameters = [parameters[1]]))
                 
                 
     def handleAssociateEvent(self, parameters):
     def handleAssociateEvent(self, parameters):
@@ -645,8 +665,9 @@ class StatechartSemantics:
         self.concurrency = self.Single
         self.concurrency = self.Single
 
 
 class State:
 class State:
-    def __init__(self, state_id, obj):
+    def __init__(self, state_id, name, obj):
         self.state_id = state_id
         self.state_id = state_id
+        self.name = name
         self.obj = obj
         self.obj = obj
         
         
         self.ancestors = []
         self.ancestors = []
@@ -697,12 +718,12 @@ class State:
         return "State(%s)" % (self.state_id)
         return "State(%s)" % (self.state_id)
         
         
 class HistoryState(State):
 class HistoryState(State):
-    def __init__(self, state_id, obj):
-        State.__init__(self, state_id, obj)
+    def __init__(self, state_id, name, obj):
+        State.__init__(self, state_id, name, obj)
         
         
 class ShallowHistoryState(HistoryState):
 class ShallowHistoryState(HistoryState):
-    def __init__(self, state_id, obj):
-        HistoryState.__init__(self, state_id, obj)
+    def __init__(self, state_id, name, obj):
+        HistoryState.__init__(self, state_id, name, obj)
         
         
     def getEffectiveTargetStates(self):
     def getEffectiveTargetStates(self):
         if self.state_id in self.obj.history_values:
         if self.state_id in self.obj.history_values:
@@ -715,8 +736,8 @@ class ShallowHistoryState(HistoryState):
             return self.parent.getEffectiveTargetStates()
             return self.parent.getEffectiveTargetStates()
         
         
 class DeepHistoryState(HistoryState):
 class DeepHistoryState(HistoryState):
-    def __init__(self, state_id, obj):
-        HistoryState.__init__(self, state_id, obj)
+    def __init__(self, state_id, name, obj):
+        HistoryState.__init__(self, state_id, name, obj)
         
         
     def getEffectiveTargetStates(self):
     def getEffectiveTargetStates(self):
         if self.state_id in self.obj.history_values:
         if self.state_id in self.obj.history_values:
@@ -726,8 +747,8 @@ class DeepHistoryState(HistoryState):
             return self.parent.getEffectiveTargetStates()
             return self.parent.getEffectiveTargetStates()
         
         
 class ParallelState(State):
 class ParallelState(State):
-    def __init__(self, state_id, obj):
-        State.__init__(self, state_id, obj)
+    def __init__(self, state_id, name, obj):
+        State.__init__(self, state_id, name, obj)
         
         
     def getEffectiveTargetStates(self):
     def getEffectiveTargetStates(self):
         targets = [self]
         targets = [self]
@@ -770,11 +791,11 @@ class Transition:
                     f = lambda s0: not s0.descendants and s0 in s.descendants
                     f = lambda s0: not s0.descendants and s0 in s.descendants
                 self.obj.history_values[h.state_id] = filter(f, self.obj.configuration)
                 self.obj.history_values[h.state_id] = filter(f, self.obj.configuration)
         for s in exit_set:
         for s in exit_set:
+            print_debug('EXIT: %s::%s' % (self.obj.__class__.__name__, s.name))
             self.obj.eventless_states -= s.has_eventless_transitions
             self.obj.eventless_states -= s.has_eventless_transitions
             # execute exit action(s)
             # execute exit action(s)
             if s.exit:
             if s.exit:
                 s.exit()
                 s.exit()
-            # self.obj.configuration.remove(s)
             self.obj.configuration_bitmap &= ~2**s.state_id
             self.obj.configuration_bitmap &= ~2**s.state_id
         
         
         # combo state changed area
         # combo state changed area
@@ -788,8 +809,8 @@ class Transition:
         # enter states...
         # enter states...
         enter_set = self.__enterSet(targets)
         enter_set = self.__enterSet(targets)
         for s in enter_set:
         for s in enter_set:
+            print_debug('ENTER: %s::%s' % (self.obj.__class__.__name__, s.name))
             self.obj.eventless_states += s.has_eventless_transitions
             self.obj.eventless_states += s.has_eventless_transitions
-            # self.obj.configuration.append(s)
             self.obj.configuration_bitmap |= 2**s.state_id
             self.obj.configuration_bitmap |= 2**s.state_id
             # execute enter action(s)
             # execute enter action(s)
             if s.enter:
             if s.enter:
@@ -800,7 +821,6 @@ class Transition:
         else:
         else:
             self.obj.controller.object_manager.eventless.discard(self.obj)
             self.obj.controller.object_manager.eventless.discard(self.obj)
                 
                 
-        # self.obj.configuration.sort(key=lambda x: x.state_id)
         try:
         try:
             self.obj.configuration = self.obj.config_mem[self.obj.configuration_bitmap]
             self.obj.configuration = self.obj.config_mem[self.obj.configuration_bitmap]
         except:
         except: