-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPElement.py
109 lines (82 loc) · 2.71 KB
/
PElement.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
""" PElement module contains only the PElement class"""
from inspect import isclass
def huhu():
"""some example function with an external module dependency."""
print("is class? " + isclass(PElement))
def haha(anargument):
"""another example function with an external module dependency."""
print("is class? " + isclass(PElement))
class PElement:
""" class describing an atomic PUMLA model element """
def __init__(self):
""" init every attribute with '-' as default, nothing more """
self.name = "-"
self.alias = "-"
self.type = "-"
self.parent = "-"
self.filename = "-"
self.path = "-"
self.stereotypes = []
self.isInstance = False
self.instance_class_alias = "-"
# can be "static" or "dynamic"
self.kind = "-"
def setKindStatic(self):
self.kind = "static"
def setKindDynamic(self):
self.kind = "dynamic"
def getKind(self):
return self.kind
def setInstance(self):
self.isInstance = True
def setInstanceClassAlias(self, ic):
self.instance_class_alias = ic
def getInstanceClassAlias(self):
return self.instance_class_alias
def setName(self, name):
""" setter for 'name' """
self.name = name
def setType(self, type):
self.type = type
def setFilename(self, filename):
""" setter for 'filename' """
self.filename = filename
def setParent(self, parent):
""" setter for 'parent' """
self.parent = parent
def setAlias(self, alias):
""" setter for 'alias' """
self.alias = alias
def setPath(self, path):
""" setter for 'path' """
self.path = path
def addStereotype(self, st):
self.stereotypes.append(st)
def getName(self):
return self.name
def getType(self):
return self.type
def getAlias(self):
return self.alias
def getParent(self):
return self.parent
def getPath(self):
return self.path
def getFilename(self):
return self.filename
def getStereotypes(self):
return self.stereotypes
def printMe(self):
""" command line print out of the model element attributes """
print("name: " + self.name)
print("alias: " + self.alias)
print("type: " + self.type)
sts = "-"
if (len(self.stereotypes) > 0):
sts = "" + self.stereotypes[0]
for i in range(len(self.stereotypes)-1):
sts = sts + ", " + self.stereotypes[i+1]
print("stereotypes: " + sts)
print("parent: " + self.parent)
print("path: " + self.path)
print("filename: " + self.filename)