source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19136_gml/units/derivedunit.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19136_gml/units/derivedunit.py@8457
Revision 8457, 2.7 KB checked in by mnagni, 7 years ago (diff)

Corrected an error in the generation of the classes "synchronize" method.

  • Property svn:mime-type set to text/plain
Line 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21from ea_model.iso_19136_gml.units.unitdefinition import  UnitDefinition
22from ascore.utils import has_value, collectionProofHash
23
24'''
25Created on 10-Jul-2012 14:15:10
26
27@author: mnagni
28'''
29
30class DerivedUnit(UnitDefinition):
31        '''
32                Represents a data entity defined in a UML diagram and supposed to
33                be persisted in a relational database.
34 
35                This class has been genererated automatically using the Apache Velocity project.
36        '''
37        '''
38                Please note that any access to the inner attributes should be done using
39                the given get/set methods and NOT accessing them directly.
40        '''
41        def __init__(self):
42                self._unitdefinition = UnitDefinition()         
43
44                self.identifier = None
45                self.derivationUnitTerm = []
46                self.catalogSymbol = None
47                self.description = None
48                self.quantityTypeReference = None
49                self.descriptionReference = None
50                self.quantityType = None
51                super(DerivedUnit, self).__init__()
52        @property
53        def identifier(self):   
54                return self._unitdefinition.identifier
55
56        @identifier.setter
57        def identifier(self, value):   
58                        self._unitdefinition.identifier = value
59        @property
60        def name(self):
61                return self._unitdefinition.name
62
63        @name.setter
64        def name(self, value): 
65                        self._unitdefinition.name = value
66        @property
67        def catalogSymbol(self):       
68                return self._unitdefinition.catalogSymbol
69
70        @catalogSymbol.setter
71        def catalogSymbol(self, value):
72                        self._unitdefinition.catalogSymbol = value
73        @property
74        def description(self): 
75                return self._unitdefinition.description
76
77        @description.setter
78        def description(self, value):   
79                        self._unitdefinition.description = value
80        @property
81        def quantityTypeReference(self):       
82                return self._unitdefinition.quantityTypeReference
83
84        @quantityTypeReference.setter
85        def quantityTypeReference(self, value):
86                        self._unitdefinition.quantityTypeReference = value
87        @property
88        def descriptionReference(self):
89                return self._unitdefinition.descriptionReference
90
91        @descriptionReference.setter
92        def descriptionReference(self, value): 
93                        self._unitdefinition.descriptionReference = value
94        @property
95        def quantityType(self):
96                return self._unitdefinition.quantityType
97
98        @quantityType.setter
99        def quantityType(self, value): 
100                        self._unitdefinition.quantityType = value
101
102        def synchronize(self):
103                pass
104
105        def __key(self):
106                return (self.identifier, self.name, self.derivationUnitTerm, self.catalogSymbol, self.description, self.quantityTypeReference, self.descriptionReference, self.quantityType)
107
108        def __eq__(self, y):
109                if type(self) != type(y):
110                        return False
111                '''
112                Cannot compare classes which do not define a "__key" attribute
113                '''
114                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
115                        return self.__key() == y.__key()
116                return id(self) == id(y)
117
118        def __hash__(self):
119                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.