INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

description: "Trees with a dynamically modifiable 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: dynamic_tree, tree
cluster: eiffelbase
deferred class DYNAMIC_TREE [G]
inherit

TREE [G]
redefine
parent
end
feature -- Access

parent: like Current
feature -- Status report

extendible: BOOLEAN
feature -- Element change

extend (v: G)
-- Add `v' as new child.

child_extend (v: G)
-- Add `v' to the list of children.
-- Do not move child cursor.

child_put_left (v: G)
-- Add `v' to the left of cursor position.
-- Do not move child cursor.
require
not_child_before: not child_before

child_put_right (v: G)
-- Add `v' to the right of cursor position.
-- Do not move child cursor.
require
not_child_after: not child_after

put_child (n: like parent)
-- Add `n' to the list of children.
-- Do not move child cursor.
require
non_void_argument: n /= void

put_child_left (n: like parent)
-- Add `n' to the left of cursor position.
-- Do not move cursor.
require
not_child_before: not child_before
non_void_argument: n /= void

put_child_right (n: like parent)
-- Add `n' to the right of cursor position.
-- Do not move cursor.
require
not_child_after: not child_after
non_void_argument: n /= void

merge_tree_before (other: like parent)
-- Merge children of `other' into current structure
-- after cursor position. Do not move cursor.
-- Make `other' a leaf.
require
not_child_off: not child_off
other_exists: (other /= void)
ensure
other_is_leaf: other.is_leaf

merge_tree_after (other: like parent)
-- Merge children of `other' into current structure
-- after cursor position. Do not move cursor.
-- Make `other' a leaf.
require
not_child_off: not child_off
other_exists: (other /= void)
ensure
other_is_leaf: other.is_leaf
feature -- Removal

remove_left_child
-- Remove item to the left of cursor position.
-- Do not move cursor.
require
is_not_first: not child_isfirst
ensure
new_arity: arity = arity - 1
new_child_index: child_index = child_index - 1

remove_right_child
-- Remove item to the right of cursor position.
-- Do not move cursor.
require
is_not_last: not child_islast
ensure
new_arity: arity = arity - 1
new_child_index: child_index = child_index

remove_child
-- Remove child at cursor position.
-- Move cursor to next sibling, or `after' if none.
require
child_not_off: not child_off
ensure
new_arity: arity = arity - 1
new_child_index: child_index = child_index

wipe_out
-- Remove all child
feature -- Conversion

fill_from_binary (b: BINARY_TREE [G])
-- Fill from a binary tree representation.
-- Left child becomes first child.
-- Right child becomes right sibling.
-- Any right child of `b' is ignored.
feature -- Duplication

duplicate (n: INTEGER): like Current
-- Copy of sub-tree beginning at cursor position and
-- having min (`n', `arity' - `child_index' + 1)
-- children
invariant

extendible_definition: extendible
child_after_definition: child_after = (child_index = arity + 1)
end -- class DYNAMIC_TREE

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES