indexing
description: "Sets represented as arrayed lists"
status: "See notice at end of class"
names: arrayed_set, set, arrayed_list
representation: array
size: fixed
access: membership
contents: generic
date: "$Date$"
revision: "$Revision$"
class interface
ARRAYED_SET [G]
create
make (n: INTEGER)
n
n
ARRAYED_LIST
require ARRAYED_LIST
valid_number_of_items: n >= 0
ensure ARRAYED_LIST
correct_position: before
feature
has (v: like item): BOOLEAN
v
object_comparison
CHAIN
ensure CONTAINER
not_found_in_empty: Result implies not is_empty
index: INTEGER
item
ARRAYED_LIST
item: like first
ARRAYED_LIST
require TRAVERSABLE
not_off: not off
require ACTIVE
readable: readable
require TRAVERSABLE_SUBSET
not_off: not off
require else ARRAYED_LIST
index_is_valid: valid_index (index)
feature
count: INTEGER
ARRAYED_LIST
feature
disjoint (other: TRAVERSABLE_SUBSET [G]): BOOLEAN
other
TRAVERSABLE_SUBSET
require SUBSET
set_exists: other /= void
same_rule: object_comparison = other.object_comparison
is_equal (other: like Current): BOOLEAN
other
LIST
require ANY
other_not_void: other /= void
ensure ANY
symmetric: Result implies other.is_equal (Current)
consistent: standard_is_equal (other) implies Result
ensure then LIST
indices_unchanged: index = old index and other.index = old other.index
true_implies_same_size: Result implies count = other.count
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
feature
after: BOOLEAN
LIST
before: BOOLEAN
LIST
Extendible: BOOLEAN is True
DYNAMIC_CHAIN
is_empty: BOOLEAN
FINITE
is_inserted (v: G): BOOLEAN
v
COLLECTION
islast: BOOLEAN
CHAIN
ensure CHAIN
valid_position: Result implies not is_empty
object_comparison: BOOLEAN
equal=
=
CONTAINER
off: BOOLEAN
CHAIN
prunable: BOOLEAN
ARRAYED_LIST
valid_index (i: INTEGER): BOOLEAN
i
ARRAYED_LIST
ensure then INDEXABLE
only_if_in_index_set: Result implies ((i >= index_set.lower) and (i <= index_set.upper))
ensure then CHAIN
valid_index_definition: Result = ((i >= 1) and (i <= count))
ensure LINEAR_SUBSET
index_valid: 0 <= n and n <= count + 1
valid_index (i: INTEGER): BOOLEAN
i
ARRAYED_LIST
ensure then INDEXABLE
only_if_in_index_set: Result implies ((i >= index_set.lower) and (i <= index_set.upper))
ensure then CHAIN
valid_index_definition: Result = ((i >= 1) and (i <= count))
ensure LINEAR_SUBSET
index_valid: 0 <= n and n <= count + 1
feature
compare_objects
equal
=
CONTAINER
require CONTAINER
changeable_comparison_criterion
ensure CONTAINER
object_comparison
compare_references
=
equal
CONTAINER
require CONTAINER
changeable_comparison_criterion
ensure CONTAINER
reference_comparison: not object_comparison
feature
forth
ARRAYED_LIST
require LINEAR
not_after: not after
require TRAVERSABLE_SUBSET
not_after: not after
ensure then LIST
moved_forth: index = old index + 1
go_i_th (i: INTEGER)
i
ARRAYED_LIST
require CHAIN
valid_cursor_index: valid_cursor_index (i)
require LINEAR_SUBSET
valid_index: valid_index (i)
ensure CHAIN
position_expected: index = i
ensure LINEAR_SUBSET
cursor_moved: index = i
start
ARRAYED_LIST
ensure then CHAIN
at_first: not is_empty implies isfirst
ensure then ARRAYED_LIST
after_when_empty: is_empty implies after
feature
extend (v: G)
v
ARRAYED_SETput
require COLLECTION
extendible: extendible
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
merge (other: CONTAINER [G])
other
TRAVERSABLE_SUBSET
require SUBSET
set_exists: other /= void
same_rule: object_comparison = other.object_comparison
move_item (v: G)
v
LINEAR_SUBSET
require LINEAR_SUBSET
item_exists: v /= void
item_in_set: has (v)
put (v: G)
v
ARRAYED_SETextend
require COLLECTION
extendible: extendible
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)
put_left (v: like item)
v
ARRAYED_LIST
require DYNAMIC_CHAIN
extendible: extendible
not_before: not before
require LINEAR_SUBSET
item_exists: v /= void
not_before: not before
ensure DYNAMIC_CHAIN
new_count: count = old count + 1
new_index: index = old index + 1
ensure LINEAR_SUBSET
cursor_position_unchanged: index = old index + 1
feature
changeable_comparison_criterion: BOOLEAN
object_comparison
SET
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: like item)
v
object_comparison
ARRAYED_LIST
require COLLECTION
prunable
ensure COLLECTION
no_more_occurrences: not has (v)
ensure then DYNAMIC_CHAIN
is_exhausted: exhausted
ensure then ARRAYED_LIST
is_after: after
remove
after
ARRAYED_LIST
require ACTIVE
prunable: prunable
writable: writable
require TRAVERSABLE_SUBSET
not_off: not off
ensure then DYNAMIC_LIST
after_when_empty: is_empty implies after
ensure then ARRAYED_LIST
index: index = old index
wipe_out
ARRAYED_LIST
require COLLECTION
prunable
ensure COLLECTION
wiped_out: is_empty
ensure then DYNAMIC_LIST
is_before: before
feature
linear_representation: LINEAR [G]
LINEAR
feature
copy (other: like Current)
other
clone
ARRAY
require ANY
other_not_void: other /= void
type_identity: same_type (other)
ensure ANY
is_equal: is_equal (other)
ensure then ARRAY
equal_areas: area.is_equal (other.area)
duplicate (n: INTEGER): like Current
ncountindex
ARRAYED_LIST
require CHAIN
not_off_unless_after: off implies after
valid_subchain: n >= 0
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
feature
intersect (other: TRAVERSABLE_SUBSET [G])
other
otheris_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
invariant
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
LINEAR_SUBSET
before_definition: before = (index = 0)
TRAVERSABLE_SUBSET
empty_definition: is_empty = (count = 0)
count_range: count >= 0
ARRAYED_LIST
prunable: prunable
starts_from_one: lower = 1
empty_means_storage_empty: is_empty implies all_default
ARRAY
area_exists: area /= void
consistent_size: capacity = upper - lower + 1
non_negative_count: count >= 0
index_set_has_same_count: valid_index_set
RESIZABLE
increase_by_at_least_one: minimal_increase >= 1
BOUNDED
valid_count: count <= capacity
full_definition: full = (count = capacity)
FINITE
empty_definition: is_empty = (count = 0)
non_negative_count: count >= 0
INDEXABLE
index_set_not_void: index_set /= void
LIST
before_definition: before = (index = 0)
after_definition: after = (index = count + 1)
CHAIN
non_negative_index: index >= 0
index_small_enough: index <= count + 1
off_definition: off = ((index = 0) or (index = count + 1))
isfirst_definition: isfirst = ((not is_empty) and (index = 1))
islast_definition: islast = ((not is_empty) and (index = count))
item_corresponds_to_index: (not off) implies (item = i_th (index))
index_set_has_same_count: index_set.count = count
ACTIVE
writable_constraint: writable implies readable
empty_constraint: is_empty implies (not readable) and (not writable)
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
DYNAMIC_CHAIN
extendible: extendible
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 -- ARRAYED_SET