Advertisement
Benlahbib_Abdessamad

Untitled

Jan 7th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. helper context MM!Class def : genereConsSP() : String = 'public ' + self.name + '() { \nsuper();\n}\n' ;
  2.  
  3. helper
  4. context MM!Class def : genereConstructeur() : String = '\n\n'
  5. +'public ' + self.name + '() { \n\tsuper();\n' + self.ownedAttribute->iterate(elem;acc : String = '' | acc + 'this.' + elem.name + '=' + elem.initializeAttribut() + ';\n') + '} \n\n'
  6. + if self.superClass->notEmpty() then
  7. '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') + '}'
  8. else if (self .superClass->isEmpty() and self.ownedAttribute->notEmpty()) then
  9. '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') + '}'
  10. else
  11. ''
  12. endif
  13. endif
  14.  
  15. ;
  16.  
  17.  
  18. helper
  19. context MM!Property def : genereType() : String =
  20. if self.type.oclIsUndefined() then
  21. 'Object '
  22. else if self.type.name = 'Real' then
  23. 'Double '
  24. else
  25. self.type.name + ' '
  26. endif
  27. endif
  28. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement