added __eq__ method to the tree
git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@147 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
parent
7ecf75efb7
commit
04e3b8e316
@ -61,7 +61,17 @@ class node (object):
|
||||
|
||||
return
|
||||
pass
|
||||
def __eq__(self,other):
|
||||
if not (isinstance(other,node) and self.name==other.name and self.kind==other.kind):
|
||||
return False
|
||||
|
||||
if self.kind==UNARY:
|
||||
if other.prop!=self.prop:
|
||||
return False
|
||||
return self.child==other.child
|
||||
if self.kind==BINARY:
|
||||
return self.left==other.left and self.right==other.right
|
||||
return True
|
||||
def __str__(self):
|
||||
if (self.kind==RELATION):
|
||||
return self.name
|
||||
@ -182,6 +192,7 @@ if __name__=="__main__":
|
||||
#a= tokenize("(a - (a ᑌ b) * π a,b (a-b)) - ρ 123 (a)")
|
||||
#a= tokenize(u"π a,b (a*b)")
|
||||
#a=tokenize("(a-b*c)*(b-c)")
|
||||
print tree("σ i==2 (c ᑌ d - (aᑎb))") == tree("σ i==3 (c ᑌ d - (aᑎb))")
|
||||
a=general_optimize("σ i==2 (c ᑌ d - (aᑎb))")
|
||||
#a=general_optimize("σ i==2 (σ b>5 (d))")
|
||||
print a
|
||||
|
Loading…
x
Reference in New Issue
Block a user