INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

description: "Stacks with a bounded physical size, implemented by arrays "
title: "EiffelBase: library of reusable components for Eiffel. ", "Based on EiffelBase library for ISE Eiffel, ", "used with permission. "
project: "EiffelBase Library"
copyright: "(c) 1986-1997 Interactive Software Engineering Inc. ", "Modifications and extensions: ", "(c) 1997 Object Tools ", "All rights reserved. Duplication and distribution prohibited", "May be used only with Visual Eiffel under terms of user ", "license "
key: dispenser, array
cluster: eiffelbase
class BOUNDED_STACK [G]
inherit

STACK [G]
redefine
replace
end

BOUNDED [G]
end
creation

make
feature -- Initialization

make (n: INTEGER)
-- Create a stack for at most `n' items.
require
non_negative_argument: n >= 0
ensure
stack_allocated: capacity = n
empty_stack: count = 0
feature -- Access

item: G
-- Last item pushed (i.e. top)
require
not_empty: count > 0
feature -- Measurement

count: INTEGER

capacity: INTEGER

occurrences (v: G): INTEGER
feature -- Element change

extend, force, put (v: G)
-- Push `v' on top.

replace (v: G)
-- Replace top item by `v'.
feature -- Access

has (v: G): BOOLEAN
-- Does `v' appear in stack?
-- (Reference or object equality,
-- based on `object_comparison'.)
feature -- Removal

remove
-- Remove top item.
require
not_empty: count /= 0

wipe_out
-- Remove all items.
feature -- Status report

extendible: BOOLEAN
ensure
Result = not full

resizable: BOOLEAN

prunable: BOOLEAN
feature -- Conversion

linear_representation: ARRAYED_LIST [G]
-- Representation as a linear structure
-- (in the reverse order of original insertion)
invariant

count_small_enough: count <= capacity
extendible_definition: extendible = not full
end -- class BOUNDED_STACK

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES