PageRenderTime 10ms CodeModel.GetById 7ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/signal/a.e

http://github.com/tybor/Liberty
Specman e | 28 lines | 20 code | 6 blank | 2 comment | 1 complexity | 2917b098cced032aeebccb798c177d3e MD5 | raw file
 1class A
 2
 3creation {ANY}
 4	make
 5
 6feature {ANY}
 7	value_changed: SIGNAL_1[INTEGER] --declare variable of SIGNAL type, never inherit form SIGNAL.
 8
 9	value: INTEGER
10
11feature {}
12	make is
13		do
14			create value_changed.make
15		end
16
17feature {ANY}
18	set_val (v: INTEGER) is
19		do
20			-- Only emit if value really change (see signals.txt: when
21			-- to use). Avoid infinite looping in case of cyclic connections.
22			if v /= value then
23				value := v
24				value_changed.emit(v)
25			end
26		end
27
28end -- class A