indexing
description: "Sets of integers with a finite number of items"
status: "See notice at end of class"
date: "$Date$"
revision: "$Revision$"
class interface
FIXED_INTEGER_SET
create
make (n: INTEGER)
nn
require
n_positive: n > 0
ensure
set_empty: is_empty
feature
make (n: INTEGER)
nn
require
n_positive: n > 0
ensure
set_empty: is_empty
boolean_set_make (n: INTEGER)
n
BOOL_STRING
require BOOL_STRING
non_negative_size: n >= 0
ensure BOOL_STRING
correct_allocation: count = n
feature
has (i: INTEGER): BOOLEAN
i
require
index_large_enough: 1 <= i
index_small_enough: i <= count
is_empty: BOOLEAN
item (i: INTEGER): BOOLEAN
i
BOOL_STRING
require BOOL_STRING
index_large_enough: 1 <= i
index_small_enough: i <= count
largest: INTEGER
next (p: INTEGER): INTEGER
p
countplargest
require
p_in_set: p >= 1 and p <= count
smallest: INTEGER
count
feature
count: INTEGER
BOOL_STRING
feature
all_false
BOOL_STRING
all_true
BOOL_STRING
put (i: INTEGER)
i
require
index_large_enough: 1 <= i
index_small_enough: i <= count
ensure
is_in_set: has (i)
bool_string_put (v: like item; i: INTEGER)
vi
BOOL_STRING
require BOOL_STRING
index_large_enough: 1 <= i
index_small_enough: i <= count
feature
remove (i: INTEGER)
i
require
index_large_enough: 1 <= i
index_small_enough: i <= count
ensure
is_not_in_set: not has (i)
feature
to_c: ANY
feature
left_shifted (n: INTEGER): like Current
n
BOOL_STRING
require BOOL_STRING
non_negative_shift: n >= 0
right_shifted (n: INTEGER): like Current
n
BOOL_STRING
require BOOL_STRING
non_negative_shift: n >= 0
infix "and" (other: like Current): like Current
other
BOOL_STRING
require BOOL_STRING
other_not_void: other /= void
same_size: other.count = count
prefix "not": like Current
BOOL_STRING
infix "or" (other: like Current): like Current
other
BOOL_STRING
require BOOL_STRING
other_not_void: other /= void
same_size: other.count = count
infix "xor" (other: like Current): like Current
other
BOOL_STRING
require BOOL_STRING
other_not_void: other /= void
same_size: other.count = count
feature
print
invariant
positive_size: count > 0
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
end -- FIXED_INTEGER_SET