WIP: plus simple, plus propre, plus joli. ( ;- ))
This commit is contained in:
parent
29c8d0c127
commit
5751a6cd72
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue