PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 0ms RepoModel.GetById 2ms app.codeStats 0ms

/tutorial/triangle/version4/point.e

http://github.com/tybor/Liberty
Specman e | 46 lines | 33 code | 7 blank | 6 comment | 0 complexity | 0bed21972987594b575a6eb70e483ad3 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_on (stream: OUTPUT_STREAM) is
25			-- Display `Current' on the `stream'.
26		require
27			stream.is_connected
28		do
29			stream.put_string("POINT[")
30			stream.put_real(x)
31			stream.put_character(',')
32			stream.put_real(y)
33			stream.put_string("]%N")
34		ensure
35			stream.is_connected
36		end
37
38feature {}
39	make (vx, vy: REAL) is
40			-- To create a new POINT.
41		do
42			x := vx
43			y := vy
44		end
45
46end -- class POINT