indexing
description: "Sorted sets implemented as binary search trees"
legal: "See notice at end of class."
status: "See notice at end of class."
names: binary_search_tree_set, set, binary_search_tree
representation: recursive, array
access: membership, min, max
contents: generic
date: "$Date: 2006-01-22 18:25:44 -0800 (Sun, 22 Jan 2006) $"
revision: "$Revision: 56675 $"
class interface
BINARY_SEARCH_TREE_SET [G -> COMPARABLE]
create
make
feature
make
feature
generating_type: STRING_8
ANY
generator: STRING_8
ANY
feature
count: INTEGER_32
require SET
True
item: G
require TRAVERSABLE
not_off: not off
require TRAVERSABLE_SUBSET
not_off: not off
max: like item
require COMPARABLE_SET
not_empty: not is_empty
min: like item
require COMPARABLE_SET
not_empty: not is_empty
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 some.same_type (other)
symmetric: Result implies deep_equal (other, some)
disjoint (other: TRAVERSABLE_SUBSET [G]): BOOLEAN
`other'
TRAVERSABLE_SUBSET
require SUBSET
set_exists: other /= Void
same_rule: object_comparison = other.object_comparison
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))
is_equal (other: like Current): 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
is_subset (other: TRAVERSABLE_SUBSET [G]): BOOLEAN
`other'
TRAVERSABLE_SUBSET
require SUBSET
set_exists: other /= Void
same_rule: object_comparison = other.object_comparison
is_superset (other: SUBSET [G]): BOOLEAN
`other'
SUBSET
require SUBSET
set_exists: other /= Void
same_rule: object_comparison = other.object_comparison
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: like Current): 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
after: BOOLEAN
before: BOOLEAN
conforms_to (other: ANY): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
extendible: BOOLEAN is True
has (v: like item): BOOLEAN
`v'
object_comparison
require CONTAINER
True
ensure CONTAINER
not_found_in_empty: Result implies not is_empty
is_empty: BOOLEAN
require CONTAINER
True
is_inserted (v: G): BOOLEAN
`v'
`has (v)'
COLLECTION
object_comparison: BOOLEAN
equal`='
`='
CONTAINER
off: BOOLEAN
offis_empty
beforeafter
require TRAVERSABLE
True
require TRAVERSABLE_SUBSET
True
prunable: BOOLEAN is True
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))
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
require BILINEAR
not_before: not before
finish
forth
require LINEAR
not_after: not after
require TRAVERSABLE_SUBSET
not_after: not after
start
require TRAVERSABLE
True
require TRAVERSABLE_SUBSET
True
feature
extend (v: like item)
`v'
BINARY_SEARCH_TREE_SETput
require COLLECTION
extendible: extendible
require else
item_exists: v /= Void
ensure COLLECTION
item_inserted: is_inserted (v)
ensure then SET
in_set_already: old has (v) implies (count = old count)
added_to_set: not old has (v) implies (count = old count + 1)
fill (other: CONTAINER [G])
`other'
`other'
COLLECTION
require COLLECTION
other_not_void: other /= Void
extendible: extendible
merge (other: CONTAINER [G])
`other'
TRAVERSABLE_SUBSET
require SUBSET
set_exists: other /= Void
same_rule: object_comparison = other.object_comparison
put (v: like item)
`v'
BINARY_SEARCH_TREE_SETextend
require COLLECTION
extendible: extendible
require else
item_exists: v /= Void
ensure COLLECTION
item_inserted: is_inserted (v)
ensure then SET
in_set_already: old has (v) implies (count = old count)
added_to_set: not old has (v) implies (count = old count + 1)
feature
changeable_comparison_criterion: BOOLEAN
object_comparison
SET
require CONTAINER
True
ensure then SET
only_on_empty: Result = is_empty
prune (v: like item)
`v'
require COLLECTION
prunable: prunable
ensure then SET
removed_count_change: old has (v) implies (count = old count - 1)
not_removed_no_count_change: not old has (v) implies (count = old count)
item_deleted: not has (v)
prune_all (v: G)
`v'
object_comparison
COLLECTION
require COLLECTION
prunable: prunable
ensure COLLECTION
no_more_occurrences: not has (v)
remove
require TRAVERSABLE_SUBSET
not_off: not off
wipe_out
require COLLECTION
prunable: prunable
ensure COLLECTION
wiped_out: is_empty
feature
linear_representation: LINEAR [G]
LINEAR
require CONTAINER
True
feature
copy (other: like Current)
`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: like Current)
copy`other'deep_twin
ANY
require ANY
other_not_void: other /= Void
ensure ANY
deep_equal: deep_equal (Current, other)
frozen deep_twin: like Current
ANY
ensure ANY
deep_equal: deep_equal (Current, Result)
duplicate (n: INTEGER_32): BINARY_SEARCH_TREE_SET [G]
`n'count
require SUBSET
non_negative: n >= 0
ensure SUBSET
correct_count_1: n <= count implies Result.count = n
correct_count_2: n >= count implies Result.count = count
frozen standard_copy (other: like Current)
`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: like Current
`other'
ANY
ensure ANY
standard_twin_not_void: Result /= Void
equal: standard_equal (Result, Current)
frozen twin: like Current
`Current'
twincopycopy
ANY
ensure ANY
twin_not_void: Result /= Void
is_equal: Result.is_equal (Current)
feature
frozen default: like Current
ANY
frozen default_pointer: POINTER
`POINTER'
`p'default
`p'`POINTER'
ANY
default_rescue
ANY
frozen do_nothing
ANY
intersect (other: TRAVERSABLE_SUBSET [G])
`other'
`other'is_empty
TRAVERSABLE_SUBSET
require SUBSET
set_exists: other /= Void
same_rule: object_comparison = other.object_comparison
ensure SUBSET
is_subset_other: is_subset (other)
subtract (other: TRAVERSABLE_SUBSET [G])
`other'
TRAVERSABLE_SUBSET
require SUBSET
set_exists: other /= Void
same_rule: object_comparison = other.object_comparison
ensure SUBSET
is_disjoint: disjoint (other)
symdif (other: TRAVERSABLE_SUBSET [G])
`other'
`other'
TRAVERSABLE_SUBSET
require SUBSET
set_exists: other /= Void
same_rule: object_comparison = other.object_comparison
feature
io: STD_FILES
ANY
out: STRING_8
ANYtagged_out
ANY
print (some: ANY)
`some'
ANY
frozen tagged_out: STRING_8
ANYout
ANY
feature
operating_environment: OPERATING_ENVIRONMENT
ANY
invariant
comparison_mode_equal: tree /= Void implies object_comparison = tree.object_comparison
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
COMPARABLE_STRUCT
empty_constraint: min_max_available implies not is_empty
BILINEAR
not_both: not (after and before)
before_constraint: before implies off
LINEAR
after_constraint: after implies off
TRAVERSABLE
empty_constraint: is_empty implies off
TRAVERSABLE_SUBSET
empty_definition: is_empty = (count = 0)
count_range: count >= 0
indexing
library: "EiffelBase: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end BINARY_SEARCH_TREE_SET