-
Notifications
You must be signed in to change notification settings - Fork 0
/
Node.py
25 lines (24 loc) · 867 Bytes
/
Node.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Node:
def __init__(self, inCondition, inConclusion, inFatherNode, inExceptNode, inIfnotNode, inDepth):
self.condition = inCondition
self.conclusion = inConclusion
self.fatherNode = inFatherNode
self.exceptNode = inExceptNode
self.ifnotNode = inIfnotNode
self.depth = inDepth
def countNodes(self):
count = 1
if self.exceptNode is not None:
count += self.exceptNode.countNodes()
if self.ifnotNode is not None:
count += self.ifnotNode.countNodes()
return count
def satisfy(self, object_):
check = True
for i in range(10):
key = self.condition.context[i]
if key is not None:
if not (key == object_.context[i]):
check = False
break
return check