indexing
description: "Group of EV_FIGURE's. If a figure is added tothis group, it is removed from its previous group first."
status: "See notice at end of class"
keywords: "group, figure"
date: "$Date$"
revision: "$Revision$"
class interface
EV_FIGURE_GROUP
create
default_create
make_with_point (a_point: EV_RELATIVE_POINT)
a_point
EV_SINGLE_POINTED_FIGURE
require EV_SINGLE_POINTED_FIGURE
a_point_not_void: a_point /= void
feature
list_make (n: INTEGER)
n
n
ARRAYED_LIST
require ARRAYED_LIST
valid_number_of_items: n >= 0
ensure ARRAYED_LIST
correct_position: before
make_filled (n: INTEGER)
n
n
ARRAYED_LIST
require ARRAYED_LIST
valid_number_of_items: n >= 0
ensure ARRAYED_LIST
correct_position: before
filled: full
make_from_array (a: ARRAY [EV_FIGURE])
a
ARRAYED_LIST
require ARRAY
array_exists: a /= void
feature
cursor: CURSOR
ARRAYED_LIST
first: EV_FIGURE
ARRAYED_LIST
require CHAIN
not_empty: not is_empty
group: EV_FIGURE_GROUP
Current
EV_FIGURE
has (v: EV_FIGURE): BOOLEAN
v
object_comparison
ARRAY
ensure CONTAINER
not_found_in_empty: Result implies not is_empty
frozen id_object (an_id: INTEGER): IDENTIFIED
an_id
IDENTIFIED
ensure IDENTIFIED
consistent: Result = void or else Result.object_id = an_id
index: INTEGER
item
ARRAYED_LIST
index_of (v: like item; i: INTEGER): INTEGER
iv
object_comparison
CHAIN
require LINEAR
positive_occurrences: i > 0
ensure LINEAR
non_negative_result: Result >= 0
item: like first
ARRAYED_LIST
require TRAVERSABLE
not_off: not off
require ACTIVE
readable: readable
require else ARRAYED_LIST
index_is_valid: valid_index (index)
i_th (i: INTEGER): EV_FIGURE
i
ARRAY@
ARRAY
require TABLE
valid_key: array_valid_index (k)
last: like first
ARRAYED_LIST
require CHAIN
not_empty: not is_empty
frozen object_id: INTEGER
IDENTIFIED
ensure IDENTIFIED
valid_id: id_object (Result) = Current
sequential_occurrences (v: EV_FIGURE): INTEGER
v
object_comparison
LINEAR
ensure BAG
non_negative_occurrences: Result >= 0
orientation: DOUBLE
Current
EV_FIGURE
pebble: ANY
EV_FIGURE
pebble_function: FUNCTION [ANY, TUPLE, ANY]
Voidpebble
EV_FIGURE
point: EV_RELATIVE_POINT
Current
EV_SINGLE_POINTED_FIGURE
point_array: ARRAY [EV_COORDINATE]
points
EV_FIGURE
ensure EV_FIGURE
same_length: Result.count = points.count
point_count: INTEGER
Current
EV_SINGLE_POINTED_FIGURE
pointer_style: EV_CURSOR
EV_FIGURE
target_name: STRING
Current
EV_ABSTRACT_PICK_AND_DROPABLE
world: EV_FIGURE_WORLD
Current
EV_FIGURE
infix "@" (i: INTEGER): EV_FIGURE
i
ARRAYitem
ARRAY
require TABLE
valid_key: array_valid_index (k)
feature
count: INTEGER
ARRAYED_LIST
index_set: INTEGER_INTERVAL
CHAIN
ensure INDEXABLE
not_void: Result /= void
ensure then CHAIN
count_definition: Result.count = count
occurrences (v: like item): INTEGER
v
object_comparison
CHAIN
ensure BAG
non_negative_occurrences: Result >= 0
occurrences (v: like item): INTEGER
v
object_comparison
CHAIN
ensure BAG
non_negative_occurrences: Result >= 0
feature
capacity: INTEGER
ARRAYcount
ARRAY
ensure then ARRAY
consistent_with_bounds: Result = upper - lower + 1
feature
after: BOOLEAN
LIST
before: BOOLEAN
LIST
bounding_box: EV_RECTANGLE
Current
ensure EV_FIGURE
not_void: Result /= void
changeable_comparison_criterion: BOOLEAN
object_comparison
CONTAINER
exhausted: BOOLEAN
LINEAR
ensure LINEAR
exhausted_when_off: off implies Result
Extendible: BOOLEAN is True
DYNAMIC_CHAIN
full: BOOLEAN
ARRAYED_LIST
has_capture: BOOLEAN
Current
EV_FIGURE
invalid_rectangle: EV_RECTANGLE
Void
is_empty: BOOLEAN
FINITE
is_inserted (v: EV_FIGURE): BOOLEAN
vput
extend
ARRAYED_LIST
is_sensitive: BOOLEAN
EV_FIGURE
is_show_requested: BOOLEAN
Current
EV_FIGURE
isfirst: BOOLEAN
CHAIN
ensure CHAIN
valid_position: Result implies not is_empty
islast: BOOLEAN
CHAIN
ensure CHAIN
valid_position: Result implies not is_empty
object_comparison: BOOLEAN
equal=
=
CONTAINER
off: BOOLEAN
CHAIN
prunable: BOOLEAN
ARRAYED_LIST
readable: BOOLEAN
SEQUENCE
update_rectangle: EV_RECTANGLE
Void
valid_cursor (p: CURSOR): BOOLEAN
p
ARRAYED_LIST
valid_cursor_index (i: INTEGER): BOOLEAN
i
CHAIN
ensure CHAIN
valid_cursor_index_definition: Result = ((i >= 0) and (i <= 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))
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))
writable: BOOLEAN
SEQUENCE
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
disable_capture
world
EV_FIGURE
require EV_FIGURE
in_world: world /= void
ensure EV_FIGURE
capture_released: not has_capture
disable_sensitive
EV_FIGURE
ensure EV_FIGURE
insensitive_requested: not internal_is_sensitive
enable_capture
world
EV_FIGURE
require EV_FIGURE
in_world: world /= void
ensure EV_FIGURE
capture_set: has_capture
enable_sensitive
EV_FIGURE
ensure EV_FIGURE
sensitive_requested: internal_is_sensitive
hide
Currentgroup
EV_FIGURE
ensure EV_FIGURE
not_is_show_requested: not is_show_requested
intersects (r: EV_RECTANGLE): BOOLEAN
rCurrentbounding_box
EV_FIGURE
set_point (a_point: EV_RELATIVE_POINT)
a_pointpoint
EV_SINGLE_POINTED_FIGURE
require EV_SINGLE_POINTED_FIGURE
a_point_not_void: a_point /= void
ensure EV_SINGLE_POINTED_FIGURE
point_assigned: point = a_point
set_target_name (a_name: STRING)
a_nametarget_name
EV_ABSTRACT_PICK_AND_DROPABLE
require EV_ABSTRACT_PICK_AND_DROPABLE
a_name_not_void: a_name /= void
ensure EV_ABSTRACT_PICK_AND_DROPABLE
target_name_assigned: a_name /= target_name and a_name.is_equal (target_name)
show
Currentgroup
True
EV_FIGURE
ensure EV_FIGURE
is_show_requested: is_show_requested
snap_to_grid
require
world_not_void: world /= void
grid_enabled: world.grid_enabled
feature
back
ARRAYED_LIST
require BILINEAR
not_before: not before
finish
ARRAYED_LIST
ensure then CHAIN
at_last: not is_empty implies islast
ensure then ARRAYED_LIST
before_when_empty: is_empty implies before
forth
ARRAYED_LIST
require LINEAR
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)
ensure CHAIN
position_expected: index = i
go_to (p: CURSOR)
p
ARRAYED_LIST
require CURSOR_STRUCTURE
cursor_position_valid: valid_cursor (p)
move (i: INTEGER)
i
ARRAYED_LIST
ensure CHAIN
too_far_right: (old index + i > count) implies exhausted
too_far_left: (old index + i < 1) implies exhausted
expected_index: (not exhausted) implies (index = old index + i)
search (v: like item)
itemv
v
exhausted
object_comparison
BILINEAR
ensure LINEAR
object_found: (not exhausted and object_comparison) implies equal (v, item)
item_found: (not exhausted and not object_comparison) implies v = item
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
append (s: SEQUENCE [EV_FIGURE])
s
SEQUENCE
require SEQUENCE
argument_not_void: s /= void
ensure SEQUENCE
new_count: count >= old count
extend (v: like item)
v
ARRAYED_LISTforce
ARRAYED_LIST
require COLLECTION
extendible: extendible
ensure COLLECTION
item_inserted: is_inserted (v)
ensure then BAG
one_more_occurrence: occurrences (v) = old (occurrences (v)) + 1
fill (other: CONTAINER [EV_FIGURE])
other
other
COLLECTION
require COLLECTION
other_not_void: other /= void
extendible
force (v: like item)
v
ARRAYED_LISTextend
ARRAYED_LIST
require SEQUENCE
extendible: extendible
ensure then SEQUENCE
new_count: count = old count + 1
item_inserted: has (v)
put (v: like item)
v
replace
CHAIN
require COLLECTION
extendible: extendible
ensure COLLECTION
item_inserted: is_inserted (v)
ensure then CHAIN
same_count: count = old count
put_front (v: like item)
v
ARRAYED_LIST
ensure DYNAMIC_CHAIN
new_count: count = old count + 1
item_inserted: first = v
put_left (v: like item)
v
ARRAYED_LIST
require DYNAMIC_CHAIN
extendible: extendible
not_before: not before
ensure DYNAMIC_CHAIN
new_count: count = old count + 1
new_index: index = old index + 1
put_right (v: like item)
v
ARRAYED_LIST
require DYNAMIC_CHAIN
extendible: extendible
not_after: not after
ensure DYNAMIC_CHAIN
new_count: count = old count + 1
same_index: index = old index
remove_pebble
pebbleVoidpebble_function
EV_FIGURE
ensure EV_ABSTRACT_PICK_AND_DROPABLE
pebble_removed: pebble = void and pebble_function = void
set_accept_cursor (a_cursor: EV_CURSOR)
a_cursor
pebble
EV_FIGURE
ensure EV_ABSTRACT_PICK_AND_DROPABLE
accept_cursor_assigned: accept_cursor.is_equal (a_cursor)
set_deny_cursor (a_cursor: EV_CURSOR)
a_cursor
EV_FIGURE
ensure EV_ABSTRACT_PICK_AND_DROPABLE
deny_cursor_assigned: deny_cursor.is_equal (a_cursor)
set_origin (an_origin: EV_RELATIVE_POINT)
o
EV_FIGURE
set_pebble (a_pebble: like pebble)
a_pebblepebble
EV_FIGURE
require EV_ABSTRACT_PICK_AND_DROPABLE
a_pebble_not_void: a_pebble /= void
ensure EV_ABSTRACT_PICK_AND_DROPABLE
pebble_assigned: pebble = a_pebble
set_pebble_function (a_function: FUNCTION [ANY, TUPLE, ANY])
a_functionpebble
EV_FIGURE
require EV_ABSTRACT_PICK_AND_DROPABLE
a_function_not_void: a_function /= void
a_function_takes_two_integer_open_operands: a_function.valid_operands ([1, 1])
ensure EV_ABSTRACT_PICK_AND_DROPABLE
pebble_function_assigned: pebble_function = a_function
set_pointer_style (a_cursor: like pointer_style)
a_cursorpointer_style
EV_FIGURE
require EV_FIGURE
a_cursor_not_void: a_cursor /= void
ensure EV_FIGURE
pointer_style_assigned: pointer_style = a_cursor
feature
prune (v: like item)
v
afterv
ARRAYED_LIST
require COLLECTION
prunable: prunable
remove_left
ARRAYED_LIST
require DYNAMIC_CHAIN
left_exists: index > 1
require else DYNAMIC_LIST
not_before: not before
ensure DYNAMIC_CHAIN
new_count: count = old count - 1
new_index: index = old index - 1
remove_right
ARRAYED_LIST
require DYNAMIC_CHAIN
right_exists: index < count
ensure DYNAMIC_CHAIN
new_count: count = old count - 1
same_index: index = old index
feature
swap (i: INTEGER)
i
ARRAYED_LIST
require CHAIN
not_off: not off
valid_index: array_valid_index (i)
ensure CHAIN
swapped_to_item: item = old i_th (i)
swapped_from_item: i_th (i) = old item
feature
linear_representation: LINEAR [EV_FIGURE]
LINEAR
feature
duplicate (n: INTEGER): like Current
ncountindex
ARRAYED_LIST
require CHAIN
not_off_unless_after: off implies after
valid_subchain: n >= 0
feature
conforming_pick_actions: EV_NOTIFY_ACTION_SEQUENCE
EV_FIGURE
drop_actions: EV_PND_ACTION_SEQUENCE
Current
EV_FIGURE
pick_actions: EV_PND_START_ACTION_SEQUENCE
pebble
EV_FIGURE
pointer_button_press_actions: EV_POINTER_BUTTON_ACTION_SEQUENCE
EV_FIGURE
pointer_button_release_actions: EV_POINTER_BUTTON_ACTION_SEQUENCE
EV_FIGURE
pointer_double_press_actions: EV_POINTER_BUTTON_ACTION_SEQUENCE
EV_FIGURE
pointer_enter_actions: EV_NOTIFY_ACTION_SEQUENCE
EV_FIGURE
pointer_leave_actions: EV_NOTIFY_ACTION_SEQUENCE
EV_FIGURE
pointer_motion_actions: EV_POINTER_MOTION_ACTION_SEQUENCE
EV_FIGURE
proximity_in_actions: EV_PROXIMITY_ACTION_SEQUENCE
EV_FIGURE
proximity_out_actions: EV_PROXIMITY_ACTION_SEQUENCE
EV_FIGURE
feature
position_on_figure (x, y: INTEGER): BOOLEAN
xy
False
feature
do_all (action: PROCEDURE [ANY, TUPLE [EV_FIGURE]])
action
action
LINEAR
require TRAVERSABLE
action_exists: action /= void
do_if (action: PROCEDURE [ANY, TUPLE [EV_FIGURE]]; test: FUNCTION [ANY, TUPLE [EV_FIGURE], BOOLEAN])
actiontest
actiontest
LINEAR
require TRAVERSABLE
action_exists: action /= void
test_exits: test /= void
for_all (test: FUNCTION [ANY, TUPLE [EV_FIGURE], BOOLEAN]): BOOLEAN
test
LINEAR
require TRAVERSABLE
test_exits: test /= void
there_exists (test: FUNCTION [ANY, TUPLE [EV_FIGURE], BOOLEAN]): BOOLEAN
test
LINEAR
require TRAVERSABLE
test_exits: test /= void
feature
force_i_th (fig: like item; i: INTEGER)
fig
ensure ARRAY
inserted: i_th (i) = v
higher_count: count >= old count
insert (fig: like item; i: INTEGER)
fig
require ARRAYED_LIST
index_small_enough: pos <= count
index_large_enough: pos >= 1
ensure ARRAYED_LIST
new_count: count = old count + 1
index_unchanged: index = old index
insertion_done: i_th (pos) = v
merge_left (other: like Current)
other
other
require DYNAMIC_CHAIN
extendible: extendible
not_before: not before
other_exists: other /= void
ensure DYNAMIC_CHAIN
new_count: count = old count + old other.count
new_index: index = old index + old other.count
other_is_empty: other.is_empty
ensure then DYNAMIC_LIST
other_empty: other.is_empty
merge_right (other: like Current)
other
other
require DYNAMIC_CHAIN
extendible: extendible
not_after: not after
other_exists: other /= void
ensure DYNAMIC_CHAIN
new_count: count = old count + old other.count
same_index: index = old index
other_is_empty: other.is_empty
ensure then DYNAMIC_LIST
other_empty: other.is_empty
prune_all (fig: like item)
fig
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
item
require ACTIVE
prunable: prunable
writable: writable
ensure then DYNAMIC_LIST
after_when_empty: is_empty implies after
ensure then ARRAYED_LIST
index: index = old index
replace (fig: like item)
fig
require ACTIVE
writable: writable
ensure ACTIVE
item_replaced: item = v
wipe_out
require COLLECTION
prunable
ensure COLLECTION
wiped_out: is_empty
ensure then DYNAMIC_LIST
is_before: before
feature
calculate_absolute_position
invalidate
Current
validate
Current
invariant
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
EV_FIGURE
points_not_void: points /= void
points_correct_size: points.count = point_count
points_items_not_void: all_points_exist (points)
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
index_set_has_same_bounds: ((index_set.lower = lower) and (index_set.upper = lower + count - 1))
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
end -- EV_FIGURE_GROUP