PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/tutorial/triangle/version3/point.e

http://github.com/tybor/Liberty
Specman e | 42 lines | 29 code | 7 blank | 6 comment | 0 complexity | f9ba1754f88723f58dc358b0b496df42 MD5 | raw file
 1class POINT
 2	-- Description of POINTs objects.
 3
 4creation {ANY}
 5	make
 6
 7feature {ANY}
 8	x: REAL
 9			-- The `x' coordinate.
10
11	y: REAL
12			-- The `y' coordinate.
13
14	translate (dx, dy: REAL) is
15			-- To translate `Current' using `dx' and `dy'.
16		do
17			x := x + dx
18			y := y + dy
19		ensure
20			x = dx + old x
21			y = dy + old y
22		end
23
24	display is
25			-- Display `Current' on `io'.
26		do
27			io.put_string("POINT[")
28			io.put_real(x)
29			io.put_character(',')
30			io.put_real(y)
31			io.put_string("]%N")
32		end
33
34feature {}
35	make (vx, vy: REAL) is
36			-- To create a new POINT.
37		do
38			x := vx
39			y := vy
40		end
41
42end -- class POINT