diff --git a/src/rules_tree.py b/src/rules_tree.py index 329b5d7..5ff0b56 100644 --- a/src/rules_tree.py +++ b/src/rules_tree.py @@ -13,10 +13,11 @@ for i in range(0, len(model.testmodel.get_conditions().get_conditions_array())): condition = model.testmodel.get_conditions().get_condition(i) conditions_set.add((condition.get_node_self_id(), condition.get_node_parent_id(), - condition.get_coord("x"), # TODO y,z,... + condition.get_coord("x"), # TODO y,z,... condition.get_site(), condition.get_weight())) + class CondTreeNode(NodeMixin): def __init__(self, id, x, site, weight, parent_node_id): super(CondTreeNode, self).__init__() @@ -31,12 +32,13 @@ class CondTreeNode(NodeMixin): self.parent = parent_node print('orphan node ', self.id, ' is adopted by node ', parent_node.id) + for i in conditions_set: # sorted(conditions_set, key=i.id): condition = CondTreeNode(i[0], i[2], i[3], i[4], i[1]) # TODO y,z,... conditions_list.append(condition) for i in conditions_list: - if (i.parent == None): + if (i.parent is None): for j in conditions_list: if (i.parent_node_id == j.id): i.add_parent_node(j)