source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/spatial_examples_from_iso_19107/application_schema/simplicial_topology/zerosimplex.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/spatial_examples_from_iso_19107/application_schema/simplicial_topology/zerosimplex.py@8457
Revision 8457, 1.9 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:01
25
26@author: mnagni
27'''
28
29class ZeroSimplex(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.dimension = None
43                self._vertices_eg_pointestimate = None
44                self._vertices_gm_compositepoint = None
45                self._vertices = None
46                super(ZeroSimplex, self).__init__()
47        @property
48        def vertices(self):     
49                if(has_value(self._vertices_eg_pointestimate)):
50                        return self._vertices_eg_pointestimate
51                if(has_value(self._vertices_gm_compositepoint)):
52                        return self._vertices_gm_compositepoint
53                return  None
54
55        @vertices.setter
56        def vertices(self, value):     
57                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
58                if valueClass == "ea_model.iso_19133_tracking_and_navigation.tracking.point_estimates.eg_pointestimate.EG_PointEstimate":
59                        self._vertices_eg_pointestimate = value
60                        self._vertices_gm_compositepoint = None
61                if valueClass == "ea_model.iso_19107_2003_spatial_schema.geometry.geometric_complex.gm_compositepoint.GM_CompositePoint":
62                        self._vertices_gm_compositepoint = value
63                        self._vertices_eg_pointestimate = None
64
65        def synchronize(self):
66                pass
67
68        def __key(self):
69                return (self.dimension, self.vertices)
70
71        def __eq__(self, y):
72                if type(self) != type(y):
73                        return False
74                '''
75                Cannot compare classes which do not define a "__key" attribute
76                '''
77                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
78                        return self.__key() == y.__key()
79                return id(self) == id(y)
80
81        def __hash__(self):
82                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.