EiffelBase class
(HTML page generated by ISE Eiffel 4.2)
Eiffel Class
indexing
description: "General container data structures, characterized by the membership properties of their items.";
status: "See notice at end of class";
names: collection, access;
access: membership;
contents: generic;
date: "$Date: 2007-03-30 11:10:11 -0800 (Fri, 30 Mar 2007) $";
revision: "$Revision: 95354 $"
deferred class COLLECTION [G]
inherit
CONTAINER [G]
feature -- Status report
extendible: BOOLEAN is
-- May new items be added?
deferred
end;
prunable: BOOLEAN is
-- May items be removed?
deferred
end;
feature -- Element change
put (v: G) is
-- Ensure that structure includes v.
-- Was declared in COLLECTION as synonym of put and extend.
require
extendible: extendible
deferred
ensure
item_inserted: has (v)
end;
extend (v: G) is
-- Ensure that structure includes v.
-- Was declared in COLLECTION as synonym of put and extend.
require
extendible: extendible
deferred
ensure
item_inserted: has (v)
end;
fill (other: CONTAINER [G]) is
-- Fill with as many items of other as possible.
-- The representations of other and current structure
-- need not be the same.
require
other_not_void: other /= void;
extendible
local
lin_rep: LINEAR [G]
do
lin_rep := other.linear_representation;
from
lin_rep.start
until
notextendible or else lin_rep.off
loop
extend (lin_rep.item);
lin_rep.forth
end
end;
feature -- Removal
prune (v: G) is
-- Remove one occurrence of v if any.
-- (Reference or object equality,
-- based on object_comparison.)
require
prunable: prunable
deferred
end;
prune_all (v: G) is
-- Remove all occurrences of v.
-- (Reference or object equality,
-- based on object_comparison.)
require
prunable
do
from
until
nothas (v)
loop
prune (v)
end
ensure
no_more_occurrences: nothas (v)
end;
wipe_out is
-- Remove all items.
require
prunable
deferred
ensure
wiped_out: empty
end;
end -- class COLLECTION
|