source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/xamples/norwegian_land_information_spatial_schema/nl_compositecurve.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_compositecurve.py@8457
Revision 8457, 3.0 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_orientablecurve import  NL_OrientableCurve
23from ascore.utils import has_value, collectionProofHash
24
25'''
26Created on 10-Jul-2012 14:15:04
27
28@author: mnagni
29'''
30
31class NL_CompositeCurve(NL_Composite,NL_OrientableCurve):
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_orientablecurve = NL_OrientableCurve()         
44                self._nl_composite = NL_Composite()     
45
46                self.orientation = None
47                self.superComplex = None
48                self._generator_nl_compositecurve = []
49                self._generator_nl_curve = []
50                self._generator = []
51                super(NL_CompositeCurve, self).__init__()
52        @property
53        def composite(self):   
54                return self._nl_orientablecurve.composite
55
56        @composite.setter
57        def composite(self, value):     
58                        self._nl_orientablecurve.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_orientablecurve.complex
69
70        @complex.setter
71        def complex(self, value):       
72                        self._nl_orientablecurve.complex = value
73        @property
74        def generator(self):   
75                try:
76                        ret = []
77                        ret.extend(self._generator_nl_compositecurve)
78                        ret.extend(self._generator_nl_curve)
79                        if not hasattr(self, '_generator'):
80                                self._generator = []
81                        if self._generator is not None:
82                                ret.extend(self._generator)
83                        del self._generator[:]
84                        self._generator.extend(set(ret))
85                except Exception as e:
86                        pass
87                return self._generator
88
89
90        def synchronize(self):
91                int_generator = self.generator 
92                del self._generator_nl_compositecurve[:]
93                del self._generator_nl_curve[:]
94                for item in int_generator:     
95                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
96                        if valueClass == "ea_model.informative.xamples.norwegian_land_information_spatial_schema.nl_compositecurve.NL_CompositeCurve":
97                                self._generator_nl_compositecurve.append(item)
98                                continue
99                        if valueClass == "ea_model.informative.xamples.norwegian_land_information_spatial_schema.nl_curve.NL_Curve":
100                                self._generator_nl_curve.append(item)
101                                continue
102                pass
103
104        def __key(self):
105                return (self.composite, self.orientation, self.superComplex, self.complex, self.generator)
106
107        def __eq__(self, y):
108                if type(self) != type(y):
109                        return False
110                '''
111                Cannot compare classes which do not define a "__key" attribute
112                '''
113                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
114                        return self.__key() == y.__key()
115                return id(self) == id(y)
116
117        def __hash__(self):
118                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.