/tutorial/triangle/version1/triangle.e

http://github.com/tybor/Liberty · Specman e · 30 lines · 18 code · 6 blank · 6 comment · 0 complexity · ee42868682efe392b50bf40a6a1b88a3 MD5 · raw file

  1. class TRIANGLE
  2. -- Description of TRIANGLEs objects.
  3. feature {ANY}
  4. p1: POINT
  5. -- First point.
  6. p2: POINT
  7. -- Second point.
  8. p3: POINT
  9. -- Third point.
  10. make (a, b, c: POINT) is
  11. -- To initialize the `Current' TRIANGLE.
  12. do
  13. p1 := a
  14. p2 := b
  15. p3 := c
  16. end
  17. translate (dx, dy: REAL) is
  18. -- To translate the `Current' TRIANGLE.
  19. do
  20. p1.translate(dx, dy)
  21. p2.translate(dx, dy)
  22. p3.translate(dx, dy)
  23. end
  24. end -- class TRIANGLE