1 | |
---|
2 | |
---|
3 | |
---|
4 | |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | |
---|
9 | |
---|
10 | |
---|
11 | |
---|
12 | |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | from sqlalchemy.types import Text |
---|
22 | from ascore.utils import has_value |
---|
23 | |
---|
24 | ''' |
---|
25 | Created on 14-Feb-2012 17:19:35 |
---|
26 | |
---|
27 | @author: mnagni |
---|
28 | ''' |
---|
29 | |
---|
30 | class OCL(Text): |
---|
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._characterstring = Text() |
---|
43 | |
---|
44 | self.size = None |
---|
45 | self.characterSet = None |
---|
46 | self.elements = None |
---|
47 | self.maxLength = None |
---|
48 | super(OCL, self).__init__() |
---|
49 | |
---|
50 | @property |
---|
51 | def size(self): |
---|
52 | return self._characterstring.size |
---|
53 | |
---|
54 | @size.setter |
---|
55 | def size(self, value): |
---|
56 | self._characterstring.size = value |
---|
57 | |
---|
58 | @property |
---|
59 | def characterSet(self): |
---|
60 | return self._characterstring.characterSet |
---|
61 | |
---|
62 | @characterSet.setter |
---|
63 | def characterSet(self, value): |
---|
64 | self._characterstring.characterSet = value |
---|
65 | |
---|
66 | @property |
---|
67 | def elements(self): |
---|
68 | return self._characterstring.elements |
---|
69 | |
---|
70 | @elements.setter |
---|
71 | def elements(self, value): |
---|
72 | self._characterstring.elements = value |
---|
73 | |
---|
74 | @property |
---|
75 | def maxLength(self): |
---|
76 | return self._characterstring.maxLength |
---|
77 | |
---|
78 | @maxLength.setter |
---|
79 | def maxLength(self, value): |
---|
80 | self._characterstring.maxLength = value |
---|
81 | |
---|
82 | def __key(self): |
---|
83 | return (self.size, self.characterSet, self.elements, self.maxLength) |
---|
84 | |
---|
85 | def __eq__(self, y): |
---|
86 | ''' |
---|
87 | Cannot compare classes which do not define a "__key" attribute |
---|
88 | ''' |
---|
89 | if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)): |
---|
90 | return self.__key() == y.__key() |
---|
91 | return id(self) == id(y) |
---|
92 | |
---|
93 | def __hash__(self): |
---|
94 | return hash(self.__key()) |
---|