note description: "Cursor trees with a recursive structure" library: "Free implementation of ELKS library" legal: "See notice at end of class." status: "See notice at end of class." names: recursive_cursor_tree, cursor_tree, tree access: cursor, membership representation: recursive contents: generic date: "$Date: 2018-12-15 18:06:16 +0000 (Sat, 15 Dec 2018) $" revision: "$Revision: 102608 $" deferred class interface RECURSIVE_CURSOR_TREE [G] feature -- Access item: G -- Item at cursor position cursor: RECURSIVE_TREE_CURSOR [G] -- Current cursor position feature -- Measurement arity: INTEGER_32 -- Number of children of active node. -- If cursor is above, 0 if tree is empty, 1 otherwise. require else valid_cursor: not off or else above count: INTEGER_32 -- Number of items in the tree feature -- Status report after: BOOLEAN -- Is there no valid cursor position to the right of cursor? before: BOOLEAN -- Is there no valid cursor position to the left of cursor? above: BOOLEAN -- Is there no valid cursor position above cursor? is_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_32) -- 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 then not_off_unless_empty: is_empty or else not off wipe_out -- Remove all items. ensure then cursor_above: above invariant coherency: not above implies (attached active_parent as a and then a.child = active) note 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 RECURSIVE_CURSOR_TREE
Generated by ISE EiffelStudio