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

Contents of /trunk/eweasel/tests/incr071/dynamic_list.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: 3308 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 Sequential, dynamically modifiable lists,
5 without commitment to a particular representation
6 ]"
7
8 status: "See notice at end of class"
9 names: dynamic_list, sequence;
10 access: index, cursor, membership;
11 contents: generic;
12 date: "$Date$"
13 revision: "$Revision$"
14
15 deferred class DYNAMIC_LIST [G] inherit
16
17 LIST [G]
18 undefine
19 prune,
20 sequential_index_of, sequential_has,
21 remove, prune_all
22 end
23
24 DYNAMIC_CHAIN [G]
25 rename
26 wipe_out as chain_wipe_out
27 export
28 {NONE} chain_wipe_out
29 undefine
30 is_equal
31 redefine
32 put_left, put_right,
33 remove_left, remove_right
34 end
35
36 DYNAMIC_CHAIN [G]
37 undefine
38 is_equal
39 redefine
40 put_left, put_right,
41 remove_left, remove_right, wipe_out
42 select
43 wipe_out
44 end
45
46 feature -- Element change
47
48 put_left (v: like item) is
49 -- Add `v' to the left of cursor position.
50 -- Do not move cursor.
51 local
52 temp: like item
53 do
54 if is_empty then
55 put_front (v)
56 elseif after then
57 back
58 put_right (v)
59 move (2)
60 else
61 temp := item
62 replace (v)
63 put_right (temp)
64 forth
65 end
66 end
67
68 put_right (v: like item) is
69 -- Add `v' to the right of cursor position.
70 -- Do not move cursor.
71 deferred
72 end
73
74 merge_left (other: like Current) is
75 -- Merge `other' into current structure before cursor
76 -- position. Do not move cursor. Empty `other'.
77 do
78 from
79 other.start
80 until
81 other.is_empty
82 loop
83 put_left (other.item)
84 other.remove
85 end
86 end
87
88 merge_right (other: like Current) is
89 -- Merge `other' into current structure after cursor
90 -- position. Do not move cursor. Empty `other'.
91 do
92 from
93 other.finish
94 until
95 other.is_empty
96 loop
97 put_right (other.item)
98 other.back
99 other.remove_right
100 end
101 end
102
103 feature -- Removal
104
105 remove is
106 -- Remove current item.
107 -- Move cursor to right neighbor
108 -- (or `after' if no right neighbor).
109 deferred
110 ensure then
111 after_when_empty: is_empty implies after
112 end
113
114 remove_left is
115 -- Remove item to the left of cursor position.
116 -- Do not move cursor.
117 require else
118 not_before: not before
119 deferred
120 end
121
122 remove_right is
123 -- Remove item to the right of cursor position.
124 -- Do not move cursor.
125 deferred
126 end
127
128 wipe_out is
129 -- Remove all items.
130 do
131 chain_wipe_out
132 back
133 ensure then
134 is_before: before
135 end
136
137 indexing
138
139 library: "[
140 EiffelBase: Library of reusable components for Eiffel.
141 ]"
142
143 status: "[
144 --| Copyright (c) 1993-2006 University of Southern California and contributors.
145 For ISE customers the original versions are an ISE product
146 covered by the ISE Eiffel license and support agreements.
147 ]"
148
149 license: "[
150 EiffelBase may now be used by anyone as FREE SOFTWARE to
151 develop any product, public-domain or commercial, without
152 payment to ISE, under the terms of the ISE Free Eiffel Library
153 License (IFELL) at http://eiffel.com/products/base/license.html.
154 ]"
155
156 source: "[
157 Interactive Software Engineering Inc.
158 ISE Building
159 360 Storke Road, Goleta, CA 93117 USA
160 Telephone 805-685-1006, Fax 805-685-6869
161 Electronic mail <info@eiffel.com>
162 Customer support http://support.eiffel.com
163 ]"
164
165 info: "[
166 For latest info see award-winning pages: http://eiffel.com
167 ]"
168
169 end -- class DYNAMIC_LIST
170
171
172

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23