source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19107_2003_spatial_schema/topology/topological_primitive/tp_expressionterm.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19107_2003_spatial_schema/topology/topological_primitive/tp_expressionterm.py@8457
Revision 8457, 6.3 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 ascore.utils import has_value, collectionProofHash
22
23'''
24Created on 10-Jul-2012 14:15:12
25
26@author: mnagni
27'''
28
29class TP_ExpressionTerm(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._expression_topocurve = None
43                self._expression_topovolume = None
44                self._expression_tp_shell = None
45                self._expression_topopoint = None
46                self._expression_toposurface = None
47                self._expression_tp_ring = None
48                self._expression_tp_boundary = None
49                self._expression = None
50                self._variable_tp_directededge = None
51                self._variable_tp_directedsolid = None
52                self._variable_tp_directedface = None
53                self._variable_tp_directednode = None
54                self._variable = None
55                self.coefficient = None
56                super(TP_ExpressionTerm, self).__init__()
57        @property
58        def expression(self):   
59                if(has_value(self._expression_topocurve)):
60                        return self._expression_topocurve
61                if(has_value(self._expression_topovolume)):
62                        return self._expression_topovolume
63                if(has_value(self._expression_tp_shell)):
64                        return self._expression_tp_shell
65                if(has_value(self._expression_topopoint)):
66                        return self._expression_topopoint
67                if(has_value(self._expression_toposurface)):
68                        return self._expression_toposurface
69                if(has_value(self._expression_tp_ring)):
70                        return self._expression_tp_ring
71                if(has_value(self._expression_tp_boundary)):
72                        return self._expression_tp_boundary
73                return  None
74
75        @expression.setter
76        def expression(self, value):   
77                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
78                if valueClass == "ea_model.iso_19136_gml.topology.topocurve.TopoCurve":
79                        self._expression_topocurve = value
80                        self._expression_topovolume = None
81                        self._expression_tp_shell = None
82                        self._expression_topopoint = None
83                        self._expression_toposurface = None
84                        self._expression_tp_ring = None
85                        self._expression_tp_boundary = None
86                if valueClass == "ea_model.iso_19136_gml.topology.topovolume.TopoVolume":
87                        self._expression_topovolume = value
88                        self._expression_topocurve = None
89                        self._expression_tp_shell = None
90                        self._expression_topopoint = None
91                        self._expression_toposurface = None
92                        self._expression_tp_ring = None
93                        self._expression_tp_boundary = None
94                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_shell.TP_Shell":
95                        self._expression_tp_shell = value
96                        self._expression_topocurve = None
97                        self._expression_topovolume = None
98                        self._expression_topopoint = None
99                        self._expression_toposurface = None
100                        self._expression_tp_ring = None
101                        self._expression_tp_boundary = None
102                if valueClass == "ea_model.iso_19136_gml.topology.topopoint.TopoPoint":
103                        self._expression_topopoint = value
104                        self._expression_topocurve = None
105                        self._expression_topovolume = None
106                        self._expression_tp_shell = None
107                        self._expression_toposurface = None
108                        self._expression_tp_ring = None
109                        self._expression_tp_boundary = None
110                if valueClass == "ea_model.iso_19136_gml.topology.toposurface.TopoSurface":
111                        self._expression_toposurface = value
112                        self._expression_topocurve = None
113                        self._expression_topovolume = None
114                        self._expression_tp_shell = None
115                        self._expression_topopoint = None
116                        self._expression_tp_ring = None
117                        self._expression_tp_boundary = None
118                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_ring.TP_Ring":
119                        self._expression_tp_ring = value
120                        self._expression_topocurve = None
121                        self._expression_topovolume = None
122                        self._expression_tp_shell = None
123                        self._expression_topopoint = None
124                        self._expression_toposurface = None
125                        self._expression_tp_boundary = None
126                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_boundary.TP_Boundary":
127                        self._expression_tp_boundary = value
128                        self._expression_topocurve = None
129                        self._expression_topovolume = None
130                        self._expression_tp_shell = None
131                        self._expression_topopoint = None
132                        self._expression_toposurface = None
133                        self._expression_tp_ring = None
134        @property
135        def variable(self):     
136                if(has_value(self._variable_tp_directededge)):
137                        return self._variable_tp_directededge
138                if(has_value(self._variable_tp_directedsolid)):
139                        return self._variable_tp_directedsolid
140                if(has_value(self._variable_tp_directedface)):
141                        return self._variable_tp_directedface
142                if(has_value(self._variable_tp_directednode)):
143                        return self._variable_tp_directednode
144                return  None
145
146        @variable.setter
147        def variable(self, value):     
148                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
149                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directededge.TP_DirectedEdge":
150                        self._variable_tp_directededge = value
151                        self._variable_tp_directedsolid = None
152                        self._variable_tp_directedface = None
153                        self._variable_tp_directednode = None
154                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directedsolid.TP_DirectedSolid":
155                        self._variable_tp_directedsolid = value
156                        self._variable_tp_directededge = None
157                        self._variable_tp_directedface = None
158                        self._variable_tp_directednode = None
159                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directedface.TP_DirectedFace":
160                        self._variable_tp_directedface = value
161                        self._variable_tp_directededge = None
162                        self._variable_tp_directedsolid = None
163                        self._variable_tp_directednode = None
164                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directednode.TP_DirectedNode":
165                        self._variable_tp_directednode = value
166                        self._variable_tp_directededge = None
167                        self._variable_tp_directedsolid = None
168                        self._variable_tp_directedface = None
169
170        def synchronize(self):
171                pass
172
173        def __key(self):
174                return (self.expression, self.variable, self.coefficient)
175
176        def __eq__(self, y):
177                if type(self) != type(y):
178                        return False
179                '''
180                Cannot compare classes which do not define a "__key" attribute
181                '''
182                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
183                        return self.__key() == y.__key()
184                return id(self) == id(y)
185
186        def __hash__(self):
187                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.