source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19108_2006_temporal_schema/temporal_reference_system/tm_temporalposition.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19108_2006_temporal_schema/temporal_reference_system/tm_temporalposition.py@8457
Revision 8457, 3.4 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:06
25
26@author: mnagni
27'''
28
29class TM_TemporalPosition(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.indeterminatePosition = None
43                self._frame_tm_temporalcrs = None
44                self._frame_tm_ordinalreferencesystem = None
45                self._frame_tm_coordinatesystem = None
46                self._frame_tm_calendar = None
47                self._frame_tm_clock = None
48                self._frame = None
49                super(TM_TemporalPosition, self).__init__()
50        @property
51        def frame(self):       
52                if(has_value(self._frame_tm_temporalcrs)):
53                        return self._frame_tm_temporalcrs
54                if(has_value(self._frame_tm_ordinalreferencesystem)):
55                        return self._frame_tm_ordinalreferencesystem
56                if(has_value(self._frame_tm_coordinatesystem)):
57                        return self._frame_tm_coordinatesystem
58                if(has_value(self._frame_tm_calendar)):
59                        return self._frame_tm_calendar
60                if(has_value(self._frame_tm_clock)):
61                        return self._frame_tm_clock
62                return  None
63
64        @frame.setter
65        def frame(self, value):
66                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
67                if valueClass == "ea_model.iso_19111_referencing_by_coordinates.temporal_reference_systems.tm_temporalcrs.TM_TemporalCRS":
68                        self._frame_tm_temporalcrs = value
69                        self._frame_tm_ordinalreferencesystem = None
70                        self._frame_tm_coordinatesystem = None
71                        self._frame_tm_calendar = None
72                        self._frame_tm_clock = None
73                if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_reference_system.tm_ordinalreferencesystem.TM_OrdinalReferenceSystem":
74                        self._frame_tm_ordinalreferencesystem = value
75                        self._frame_tm_temporalcrs = None
76                        self._frame_tm_coordinatesystem = None
77                        self._frame_tm_calendar = None
78                        self._frame_tm_clock = None
79                if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_reference_system.tm_coordinatesystem.TM_CoordinateSystem":
80                        self._frame_tm_coordinatesystem = value
81                        self._frame_tm_temporalcrs = None
82                        self._frame_tm_ordinalreferencesystem = None
83                        self._frame_tm_calendar = None
84                        self._frame_tm_clock = None
85                if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_reference_system.tm_calendar.TM_Calendar":
86                        self._frame_tm_calendar = value
87                        self._frame_tm_temporalcrs = None
88                        self._frame_tm_ordinalreferencesystem = None
89                        self._frame_tm_coordinatesystem = None
90                        self._frame_tm_clock = None
91                if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_reference_system.tm_clock.TM_Clock":
92                        self._frame_tm_clock = value
93                        self._frame_tm_temporalcrs = None
94                        self._frame_tm_ordinalreferencesystem = None
95                        self._frame_tm_coordinatesystem = None
96                        self._frame_tm_calendar = None
97
98        def synchronize(self):
99                pass
100
101        def __key(self):
102                return (self.indeterminatePosition, self.frame)
103
104        def __eq__(self, y):
105                if type(self) != type(y):
106                        return False
107                '''
108                Cannot compare classes which do not define a "__key" attribute
109                '''
110                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
111                        return self.__key() == y.__key()
112                return id(self) == id(y)
113
114        def __hash__(self):
115                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.