transformationText2Picture.tex 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. %\begin{mycode}
  2. \begin{tomcode3}[caption=Extrait de code de la transformation \emph{Text2Picture} illustrant les nouvelles constructions {\tom} dédiées aux transformations de modèles et correspondant aux transformations présentées dans la figure~\ref{fig:approachSimpleRulesTrace},label=code:transformationText2Picture]
  3. #\colcode{blue}{\%transformation}# Text2Picture(link:LinkClass, gp:GeoPicture)#\colcode{blue}{:}#
  4. "text.ecore" #\colcode{blue}{->}# "picture.ecore" #\colcode{blue}{\{}#
  5. #\colcode{blue}{definition}# Letter2Shape #\colcode{blue}{traversal}# `TopDown(Letter2Shape(link,gp)) #\colcode{blue}{\{}#
  6. source@BText() #\colcode{blue}{-> \{}#
  7. //use target_right
  8. Shape greenSquare = #\colcode{blue}{\%resolve}#(source:BText,#\colcode{black}{\myul{magenta}{target\_right}}#:Square);
  9. Shape bluePentagon = `Pentagon(blue());
  10. Segment segment = `Segment(bluePentagon, greenSquare);
  11. ...
  12. #\colcode{blue}{\}}#
  13. AText() #\colcode{blue}{-> \{}#
  14. #\colcode{blue}{\%tracelink}#(#\colcode{black}{\myul{black}{target\_left}}#:Circle,`Circle(red())); //define target_left
  15. Shape redHexagon = `Hexagon(red());
  16. Segment segment = `Segment(redHexagon, target_left);
  17. ...
  18. #\colcode{blue}{\}}#
  19. ...
  20. #\colcode{blue}{\}}#
  21. #\colcode{blue}{definition}# Symbol2Shape #\colcode{blue}{traversal}# `BottomUp(Symbol2Shape(link,gp)) #\colcode{blue}{\{}#
  22. SemiColon[left=l] #\colcode{blue}{-> \{}#
  23. Shape greenTriangle = `Triangle(green());
  24. #\colcode{blue}{\%tracelink}#(#\colcode{black}{\myul{magenta}{target\_right}}#:Square,`Square(green())); //define target_right
  25. Segment right_segment = `Segment(greenTriangle, target_right);
  26. Shape redCircle = #\colcode{blue}{\%resolve}#(l:AText,#\colcode{black}{\myul{black}{target\_left}}#:Circle);//use target_left
  27. Segment left_segment = `Segment(redCircle, greenTriangle);
  28. ...
  29. #\colcode{blue}{\}}#
  30. ...
  31. #\colcode{blue}{\}}#
  32. ...
  33. #\colcode{blue}{\}}#
  34. \end{tomcode3}
  35. %\end{mycode}