Automatic generation produced by ISE Eiffel

Classes Clusters Cluster hierarchy Chart Relations Text Flat Contracts Flat contracts Go to:
indexing description: "Cursor trees with a recursive structure" status: "See notice at end of class" names: recursive_cursor_tree, cursor_tree, tree access: cursor, membership representation: recursive contents: generic date: "$Date: 2001-11-16 20:32:23 +0000 (Fri, 16 Nov 2001) $" revision: "$Revision: 51435 $" deferred class interface RECURSIVE_CURSOR_TREE [G] feature -- Access child_item (i: INTEGER): G -- Item in i-th child -- (from CURSOR_TREE) require -- from CURSOR_TREE argument_within_bounds: i >= 1 and then i <= arity not_off: not off cursor: CURSOR -- Current cursor position has (v: G): BOOLEAN -- Does structure include an occurrence of v? -- (Reference or object equality, -- based on object_comparison.) -- (from CURSOR_TREE) ensure -- from CONTAINER not_found_in_empty: Result implies not is_empty index_of (v: like item; i: INTEGER): INTEGER -- Index of i-th occurrence of v. -- 0 if none. -- (Reference or object equality, -- based on object_comparison.) -- (from LINEAR) require -- from LINEAR positive_occurrences: i > 0 ensure -- from LINEAR non_negative_result: Result >= 0 item: G -- Item at cursor position require -- from TRAVERSABLE not_off: not off require -- from ACTIVE readable: readable occurrences (v: G): INTEGER -- (from CURSOR_TREE) ensure -- from BAG non_negative_occurrences: Result >= 0 parent_item: G -- Item in parent. -- (from CURSOR_TREE) require -- from CURSOR_TREE not_on_root: not is_root search (v: like item) -- Move to first position (at or after current -- position) where item and v are equal. -- (Reference or object equality, -- based on object_comparison.) -- If no such position ensure that exhausted will be true. -- (from LINEAR) ensure -- from LINEAR object_found: (not exhausted and object_comparison) implies equal (v, item) item_found: (not exhausted and not object_comparison) implies v = item feature -- Measurement arity: INTEGER -- Number of children of active node. -- If cursor is above, 0 if tree is empty, 1 otherwise. require -- from HIERARCHICAL not_off: not off require else valid_cursor: not off or else above breadth: INTEGER -- Breadth of current level -- (from CURSOR_TREE) count: INTEGER -- Number of items in the tree depth: INTEGER -- Depth of the tree -- (from CURSOR_TREE) level: INTEGER -- Level of current node in tree -- (Root is on level 1) -- (from CURSOR_TREE) feature -- Status report above: BOOLEAN -- Is there no valid cursor position above cursor? 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? below: BOOLEAN -- Is there no valid cursor position below cursor? -- (from CURSOR_TREE) changeable_comparison_criterion: BOOLEAN -- May object_comparison be changed? -- (Answer: yes by default.) -- (from CONTAINER) exhausted: BOOLEAN -- Has structure been completely explored? -- (from LINEAR) ensure -- from LINEAR exhausted_when_off: off implies Result extendible: BOOLEAN -- May new items be added on current level? is_empty: BOOLEAN -- Is the tree empty? is_inserted (v: G): BOOLEAN -- Has v been inserted by the most recent insertion? -- (By default, the value returned is equivalent to calling -- `has (v)'. However, descendants might be able to provide more -- efficient implementations.) -- (from COLLECTION) is_leaf: BOOLEAN -- Is cursor on a leaf? -- (from CURSOR_TREE) is_root: BOOLEAN -- Is cursor on tree root? isfirst: BOOLEAN -- Is cursor on first sibling? islast: BOOLEAN -- Is cursor on last sibling? object_comparison: BOOLEAN -- Must search operations use equal rather than = -- for comparing references? (Default: no, use =.) -- (from CONTAINER) off: BOOLEAN -- Is there no current item? -- (True if is_empty) -- (from CURSOR_TREE) prunable: BOOLEAN -- May items be removed? -- (from COLLECTION) readable: BOOLEAN -- Is there a current item that may be read? -- (from CURSOR_TREE) valid_cursor (p: CURSOR): BOOLEAN -- Can the cursor be moved to position p? valid_cursor_index (i: INTEGER): BOOLEAN -- Can cursor be moved to i-th child? -- 0 is before and arity + 1 is after. -- (from CURSOR_TREE) writable: BOOLEAN -- Is there a current item that may be modified? -- (from CURSOR_TREE) feature -- Status setting compare_objects -- Ensure that future search operations will use equal -- rather than = for comparing references. -- (from CONTAINER) require -- from CONTAINER changeable_comparison_criterion ensure -- from CONTAINER object_comparison compare_references -- Ensure that future search operations will use = -- rather than equal for comparing references. -- (from CONTAINER) require -- from CONTAINER changeable_comparison_criterion ensure -- from CONTAINER reference_comparison: not object_comparison feature -- Cursor movement back -- Move cursor one position backward. breadth_forth -- Move cursor to next position in breadth-first order. -- If the active node is the last in -- breadth-first order, the cursor ends up off. -- (from CURSOR_TREE) require -- from CURSOR_TREE not_off: not off 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. require -- from HIERARCHICAL not_off: not off argument_within_bounds: i >= 1 and i <= arity require else -- from CURSOR_TREE not_before: not before not_after: not after not_below: not below valid_cursor_index: (above and i = 0) or else valid_cursor_index (i) ensure then -- from CURSOR_TREE gone_before: (i = 0) implies before forth -- Move cursor one position forward. go_last_child -- Go to the last child of current parent. -- No effect if below -- (from CURSOR_TREE) require -- from LINEAR True require else -- from CURSOR_TREE not_above: not above go_to (p: CURSOR) -- Move cursor to position p. require -- from CURSOR_STRUCTURE cursor_position_valid: valid_cursor (p) level_back -- Move cursor to previous position of current level. -- (from CURSOR_TREE) level_forth -- Move cursor to next position of current level. -- (from CURSOR_TREE) postorder_forth -- Move cursor to next position in postorder. -- If the active node is the last in -- postorder, the cursor ends up off. -- (from CURSOR_TREE) require -- from CURSOR_TREE not_off: not off postorder_start -- Move cursor to first position in postorder. -- Leave cursor off if tree is empty. -- (from CURSOR_TREE) preorder_forth -- Move cursor to next position in preorder. -- If the active node is the last in -- preorder, the cursor ends up off. -- (from CURSOR_TREE) require -- from LINEAR not_after: not after start -- Move cursor to root. -- Leave cursor off if is_empty. -- (from CURSOR_TREE) ensure then -- from CURSOR_TREE on_root_unless_empty: not is_empty implies is_root start_on_level (l: INTEGER) -- Move the cursor to the first position -- of the l-th level counting from root. -- (from CURSOR_TREE) require -- from CURSOR_TREE argument_within_bounds: l >= 1 and then depth >= l ensure -- from CURSOR_TREE level_expected: level = l is_first: isfirst up -- Move cursor one level upward to parent, -- or above if is_root holds. require -- from HIERARCHICAL not_off: not off require else -- from CURSOR_TREE not_above: not above ensure then -- from CURSOR_TREE not_before: not before not_after: not after not_below: not below coherency: (not old off and above) = (old is_root) feature -- Element change fill (other: CURSOR_TREE [G]) -- Fill with as many items of other -- as possible. -- The representations of other and current structure -- need not be the same. -- (from CURSOR_TREE) require -- from CURSOR_TREE is_empty: is_empty container_fill (other: CONTAINER [G]) -- Fill with as many items of other as possible. -- The representations of other and current structure -- need not be the same. -- (from COLLECTION) require -- from COLLECTION other_not_void: other /= void extendible fill_from_active (other: CURSOR_TREE [G]) -- Copy subtree of other's active node -- onto active node of current tree. -- (from CURSOR_TREE) require -- from CURSOR_TREE cursor_on_leaf: is_leaf merge_left (other: CURSOR_TREE [G]) -- Merge the items of other into current structure to -- the left of cursor position. -- (from CURSOR_TREE) require -- from CURSOR_TREE other_exists: other /= void not_before: not before not_above: not above only_one_root: (level = 1) implies is_empty merge_right (other: CURSOR_TREE [G]) -- Merge the items of other into current structure to -- the right of cursor position. -- (from CURSOR_TREE) require -- from CURSOR_TREE other_exists: other /= void not_after: not after not_above: not above only_one_root: (level = 1) implies is_empty put (v: G) -- Put v at cursor position. -- (Synonym for replace) -- (from CURSOR_TREE) require -- from COLLECTION extendible: extendible ensure -- from COLLECTION item_inserted: is_inserted (v) put_left (v: G) -- Add v to the left of cursor position. -- (from CURSOR_TREE) require -- from CURSOR_TREE not_before: not before not_above: not above only_one_root: (level = 1) implies is_empty put_right (v: G) -- Add v to the right of cursor position. -- (from CURSOR_TREE) require -- from CURSOR_TREE not_after: not after not_above: not above only_one_root: (level = 1) implies is_empty replace (v: G) -- Replace current item by v. require -- from ACTIVE writable: writable ensure -- from ACTIVE item_replaced: item = v feature -- Removal remove -- Remove node at cursor position -- (and consequently the corresponding -- subtree). Cursor moved up one level. require -- from ACTIVE prunable: prunable writable: writable ensure then not_off_unless_empty: is_empty or else not off wipe_out -- Remove all items. require -- from COLLECTION prunable ensure -- from COLLECTION wiped_out: is_empty ensure then cursor_above: above feature -- Conversion linear_representation: LINEAR [G] -- Representation as a linear structure -- (from LINEAR) feature -- Duplication child_tree (i: INTEGER): like Current -- Subtree rooted at i-th child -- (from CURSOR_TREE) require -- from CURSOR_TREE argument_within_bounds: i >= 1 and then i <= arity not_off: not off parent_tree: like Current -- Subtree rooted at parent -- (from CURSOR_TREE) require -- from CURSOR_TREE not_on_root: not is_root not_off: not off subtree: like Current -- Subtree rooted at current node -- (from CURSOR_TREE) require -- from CURSOR_TREE not_off: not off feature -- Insert element extend (v: G) -- Add v after last child. -- Make v the first_child if below and place -- cursor before. require -- from COLLECTION extendible: extendible ensure -- from COLLECTION item_inserted: is_inserted (v) ensure then -- from BAG one_more_occurrence: occurrences (v) = old (occurrences (v)) + 1 feature -- Iteration do_all (action: PROCEDURE [ANY, TUPLE [G]]) -- Apply action to every item. -- Semantics not guaranteed if action changes the structure; -- in such a case, apply iterator to clone of structure instead. -- (from TRAVERSABLE) require -- from TRAVERSABLE action_exists: action /= void linear_do_all (action: PROCEDURE [ANY, TUPLE [G]]) -- Apply action to every item. -- Semantics not guaranteed if action changes the structure; -- in such a case, apply iterator to clone of structure instead. -- (from LINEAR) require -- from TRAVERSABLE action_exists: action /= void do_if (action: PROCEDURE [ANY, TUPLE [G]]; test: FUNCTION [ANY, TUPLE [G], BOOLEAN]) -- Apply action to every item that satisfies test. -- Semantics not guaranteed if action or test changes the structure; -- in such a case, apply iterator to clone of structure instead. -- (from TRAVERSABLE) require -- from TRAVERSABLE action_exists: action /= void test_exits: test /= void linear_do_if (action: PROCEDURE [ANY, TUPLE [G]]; test: FUNCTION [ANY, TUPLE [G], BOOLEAN]) -- Apply action to every item that satisfies test. -- Semantics not guaranteed if action or test changes the structure; -- in such a case, apply iterator to clone of structure instead. -- (from LINEAR) require -- from TRAVERSABLE action_exists: action /= void test_exits: test /= void linear_for_all (test: FUNCTION [ANY, TUPLE [G], BOOLEAN]): BOOLEAN -- Is test true for all items? -- (from LINEAR) require -- from TRAVERSABLE test_exits: test /= void for_all (test: FUNCTION [ANY, TUPLE [G], BOOLEAN]): BOOLEAN -- Is test true for all items? -- (from TRAVERSABLE) require -- from TRAVERSABLE test_exits: test /= void there_exists (test: FUNCTION [ANY, TUPLE [G], BOOLEAN]): BOOLEAN -- Is test true for at least one item? -- (from TRAVERSABLE) require -- from TRAVERSABLE test_exits: test /= void linear_there_exists (test: FUNCTION [ANY, TUPLE [G], BOOLEAN]): BOOLEAN -- Is test true for at least one item? -- (from LINEAR) require -- from TRAVERSABLE test_exits: test /= void invariant coherency: not above implies active_parent.child = active -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) -- from CURSOR_TREE non_negative_depth: depth >= 0 non_negative_breadth: breadth >= 0 is_leaf_definition: not off implies is_leaf = (arity = 0) above_property: above implies (arity <= 1) on_tree: (isfirst or islast or is_leaf or is_root) implies not off off_definition: off = after or before or above or below below_constraint: below implies ((after or before) and not above) above_constraint: above implies not (before or after or below) after_constraint: after implies not (before or above) before_constaint: before implies not (after or above) empty_below_constraint: (is_empty and (after or before)) implies below -- from HIERARCHICAL non_negative_successor_count: arity >= 0 -- from TRAVERSABLE empty_constraint: is_empty implies off -- from ACTIVE writable_constraint: writable implies readable empty_constraint: is_empty implies (not readable) and (not writable) -- from LINEAR after_constraint: after implies off indexing library: "[ EiffelBase: Library of reusable components for Eiffel. ]" status: "[ Copyright 1986-2001 Interactive Software Engineering (ISE). For ISE customers the original versions are an ISE product covered by the ISE Eiffel license and support agreements. ]" license: "[ EiffelBase may now be used by anyone as FREE SOFTWARE to develop any product, public-domain or commercial, without payment to ISE, under the terms of the ISE Free Eiffel Library License (IFELL) at http://eiffel.com/products/base/license.html. ]" source: "[ Interactive Software Engineering Inc. ISE Building 360 Storke Road, Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Electronic mail <info@eiffel.com> Customer support http://support.eiffel.com ]" info: "[ For latest info see award-winning pages: http://eiffel.com ]" end -- class RECURSIVE_CURSOR_TREE
Classes Clusters Cluster hierarchy Chart Relations Text Flat Contracts Flat contracts Go to:

-- Generated by ISE Eiffel --
For more details: www.eiffel.com