source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19130_sensor_data/replacement/sd_localmodel.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19130_sensor_data/replacement/sd_localmodel.py@8457
Revision 8457, 4.5 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:05
25
26@author: mnagni
27'''
28
29class SD_LocalModel(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.identifier = None
43                self.childModel = []
44                self._localGeolocationInformation_sd_gcpcollection = None
45                self._localGeolocationInformation_sd_multimodel = None
46                self._localGeolocationInformation_sd_functionalfitmodel = None
47                self._localGeolocationInformation_sd_sensormodel = None
48                self._localGeolocationInformation_sd_rasterdigitisedproduct = None
49                self._localGeolocationInformation = None
50                self.parentModel = None
51                self.regionOfValidity = []
52                super(SD_LocalModel, self).__init__()
53        @property
54        def localGeolocationInformation(self): 
55                if(has_value(self._localGeolocationInformation_sd_gcpcollection)):
56                        return self._localGeolocationInformation_sd_gcpcollection
57                if(has_value(self._localGeolocationInformation_sd_multimodel)):
58                        return self._localGeolocationInformation_sd_multimodel
59                if(has_value(self._localGeolocationInformation_sd_functionalfitmodel)):
60                        return self._localGeolocationInformation_sd_functionalfitmodel
61                if(has_value(self._localGeolocationInformation_sd_sensormodel)):
62                        return self._localGeolocationInformation_sd_sensormodel
63                if(has_value(self._localGeolocationInformation_sd_rasterdigitisedproduct)):
64                        return self._localGeolocationInformation_sd_rasterdigitisedproduct
65                return  None
66
67        @localGeolocationInformation.setter
68        def localGeolocationInformation(self, value):   
69                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
70                if valueClass == "ea_model.iso_19130_sensor_data.ground_control.sd_gcpcollection.SD_GCPCollection":
71                        self._localGeolocationInformation_sd_gcpcollection = value
72                        self._localGeolocationInformation_sd_multimodel = None
73                        self._localGeolocationInformation_sd_functionalfitmodel = None
74                        self._localGeolocationInformation_sd_sensormodel = None
75                        self._localGeolocationInformation_sd_rasterdigitisedproduct = None
76                if valueClass == "ea_model.iso_19130_sensor_data.sd_multimodel.SD_MultiModel":
77                        self._localGeolocationInformation_sd_multimodel = value
78                        self._localGeolocationInformation_sd_gcpcollection = None
79                        self._localGeolocationInformation_sd_functionalfitmodel = None
80                        self._localGeolocationInformation_sd_sensormodel = None
81                        self._localGeolocationInformation_sd_rasterdigitisedproduct = None
82                if valueClass == "ea_model.iso_19130_sensor_data.functional_fit.sd_functionalfitmodel.SD_FunctionalFitModel":
83                        self._localGeolocationInformation_sd_functionalfitmodel = value
84                        self._localGeolocationInformation_sd_gcpcollection = None
85                        self._localGeolocationInformation_sd_multimodel = None
86                        self._localGeolocationInformation_sd_sensormodel = None
87                        self._localGeolocationInformation_sd_rasterdigitisedproduct = None
88                if valueClass == "ea_model.iso_19130_sensor_data.sensor_model.sd_sensormodel.SD_SensorModel":
89                        self._localGeolocationInformation_sd_sensormodel = value
90                        self._localGeolocationInformation_sd_gcpcollection = None
91                        self._localGeolocationInformation_sd_multimodel = None
92                        self._localGeolocationInformation_sd_functionalfitmodel = None
93                        self._localGeolocationInformation_sd_rasterdigitisedproduct = None
94                if valueClass == "ea_model.iso_19130_sensor_data.raster_digitised_product.sd_rasterdigitisedproduct.SD_RasterDigitisedProduct":
95                        self._localGeolocationInformation_sd_rasterdigitisedproduct = value
96                        self._localGeolocationInformation_sd_gcpcollection = None
97                        self._localGeolocationInformation_sd_multimodel = None
98                        self._localGeolocationInformation_sd_functionalfitmodel = None
99                        self._localGeolocationInformation_sd_sensormodel = None
100
101        def synchronize(self):
102                pass
103
104        def __key(self):
105                return (self.identifier, self.childModel, self.localGeolocationInformation, self.parentModel, self.regionOfValidity)
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.