/tutorial/agent/example5.e
Specman e | 33 lines | 24 code | 4 blank | 5 comment | 0 complexity | d48b53e6096b67b54a6cba7c5713e2d2 MD5 | raw file
1class EXAMPLE5 2 -- 3 -- There is also a `for_all' routine in COLLECTION (i.e. ARRAY, 4 -- FAST_ARRAY, LINKED_LIST, TWO_WAY_LINKED_LIST). 5 -- You can watch the result using sedb, the Liberty Eiffel DeBugger. 6 -- 7 8create {ANY} 9 make 10 11feature {ANY} 12 make 13 local 14 my_array: ARRAY[INTEGER]; bool: BOOLEAN 15 do 16 my_array := {ARRAY[INTEGER] 1, << 2, 3, 4 >> } 17 bool := my_array.for_all(agent greater_than(?, 1)) 18 sedb_breakpoint 19 bool := my_array.for_all(agent greater_than(1, ?)) 20 sedb_breakpoint 21 bool := my_array.exists(agent greater_than(4, ?)) 22 sedb_breakpoint 23 bool := my_array.exists(agent greater_than(?, 4)) 24 sedb_breakpoint 25 end 26 27feature {} 28 greater_than (item, value: INTEGER): BOOLEAN 29 do 30 Result := item > value 31 end 32 33end -- class EXAMPLE5