source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19133_tracking_and_navigation/network/combined_networks/nt_combinednetwork.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/combined_networks/nt_combinednetwork.py@8457
Revision 8457, 3.8 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.iso_19133_tracking_and_navigation.network.network_model.nt_network import  NT_Network
22from ascore.utils import has_value, collectionProofHash
23
24'''
25Created on 10-Jul-2012 14:15:06
26
27@author: mnagni
28'''
29
30class NT_CombinedNetwork(NT_Network):
31        '''
32                Represents a data entity defined in a UML diagram and supposed to
33                be persisted in a relational database.
34 
35                This class has been genererated automatically using the Apache Velocity project.
36        '''
37        '''
38                Please note that any access to the inner attributes should be done using
39                the given get/set methods and NOT accessing them directly.
40        '''
41        def __init__(self):
42                self._nt_network = NT_Network()         
43
44                self.transferLlink = []
45                self.maximalComplex = None
46                self.transferNode = []
47                self.geometry = None
48                self._componentNetworks_nt_combinednetwork = []
49                self._componentNetworks_nt_route = []
50                self._componentNetworks = []
51                super(NT_CombinedNetwork, self).__init__()
52        @property
53        def turn(self):
54                return self._nt_network.turn
55
56        @turn.setter
57        def turn(self, value): 
58                        self._nt_network.turn = value
59        @property
60        def maximalComplex(self):       
61                return self._nt_network.maximalComplex
62
63        @maximalComplex.setter
64        def maximalComplex(self, value):       
65                        self._nt_network.maximalComplex = value
66        @property
67        def subComplex(self):   
68                return self._nt_network.subComplex
69
70        @subComplex.setter
71        def subComplex(self, value):   
72                        self._nt_network.subComplex = value
73        @property
74        def superComplex(self):
75                return self._nt_network.superComplex
76
77        @superComplex.setter
78        def superComplex(self, value): 
79                        self._nt_network.superComplex = value
80        @property
81        def geometry(self):     
82                return self._nt_network.geometry
83
84        @geometry.setter
85        def geometry(self, value):     
86                        self._nt_network.geometry = value
87        @property
88        def junction(self):     
89                return self._nt_network.junction
90
91        @junction.setter
92        def junction(self, value):     
93                        self._nt_network.junction = value
94        @property
95        def element(self):     
96                return self._nt_network.element
97
98        @element.setter
99        def element(self, value):       
100                        self._nt_network.element = value
101        @property
102        def componentNetworks(self):   
103                try:
104                        ret = []
105                        ret.extend(self._componentNetworks_nt_combinednetwork)
106                        ret.extend(self._componentNetworks_nt_route)
107                        if not hasattr(self, '_componentNetworks'):
108                                self._componentNetworks = []
109                        if self._componentNetworks is not None:
110                                ret.extend(self._componentNetworks)
111                        del self._componentNetworks[:]
112                        self._componentNetworks.extend(set(ret))
113                except Exception as e:
114                        pass
115                return self._componentNetworks
116
117        @property
118        def link(self):
119                return self._nt_network.link
120
121        @link.setter
122        def link(self, value): 
123                        self._nt_network.link = value
124
125        def synchronize(self):
126                int_componentNetworks = self.componentNetworks 
127                del self._componentNetworks_nt_combinednetwork[:]
128                del self._componentNetworks_nt_route[:]
129                for item in int_componentNetworks:     
130                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
131                        if valueClass == "ea_model.iso_19133_tracking_and_navigation.network.combined_networks.nt_combinednetwork.NT_CombinedNetwork":
132                                self._componentNetworks_nt_combinednetwork.append(item)
133                                continue
134                        if valueClass == "ea_model.iso_19133_tracking_and_navigation.network.route.nt_route.NT_Route":
135                                self._componentNetworks_nt_route.append(item)
136                                continue
137                pass
138
139        def __key(self):
140                return (self.turn, self.transferLlink, self.maximalComplex, self.transferNode, self.subComplex, self.superComplex, self.geometry, self.junction, self.element, self.componentNetworks, self.link)
141
142        def __eq__(self, y):
143                if type(self) != type(y):
144                        return False
145                '''
146                Cannot compare classes which do not define a "__key" attribute
147                '''
148                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
149                        return self.__key() == y.__key()
150                return id(self) == id(y)
151
152        def __hash__(self):
153                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.