INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

description: "Cursor trees with a recursive structure "
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: recursive_cursor_tree, cursor_tree, tree
cluster: eiffelbase
deferred class RECURSIVE_CURSOR_TREE [G]
inherit

CURSOR_TREE [G]
redefine
extend,
extendible
end
feature -- Access

item: G
-- Item at cursor position

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

arity: INTEGER
-- Number of children of active node.
-- If cursor is `above', 0 if tree is empty, 1 otherwise.

count: INTEGER
-- Number of items in the tree
feature -- Status report

after: BOOLEAN

before: BOOLEAN

above: BOOLEAN
-- Is there no valid cursor position above cursor?

empty: BOOLEAN
-- Is the tree empty?

extendible: BOOLEAN
-- May new items be added on current level?

isfirst: BOOLEAN
-- Is cursor on first sibling?

islast: BOOLEAN
-- Is cursor on last sibling?

is_root: BOOLEAN
-- Is cursor on tree root?

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

back
-- Move cursor one position backward.

forth
-- Move cursor one position forward.

up
-- Move cursor one level upward to parent,
-- or `above' if `is_root' holds.

down (i: INTEGER)
-- Move cursor one level downward:
-- to `i'-th child if there is one,
-- or `after' if `i' = `arity' + 1,
-- or `before' if `i' = 0.

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

extend (v: G)
-- Add `v' after last child.
-- Make `v' the `first_child' if `below' and place
-- cursor `before'.
feature -- Element change

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

remove
-- Remove node at cursor position
-- (and consequently the corresponding
-- subtree). Cursor moved up one level.
ensure
not_off_unless_empty: empty or else not off

wipe_out
-- Remove all items.
ensure
cursor_above: above
invariant

coherency: not above implies active_parent.child = active
end -- class RECURSIVE_CURSOR_TREE

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES