19 |
19 |
20 class ClassModel(UMLModel): |
20 class ClassModel(UMLModel): |
21 """ |
21 """ |
22 Class implementing the class model. |
22 Class implementing the class model. |
23 """ |
23 """ |
24 def __init__(self, name, methods=[], attributes=[]): |
24 def __init__(self, name, methods=None, attributes=None): |
25 """ |
25 """ |
26 Constructor |
26 Constructor |
27 |
27 |
28 @param name the class name (string) |
28 @param name the class name (string) |
29 @param methods list of method names of the class |
29 @param methods list of method names of the class |
31 @param attributes list of attribute names of the class |
31 @param attributes list of attribute names of the class |
32 (list of strings) |
32 (list of strings) |
33 """ |
33 """ |
34 super(ClassModel, self).__init__(name) |
34 super(ClassModel, self).__init__(name) |
35 |
35 |
36 self.methods = methods |
36 self.methods = [] if methods is None else methods[:] |
37 self.attributes = attributes |
37 self.attributes = [] if attributes is None else attributes[:] |
38 |
38 |
39 def addMethod(self, method): |
39 def addMethod(self, method): |
40 """ |
40 """ |
41 Public method to add a method to the class model. |
41 Public method to add a method to the class model. |
42 |
42 |