INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

title: "View of the memory region as an array of objects. Should not be used with type %'G%' tuned to class with reference attributes"
project: "Visual Eiffel Library"
revision: "$Revision: 1.1 $"
copyright: "Copyright (C) 1996-2005 Object Tools Group"
license: "http://visual-eiffel.com/license"
cluster: kernel
deferred class RTS_MEMORY_MAP [G]
inherit

RTS_MEMORY
end
feature -- Access

infix "@", item (i: INTEGER): G
-- Entry at index 'i' if in index range
require
good_key: valid_index (i)
feature -- Measurement

size: INTEGER

count: INTEGER
-- Actual number of items
ensure
non_negative_count: count >= 0
feature -- Status report

valid_index (i: INTEGER): BOOLEAN
-- Is 'i' within the bounds of the memory region?
feature -- Element change

put (v: G; i: INTEGER)
-- Replace item at index 'i' by 'v'
require
good_key: valid_index (i)

fill (v: G; start_index: INTEGER; end_index: INTEGER)
-- Replace every item having index in range 'start_index'..'end_index'
-- with 'v'
require
valid_start_index: 1 <= start_index
valid_end_index: end_index <= count
valid_index_range: start_index <= end_index + 1
ensure
definition:

move (lower_index: INTEGER; upper_index: INTEGER; distance: INTEGER)
-- Move range 'lower_index'..'upper_index' by 'distance'
-- positions. Negative 'distance' moves towards lower indices.
-- Free places do not change
require
valid_lower_index: 1 <= lower_index
valid_upper_index: upper_index <= count
valid_index_range: lower_index <= upper_index + 1
inside_bounds: 1 <= lower_index + distance and upper_index + distance <= count
invariant

non_negative_count: count >= 0
end -- class RTS_MEMORY_MAP

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES