1 | |
---|
2 | |
---|
3 | |
---|
4 | |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | |
---|
9 | |
---|
10 | |
---|
11 | |
---|
12 | |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | from ascore.utils import has_value |
---|
22 | |
---|
23 | ''' |
---|
24 | Created on 14-Feb-2012 17:19:28 |
---|
25 | |
---|
26 | @author: mnagni |
---|
27 | ''' |
---|
28 | |
---|
29 | class UnitOfMeasure(object): |
---|
30 | ''' |
---|
31 | Represents a data entity defined in a UML diagram and supposed to |
---|
32 | be persisted in a relational database. |
---|
33 | |
---|
34 | This class has been genererated automatically using the Apache Velocity project. |
---|
35 | ''' |
---|
36 | ''' |
---|
37 | Please note that any access to the inner attributes should be done using |
---|
38 | the given get/set methods and NOT accessing them directly. |
---|
39 | ''' |
---|
40 | def __init__(self): |
---|
41 | |
---|
42 | self.subunit = None |
---|
43 | self.nameStandardUnit = None |
---|
44 | self.scaleToStandardUnit = None |
---|
45 | self.measure = [] |
---|
46 | self.measureType = None |
---|
47 | self.offsetToStandardUnit = None |
---|
48 | self.uomName = None |
---|
49 | self.formula = None |
---|
50 | self.uomSymbol = None |
---|
51 | super(UnitOfMeasure, self).__init__() |
---|
52 | |
---|
53 | def __key(self): |
---|
54 | return (self.subunit, self.nameStandardUnit, self.scaleToStandardUnit, self.measure, self.measureType, self.offsetToStandardUnit, self.uomName, self.formula, self.uomSymbol) |
---|
55 | |
---|
56 | def __eq__(self, y): |
---|
57 | ''' |
---|
58 | Cannot compare classes which do not define a "__key" attribute |
---|
59 | ''' |
---|
60 | if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)): |
---|
61 | return self.__key() == y.__key() |
---|
62 | return id(self) == id(y) |
---|
63 | |
---|
64 | def __hash__(self): |
---|
65 | return hash(self.__key()) |
---|