source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19133_tracking_and_navigation/network/route/nt_routesummary.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19133_tracking_and_navigation/network/route/nt_routesummary.py@8457
Revision 8457, 3.3 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:08
25
26@author: mnagni
27'''
28
29class NT_RouteSummary(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.begin = None
43                self.stops = None
44                self.distance = None
45                self._extent_ex_geographicdescription = None
46                self._extent_ex_geographicboundingbox = None
47                self._extent_ex_boundingpolygon = None
48                self._extent = None
49                self.end = None
50                self._time_tm_periodduration = None
51                self._time_tm_intervallength = None
52                self._time = None
53                super(NT_RouteSummary, self).__init__()
54        @property
55        def extent(self):       
56                if(has_value(self._extent_ex_geographicdescription)):
57                        return self._extent_ex_geographicdescription
58                if(has_value(self._extent_ex_geographicboundingbox)):
59                        return self._extent_ex_geographicboundingbox
60                if(has_value(self._extent_ex_boundingpolygon)):
61                        return self._extent_ex_boundingpolygon
62                return  None
63
64        @extent.setter
65        def extent(self, value):       
66                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
67                if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.extent_information.ex_geographicdescription.EX_GeographicDescription":
68                        self._extent_ex_geographicdescription = value
69                        self._extent_ex_geographicboundingbox = None
70                        self._extent_ex_boundingpolygon = None
71                if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.extent_information.ex_geographicboundingbox.EX_GeographicBoundingBox":
72                        self._extent_ex_geographicboundingbox = value
73                        self._extent_ex_geographicdescription = None
74                        self._extent_ex_boundingpolygon = None
75                if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.extent_information.ex_boundingpolygon.EX_BoundingPolygon":
76                        self._extent_ex_boundingpolygon = value
77                        self._extent_ex_geographicdescription = None
78                        self._extent_ex_geographicboundingbox = None
79        @property
80        def time(self):
81                if(has_value(self._time_tm_periodduration)):
82                        return self._time_tm_periodduration
83                if(has_value(self._time_tm_intervallength)):
84                        return self._time_tm_intervallength
85                return  None
86
87        @time.setter
88        def time(self, value): 
89                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
90                if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_objects.tm_periodduration.TM_PeriodDuration":
91                        self._time_tm_periodduration = value
92                        self._time_tm_intervallength = None
93                if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_objects.tm_intervallength.TM_IntervalLength":
94                        self._time_tm_intervallength = value
95                        self._time_tm_periodduration = None
96
97        def synchronize(self):
98                pass
99
100        def __key(self):
101                return (self.begin, self.stops, self.distance, self.extent, self.end, self.time)
102
103        def __eq__(self, y):
104                if type(self) != type(y):
105                        return False
106                '''
107                Cannot compare classes which do not define a "__key" attribute
108                '''
109                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
110                        return self.__key() == y.__key()
111                return id(self) == id(y)
112
113        def __hash__(self):
114                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.