source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/xamples/norwegian_land_information_spatial_schema/nl_compsitesurface.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/xamples/norwegian_land_information_spatial_schema/nl_compsitesurface.py@8457
Revision 8457, 3.2 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.xamples.norwegian_land_information_spatial_schema.nl_composite import  NL_Composite
22from ea_model.informative.xamples.norwegian_land_information_spatial_schema.nl_orientablesurface import  NL_OrientableSurface
23from ascore.utils import has_value, collectionProofHash
24
25'''
26Created on 10-Jul-2012 14:15:08
27
28@author: mnagni
29'''
30
31class NL_CompsiteSurface(NL_Composite,NL_OrientableSurface):
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._nl_orientablesurface = NL_OrientableSurface()     
44                self._nl_composite = NL_Composite()     
45
46                self.orientation = None
47                self.superComplex = None
48                self._generator_nl_surface = []
49                self._generator_nl_compsitesurface = []
50                self._generator = []
51                super(NL_CompsiteSurface, self).__init__()
52        @property
53        def composite(self):   
54                return self._nl_orientablesurface.composite
55
56        @composite.setter
57        def composite(self, value):     
58                        self._nl_orientablesurface.composite = value
59        @property
60        def superComplex(self):
61                return self._nl_composite.superComplex
62
63        @superComplex.setter
64        def superComplex(self, value): 
65                        self._nl_composite.superComplex = value
66        @property
67        def complex(self):     
68                return self._nl_orientablesurface.complex
69
70        @complex.setter
71        def complex(self, value):       
72                        self._nl_orientablesurface.complex = value
73        @property
74        def boundary(self):     
75                return self._nl_orientablesurface.boundary
76
77        @boundary.setter
78        def boundary(self, value):     
79                        self._nl_orientablesurface.boundary = value
80        @property
81        def generator(self):   
82                try:
83                        ret = []
84                        ret.extend(self._generator_nl_surface)
85                        ret.extend(self._generator_nl_compsitesurface)
86                        if not hasattr(self, '_generator'):
87                                self._generator = []
88                        if self._generator is not None:
89                                ret.extend(self._generator)
90                        del self._generator[:]
91                        self._generator.extend(set(ret))
92                except Exception as e:
93                        pass
94                return self._generator
95
96
97        def synchronize(self):
98                int_generator = self.generator 
99                del self._generator_nl_surface[:]
100                del self._generator_nl_compsitesurface[:]
101                for item in int_generator:     
102                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
103                        if valueClass == "ea_model.informative.xamples.norwegian_land_information_spatial_schema.nl_surface.NL_Surface":
104                                self._generator_nl_surface.append(item)
105                                continue
106                        if valueClass == "ea_model.informative.xamples.norwegian_land_information_spatial_schema.nl_compsitesurface.NL_CompsiteSurface":
107                                self._generator_nl_compsitesurface.append(item)
108                                continue
109                pass
110
111        def __key(self):
112                return (self.composite, self.orientation, self.superComplex, self.complex, self.boundary, self.generator)
113
114        def __eq__(self, y):
115                if type(self) != type(y):
116                        return False
117                '''
118                Cannot compare classes which do not define a "__key" attribute
119                '''
120                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
121                        return self.__key() == y.__key()
122                return id(self) == id(y)
123
124        def __hash__(self):
125                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.