indexing
description: "[
Contiguous integer interval that calls an action sequence
when it changes.
]"
status: "See notice at end of class"
keywords: "event, action, linked, list"
date: "$Date$"
revision: "$Revision$"
class interface
ACTIVE_INTEGER_INTERVAL
create
make (min_index, max_index: INTEGER)
min_index
max_indexmin_indexmax_index
INTEGER_INTERVAL
ensure INTEGER_INTERVAL
lower_defined: lower_defined
upper_defined: upper_defined
set_if_non_empty: (min_index <= max_index) implies ((lower = min_index) and (upper = max_index))
empty_if_not_in_order: (min_index > max_index) implies is_empty
feature
adapt (other: INTEGER_INTERVAL)
other
require INTEGER_INTERVAL
other_not_void: other /= void
ensure INTEGER_INTERVAL
same_lower: lower = other.lower
same_upper: upper = other.upper
same_lower_defined: lower_defined = other.lower_defined
same_upper_defined: upper_defined = other.upper_defined
feature
has (v: INTEGER): BOOLEAN
v
INTEGER_INTERVALvalid_index
INTEGER_INTERVAL
ensure CONTAINER
not_found_in_empty: Result implies not is_empty
ensure then INTEGER_INTERVAL
iff_within_bounds: Result = ((upper_defined implies v <= upper) and (lower_defined implies v >= lower))
item (i: INTEGER): INTEGER
i
INTEGER_INTERVAL@
INTEGER_INTERVAL
require TABLE
valid_key: valid_index (k)
lower: INTEGER
INTEGER_INTERVAL
require INTEGER_INTERVAL
lower_defined: lower_defined
lower_defined: BOOLEAN
INTEGER_INTERVAL
upper: INTEGER
INTEGER_INTERVAL
require INTEGER_INTERVAL
upper_defined: upper_defined
upper_defined: BOOLEAN
INTEGER_INTERVAL
valid_index (v: INTEGER): BOOLEAN
v
INTEGER_INTERVALhas
INTEGER_INTERVAL
ensure then INDEXABLE
only_if_in_index_set: Result implies ((i >= index_set.lower) and (i <= index_set.upper))
ensure then INTEGER_INTERVAL
iff_within_bounds: Result = ((upper_defined implies v <= upper) and (lower_defined implies v >= lower))
infix "@" (i: INTEGER): INTEGER
i
INTEGER_INTERVALitem
INTEGER_INTERVAL
require TABLE
valid_key: valid_index (k)
feature
additional_space: INTEGER
RESIZABLE
ensure RESIZABLE
at_least_one: Result >= 1
capacity: INTEGER
count
INTEGER_INTERVAL
count: INTEGER
INTEGER_INTERVAL
ensure then INTEGER_INTERVAL
definition: Result = upper - lower + 1
Growth_percentage: INTEGER is 50
RESIZABLE
index_set: INTEGER_INTERVAL
INTEGER_INTERVAL
ensure INDEXABLE
not_void: Result /= void
ensure then INTEGER_INTERVAL
index_set_is_range: equal (Result, Current)
Minimal_increase: INTEGER is 5
RESIZABLE
occurrences (v: INTEGER): INTEGER
v
INTEGER_INTERVAL
ensure BAG
non_negative_occurrences: Result >= 0
ensure then INTEGER_INTERVAL
one_iff_in_bounds: Result = 1 implies has (v)
zero_otherwise: Result /= 1 implies Result = 0
feature
is_equal (other: like Current): BOOLEAN
other
INTEGER_INTERVAL
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 INTEGER_INTERVAL
iff_same_bounds: Result = ((lower_defined implies (other.lower_defined and lower = other.lower)) and (upper_defined implies (other.upper_defined and upper = other.upper)))
feature
all_cleared: BOOLEAN
INTEGER_INTERVAL
ensure then INTEGER_INTERVAL
iff_at_zero: Result = ((lower = 0) and (upper = 0))
extendible: BOOLEAN
INTEGER_INTERVAL
full: BOOLEAN
BOUNDED
is_empty: BOOLEAN
FINITE
is_inserted (v: INTEGER): BOOLEAN
v
COLLECTION
object_comparison: BOOLEAN
equal=
=
CONTAINER
prunable: BOOLEAN
INTEGER_INTERVAL
resizable: BOOLEAN
capacity
RESIZABLE
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
extend (v: INTEGER)
v
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)
ensure then BAG
one_more_occurrence: occurrences (v) = old (occurrences (v)) + 1
ensure then INTEGER_INTERVAL
extended_down: lower = (old lower).min (v)
extended_up: upper = (old upper).max (v)
fill (other: CONTAINER [INTEGER])
other
other
COLLECTION
require COLLECTION
other_not_void: other /= void
extendible
put (v: INTEGER)
v
require INTEGER_INTERVAL
True
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)
ensure then INTEGER_INTERVAL
extended_down: lower = (old lower).min (v)
extended_up: upper = (old upper).max (v)
feature
changeable_comparison_criterion: BOOLEAN
object_comparison
SET
ensure then SET
only_on_empty: Result = is_empty
prune_all (v: INTEGER)
v
object_comparison
COLLECTION
require COLLECTION
prunable
ensure COLLECTION
no_more_occurrences: not has (v)
wipe_out
INTEGER_INTERVAL
require COLLECTION
prunable
ensure COLLECTION
wiped_out: is_empty
feature
automatic_grow
Growth_percentage
RESIZABLE
ensure RESIZABLE
increased_capacity: capacity >= old capacity + old capacity * growth_percentage // 100
grow (i: INTEGER)
i
INTEGER_INTERVAL
ensure RESIZABLE
new_capacity: capacity >= i
ensure then INTEGER_INTERVAL
no_loss_from_bottom: lower <= old lower
no_loss_from_top: upper >= old upper
resize (min_index, max_index: INTEGER)
min_indexmax_index
resize_exactly (min_index, max_index: INTEGER)
min_indexmax_index
feature
as_array: ARRAY [INTEGER]
INTEGER_INTERVAL
require INTEGER_INTERVAL
finite: upper_defined and lower_defined
ensure INTEGER_INTERVAL
same_lower: Result.lower = lower
same_upper: Result.upper = upper
linear_representation: LINEAR [INTEGER]
INTEGER_INTERVAL
feature
copy (other: like Current)
other
require ANY
other_not_void: other /= void
type_identity: same_type (other)
ensure ANY
is_equal: is_equal (other)
ensure then INTEGER_INTERVAL
same_lower: lower = other.lower
same_upper: upper = other.upper
same_lower_defined: lower_defined = other.lower_defined
same_upper_defined: upper_defined = other.upper_defined
subinterval (start_pos, end_pos: INTEGER): like Current
start_posend_pos
INTEGER_INTERVAL
feature
change_actions: ACTION_SEQUENCE [TUPLE]
ensure
not_void: Result /= void
feature
exists (condition: FUNCTION [ANY, TUPLE [INTEGER], BOOLEAN]): BOOLEAN
condition
INTEGER_INTERVAL
require INTEGER_INTERVAL
finite: upper_defined and lower_defined
ensure INTEGER_INTERVAL
consistent_with_count: Result = (hold_count (condition) > 0)
exists1 (condition: FUNCTION [ANY, TUPLE [INTEGER], BOOLEAN]): BOOLEAN
condition
INTEGER_INTERVAL
require INTEGER_INTERVAL
finite: upper_defined and lower_defined
ensure INTEGER_INTERVAL
consistent_with_count: Result = (hold_count (condition) = 1)
for_all (condition: FUNCTION [ANY, TUPLE [INTEGER], BOOLEAN]): BOOLEAN
condition
INTEGER_INTERVAL
require INTEGER_INTERVAL
finite: upper_defined and lower_defined
ensure INTEGER_INTERVAL
consistent_with_count: Result = (hold_count (condition) = count)
hold_count (condition: FUNCTION [ANY, TUPLE [INTEGER], BOOLEAN]): INTEGER
condition
INTEGER_INTERVAL
require INTEGER_INTERVAL
finite: upper_defined and lower_defined
ensure INTEGER_INTERVAL
non_negative: Result >= 0
invariant
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
INTEGER_INTERVAL
count_definition: upper_defined and lower_defined implies count = upper - lower + 1
index_set_is_range: equal (index_set, Current)
not_infinite: upper_defined and lower_defined
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
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 -- ACTIVE_INTEGER_INTERVAL