215 ^ aLink |
215 ^ aLink |
216 ! |
216 ! |
217 |
217 |
218 remove:aLink ifAbsent:exceptionBlock |
218 remove:aLink ifAbsent:exceptionBlock |
219 "remove the argument, aLink from the sequence; if absent, |
219 "remove the argument, aLink from the sequence; if absent, |
220 evaluate the exceptionBlock" |
220 evaluate the exceptionBlock. |
|
221 Actually this is really a removeIdentical (but for historic reasons ...)" |
221 |
222 |
222 |prevNode nextNode thisNode| |
223 |prevNode nextNode thisNode| |
223 |
224 |
224 thisNode := firstLink. |
225 thisNode := firstLink. |
225 [thisNode notNil] whileTrue:[ |
226 [thisNode notNil] whileTrue:[ |
226 nextNode := thisNode nextLink. |
227 nextNode := thisNode nextLink. |
227 (thisNode == aLink) ifTrue:[ |
228 (thisNode == aLink) ifTrue:[ |
228 prevNode isNil ifTrue:[ |
229 prevNode isNil ifTrue:[ |
229 firstLink := thisNode nextLink |
230 firstLink := thisNode nextLink |
230 ] ifFalse:[ |
231 ] ifFalse:[ |
231 prevNode nextLink:(thisNode nextLink) |
232 prevNode nextLink:(thisNode nextLink) |
232 ]. |
233 ]. |
233 (lastLink == thisNode) ifTrue:[ |
234 (lastLink == thisNode) ifTrue:[ |
234 thisNode nextLink isNil ifTrue:[ |
235 thisNode nextLink isNil ifTrue:[ |
235 lastLink := prevNode |
236 lastLink := prevNode |
236 ] ifFalse:[ |
237 ] ifFalse:[ |
237 lastLink := thisNode nextLink |
238 lastLink := thisNode nextLink |
238 ] |
239 ] |
239 ]. |
240 ]. |
240 numberOfNodes := numberOfNodes - 1. |
241 numberOfNodes := numberOfNodes - 1. |
241 thisNode nextLink:nil. |
242 thisNode nextLink:nil. |
242 ^ aLink |
243 ^ aLink |
243 ]. |
244 ]. |
244 prevNode := thisNode. |
245 prevNode := thisNode. |
245 thisNode := nextNode |
246 thisNode := nextNode |
246 ]. |
247 ]. |
247 ^ exceptionBlock value |
248 ^ exceptionBlock value |
|
249 |
|
250 "Modified: 1.2.1997 / 12:00:40 / cg" |
248 ! |
251 ! |
249 |
252 |
250 removeAll |
253 removeAll |
251 "remove all elements from the sequence. Returns the receiver." |
254 "remove all elements from the sequence. Returns the receiver." |
252 |
255 |