1 | |
---|
2 | |
---|
3 | |
---|
4 | |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | |
---|
9 | |
---|
10 | |
---|
11 | |
---|
12 | |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | from ea_model.iso_19108_2006_temporal_schema.temporal_objects.tm_complex import TM_Complex |
---|
22 | from ascore.utils import has_value |
---|
23 | |
---|
24 | ''' |
---|
25 | Created on 16-Feb-2012 16:18:08 |
---|
26 | |
---|
27 | @author: mnagni |
---|
28 | ''' |
---|
29 | |
---|
30 | class TM_TopologicalComplex(TM_Complex): |
---|
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._tm_complex = TM_Complex() |
---|
43 | |
---|
44 | self._primitive_tm_edge = [] |
---|
45 | self._primitive_tm_node = [] |
---|
46 | super(TM_TopologicalComplex, self).__init__() |
---|
47 | |
---|
48 | @property |
---|
49 | def primitive(self): |
---|
50 | ret = [] |
---|
51 | for item in self._primitive_tm_edge: |
---|
52 | ret.append(item) |
---|
53 | for item in self._primitive_tm_node: |
---|
54 | ret.append(item) |
---|
55 | return ret |
---|
56 | |
---|
57 | @primitive.setter |
---|
58 | def primitive(self, value): |
---|
59 | if isinstance(value, list): |
---|
60 | self._primitive_tm_edge[:] |
---|
61 | self._primitive_tm_node[:] |
---|
62 | for item in value: |
---|
63 | valueClass = "%s.%s" % (type(item).__module__,type(item).__name__) |
---|
64 | if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_objects.tm_edge.TM_Edge": |
---|
65 | self._primitive_tm_edge.append(item) |
---|
66 | continue |
---|
67 | if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_objects.tm_node.TM_Node": |
---|
68 | self._primitive_tm_node.append(item) |
---|
69 | continue |
---|
70 | |
---|
71 | def __key(self): |
---|
72 | return (self.primitive) |
---|
73 | |
---|
74 | def __eq__(self, y): |
---|
75 | ''' |
---|
76 | Cannot compare classes which do not define a "__key" attribute |
---|
77 | ''' |
---|
78 | if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)): |
---|
79 | return self.__key() == y.__key() |
---|
80 | return id(self) == id(y) |
---|
81 | |
---|
82 | def __hash__(self): |
---|
83 | return hash(self.__key()) |
---|