@@ -149,34 +149,6 @@ function invalidate!(c::AbstractContainer, id::Int)
149149 return invalidate! (c, id, id)
150150end
151151
152- # Swap two elements in a container while preserving element connectivity.
153- function swap! (c:: AbstractContainer , a:: Int , b:: Int )
154- @assert 1 <= a<= length (c) " a out of range"
155- @assert 1 <= b<= length (c) " b out of range"
156-
157- # Return if swap would be a no-op
158- if a == b
159- return c
160- end
161-
162- # Move a to dummy location
163- raw_copy! (c, a, c. dummy)
164- move_connectivity! (c, a, c. dummy)
165-
166- # Move b to a
167- raw_copy! (c, b, a)
168- move_connectivity! (c, b, a)
169-
170- # Move from dummy location to b
171- raw_copy! (c, c. dummy, b)
172- move_connectivity! (c, c. dummy, b)
173-
174- # Invalidate dummy to be sure
175- invalidate! (c, c. dummy)
176-
177- return c
178- end
179-
180152# Insert blank elements in container, shifting the following elements back.
181153#
182154# After a call to insert!, the range `position:position + count - 1` will be available for use.
@@ -209,25 +181,6 @@ function insert!(c::AbstractContainer, position::Int, count::Int)
209181 return c
210182end
211183
212- # Erase elements from container, deleting their connectivity and then invalidating their data.
213- # TODO : Shall we extend Base.deleteat! or Base.delete! ?
214- function erase! (c:: AbstractContainer , first:: Int , last:: Int )
215- @assert 1 <= first<= length (c) " First cell out of range"
216- @assert 1 <= last<= length (c) " Last cell out of range"
217-
218- # Return if eraseure would be a no-op
219- if last < first
220- return c
221- end
222-
223- # Delete connectivity and invalidate cells
224- delete_connectivity! (c, first, last)
225- invalidate! (c, first, last)
226-
227- return c
228- end
229- erase! (c:: AbstractContainer , id:: Int ) = erase! (c, id, id)
230-
231184# Remove cells and shift existing cells forward to close the gap
232185function remove_shift! (c:: AbstractContainer , first:: Int , last:: Int )
233186 @assert 1 <= first<= length (c) " First cell out of range"
@@ -257,44 +210,6 @@ function remove_shift!(c::AbstractContainer, first::Int, last::Int)
257210end
258211remove_shift! (c:: AbstractContainer , id:: Int ) = remove_shift! (c, id, id)
259212
260- # Remove cells and fill gap with cells from the end of the container (to reduce copy operations)
261- function remove_fill! (c:: AbstractContainer , first:: Int , last:: Int )
262- @assert 1 <= first<= length (c) " First cell out of range"
263- @assert 1 <= last<= length (c) " Last cell out of range"
264-
265- # Return if removal would be a no-op
266- if last < first
267- return c
268- end
269-
270- # Delete connectivity of cells to be removed and then invalidate them
271- delete_connectivity! (c, first, last)
272- invalidate! (c, first, last)
273-
274- # Copy cells from end (unless last is already the last cell)
275- count = last - first + 1
276- if last < length (c)
277- move! (c, max (length (c) - count + 1 , last + 1 ), length (c), first)
278- end
279-
280- # Reduce length
281- c. length -= count
282-
283- return c
284- end
285-
286- # Reset container to zero-length and with a new capacity
287- function reset! (c:: AbstractContainer , capacity:: Int )
288- @assert capacity >= 0
289-
290- c. capacity = capacity
291- c. length = 0
292- c. dummy = capacity + 1
293- reset_data_structures! (c)
294-
295- return c
296- end
297-
298213# Invalidate all elements and set length to zero.
299214function clear! (c:: AbstractContainer )
300215 invalidate! (c)
0 commit comments