/[eiffelstudio]/FreeELKS/trunk/library/structures/access/collection.e
ViewVC logotype

Contents of /FreeELKS/trunk/library/structures/access/collection.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 91477 - (show annotations)
Sun Jan 14 09:47:13 2007 UTC (13 years ago) by ericb
File size: 2592 byte(s)
Synchronized with ISE 6.0.65740
1 indexing
2
3 description: "[
4 General container data structures,
5 characterized by the membership properties of their items.
6 ]"
7 legal: "See notice at end of class."
8
9 status: "See notice at end of class."
10 names: collection, access;
11 access: membership;
12 contents: generic;
13 date: "$Date$"
14 revision: "$Revision$"
15
16 deferred class COLLECTION [G] inherit
17
18 CONTAINER [G]
19
20 feature -- Status report
21
22 extendible: BOOLEAN is
23 -- May new items be added?
24 deferred
25 end
26
27 prunable: BOOLEAN is
28 -- May items be removed?
29 deferred
30 end
31
32 is_inserted (v: G): BOOLEAN is
33 -- Has `v' been inserted by the most recent insertion?
34 -- (By default, the value returned is equivalent to calling
35 -- `has (v)'. However, descendants might be able to provide more
36 -- efficient implementations.)
37 do
38 Result := has (v)
39 end
40
41 feature -- Element change
42
43 put, extend (v: G) is
44 -- Ensure that structure includes `v'.
45 require
46 extendible: extendible
47 deferred
48 ensure
49 item_inserted: is_inserted (v)
50 end
51
52 fill (other: CONTAINER [G]) is
53 -- Fill with as many items of `other' as possible.
54 -- The representations of `other' and current structure
55 -- need not be the same.
56 require
57 other_not_void: other /= Void
58 extendible: extendible
59 local
60 lin_rep: LINEAR [G]
61 do
62 lin_rep := other.linear_representation
63 from
64 lin_rep.start
65 until
66 not extendible or else lin_rep.off
67 loop
68 extend (lin_rep.item)
69 lin_rep.forth
70 end
71 end
72
73 feature -- Removal
74
75 prune (v: G) is
76 -- Remove one occurrence of `v' if any.
77 -- (Reference or object equality,
78 -- based on `object_comparison'.)
79 require
80 prunable: prunable
81 deferred
82 end
83
84 prune_all (v: G) is
85 -- Remove all occurrences of `v'.
86 -- (Reference or object equality,
87 -- based on `object_comparison'.)
88 --|Default implementation, usually inefficient.
89 require
90 prunable: prunable
91 do
92 from
93 until not has (v) loop
94 prune (v)
95 end
96 ensure
97 no_more_occurrences: not has (v)
98 end
99
100 wipe_out is
101 -- Remove all items.
102 require
103 prunable: prunable
104 deferred
105 ensure
106 wiped_out: is_empty
107 end
108
109 indexing
110 library: "EiffelBase: Library of reusable components for Eiffel."
111 copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
112 license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
113 source: "[
114 Eiffel Software
115 356 Storke Road, Goleta, CA 93117 USA
116 Telephone 805-685-1006, Fax 805-685-6869
117 Website http://www.eiffel.com
118 Customer support http://support.eiffel.com
119 ]"
120
121
122
123
124
125
126
127 end -- class COLLECTION
128
129

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23