INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

description: "Circular chains 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: arrayed_circular, ring, sequence
cluster: eiffelbase
class ARRAYED_CIRCULAR [G]
inherit

DYNAMIC_CIRCULAR [G]
undefine
isfirst,
readable,
writable
redefine
islast,
start,
wipe_out
select
after,
before,
first,
forth,
go_i_th,
off,
prune,
prune_all,
remove
end

LIST [G]
rename
after as l_after,
before as l_before,
remove as l_remove,
first as l_first,
off as l_off,
prune as l_prune,
prune_all as l_prune_all,
go_i_th as l_go_i_th,
forth as l_forth
export
{NONE}
l_after,
l_before,
l_first,
l_forth,
l_go_i_th,
l_off,
l_prune,
l_prune_all,
l_remove
undefine
exhausted,
isfirst,
islast,
last,
move,
readable,
start,
valid_cursor_index,
writable
end
creation

make
feature -- Initialization

make (n: INTEGER)
-- Create a circular chain with `n' items.
require
at_least_one: n >= 1
feature -- Access

item: G
-- Current item

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

count: INTEGER
-- Number of items
feature -- Status report

full: BOOLEAN
-- Is structure filled to capacity?

readable: BOOLEAN
-- Is there a current item that may be read?

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

writable: BOOLEAN
-- Is there a current item that may be written?

isfirst: BOOLEAN
-- Is cursor on first item?

islast: BOOLEAN
-- Is cursor on last item?
feature -- Cursor movement

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

set_start
-- Select current item as the first.

start
-- Move to position currently selected as first.
feature -- Element change

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

merge_right (other: like Current)
-- Merge `other' into current structure after cursor
-- position. Do not move cursor. Empty `other'.

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

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

extend (v: G)
-- Add `v' to end.
-- Do not move cursor except if it was `off'.

merge_left (other: like Current)
-- Merge `other' into current structure before cursor
-- position. Do not move cursor. Empty `other'.

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

remove_left
-- Remove item to the left of cursor position.
-- Do not move cursor.
require
count > 1

remove_right
-- Remove item to the right of cursor position.
-- Do not move cursor.
require
count > 1

wipe_out
-- Remove all items.
invariant

non_negative_count: count >= 0
valid_starter: starter >= 0 and starter <= count
end -- class ARRAYED_CIRCULAR

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES