PageRenderTime 13ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1class TRIANGLE
 2	-- Description of TRIANGLEs objects.
 3
 4creation {ANY}
 5	make
 6
 7feature {ANY}
 8	p1: POINT
 9			-- First point.
10
11	p2: POINT
12			-- Second point.
13
14	p3: POINT
15			-- Third point.
16
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
25feature {}
26	make (a, b, c: POINT) is
27			-- To create a new TRIANGLE.
28		require
29			a /= Void
30			b /= Void
31			c /= Void
32		do
33			p1 := a
34			p2 := b
35			p3 := c
36		ensure
37			p1 = a
38			p2 = b
39			p3 = c
40		end
41
42invariant
43	p1 /= Void
44
45	p2 /= Void
46
47	p3 /= Void
48
49end -- class TRIANGLE