Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- helper context MM!Class def : genereConsSP() : String = 'public ' + self.name + '() { \nsuper();\n}\n' ;
- helper
- context MM!Class def : genereConstructeur() : String = '\n\n'
- +'public ' + self.name + '() { \n\tsuper();\n' + self.ownedAttribute->iterate(elem;acc : String = '' | acc + 'this.' + elem.name + '=' + elem.initializeAttribut() + ';\n') + '} \n\n'
- + if self.superClass->notEmpty() then
- 'public ' + self.name + '(' + self.ownedAttribute->iterate(elem;acc : String = '' | acc + elem.genereType() + elem.name + ',') + (self.superClass->iterate(elem1;acc1 : String = '' | acc1 + elem1.ownedAttribute->iterate(elem;acc : String = '' | acc + elem.genereType() + elem.name + ','))).getRidOfComma() + ') {\n\tsuper(' + (self.superClass->iterate(elem1;acc1 : String = '' | acc1 + elem1.ownedAttribute->iterate(elem;acc : String = '' | acc + elem.name + ','))).getRidOfComma() + ');\n' + self.ownedAttribute->iterate(elem;acc : String = '' | acc + 'this.' + elem.name + '=' + elem.name + ';\n') + '}'
- else if (self .superClass->isEmpty() and self.ownedAttribute->notEmpty()) then
- 'public ' + self.name + '(' + (self.ownedAttribute->iterate(elem;acc : String = '' | acc + elem.genereType() + elem.name + ',')).getRidOfComma() + '){\n\t' + self.ownedAttribute->iterate(elem;acc : String = '' | acc + 'this.' + elem.name + '=' + elem.name + ';\n') + '}'
- else
- ''
- endif
- endif
- ;
- helper
- context MM!Property def : genereType() : String =
- if self.type.oclIsUndefined() then
- 'Object '
- else if self.type.name = 'Real' then
- 'Double '
- else
- self.type.name + ' '
- endif
- endif
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement