INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

title: "SORTED_TABLE with access by ordinal position"
project: "Visual Eiffel"
revision: "$Revision: 1.1 $"
copyright: "Copyright (C) 1996-2005 Object Tools Group"
license: "http://visual-eiffel.com/license"
cluster: dale
class NUMBERED_SORTED_TABLE [G, H -> COMPARABLE]
inherit

SORTED_TABLE_ [G, H]
redefine
make,
put
select
make
end

SORTED_TABLE_ [G, H]
rename
make as sorted_table_make
export
{NONE}
sorted_table_make
redefine
put
end
creation

make
feature -- Operations

make (is_unique: BOOLEAN)
-- redefinition from SORTED_TABLE; tells the container if
-- its entries must be unique
--local
-- init_size: INTEGER
-- s_order: SIMPLE_ORDER_WITH_KEYS_ [H]
-- order_key: ORDER_WITH_KEYS_ [H]

put (x: G; k: H)
-- redefinition from SORTED_TABLE; adds the new entry into
-- the structure

put_no (x: G; k: INTEGER)
-- puts the k-th entry into the structure
require
valid_item: x /= void
in_bounds: 1 <= k and then k <= count
no_obstacle: not is_protected

merge_in_order (x: like Current)
-- same as 'merge' but in order in which items were put
require
no_obstacle: not is_protected
valid_argument: x /= void
ensure
well_done: count = count + x.count
feature -- Queries:

item (k: H): G
-- returns first item having the specified key
require
valid_key: k /= void

item_no (k: INTEGER): G
-- returns the k-th item of this table
require
in_bounds: 1 <= k and then k <= count
ensure
not_void: Result /= void

key_no (k: INTEGER): H
-- returns key of the k-th item
require
in_bounds: 1 <= k and then k <= count
ensure
not_void: Result /= void
invariant

consistent: narray.count >= count and then karray.count = narray.count
end -- class NUMBERED_SORTED_TABLE

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES