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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 65297 - (show annotations)
Thu Nov 30 20:22:33 2006 UTC (13 years, 2 months ago) by manus
File size: 2195 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
2 indexing
3
4 description:
5 "Collection, where each element must be unique.";
6
7 status: "See notice at end of class";
8 names: set;
9 access: membership;
10 contents: generic;
11 date: "$Date$";
12 revision: "$Revision$"
13
14 deferred class SET [G] inherit
15
16 COLLECTION [G]
17 redefine
18 changeable_comparison_criterion
19 end
20
21 feature -- Measurement
22
23 count: INTEGER is
24 -- Number of items
25 deferred
26 end
27
28 feature -- Element change
29
30 extend, put (v: G) is
31 -- Ensure that set includes `v'.
32 deferred
33 ensure then
34 in_set_already: old has (v) implies (count = old count);
35 added_to_set: not old has (v) implies (count = old count + 1)
36 end;
37
38 feature -- Removal
39
40 prune (v: G) is
41 -- Remove `v' if present.
42 deferred
43 ensure then
44 removed_count_change: old has (v) implies (count = old count - 1);
45 not_removed_no_count_change: not old has (v) implies (count = old count);
46 item_deleted: not has (v)
47 end;
48
49 changeable_comparison_criterion: BOOLEAN is
50 -- May `object_comparison' be changed?
51 -- (Answer: only if set empty; otherwise insertions might
52 -- introduce duplicates, destroying the set property.)
53 do
54 Result := is_empty
55 ensure then
56 only_on_empty: Result = is_empty
57 end
58
59 end -- class SET
60
61
62 --|----------------------------------------------------------------
63 --| EiffelBase: Library of reusable components for Eiffel.
64 --| Copyright (c) 1993-2006 University of Southern California and contributors.
65 --| For ISE customers the original versions are an ISE product
66 --| covered by the ISE Eiffel license and support agreements.
67 --| EiffelBase may now be used by anyone as FREE SOFTWARE to
68 --| develop any product, public-domain or commercial, without
69 --| payment to ISE, under the terms of the ISE Free Eiffel Library
70 --| License (IFELL) at http://eiffel.com/products/base/license.html.
71 --|
72 --| Interactive Software Engineering Inc.
73 --| ISE Building, 2nd floor
74 --| 270 Storke Road, Goleta, CA 93117 USA
75 --| Telephone 805-685-1006, Fax 805-685-6869
76 --| Electronic mail <info@eiffel.com>
77 --| Customer support e-mail <support@eiffel.com>
78 --| For latest info see award-winning pages: http://eiffel.com
79 --|----------------------------------------------------------------
80

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23