INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

description: "Lists implemented by resizable 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: sequence
cluster: eiffelbase
class ARRAYED_LIST [G]
inherit

ISE_ARRAY [G]
rename
force as force_i_th,
item as i_th,
make as array_make,
put as put_i_th,
wipe_out as array_wipe_out,
count as array_count,
bag_put as put
export
{NONE}
all
{ARRAYED_LIST}
array_make
{ANY}
capacity
undefine
consistent,
extendible,
has,
is_equal,
linear_representation,
occurrences,
prunable,
prune,
put
redefine
copy,
extend,
full,
prune_all,
setup,
valid_index
end

ISE_ARRAY [G]
rename
force as force_i_th,
item as i_th,
make as array_make,
put as put_i_th,
count as array_count,
bag_put as put
export
{NONE}
all
{ARRAYED_LIST}
array_make
{ANY}
capacity
undefine
consistent,
extendible,
full,
has,
is_equal,
linear_representation,
occurrences,
prunable,
prune,
put
redefine
copy,
extend,
prune_all,
setup,
valid_index,
wipe_out
select
wipe_out
end

DYNAMIC_LIST [G]
undefine
infix "@",
force,
i_th,
put_i_th,
valid_index
redefine
copy,
duplicate,
finish,
first,
go_i_th,
last,
merge_left,
merge_right,
move,
prunable,
prune,
prune_all,
put_left,
setup,
start,
swap,
wipe_out
select
count
end
creation

make,
make_filled
feature -- Initialization

make (n: INTEGER)
-- Allocate list with `n' items.
-- (`n' may be zero for empty list.)
require
valid_number_of_items: n >= 0
ensure
correct_position: before

make_filled (n: INTEGER)
-- Allocate list with `n' items.
-- (`n' may be zero for empty list.)
-- This list will be full.
require
valid_number_of_items: n >= 0
ensure
correct_position: before
filled: full
feature -- Access

item: G
-- Current item
require
index_is_valid: valid_index (index)

first: like item
-- Item at first position

last: like item
-- Item at last position

index: INTEGER

cursor: CURSOR
-- Current cursor position
feature -- Measurement

count: INTEGER
feature -- Status report

prunable: BOOLEAN
-- May items be removed? (Answer: yes.)

full: BOOLEAN
-- Is structure filled to capacity? (Answer: no.)

valid_cursor (p: CURSOR): BOOLEAN
-- Can the cursor be moved to position `p'?

valid_index (i: INTEGER): BOOLEAN
-- Is `i' a valid index?
feature -- Cursor movement

move (i: INTEGER)
-- Move cursor `i' positions.

start
-- Move cursor to first position if any.
ensure
after_when_empty: empty implies after

finish
-- Move cursor to last position if any.
ensure
before_when_empty: empty implies before

forth
-- Move cursor one position forward.

back
-- Move cursor one position backward.

go_i_th (i: INTEGER)
-- Move cursor to `i'-th position.

go_to (p: CURSOR)
-- Move cursor to position `p'.
feature -- Transformation

swap (i: INTEGER)
-- Exchange item at `i'-th position with item
-- at cursor position.
feature -- Element change

put_front (v: G)
-- Add `v' to the beginning.
-- Do not move cursor.

force, extend (v: G)
-- Add `v' to end.
-- Do not move cursor.

put_left (v: G)
-- Add `v' to the left of current position.
-- Do not move cursor.

put_right (v: G)
-- Add `v' to the right of current position.
-- Do not move cursor.

replace (v: G)
-- Replace current item by `v'.

merge_left (other: like Current)

merge_right (other: like Current)
feature -- Removal

prune (v: G)
-- Remove first occurrence of `v', if any,
-- after cursor position.
-- Move cursor to right neighbor
-- (or `after' if no right neighbor or `v'does not occur)

remove
-- Remove current item.
-- Move cursor to right neighbor
-- (or `after' if no right neighbor)

prune_all (v: G)
-- Remove all occurrences of `v'.
-- (Reference or object equality,
-- based on `object_comparison'.)
-- Leave cursor `after'.
ensure
is_after: after

remove_left
-- Remove item to the left of cursor position.
-- Do not move cursor.

remove_right
-- Remove item to the right of cursor position
-- Do not move cursor

wipe_out
-- Remove all items.
feature -- Duplication

setup (other: like Current)
-- Prepare current object so that `other'
-- can be easily copied into it.
-- It is not necessary to call `setup'
-- (since `consistent' is always true)
-- but it will make copying quicker.

copy (other: like Current)

duplicate (n: INTEGER): like Current
-- Copy of sub-list beginning at current position
-- and having min (`n', `count' - `index' + 1) items.
invariant

prunable: prunable
end -- class ARRAYED_LIST

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES