From 5751a6cd72534e9dd178259a2fba943c2ad044ca Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Sat, 8 Jan 2022 19:54:29 +0100 Subject: [PATCH] WIP: plus simple, plus propre, plus joli. ( ;- )) --- src/rules_tree.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/rules_tree.py b/src/rules_tree.py index cb231e7..42873d2 100644 --- a/src/rules_tree.py +++ b/src/rules_tree.py @@ -17,7 +17,7 @@ class CondTreeNode(NodeMixin): self.site = site self.weight = weight - def add_parent_node(self, parent_node): + def is_adopted_by(self, parent_node): # print('orphan node ', self.id, ' is adopted by node ', parent_node.id) self.parent = parent_node @@ -29,7 +29,7 @@ class TransTreeNode(NodeMixin): self.parent = None self.id = id - def add_parent_leaf_node(self, parent_node): + def is_adopted_by(self, parent_node): # print('orphan transition is adopted by leaf node', parent_node.id) self.parent = parent_node @@ -58,13 +58,15 @@ for i in range(0, len(model.testmodel.get_transitions().get_all())): for i in conditions_set: for j in conditions_set: if ((i != j) & (i.parent_id == j.id)): - i.add_parent_node(j) + i.is_adopted_by(j) for condition_node in LevelOrderIter(root): if condition_node.is_leaf: for transition_node in transitions_set: if (str(condition_node.id) == transition_node.parent_id): - transition_node.add_parent_leaf_node(condition_node) + transition_node.is_adopted_by(condition_node) + +## print tree for pre, fill, node in RenderTree(root): treestr = u"%s%s" % (pre, node.id)