- Set hash method for the classes

git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@265 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
LtWorf 2010-11-26 09:12:34 +00:00
parent ca14c23947
commit 19ac2aaacd
4 changed files with 12 additions and 2 deletions

View File

@ -10,6 +10,7 @@
- Fixed optimization involving selection and parenthesis in the expression (Rev 260)
- Fixed futile_union_intersection_subtraction optimization that didn't work when selection operator was in the left subtree (Rev 261)
- Module parallel does something, can execute queries in parallel
- Set hash method for the classes
0.11
- Font is set only on windows (Rev 206)

View File

@ -51,6 +51,7 @@ class node (object):
This class is used to convert an expression into python code.'''
kind=None
__hash__=None
def __init__(self,expression=None):
'''Generates the tree from the tokenized expression
@ -186,6 +187,7 @@ class node (object):
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

View File

@ -25,6 +25,8 @@ class relation (object):
A relation can be represented using a table
Calling an operation and providing a non relation parameter when it is expected will
result in a None value'''
__hash__=None
def __init__(self,filename=""):
'''Creates a relation, accepts a filename and then it will load the relation from
that file. If no parameter is supplied an empty relation is created. Empty
@ -185,7 +187,6 @@ class relation (object):
if (newt.header.rename(old,new)) == False:
return None
#TODO only copy the link and mark the new relation as read only
newt.content=self.content
newt._readonly=True
return newt
@ -511,9 +512,13 @@ class header (object):
'''This class defines the header of a relation.
It is used within relations to know if requested operations are accepted'''
#Since relations are mutalbe we explicitly block hashing them
__hash__=None
def __init__(self,attributes):
'''Accepts a list with attributes' names. Names MUST be unique'''
self.attributes=attributes
def __repr__(self):
return "header(%s)" % (self.attributes.__repr__())

View File

@ -54,6 +54,8 @@ class rdate (object):
self.weekday=self.intdate.weekday()
self.year=self.intdate.year
def __hash__(self):
return self.intdate.__hash__()
def __str__(self):
return self.intdate.__str__()
def __add__(self,days):