This site contains older material on Eiffel. For the main Eiffel page, see http://www.eiffel.com.

EiffelBase class
(HTML page generated by ISE Eiffel 4.2)

Eiffel Class
indexing
	description: "Stacks implemented by resizable arrays";
	status: "See notice at end of class";
	names: dispenser, array;
	representation: array;
	access: fixed, lifo, membership;
	size: fixed;
	contents: generic;
	date: "$Date: 2007-03-30 19:10:11 +0000 (Fri, 30 Mar 2007) $";
	revision: "$Revision: 95354 $"

class ARRAYED_STACK [G]

inherit
	STACK [G]
		undefine
			copy, is_equal, consistent, setup, prune_all, replace
		redefine
			linear_representation
		select
			remove, extend, put
		end;
	ARRAYED_LIST [G]
		rename
			put as al_put,
			extend as al_extend,
			force as al_force,
			remove as al_remove,
			start as finish,
			finish as start,
			forth as back,
			back as forth,
			after as before,
			before as after
		export
			{NONE} all;
			{ANY} count, readable, writable, extendible, make, wipe_out;
			{STACK} start, finish, forth, back
		undefine
			readable, writable, append, fill
		redefine
			linear_representation
		end

creation
	make

feature -- Element change

	extend (v: like item) is
			-- Push v on top.
			-- Was declared in ARRAYED_STACK as synonym of extend, put and force.
		do
			al_extend (v);
			start
		end;

	put (v: like item) is
			-- Push v on top.
			-- Was declared in ARRAYED_STACK as synonym of extend, put and force.
		do
			al_extend (v);
			start
		end;

	force (v: like item) is
			-- Push v on top.
			-- Was declared in ARRAYED_STACK as synonym of extend, put and force.
		do
			al_extend (v);
			start
		end;

feature -- Removal

	remove is
			-- Remove top item.
		require
			not_empty: count /= 0
		do
			al_remove;
			start
		end;

feature -- Conversion

	linear_representation: ARRAYED_LIST [G] is
			-- Representation as a linear structure
			-- (in the reverse order of original insertion)
		local
			i: INTEGER
		do
			from
				create Result.make (count);
				i := count
			until
				i < 1
			loop
				Result.extend (i_th (i));
				i := i - 1
			end
		end;

end -- class ARRAYED_STACK