/tutorial/cecil/etl/eif_stuff.e
Specman e | 34 lines | 24 code | 4 blank | 6 comment | 2 complexity | 14629ef098fff3d79ccdaef4d4c24205 MD5 | raw file
1expanded class EIF_STUFF 2 -- 3 -- To simulate `eif_adopt' and `eif_wean' from ETL. 4 -- 5 6feature {ANY} 7 adopted: FAST_ARRAY[ANY] is 8 once 9 create Result.with_capacity(16) 10 end 11 12 adopt (object: ANY) is 13 -- A reference to object is stored in `adopted' to avoid 14 -- it's collection at GC time. 15 do 16 if not adopted.fast_has(object) then 17 adopted.add_last(object) 18 end 19 end 20 21 wean (object: ANY) is 22 -- Remove the reference to `object' in adopted. 23 local 24 i: INTEGER 25 do 26 i := adopted.fast_first_index_of(object) 27 if adopted.valid_index(i) then 28 adopted.put(Void, i) 29 adopted.put(adopted.last, i) 30 adopted.remove_last 31 end 32 end 33 34end -- class EIF_STUFF