/[eiffelstudio]/trunk/eweasel/tests/incr071/collection.e
ViewVC logotype

Contents of /trunk/eweasel/tests/incr071/collection.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 65297 - (show annotations)
Thu Nov 30 20:22:33 2006 UTC (13 years ago) by manus
File size: 3023 byte(s)
Moved from trunk/Src/eweasel to trunk/eweasel so that a simple checkout of the source code is not penalized by the lenghty process of checking out all the tests of eweasel.
1 indexing
2
3 description: "[
4 General container data structures,
5 characterized by the membership properties of their items.
6 ]"
7
8 status: "See notice at end of class"
9 names: collection, access;
10 access: membership;
11 contents: generic;
12 date: "$Date$"
13 revision: "$Revision$"
14
15 deferred class COLLECTION [G] inherit
16
17 CONTAINER [G]
18
19 feature -- Status report
20
21 extendible: BOOLEAN is
22 -- May new items be added?
23 deferred
24 end
25
26 prunable: BOOLEAN is
27 -- May items be removed?
28 deferred
29 end
30
31 is_inserted (v: G): BOOLEAN is
32 -- Has `v' been inserted by the most recent insertion?
33 -- (By default, the value returned is equivalent to calling
34 -- `has (v)'. However, descendants might be able to provide more
35 -- efficient implementations.)
36 do
37 Result := has (v)
38 end
39
40 feature -- Element change
41
42 put, extend (v: G) is
43 -- Ensure that structure includes `v'.
44 require
45 extendible: extendible
46 deferred
47 ensure
48 item_inserted: is_inserted (v)
49 end
50
51 fill (other: CONTAINER [G]) is
52 -- Fill with as many items of `other' as possible.
53 -- The representations of `other' and current structure
54 -- need not be the same.
55 require
56 other_not_void: other /= Void
57 extendible: extendible
58 local
59 lin_rep: LINEAR [G]
60 do
61 lin_rep := other.linear_representation
62 from
63 lin_rep.start
64 until
65 not extendible or else lin_rep.off
66 loop
67 extend (lin_rep.item)
68 lin_rep.forth
69 end
70 end
71
72 feature -- Removal
73
74 prune (v: G) is
75 -- Remove one occurrence of `v' if any.
76 -- (Reference or object equality,
77 -- based on `object_comparison'.)
78 require
79 prunable: prunable
80 deferred
81 end
82
83 prune_all (v: G) is
84 -- Remove all occurrences of `v'.
85 -- (Reference or object equality,
86 -- based on `object_comparison'.)
87 --|Default implementation, usually inefficient.
88 require
89 prunable: prunable
90 do
91 from
92 until not has (v) loop
93 prune (v)
94 end
95 ensure
96 no_more_occurrences: not has (v)
97 end
98
99 wipe_out is
100 -- Remove all items.
101 require
102 prunable: prunable
103 deferred
104 ensure
105 wiped_out: is_empty
106 end
107
108 indexing
109
110 library: "[
111 EiffelBase: Library of reusable components for Eiffel.
112 ]"
113
114 status: "[
115 --| Copyright (c) 1993-2006 University of Southern California and contributors.
116 For ISE customers the original versions are an ISE product
117 covered by the ISE Eiffel license and support agreements.
118 ]"
119
120 license: "[
121 EiffelBase may now be used by anyone as FREE SOFTWARE to
122 develop any product, public-domain or commercial, without
123 payment to ISE, under the terms of the ISE Free Eiffel Library
124 License (IFELL) at http://eiffel.com/products/base/license.html.
125 ]"
126
127 source: "[
128 Interactive Software Engineering Inc.
129 ISE Building
130 360 Storke Road, Goleta, CA 93117 USA
131 Telephone 805-685-1006, Fax 805-685-6869
132 Electronic mail <info@eiffel.com>
133 Customer support http://support.eiffel.com
134 ]"
135
136 info: "[
137 For latest info see award-winning pages: http://eiffel.com
138 ]"
139
140 end -- class COLLECTION
141
142

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23