/tutorial/triangle/version2/triangle.e
http://github.com/tybor/Liberty · Specman e · 49 lines · 33 code · 10 blank · 6 comment · 0 complexity · 180ec9b12f3d04dc77610d38f423e570 MD5 · raw file
- class TRIANGLE
- -- Description of TRIANGLEs objects.
- creation {ANY}
- make
- feature {ANY}
- p1: POINT
- -- First point.
- p2: POINT
- -- Second point.
- p3: POINT
- -- Third point.
- translate (dx, dy: REAL) is
- -- To translate the `Current' TRIANGLE.
- do
- p1.translate(dx, dy)
- p2.translate(dx, dy)
- p3.translate(dx, dy)
- end
- feature {}
- make (a, b, c: POINT) is
- -- To create a new TRIANGLE.
- require
- a /= Void
- b /= Void
- c /= Void
- do
- p1 := a
- p2 := b
- p3 := c
- ensure
- p1 = a
- p2 = b
- p3 = c
- end
- invariant
- p1 /= Void
- p2 /= Void
- p3 /= Void
- end -- class TRIANGLE