INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

description: "Trees where each node has a fixed number of children ", "(The number of children is arbitrary but cannot be ", "changed once the node has been created "
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: fixed_tree, tree, fixed_list
cluster: eiffelbase
class FIXED_TREE [G]
inherit

CELL [G]
undefine
consistent,
copy,
is_equal,
setup
end

TREE [G]
undefine
child_after,
child_before,
child_item,
child_off,
consistent,
copy,
is_equal,
setup
redefine
attach_to_parent,
parent
select
changeable_comparison_criterion,
has,
is_leaf,
linear_representation,
object_comparison
end

FIXED_LIST [FIXED_TREEG]
rename
make as fl_make,
make_filled as fl_make_filled,
item as child,
i_th as array_item,
last as last_child,
first as first_child,
search as search_child,
has as fl_has,
readable as fl_readable,
put as fl_put,
replace as fl_replace,
fill as fl_fill,
writable as fl_writable,
extendible as fl_extendible,
remove as fl_remove,
linear_representation as fl_lin_rep,
count as arity,
empty as is_leaf,
full as fl_full,
start as child_start,
finish as child_finish,
forth as child_forth,
back as child_back,
go_i_th as child_go_i_th,
index as child_index,
off as child_off,
after as child_after,
before as child_before,
isfirst as child_isfirst,
islast as child_islast,
cursor as child_cursor,
go_to as child_go_to,
object_comparison as fl_object_comparison,
changeable_comparison_criterion as fl_changeable_object_criterion
export
{NONE}
fl_extendible,
fl_fill,
fl_full,
fl_has,
fl_lin_rep,
fl_make,
fl_make_filled,
fl_put,
fl_readable,
fl_remove,
fl_replace,
fl_writable
{FIXED_TREE}
array_item
undefine
child_isfirst,
child_islast,
compare_objects,
compare_references,
is_leaf,
valid_cursor_index
redefine
child,
duplicate,
first_child
end
creation

make
feature -- Initialization

make (n: INTEGER; v: G)
-- Create node with `n' void children and item `v'.
require
valid_number_of_children: n >= 0
ensure
node_item: item = v
node_arity: arity = n
feature -- Access

parent: like Current

child: like Current

first_child: like parent
-- Leftmost child

child_item: G
-- Item of active child

left_sibling: like parent
-- Left neighbor, if any

right_sibling: like parent
-- Right neighbor, if any
feature -- Status report

child_contractable: BOOLEAN
-- May items be removed?
ensure
Result = not child_off

full: BOOLEAN
feature -- Element change

child_put, child_replace (v: G)
-- Replace current child item with `v'

put_left (v: G)
-- Add `v' to the left of current node.
require
is_not_root: not is_root
has_left_sibling: left_sibling /= void
ensure
item_put: left_sibling.item = v

put_right (v: G)
-- Add `v' to the right of current node.
require
is_not_root: not is_root
has_right_sibling: right_sibling /= void
ensure
item_put: right_sibling.item = v

put_child (n: like parent)
-- Make `n' the node's child.
ensure
child_replaced: n.parent = Current

replace_child (n: like parent)
-- Make `n' the node's child.
ensure
child_replaced: n.parent = Current

put_left_sibling (other: like parent)
-- Make `other' the left sibling of current node.
require
is_not_root: not is_root
has_left_sibling: left_sibling /= void
ensure
left_sibling_replaced: left_sibling = other

put_right_sibling (other: like parent)
-- Make `other' the right sibling of current node.
require
is_not_root: not is_root
has_right_sibling: right_sibling /= void
ensure
right_sibling_replaced: right_sibling = other
feature -- Removal

remove_child
-- Remove active child.
ensure
child_removed: child = void
feature -- Duplication

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

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES