source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/spatial_examples_from_iso_19107/application_schema/topology_simple/simple_topology/ts_curvecomponent.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_curvecomponent.py@8457
Revision 8457, 4.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_featurecomponent import  TS_FeatureComponent
22from ascore.utils import has_value, collectionProofHash
23
24'''
25Created on 10-Jul-2012 14:15:09
26
27@author: mnagni
28'''
29
30class TS_CurveComponent(TS_FeatureComponent):
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._ts_featurecomponent = TS_FeatureComponent()       
43
44                self.attribute = None
45                self.composite = None
46                self.isGlobal = None
47                self.orientation = None
48                self.localName = None
49                self._generator_ts_edge = []
50                self._generator_gr_directededge = []
51                self._generator = []
52                super(TS_CurveComponent, self).__init__()
53        @property
54        def attribute(self):   
55                return self._ts_featurecomponent.attribute
56
57        @attribute.setter
58        def attribute(self, value):     
59                        self._ts_featurecomponent.attribute = value
60        @property
61        def composite(self):   
62                return self._ts_featurecomponent.composite
63
64        @composite.setter
65        def composite(self, value):     
66                        self._ts_featurecomponent.composite = value
67        @property
68        def isGlobal(self):     
69                return self._ts_featurecomponent.isGlobal
70
71        @isGlobal.setter
72        def isGlobal(self, value):     
73                        self._ts_featurecomponent.isGlobal = value
74        @property
75        def component(self):   
76                return self._ts_featurecomponent.component
77
78        @component.setter
79        def component(self, value):     
80                        self._ts_featurecomponent.component = value
81        @property
82        def localName(self):   
83                return self._ts_featurecomponent.localName
84
85        @localName.setter
86        def localName(self, value):     
87                        self._ts_featurecomponent.localName = value
88        @property
89        def theTS_FeatureComponent(self):       
90                return self._ts_featurecomponent.theTS_FeatureComponent
91
92        @theTS_FeatureComponent.setter
93        def theTS_FeatureComponent(self, value):       
94                        self._ts_featurecomponent.theTS_FeatureComponent = value
95        @property
96        def acceptableClassList(self): 
97                return self._ts_featurecomponent.acceptableClassList
98
99        @acceptableClassList.setter
100        def acceptableClassList(self, value):   
101                        self._ts_featurecomponent.acceptableClassList = value
102        @property
103        def generator(self):   
104                try:
105                        ret = []
106                        ret.extend(self._generator_ts_edge)
107                        ret.extend(self._generator_gr_directededge)
108                        if not hasattr(self, '_generator'):
109                                self._generator = []
110                        if self._generator is not None:
111                                ret.extend(self._generator)
112                        del self._generator[:]
113                        self._generator.extend(set(ret))
114                except Exception as e:
115                        pass
116                return self._generator
117
118        @property
119        def theme(self):       
120                return self._ts_featurecomponent.theme
121
122        @theme.setter
123        def theme(self, value):
124                        self._ts_featurecomponent.theme = value
125
126        def synchronize(self):
127                int_generator = self.generator 
128                del self._generator_ts_edge[:]
129                del self._generator_gr_directededge[:]
130                for item in int_generator:     
131                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
132                        if valueClass == "ea_model.informative.spatial_examples_from_iso_19107.application_schema.topology_simple.simple_topology.ts_edge.TS_Edge":
133                                self._generator_ts_edge.append(item)
134                                continue
135                        if valueClass == "ea_model.informative.spatial_examples_from_iso_19107.application_schema.topology_simple.graph.gr_directededge.GR_DirectedEdge":
136                                self._generator_gr_directededge.append(item)
137                                continue
138                pass
139
140        def __key(self):
141                return (self.attribute, self.composite, self.isGlobal, self.orientation, self.component, self.localName, self.theTS_FeatureComponent, self.acceptableClassList, self.generator, self.theme)
142
143        def __eq__(self, y):
144                if type(self) != type(y):
145                        return False
146                '''
147                Cannot compare classes which do not define a "__key" attribute
148                '''
149                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
150                        return self.__key() == y.__key()
151                return id(self) == id(y)
152
153        def __hash__(self):
154                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.