/tutorial/triangle/version3/example3.e

http://github.com/tybor/Liberty · Specman e · 50 lines · 38 code · 10 blank · 2 comment · 7 complexity · 44c61d6ff0cb58eaa023ed2c0be87303 MD5 · raw file

  1. class EXAMPLE3
  2. -- Let's start to copy and to compare objects... you may also run
  3. -- this example step-by-step using the Liberty Eiffel Debugger (-sedb).
  4. create {ANY}
  5. main
  6. feature {ANY}
  7. main
  8. local
  9. x, y, z: POINT
  10. do
  11. create x.make(1.0, 2.0)
  12. create y.make(1.0, 2.0)
  13. create z.make(3.0, 4.0)
  14. if x = y then
  15. io.put_string("x = y%N")
  16. end
  17. if x /= y then
  18. io.put_string("x /= y%N")
  19. end
  20. if x.is_equal(y) then
  21. io.put_string("x.is_equal(y)%N")
  22. end
  23. if y.is_equal(z) then
  24. io.put_string("x.is_equal(y)%N")
  25. end
  26. y := x
  27. if x = y then
  28. io.put_string("x = y%N")
  29. end
  30. if x.is_equal(y) then
  31. io.put_string("x.is_equal(y)%N")
  32. end
  33. io.put_string("To get a clone of x:%N")
  34. y := x.twin
  35. if x /= y and then x.is_equal(y) then
  36. io.put_string("x /= y and then x.is_equal(y)%N")
  37. end
  38. sedb_breakpoint
  39. end
  40. end -- class EXAMPLE3