source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/spatial_examples_from_iso_19107/application_schema/topology_simple/simple_topology/ts_edge.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/spatial_examples_from_iso_19107/application_schema/topology_simple/simple_topology/ts_edge.py@8457
Revision 8457, 3.1 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.informative.spatial_examples_from_iso_19107.application_schema.topology_simple.simple_topology.ts_root import  TS_Root
22from ea_model.informative.spatial_examples_from_iso_19107.application_schema.topology_simple.simple_topology.ts_directededge import  TS_DirectedEdge
23from ascore.utils import has_value, collectionProofHash
24
25'''
26Created on 10-Jul-2012 14:15:03
27
28@author: mnagni
29'''
30
31class TS_Edge(TS_DirectedEdge,TS_Root):
32        '''
33                Represents a data entity defined in a UML diagram and supposed to
34                be persisted in a relational database.
35 
36                This class has been genererated automatically using the Apache Velocity project.
37        '''
38        '''
39                Please note that any access to the inner attributes should be done using
40                the given get/set methods and NOT accessing them directly.
41        '''
42        def __init__(self):
43                self._ts_root = TS_Root()       
44                self._ts_directededge = TS_DirectedEdge()       
45
46                self.orientation = None
47                self.hub = None
48                self._proxy_ts_edge = None
49                self._proxy_gr_directededge = None
50                self._proxy = None
51                self.primitive = None
52                self.side = None
53                super(TS_Edge, self).__init__()
54        @property
55        def composite(self):   
56                return self._ts_directededge.composite
57
58        @composite.setter
59        def composite(self, value):     
60                        self._ts_directededge.composite = value
61        @property
62        def orientation(self): 
63                return self._ts_directededge.orientation
64
65        @orientation.setter
66        def orientation(self, value):   
67                        self._ts_directededge.orientation = value
68        @property
69        def hub(self): 
70                return self._ts_directededge.hub
71
72        @hub.setter
73        def hub(self, value):   
74                        self._ts_directededge.hub = value
75        @property
76        def proxy(self):       
77                if(has_value(self._proxy_ts_edge)):
78                        return self._proxy_ts_edge
79                if(has_value(self._proxy_gr_directededge)):
80                        return self._proxy_gr_directededge
81                return  None
82
83        @proxy.setter
84        def proxy(self, value):
85                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
86                if valueClass == "ea_model.informative.spatial_examples_from_iso_19107.application_schema.topology_simple.simple_topology.ts_edge.TS_Edge":
87                        self._proxy_ts_edge = value
88                        self._proxy_gr_directededge = None
89                if valueClass == "ea_model.informative.spatial_examples_from_iso_19107.application_schema.topology_simple.graph.gr_directededge.GR_DirectedEdge":
90                        self._proxy_gr_directededge = value
91                        self._proxy_ts_edge = None
92        @property
93        def primitive(self):   
94                return self._ts_directededge.primitive
95
96        @primitive.setter
97        def primitive(self, value):     
98                        self._ts_directededge.primitive = value
99        @property
100        def side(self):
101                return self._ts_directededge.side
102
103        @side.setter
104        def side(self, value): 
105                        self._ts_directededge.side = value
106
107        def synchronize(self):
108                pass
109
110        def __key(self):
111                return (self.composite, self.orientation, self.hub, self.proxy, self.primitive, self.side)
112
113        def __eq__(self, y):
114                if type(self) != type(y):
115                        return False
116                '''
117                Cannot compare classes which do not define a "__key" attribute
118                '''
119                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
120                        return self.__key() == y.__key()
121                return id(self) == id(y)
122
123        def __hash__(self):
124                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.