/src/lib/storage/stack.e
Specman e | 73 lines | 39 code | 7 blank | 27 comment | 0 complexity | 02ae4a221270255eb567bc5b5e024c52 MD5 | raw file
1-- This file is part of a Liberty Eiffel library. 2-- See the full copyright at the end. 3-- 4class STACK[E_] 5 -- 6 -- A Stack of elements of type `E_'. 7 -- 8 9insert 10 FAST_ARRAY[E_] 11 rename last as top, 12 add_last as push, 13 remove_last as pop, 14 make as collection_make 15 export {ANY} is_empty, top, pop, push, count, item, clear_count; 16 {STACK} all 17 redefine new_iterator 18 end 19 RECYCLABLE 20 -- To get reasonable default exports 21 undefine default_create, out_in_tagged_out_memory, copy, is_equal 22 end 23 24create {ANY} 25 make, with_capacity 26 27create {FAST_ARRAY} 28 collection_make 29 30feature {} 31 make 32 do 33 with_capacity(16) 34 ensure 35 is_empty 36 end 37 38 new_iterator: ITERATOR[E_] 39 do 40 check 41 False 42 end 43 end 44 45feature {RECYCLING_POOL} 46 recycle 47 do 48 check 49 require_is_empty: is_empty 50 end 51 end 52 53end -- class STACK 54-- 55-- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file. 56-- 57-- Permission is hereby granted, free of charge, to any person obtaining a copy 58-- of this software and associated documentation files (the "Software"), to deal 59-- in the Software without restriction, including without limitation the rights 60-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 61-- copies of the Software, and to permit persons to whom the Software is 62-- furnished to do so, subject to the following conditions: 63-- 64-- The above copyright notice and this permission notice shall be included in 65-- all copies or substantial portions of the Software. 66-- 67-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 68-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 69-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 70-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 71-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 72-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 73-- THE SOFTWARE.