exreferenceClass.tex 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. \begin{tomcode3}[caption=Exemple de classe générée implémentant l'interface \texttt{ReferenceClass} dans le cas de la transformation \emph{Text2Picture}.,label=code:exreferenceClass]
  2. public static class tom__reference_class_Letter2Shape
  3. implements tom.library.utils.ReferenceClass {
  4. private Circle target_left;
  5. public Circle gettarget_left() { return target_left; }
  6. public void settarget_left(Circle value) { this.target_left = value; }
  7. public Object get(String name) {
  8. if(name.equals("target_left")) {
  9. return gettarget_left();
  10. } else {
  11. throw new RuntimeException("This field does not exist:" + name);
  12. }
  13. }
  14. }
  15. \end{tomcode3}
  16. %
  17. %public static class tom__reference_class_Symbol2Shape implements tom.library.utils.ReferenceClass {
  18. %
  19. % private Square right_connector;
  20. % public Square getright_connector() { return right_connector; }
  21. % public void setright_connector(Square value) { this.right_connector = value; }
  22. %
  23. % public Object get(String name) {
  24. % if(name.equals("right_connector")) {
  25. % return getright_connector();
  26. % } else {
  27. % throw new RuntimeException("This field does not exist:" + name);
  28. % }
  29. % }
  30. %
  31. %}