note
	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.
	]"
	library: "Free implementation of ELKS library"
	legal: "See notice at end of class."
	status: "See notice at end of class."
	names: fixed_tree, tree, fixed_list
	representation: recursive, array
	access: cursor, membership
	contents: generic
	date: "$Date: 2018-12-15 18:06:16 +0000 (Sat, 15 Dec 2018) $"
	revision: "$Revision: 102608 $"

class interface
	FIXED_TREE [G]

create 
	make,
	make_filled

feature -- Access

	parent: detachable like Current
			-- Parent of current node.

	child_item: like item
			-- 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 = True
			-- Is tree full?
	
feature -- Element change

	child_put (v: like item)
			-- Replace current child item with v
			-- Was declared in FIXED_TREE as synonym of child_replace.

	child_replace (v: like item)
			-- Replace current child item with v
			-- Was declared in FIXED_TREE as synonym of child_put.

	put_left (v: like item)
			-- Add v to the left of current node.
		require
			is_not_root: not is_root
			has_left_sibling: left_sibling /= Void
		ensure
			item_put: attached left_sibling as l and then l.item = v

	put_right (v: like item)
			-- Add v to the right of current node.
		require
			is_not_root: not is_root
			has_right_sibling: right_sibling /= Void
		ensure
			item_put: attached right_sibling as r and then r.item = v

	put_child (n: like new_node)
			-- Make n the node's child.
		require else
			not_full: arity < capacity
		ensure then
			child_replaced: n.parent = Current

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

	put_left_sibling (other: like new_node)
			-- 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 new_node)
			-- 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 then
			child_removed: child = Void

	forget_left
			-- Forget all left siblings.

	forget_right
			-- Forget all right siblings.
	
feature -- Redefinition

	child_capacity: INTEGER_32
			-- Maximal number of children
	
feature -- Access: chilldren

	child: like parent
			-- Current child node

	array_item (n: INTEGER_32): detachable like Current

	last_child: like first_child
			-- Right most child

	first_child: like parent
			-- Leftmost child

	search_child (v: like Current)

	arity: INTEGER_32
			-- Number of children

	child_start
			-- Move cursor to first child.

	child_finish
			-- Move cursor to last child.

	child_forth
			-- Move cursor to next child.

	child_back
			-- Move cursor to previous child.

	child_go_i_th (i: INTEGER_32)
			-- Move cursor to i-th child.

	child_index: INTEGER_32
			-- Index of current child

	child_off: BOOLEAN
			-- Is there no current child?

	child_after: BOOLEAN
			-- Is there no valid child position to the right of cursor?

	child_before: BOOLEAN
			-- Is there no valid child position to the left of cursor?

	child_cursor: CURSOR
			-- Current cursor position

	child_go_to (p: CURSOR)
			-- Move cursor to position p.

	index_of (v: like Current; i: INTEGER_32): INTEGER_32

	prune (n: like new_node)
			-- Remove n from the children.

	wipe_out
			-- Remove all children.

	put_i_th (v: like Current; n: INTEGER_32)

	capacity: INTEGER_32
	
note
	ca_ignore: "CA024", "CA024: use an across loop instead of a regular one"
	copyright: "Copyright (c) 1984-2018, Eiffel Software and others"
	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
	source: "[
		Eiffel Software
		5949 Hollister Ave., Goleta, CA 93117 USA
		Telephone 805-685-1006, Fax 805-685-6869
		Website http://www.eiffel.com
		Customer support http://support.eiffel.com
	]"

end -- class FIXED_TREE

Generated by ISE EiffelStudio