source: mauRepo/MolesManager/trunk/src/ea_model/iso_19107_2003_spatial_schema/topology/topological_primitive/tp_expressionterm.py @ 8091

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19107_2003_spatial_schema/topology/topological_primitive/tp_expressionterm.py@8091
Revision 8091, 4.5 KB checked in by mnagni, 8 years ago (diff)

The migration process now includes
1) deployment_data files
2) XML document hash
3) full Dojo support


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
22
23'''
24Created on 16-Feb-2012 16:18:04
25
26@author: mnagni
27'''
28
29class TP_ExpressionTerm(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._expression_tp_shell = None
43        self._expression_tp_boundary = None
44        self._expression_tp_ring = None
45        self.coefficient = None
46        self._variable_tp_directedface = None
47        self._variable_tp_directednode = None
48        self._variable_tp_directedsolid = None
49        self._variable_tp_directededge = None
50        super(TP_ExpressionTerm, self).__init__()
51
52    @property
53    def expression(self):       
54        if(has_value(self._expression_tp_shell)):
55            return self._expression_tp_shell
56        if(has_value(self._expression_tp_boundary)):
57            return self._expression_tp_boundary
58        if(has_value(self._expression_tp_ring)):
59            return self._expression_tp_ring
60        return  None
61
62    @expression.setter
63    def expression(self, value):       
64        valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
65        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_shell.TP_Shell":
66            self._expression_tp_shell = value
67            self._expression_tp_boundary = None
68            self._expression_tp_ring = None
69        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_boundary.TP_Boundary":
70            self._expression_tp_boundary = value
71            self._expression_tp_shell = None
72            self._expression_tp_ring = None
73        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_ring.TP_Ring":
74            self._expression_tp_ring = value
75            self._expression_tp_shell = None
76            self._expression_tp_boundary = None
77
78    @property
79    def variable(self): 
80        if(has_value(self._variable_tp_directedface)):
81            return self._variable_tp_directedface
82        if(has_value(self._variable_tp_directednode)):
83            return self._variable_tp_directednode
84        if(has_value(self._variable_tp_directedsolid)):
85            return self._variable_tp_directedsolid
86        if(has_value(self._variable_tp_directededge)):
87            return self._variable_tp_directededge
88        return  None
89
90    @variable.setter
91    def variable(self, value): 
92        valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
93        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directedface.TP_DirectedFace":
94            self._variable_tp_directedface = value
95            self._variable_tp_directednode = None
96            self._variable_tp_directedsolid = None
97            self._variable_tp_directededge = None
98        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directednode.TP_DirectedNode":
99            self._variable_tp_directednode = value
100            self._variable_tp_directedface = None
101            self._variable_tp_directedsolid = None
102            self._variable_tp_directededge = None
103        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directedsolid.TP_DirectedSolid":
104            self._variable_tp_directedsolid = value
105            self._variable_tp_directedface = None
106            self._variable_tp_directednode = None
107            self._variable_tp_directededge = None
108        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directededge.TP_DirectedEdge":
109            self._variable_tp_directededge = value
110            self._variable_tp_directedface = None
111            self._variable_tp_directednode = None
112            self._variable_tp_directedsolid = None
113
114    def __key(self):
115        return (self.expression, self.coefficient, self.variable)
116
117    def __eq__(self, y):
118        '''
119        Cannot compare classes which do not define a "__key" attribute
120        '''
121        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
122            return self.__key() == y.__key()
123        return id(self) == id(y)
124
125    def __hash__(self):
126        return hash(self.__key())
Note: See TracBrowser for help on using the repository browser.