indexing
description: "Compact trees as active structures that may be traversed using a cursor"
legal: "See notice at end of class."
status: "See notice at end of class."
names: compact_cursor_tree, cursor_tree
representation: array
access: cursor, membership
size: resizable
contents: generic
date: "$Date: 2008-05-23 17:24:07 -0700 (Fri, 23 May 2008) $"
revision: "$Revision: 170 $"
class interface
COMPACT_CURSOR_TREE [G]
create
make (i: INTEGER_32)
`i'
ensure
is_above: above
is_empty: is_empty
feature
default_create
ANY
make (i: INTEGER_32)
`i'
ensure
is_above: above
is_empty: is_empty
feature
child_item (i: INTEGER_32): G
`i'
CURSOR_TREE
require CURSOR_TREE
argument_within_bounds: i >= 1 and then i <= arity
not_off: not off
cursor: COMPACT_TREE_CURSOR
ensure CURSOR_STRUCTURE
cursor_not_void: Result /= Void
generating_type: STRING_8
ANY
ensure ANY
generating_type_not_void: Result /= Void
generating_type_not_empty: not Result.is_empty
generator: STRING_8
ANY
ensure ANY
generator_not_void: Result /= Void
generator_not_empty: not Result.is_empty
has (v: like item): BOOLEAN
`v'
object_comparison
require CONTAINER
True
ensure CONTAINER
not_found_in_empty: Result implies not is_empty
index_of (v: like item; i: INTEGER_32): INTEGER_32
`i'`v'
object_comparison
LINEAR
require LINEAR
positive_occurrences: i > 0
ensure LINEAR
non_negative_result: Result >= 0
item: G
require TRAVERSABLE
not_off: not off
require ACTIVE
readable: readable
item_for_iteration: G
LINEAR
require LINEAR
not_off: not off
occurrences (v: G): INTEGER_32
`v'
object_comparison
require BAG
True
require LINEAR
True
ensure BAG
non_negative_occurrences: Result >= 0
parent_item: G
CURSOR_TREE
require CURSOR_TREE
not_on_root: not is_root
search (v: like item)
item`v'
object_comparison
exhausted
LINEAR
ensure LINEAR
object_found: (not exhausted and object_comparison) implies equal (v, item)
item_found: (not exhausted and not object_comparison) implies v = item
feature
arity: INTEGER_32
require HIERARCHICAL
not_off: not off
breadth: INTEGER_32
CURSOR_TREE
count: INTEGER_32
depth: INTEGER_32
CURSOR_TREE
level: INTEGER_32
CURSOR_TREE
feature
frozen deep_equal (some: ?ANY; other: like arg #1): BOOLEAN
`some'`other'
ANY
ensure ANY
shallow_implies_deep: standard_equal (some, other) implies Result
both_or_none_void: (some = Void) implies (Result = (other = Void))
same_type: (Result and (some /= Void)) implies (other /= Void and then some.same_type (other))
symmetric: Result implies deep_equal (other, some)
frozen equal (some: ?ANY; other: like arg #1): BOOLEAN
`some'`other'
ANY
ensure ANY
definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.is_equal (other))
frozen is_deep_equal (other: COMPACT_CURSOR_TREE [G]): BOOLEAN
`Current'`other'
ANY
require ANY
other_not_void: other /= Void
ensure ANY
shallow_implies_deep: standard_is_equal (other) implies Result
same_type: Result implies same_type (other)
symmetric: Result implies other.is_deep_equal (Current)
is_equal (other: COMPACT_CURSOR_TREE [G]): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
ensure ANY
symmetric: Result implies other.is_equal (Current)
consistent: standard_is_equal (other) implies Result
frozen standard_equal (some: ?ANY; other: like arg #1): BOOLEAN
`some'`other'
ANY
ensure ANY
definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.standard_is_equal (other))
frozen standard_is_equal (other: COMPACT_CURSOR_TREE [G]): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
ensure ANY
same_type: Result implies same_type (other)
symmetric: Result implies other.standard_is_equal (Current)
feature
above: BOOLEAN
after: BOOLEAN
before: BOOLEAN
below: BOOLEAN
CURSOR_TREE
changeable_comparison_criterion: BOOLEAN
object_comparison
CONTAINER
conforms_to (other: ANY): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
exhausted: BOOLEAN
LINEAR
ensure LINEAR
exhausted_when_off: off implies Result
extendible: BOOLEAN
CURSOR_TREE
full: BOOLEAN is False
is_empty: BOOLEAN
is_inserted (v: G): BOOLEAN
`v'
`has (v)'
COLLECTION
is_leaf: BOOLEAN
CURSOR_TREE
is_root: BOOLEAN
isfirst: BOOLEAN
islast: BOOLEAN
object_comparison: BOOLEAN
equal`='
`='
CONTAINER
off: BOOLEAN
is_empty
CURSOR_TREE
require TRAVERSABLE
True
prunable: BOOLEAN
readable: BOOLEAN
CURSOR_TREE
same_type (other: ANY): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
ensure ANY
definition: Result = (conforms_to (other) and other.conforms_to (Current))
valid_cursor (p: CURSOR): BOOLEAN
`p'
valid_cursor_index (i: INTEGER_32): BOOLEAN
`i'
arity
CURSOR_TREE
writable: BOOLEAN
CURSOR_TREE
feature
compare_objects
equal
`='
CONTAINER
require CONTAINER
changeable_comparison_criterion: changeable_comparison_criterion
ensure CONTAINER
object_comparison
compare_references
`='
equal
CONTAINER
require CONTAINER
changeable_comparison_criterion: changeable_comparison_criterion
ensure CONTAINER
reference_comparison: not object_comparison
feature
back
breadth_forth
off
CURSOR_TREE
require CURSOR_TREE
not_off: not off
down (i: INTEGER_32)
`i'
after`i'arity
before`i'
require HIERARCHICAL
not_off: not off
argument_within_bounds: i >= 1 and i <= arity
require else 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)
require else
True
ensure then CURSOR_TREE
gone_before: (i = 0) implies before
forth
go_last_child
CURSOR_TREE
require LINEAR
True
require else CURSOR_TREE
not_above: not above
go_to (p: CURSOR)
`p'
require CURSOR_STRUCTURE
cursor_position_valid: valid_cursor (p)
level_back
CURSOR_TREE
level_forth
CURSOR_TREE
postorder_forth
off
CURSOR_TREE
require CURSOR_TREE
not_off: not off
postorder_start
CURSOR_TREE
preorder_forth
off
CURSOR_TREE
require LINEAR
not_after: not after
start
offis_empty
CURSOR_TREE
require TRAVERSABLE
True
ensure then CURSOR_TREE
on_root_unless_empty: not is_empty implies is_root
start_on_level (l: INTEGER_32)
`l'
CURSOR_TREE
require CURSOR_TREE
argument_within_bounds: l >= 1 and then depth >= l
ensure CURSOR_TREE
level_expected: level = l
is_first: isfirst
up
aboveis_root
require HIERARCHICAL
not_off: not off
require else CURSOR_TREE
not_above: not above
ensure then CURSOR_TREE
not_before: not before
not_after: not after
not_below: not below
coherency: (not old off and above) = (old is_root)
feature
extend (v: G)
`v'
require COLLECTION
extendible: extendible
ensure COLLECTION
item_inserted: is_inserted (v)
ensure then BAG
one_more_occurrence: occurrences (v) = old (occurrences (v)) + 1
container_fill (other: CONTAINER [G])
`other'
`other'
COLLECTION
require COLLECTION
other_not_void: other /= Void
extendible: extendible
fill (other: CURSOR_TREE [G])
`other'
`other'
CURSOR_TREE
require CURSOR_TREE
is_empty: is_empty
fill_from_active (other: CURSOR_TREE [G])
`other'
CURSOR_TREE
require CURSOR_TREE
cursor_on_leaf: is_leaf
merge_left (other: CURSOR_TREE [G])
`other'
CURSOR_TREE
require 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])
`other'
CURSOR_TREE
require 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)
`v'
replace
CURSOR_TREE
require COLLECTION
extendible: extendible
ensure COLLECTION
item_inserted: is_inserted (v)
put_front (v: G)
`v'
aboveis_empty`v'
put_left (v: G)
`v'
require CURSOR_TREE
not_before: not before
not_above: not above
only_one_root: (level = 1) implies is_empty
require else
not_above: not above
put_parent (v: G)
require
not after
not before
put_right (v: G)
`v'
require CURSOR_TREE
not_after: not after
not_above: not above
only_one_root: (level = 1) implies is_empty
replace (v: G)
`v'
require ACTIVE
writable: writable
require else
is_writable: writable
ensure ACTIVE
item_replaced: item = v
feature
remove
after
require ACTIVE
prunable: prunable
writable: writable
ensure then
not_before: not before
remove_node
require
not_off: not off
is_root implies arity <= 1
wipe_out
require COLLECTION
prunable: prunable
ensure COLLECTION
wiped_out: is_empty
ensure then
cursor_above: above
feature
linear_representation: LINEAR [G]
LINEAR
require CONTAINER
True
feature
child_tree (i: INTEGER_32): COMPACT_CURSOR_TREE [G]
`i'
CURSOR_TREE
require CURSOR_TREE
argument_within_bounds: i >= 1 and then i <= arity
not_off: not off
copy (other: COMPACT_CURSOR_TREE [G])
`other'
ANY
require ANY
other_not_void: other /= Void
type_identity: same_type (other)
ensure ANY
is_equal: is_equal (other)
frozen deep_copy (other: COMPACT_CURSOR_TREE [G])
copy`other'deep_twin
ANY
require ANY
other_not_void: other /= Void
ensure ANY
deep_equal: deep_equal (Current, other)
frozen deep_twin: COMPACT_CURSOR_TREE [G]
ANY
ensure ANY
deep_twin_not_void: Result /= Void
deep_equal: deep_equal (Current, Result)
parent_tree: COMPACT_CURSOR_TREE [G]
CURSOR_TREE
require CURSOR_TREE
not_on_root: not is_root
not_off: not off
frozen standard_copy (other: COMPACT_CURSOR_TREE [G])
`other'
ANY
require ANY
other_not_void: other /= Void
type_identity: same_type (other)
ensure ANY
is_standard_equal: standard_is_equal (other)
frozen standard_twin: COMPACT_CURSOR_TREE [G]
`other'
ANY
ensure ANY
standard_twin_not_void: Result /= Void
equal: standard_equal (Result, Current)
subtree: COMPACT_CURSOR_TREE [G]
CURSOR_TREE
require CURSOR_TREE
not_off: not off
frozen twin: COMPACT_CURSOR_TREE [G]
`Current'
twincopycopy
ANY
ensure ANY
twin_not_void: Result /= Void
is_equal: Result.is_equal (Current)
feature
frozen default: ?COMPACT_CURSOR_TREE [G]
ANY
frozen default_pointer: POINTER
`POINTER'
`p'default
`p'`POINTER'
ANY
default_rescue
ANY
frozen do_nothing
ANY
feature
do_all (action: PROCEDURE [ANY, TUPLE [G]])
`action'
`action'
TRAVERSABLE
require TRAVERSABLE
action_exists: action /= Void
linear_do_all (action: PROCEDURE [ANY, TUPLE [G]])
`action'
`action'
LINEAR
require TRAVERSABLE
action_exists: action /= Void
do_if (action: PROCEDURE [ANY, TUPLE [G]]; test: FUNCTION [ANY, TUPLE [G], BOOLEAN])
`action'`test'
`action'`test'
TRAVERSABLE
require TRAVERSABLE
action_exists: action /= Void
test_exits: test /= Void
linear_do_if (action: PROCEDURE [ANY, TUPLE [G]]; test: FUNCTION [ANY, TUPLE [G], BOOLEAN])
`action'`test'
`action'`test'
LINEAR
require TRAVERSABLE
action_exists: action /= Void
test_exits: test /= Void
linear_for_all (test: FUNCTION [ANY, TUPLE [G], BOOLEAN]): BOOLEAN
`test'
`test'
LINEAR
requ