source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19156_2011_observations_and_measurements/general_feature_instance/gfi_feature.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19156_2011_observations_and_measurements/general_feature_instance/gfi_feature.py@8457
Revision 8457, 5.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 ascore.utils import has_value, collectionProofHash
22
23'''
24Created on 10-Jul-2012 14:15:14
25
26@author: mnagni
27'''
28
29class GFI_Feature(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._propertyValueProvider_om_geometryobservation = []
43                self._propertyValueProvider_om_countobservation = []
44                self._propertyValueProvider_om_categoryobservation = []
45                self._propertyValueProvider_om_temporalobservation = []
46                self._propertyValueProvider_om_truthobservation = []
47                self._propertyValueProvider_om_complexobservation = []
48                self._propertyValueProvider_om_measurement = []
49                self._propertyValueProvider_om_discretecoverageobservation = []
50                self._propertyValueProvider_mo_observation = []
51                self._propertyValueProvider = []
52                super(GFI_Feature, self).__init__()
53        @property
54        def propertyValueProvider(self):       
55                try:
56                        ret = []
57                        ret.extend(self._propertyValueProvider_om_geometryobservation)
58                        ret.extend(self._propertyValueProvider_om_countobservation)
59                        ret.extend(self._propertyValueProvider_om_categoryobservation)
60                        ret.extend(self._propertyValueProvider_om_temporalobservation)
61                        ret.extend(self._propertyValueProvider_om_truthobservation)
62                        ret.extend(self._propertyValueProvider_om_complexobservation)
63                        ret.extend(self._propertyValueProvider_om_measurement)
64                        ret.extend(self._propertyValueProvider_om_discretecoverageobservation)
65                        ret.extend(self._propertyValueProvider_mo_observation)
66                        if not hasattr(self, '_propertyValueProvider'):
67                                self._propertyValueProvider = []
68                        if self._propertyValueProvider is not None:
69                                ret.extend(self._propertyValueProvider)
70                        del self._propertyValueProvider[:]
71                        self._propertyValueProvider.extend(set(ret))
72                except Exception as e:
73                        pass
74                return self._propertyValueProvider
75
76
77        def synchronize(self):
78                int_propertyValueProvider = self.propertyValueProvider 
79                del self._propertyValueProvider_om_geometryobservation[:]
80                del self._propertyValueProvider_om_countobservation[:]
81                del self._propertyValueProvider_om_categoryobservation[:]
82                del self._propertyValueProvider_om_temporalobservation[:]
83                del self._propertyValueProvider_om_truthobservation[:]
84                del self._propertyValueProvider_om_complexobservation[:]
85                del self._propertyValueProvider_om_measurement[:]
86                del self._propertyValueProvider_om_discretecoverageobservation[:]
87                del self._propertyValueProvider_mo_observation[:]
88                for item in int_propertyValueProvider: 
89                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
90                        if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.geometryobservation.om_geometryobservation.OM_GeometryObservation":
91                                self._propertyValueProvider_om_geometryobservation.append(item)
92                                continue
93                        if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.countobservation.om_countobservation.OM_CountObservation":
94                                self._propertyValueProvider_om_countobservation.append(item)
95                                continue
96                        if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.categoryobservation.om_categoryobservation.OM_CategoryObservation":
97                                self._propertyValueProvider_om_categoryobservation.append(item)
98                                continue
99                        if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.temporalobservation.om_temporalobservation.OM_TemporalObservation":
100                                self._propertyValueProvider_om_temporalobservation.append(item)
101                                continue
102                        if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.truthobservation.om_truthobservation.OM_TruthObservation":
103                                self._propertyValueProvider_om_truthobservation.append(item)
104                                continue
105                        if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.complexobservation.om_complexobservation.OM_ComplexObservation":
106                                self._propertyValueProvider_om_complexobservation.append(item)
107                                continue
108                        if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.measurement.om_measurement.OM_Measurement":
109                                self._propertyValueProvider_om_measurement.append(item)
110                                continue
111                        if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.observation_schema.coverageobservation.om_discretecoverageobservation.OM_DiscreteCoverageObservation":
112                                self._propertyValueProvider_om_discretecoverageobservation.append(item)
113                                continue
114                        if valueClass == "ea_model.moles3_4.observation.mo_observation.MO_Observation":
115                                self._propertyValueProvider_mo_observation.append(item)
116                                continue
117                pass
118
119        def __key(self):
120                return (self.propertyValueProvider)
121
122        def __eq__(self, y):
123                if type(self) != type(y):
124                        return False
125                '''
126                Cannot compare classes which do not define a "__key" attribute
127                '''
128                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
129                        return self.__key() == y.__key()
130                return id(self) == id(y)
131
132        def __hash__(self):
133                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.