Adding Transitions to the Conditions Tree: success !
This commit is contained in:
parent
e364b97cbf
commit
93f4a5e2e2
|
@ -41,13 +41,13 @@ class CondTreeNode(NodeMixin):
|
|||
|
||||
|
||||
class TransTreeNode(NodeMixin):
|
||||
def __init__(self, parent_node_id):
|
||||
def __init__(self, parent_node_id, id):
|
||||
super(TransTreeNode, self).__init__()
|
||||
self.parent_node_id = parent_node_id
|
||||
self.parent = None
|
||||
self.id = None
|
||||
self.id = id
|
||||
|
||||
def add_parent_leaf_node(self, parent_node, transition_node_id):
|
||||
def add_parent_leaf_node(self, parent_node):
|
||||
# print('orphan transition is adopted by leaf node', parent_node.id)
|
||||
self.parent = parent_node
|
||||
|
||||
|
@ -69,9 +69,9 @@ for i in conditions_list:
|
|||
for condition_node in LevelOrderIter(root):
|
||||
if condition_node.is_leaf:
|
||||
for i in transitions_set:
|
||||
transition_node = TransTreeNode(i[1])
|
||||
transition_node = TransTreeNode(i[1], i[0])
|
||||
if (str(condition_node.id) == i[1]):
|
||||
transition_node.add_parent_leaf_node(condition_node, transition_node)
|
||||
transition_node.add_parent_leaf_node(condition_node)
|
||||
|
||||
|
||||
for pre, fill, node in RenderTree(root):
|
||||
|
@ -82,6 +82,6 @@ for pre, fill, node in RenderTree(root):
|
|||
if (not node.depth == 2):
|
||||
print(end=']\n')
|
||||
else:
|
||||
print(end='] *** \n')
|
||||
print('] > ', node.children[0].id, end='\n')
|
||||
|
||||
# print([node.id for node in LevelOrderIter(root) if node.is_leaf])
|
||||
|
|
Loading…
Reference in New Issue