1
|
1 |
"
|
5
|
2 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
159
|
3 |
All Rights Reserved
|
1
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
SequenceableCollection subclass:#OrderedCollection
|
159
|
14 |
instanceVariableNames:'contentsArray firstIndex lastIndex'
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Collections-Sequenceable'
|
1
|
18 |
!
|
|
19 |
|
|
20 |
OrderedCollection comment:'
|
5
|
21 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
159
|
22 |
All Rights Reserved
|
93
|
23 |
|
375
|
24 |
$Header: /cvs/stx/stx/libbasic/Attic/OrdColl.st,v 1.29 1995-08-08 00:48:10 claus Exp $
|
33
|
25 |
'!
|
|
26 |
|
|
27 |
!OrderedCollection class methodsFor:'documentation'!
|
|
28 |
|
88
|
29 |
copyright
|
|
30 |
"
|
|
31 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
159
|
32 |
All Rights Reserved
|
88
|
33 |
|
|
34 |
This software is furnished under a license and may be used
|
|
35 |
only in accordance with the terms of that license and with the
|
|
36 |
inclusion of the above copyright notice. This software may not
|
|
37 |
be provided or otherwise made available to, or used by, any
|
|
38 |
other person. No title to or ownership of the software is
|
|
39 |
hereby transferred.
|
|
40 |
"
|
|
41 |
!
|
|
42 |
|
|
43 |
version
|
|
44 |
"
|
375
|
45 |
$Header: /cvs/stx/stx/libbasic/Attic/OrdColl.st,v 1.29 1995-08-08 00:48:10 claus Exp $
|
88
|
46 |
"
|
|
47 |
!
|
|
48 |
|
33
|
49 |
documentation
|
|
50 |
"
|
68
|
51 |
OrderedCollection have ordered elements. Insertion and removal at both ends
|
|
52 |
is possible - therefore they can be used for queues and stacks.
|
1
|
53 |
|
68
|
54 |
Instance variables:
|
1
|
55 |
|
68
|
56 |
contentsArray <Array> the actual contents
|
|
57 |
firstIndex <SmallInteger> index of first valid element
|
|
58 |
lastIndex <SmallInteger> index of last valid element
|
33
|
59 |
"
|
|
60 |
! !
|
1
|
61 |
|
|
62 |
!OrderedCollection class methodsFor:'instance creation'!
|
|
63 |
|
|
64 |
new:size
|
|
65 |
"create a new OrderedCollection"
|
|
66 |
|
|
67 |
^ (self basicNew) initContents:size
|
|
68 |
!
|
|
69 |
|
|
70 |
new
|
|
71 |
"create a new OrderedCollection"
|
|
72 |
|
|
73 |
^ (self basicNew) initContents:10
|
|
74 |
! !
|
|
75 |
|
293
|
76 |
!OrderedCollection methodsFor:'private accessing'!
|
|
77 |
|
|
78 |
contentsArray
|
|
79 |
^ contentsArray
|
|
80 |
!
|
|
81 |
|
|
82 |
firstIndex
|
|
83 |
^ firstIndex
|
|
84 |
! !
|
|
85 |
|
13
|
86 |
!OrderedCollection methodsFor:'queries'!
|
1
|
87 |
|
|
88 |
size
|
|
89 |
"return the number of elements in the collection"
|
|
90 |
|
|
91 |
^ lastIndex - firstIndex + 1
|
|
92 |
!
|
|
93 |
|
360
|
94 |
capacity
|
|
95 |
"return the number of elements, that the receiver is
|
|
96 |
prepared to take.
|
|
97 |
Not used by the system; added for ST-80 compatibility."
|
|
98 |
|
|
99 |
^ contentsArray size
|
|
100 |
!
|
|
101 |
|
1
|
102 |
isFixedSize
|
|
103 |
"return true if the receiver cannot grow - this will vanish once
|
|
104 |
Arrays and Strings learn how to grow ..."
|
|
105 |
|
|
106 |
^ false
|
|
107 |
! !
|
|
108 |
|
|
109 |
!OrderedCollection methodsFor:'copying'!
|
|
110 |
|
202
|
111 |
copyEmpty
|
|
112 |
"return a copy of the receiver without any elements."
|
|
113 |
|
|
114 |
^ self copyEmpty:10
|
|
115 |
!
|
|
116 |
|
|
117 |
postCopy
|
159
|
118 |
"have to copy the contentsArray too"
|
|
119 |
|
|
120 |
contentsArray := contentsArray shallowCopy
|
|
121 |
!
|
|
122 |
|
1
|
123 |
, aCollection
|
|
124 |
"return a new collection formed from concatenating the receiver with
|
|
125 |
the argument"
|
|
126 |
|
|
127 |
|newCollection|
|
|
128 |
|
202
|
129 |
newCollection := self copyEmpty:(self size + aCollection size).
|
1
|
130 |
self do:[:element |
|
159
|
131 |
newCollection add:element
|
1
|
132 |
].
|
|
133 |
aCollection do:[:element |
|
159
|
134 |
newCollection add:element
|
1
|
135 |
].
|
|
136 |
^ newCollection
|
2
|
137 |
|
93
|
138 |
"
|
|
139 |
#(1 2 3) asOrderedCollection , #(4 5 6) asOrderedCollection
|
|
140 |
#(1 2 3) asSortedCollection , #(99 101 100) asSortedCollection
|
|
141 |
"
|
13
|
142 |
!
|
|
143 |
|
68
|
144 |
copyWith:newElement
|
229
|
145 |
"return a new collection containing the receivers elements
|
|
146 |
and the single new element, newElement.
|
|
147 |
This is different from concatentation, which expects another collection
|
|
148 |
as argument, but equivalent to copy-and-addLast."
|
68
|
149 |
|
|
150 |
|newCollection mySize newSize|
|
|
151 |
|
|
152 |
mySize := self size.
|
|
153 |
newSize := mySize + 1.
|
253
|
154 |
newCollection := self copyEmptyAndGrow:newSize. "must grow, otherwise replace fails"
|
68
|
155 |
newCollection replaceFrom:1 to:mySize with:self startingAt:1.
|
|
156 |
newCollection at:newSize put:newElement.
|
|
157 |
^newCollection
|
|
158 |
|
93
|
159 |
"
|
|
160 |
#(1 2 3 4 5) copyWith:$a
|
|
161 |
'abcdefg' copyWith:$h
|
|
162 |
'abcdefg' copyWith:'123' -- will fail: string cannot be stored into string
|
|
163 |
'abcdefg' copyWith:1 -- will fail: integer cannot be stored into string
|
|
164 |
"
|
68
|
165 |
!
|
|
166 |
|
13
|
167 |
copy
|
|
168 |
"return a new OrderedCollection containing the elements of the receiver."
|
|
169 |
|
|
170 |
"redefinition is a consequence of the implementation with a
|
|
171 |
separate array - otherwise we get a shallow copy of the
|
|
172 |
contents array, which is not what we want here"
|
|
173 |
|
|
174 |
^ self copyFrom:1 to:self size
|
|
175 |
!
|
|
176 |
|
|
177 |
copyFrom:start to:stop
|
|
178 |
"return a new OrderedCollection containing the elements
|
|
179 |
from start to stop."
|
|
180 |
|
|
181 |
|newCollection sz|
|
|
182 |
|
|
183 |
sz := stop - start + 1.
|
253
|
184 |
newCollection := self copyEmptyAndGrow:sz. "must grow, otherwise replace fails"
|
13
|
185 |
newCollection replaceFrom:1 to:sz with:self startingAt:start.
|
|
186 |
^ newCollection
|
1
|
187 |
! !
|
|
188 |
|
|
189 |
!OrderedCollection methodsFor:'adding & removing'!
|
|
190 |
|
|
191 |
removeFirst
|
|
192 |
"remove the first element from the collection; return the element"
|
|
193 |
|
|
194 |
|anObject |
|
|
195 |
|
42
|
196 |
firstIndex > lastIndex ifTrue:[
|
159
|
197 |
"error if collection is empty"
|
|
198 |
^ self emptyCollectionError.
|
42
|
199 |
].
|
1
|
200 |
anObject := contentsArray at:firstIndex.
|
13
|
201 |
contentsArray at:firstIndex put:nil.
|
1
|
202 |
firstIndex := firstIndex + 1.
|
329
|
203 |
|
13
|
204 |
firstIndex > lastIndex ifTrue:[
|
159
|
205 |
"reset to avoid ever growing"
|
|
206 |
firstIndex := 1.
|
|
207 |
lastIndex := 0
|
13
|
208 |
].
|
1
|
209 |
^ anObject
|
42
|
210 |
|
348
|
211 |
"
|
|
212 |
(OrderedCollection withAll:#(1 2 3 4 5)) removeFirst; yourself
|
|
213 |
OrderedCollection new removeFirst
|
|
214 |
(SortedCollection withAll:#(5 4 3 2 1)) removeFirst; yourself
|
|
215 |
"
|
1
|
216 |
!
|
|
217 |
|
|
218 |
removeLast
|
|
219 |
"remove the last element from the collection; return the element"
|
|
220 |
|
|
221 |
|anObject |
|
|
222 |
|
42
|
223 |
firstIndex > lastIndex ifTrue:[
|
159
|
224 |
"error if collection is empty"
|
|
225 |
^ self emptyCollectionError.
|
42
|
226 |
].
|
1
|
227 |
anObject := contentsArray at:lastIndex.
|
13
|
228 |
contentsArray at:lastIndex put:nil.
|
1
|
229 |
lastIndex := lastIndex - 1.
|
329
|
230 |
|
13
|
231 |
firstIndex > lastIndex ifTrue:[
|
159
|
232 |
"reset to avoid ever growing"
|
|
233 |
firstIndex := 1.
|
|
234 |
lastIndex := 0
|
13
|
235 |
].
|
1
|
236 |
^ anObject
|
42
|
237 |
|
348
|
238 |
"
|
|
239 |
(OrderedCollection withAll:#(1 2 3 4 5)) removeLast; yourself
|
|
240 |
OrderedCollection new removeLast
|
|
241 |
(SortedCollection withAll:#(5 4 3 2 1)) removeLast; yourself
|
|
242 |
"
|
|
243 |
!
|
|
244 |
|
|
245 |
removeFirst:n
|
|
246 |
"remove the first n elements from the collection;
|
|
247 |
return the elements in an Array"
|
|
248 |
|
|
249 |
|mySize ret|
|
|
250 |
|
|
251 |
mySize := self size.
|
|
252 |
mySize < n ifTrue:[
|
|
253 |
"error if collection has not enough elements"
|
|
254 |
^ self notEnoughElementsError.
|
|
255 |
].
|
|
256 |
|
|
257 |
ret := Array new:n.
|
|
258 |
ret replaceFrom:1 to:n with:contentsArray startingAt:firstIndex.
|
|
259 |
"/
|
|
260 |
"/ nil-out contents array, to not keep elements from being GC'd
|
|
261 |
"/
|
|
262 |
contentsArray from:firstIndex to:firstIndex + n - 1 put:nil.
|
|
263 |
firstIndex := firstIndex + n.
|
|
264 |
|
|
265 |
firstIndex > lastIndex ifTrue:[
|
|
266 |
"reset to avoid ever growing"
|
|
267 |
firstIndex := 1.
|
|
268 |
lastIndex := 0
|
|
269 |
].
|
|
270 |
^ ret
|
|
271 |
|
|
272 |
"
|
|
273 |
(OrderedCollection withAll:#(1 2 3 4 5)) removeFirst:2; yourself
|
|
274 |
(OrderedCollection withAll:#(1 2 3 4 5)) removeFirst:0; yourself
|
|
275 |
OrderedCollection new removeFirst:2
|
|
276 |
(OrderedCollection withAll:#(1 2 3 4 5)) removeFirst:6
|
|
277 |
(SortedCollection withAll:#(5 4 3 2 1)) removeFirst:2; yourself
|
|
278 |
"
|
|
279 |
!
|
|
280 |
|
|
281 |
removeLast:n
|
|
282 |
"remove the last n elements from the collection;
|
|
283 |
return the elements in an Array"
|
|
284 |
|
|
285 |
|mySize ret|
|
|
286 |
|
|
287 |
mySize := self size.
|
|
288 |
mySize < n ifTrue:[
|
|
289 |
"error if collection has not enough elements"
|
|
290 |
^ self notEnoughElementsError.
|
|
291 |
].
|
|
292 |
|
|
293 |
ret := Array new:n.
|
|
294 |
ret replaceFrom:1 to:n with:contentsArray startingAt:lastIndex - n + 1.
|
|
295 |
"/
|
|
296 |
"/ nil-out contents array, to not keep elements from being GC'd
|
|
297 |
"/
|
|
298 |
contentsArray from:lastIndex - n + 1 to:lastIndex put:nil.
|
|
299 |
lastIndex := lastIndex - n.
|
|
300 |
|
|
301 |
firstIndex > lastIndex ifTrue:[
|
|
302 |
"reset to avoid ever growing"
|
|
303 |
firstIndex := 1.
|
|
304 |
lastIndex := 0
|
|
305 |
].
|
|
306 |
^ ret
|
|
307 |
|
|
308 |
"
|
|
309 |
(OrderedCollection withAll:#(1 2 3 4 5)) removeLast:2; yourself
|
|
310 |
(OrderedCollection withAll:#(1 2 3 4 5)) removeLast:0; yourself
|
|
311 |
(OrderedCollection withAll:#(1 2 3 4 5)) removeLast:6; yourself
|
|
312 |
(SortedCollection withAll:#(5 4 3 2 1)) removeLast:2; yourself
|
|
313 |
"
|
1
|
314 |
!
|
|
315 |
|
293
|
316 |
removeFromIndex:startIndex toIndex:stopIndex
|
56
|
317 |
"remove the elements stored under startIndex up to and including
|
|
318 |
the elements under stopIndex.
|
348
|
319 |
Return the receiver.
|
|
320 |
Returning the receiver here is a historic leftover - it may change.
|
|
321 |
Please use yourself in a cascade, if you need the receivers value
|
|
322 |
when using this method."
|
56
|
323 |
|
|
324 |
|nDeleted|
|
|
325 |
|
349
|
326 |
(startIndex < 1
|
|
327 |
or:[stopIndex > self size]) ifTrue:[
|
348
|
328 |
^ self notEnoughElementsError
|
|
329 |
].
|
56
|
330 |
nDeleted := stopIndex - startIndex + 1.
|
329
|
331 |
contentsArray
|
|
332 |
replaceFrom:(firstIndex + startIndex - 1)
|
|
333 |
to:(lastIndex - nDeleted)
|
|
334 |
with:contentsArray
|
|
335 |
startingAt:(firstIndex + stopIndex).
|
|
336 |
|
|
337 |
contentsArray
|
|
338 |
from:(lastIndex - nDeleted + 1)
|
|
339 |
to:lastIndex
|
|
340 |
put:nil.
|
56
|
341 |
|
|
342 |
lastIndex := lastIndex - nDeleted.
|
|
343 |
firstIndex > lastIndex ifTrue:[
|
159
|
344 |
"reset to avoid ever growing"
|
|
345 |
firstIndex := 1.
|
|
346 |
lastIndex := 0
|
56
|
347 |
]
|
|
348 |
|
|
349 |
"
|
293
|
350 |
#(1 2 3 4 5 6 7 8 9) asOrderedCollection removeFromIndex:3 toIndex:6
|
348
|
351 |
#(1 2 3 4 5) asOrderedCollection removeFromIndex:3 toIndex:6
|
56
|
352 |
"
|
|
353 |
!
|
|
354 |
|
1
|
355 |
remove:anObject ifAbsent:exceptionBlock
|
|
356 |
"remove the first occurrence of anObject from the collection;
|
|
357 |
return the value of exceptionBlock if anObject is not in
|
|
358 |
the collection"
|
|
359 |
|
|
360 |
|index "{ Class:SmallInteger }"|
|
|
361 |
|
|
362 |
index := firstIndex.
|
|
363 |
[index <= lastIndex] whileTrue:[
|
159
|
364 |
anObject = (contentsArray at:index) ifTrue:[
|
329
|
365 |
contentsArray
|
|
366 |
replaceFrom:index
|
|
367 |
to:(contentsArray size - 1)
|
|
368 |
with:contentsArray
|
|
369 |
startingAt:(index + 1).
|
159
|
370 |
contentsArray at:lastIndex put:nil.
|
|
371 |
lastIndex := lastIndex - 1.
|
|
372 |
firstIndex > lastIndex ifTrue:[
|
|
373 |
"reset to avoid ever growing"
|
|
374 |
firstIndex := 1.
|
|
375 |
lastIndex := 0
|
|
376 |
].
|
|
377 |
^ anObject
|
|
378 |
].
|
|
379 |
index := index + 1
|
1
|
380 |
].
|
|
381 |
^ exceptionBlock value
|
348
|
382 |
|
|
383 |
"
|
|
384 |
#(1 2 3 4 5 6 7 8 9) asOrderedCollection remove:3 ifAbsent:'oops'
|
|
385 |
#(1 2 3 4 5) asOrderedCollection remove:9 ifAbsent:'oops'
|
|
386 |
"
|
1
|
387 |
!
|
|
388 |
|
114
|
389 |
removeAll
|
|
390 |
"remove all elements from the collection."
|
|
391 |
|
|
392 |
self initContents:10
|
|
393 |
!
|
|
394 |
|
348
|
395 |
removeAllSuchThat:aBlock
|
|
396 |
"remove all elements that meet a test criteria as specified in aBlock.
|
|
397 |
The argument, aBlock is evaluated for successive elements and all those,
|
|
398 |
for which it returns true, are removed."
|
|
399 |
|
|
400 |
"/ this is a q&d implementation (slow).
|
|
401 |
"/ it should be rewritten to
|
|
402 |
|
|
403 |
|runIndex removed element|
|
|
404 |
|
|
405 |
removed := self species new.
|
|
406 |
|
|
407 |
runIndex := 1.
|
|
408 |
[runIndex <= self size] whileTrue:[
|
|
409 |
element := self at:runIndex.
|
|
410 |
(aBlock value:element) ifTrue:[
|
|
411 |
removed add:element.
|
|
412 |
self removeAtIndex:runIndex
|
|
413 |
] ifFalse:[
|
|
414 |
runIndex := runIndex + 1
|
|
415 |
]
|
|
416 |
].
|
|
417 |
^ removed
|
|
418 |
|
|
419 |
"
|
|
420 |
|coll|
|
|
421 |
|
|
422 |
coll := OrderedCollection withAll:(1 to:10).
|
|
423 |
Transcript showCr:(coll removeAllSuchThat:[:el | el even]).
|
|
424 |
Transcript showCr:coll
|
|
425 |
"
|
|
426 |
!
|
|
427 |
|
1
|
428 |
add:anObject
|
|
429 |
"add the argument, anObject to the end of the collection
|
|
430 |
Return the argument, anObject."
|
|
431 |
|
202
|
432 |
|idx "{ Class:SmallInteger }"|
|
|
433 |
|
|
434 |
idx := lastIndex.
|
|
435 |
|
|
436 |
(idx == contentsArray size) ifTrue:[
|
|
437 |
self makeRoomAtLast.
|
|
438 |
idx := lastIndex.
|
1
|
439 |
].
|
370
|
440 |
idx := lastIndex := idx + 1.
|
202
|
441 |
contentsArray at:idx put:anObject.
|
370
|
442 |
"/ lastIndex := idx.
|
1
|
443 |
^ anObject
|
13
|
444 |
|
|
445 |
"
|
|
446 |
|c|
|
|
447 |
c := #(4 3 2 1) asOrderedCollection.
|
|
448 |
c add:'here'
|
|
449 |
"
|
1
|
450 |
!
|
|
451 |
|
|
452 |
addFirst:anObject
|
|
453 |
"add the argument, anObject to the beginning of the collection.
|
|
454 |
Return the argument, anObject."
|
|
455 |
|
|
456 |
(firstIndex == 1) ifTrue:[
|
159
|
457 |
self makeRoomAtFront
|
1
|
458 |
].
|
|
459 |
firstIndex := firstIndex - 1.
|
|
460 |
contentsArray at:firstIndex put:anObject.
|
|
461 |
^ anObject
|
13
|
462 |
|
|
463 |
"
|
|
464 |
|c|
|
93
|
465 |
c := #(1 2 3 4) asOrderedCollection.
|
|
466 |
c addFirst:'here'.
|
|
467 |
c
|
|
468 |
"
|
|
469 |
|
|
470 |
"
|
|
471 |
|c|
|
|
472 |
c := #() asOrderedCollection.
|
|
473 |
c addFirst:'here'.
|
|
474 |
c
|
13
|
475 |
"
|
1
|
476 |
!
|
|
477 |
|
|
478 |
add:anObject beforeIndex:index
|
|
479 |
"insert the argument, anObject to become located at index.
|
|
480 |
Return the argument, anObject."
|
|
481 |
|
|
482 |
self makeRoomAtIndex:(index - firstIndex + 1).
|
|
483 |
contentsArray at:(index - firstIndex + 1) put:anObject.
|
13
|
484 |
|
|
485 |
"
|
|
486 |
|c|
|
|
487 |
c := #(4 3 2 1) asOrderedCollection.
|
|
488 |
c add:'here' beforeIndex:3
|
|
489 |
"
|
217
|
490 |
"
|
|
491 |
|c|
|
|
492 |
c := #(4 3 2 1) asOrderedCollection.
|
|
493 |
c add:'here' beforeIndex:1
|
|
494 |
"
|
|
495 |
"
|
|
496 |
|c|
|
|
497 |
c := #(4 3 2 1) asOrderedCollection.
|
|
498 |
c add:'here' beforeIndex:5
|
|
499 |
"
|
|
500 |
!
|
|
501 |
|
|
502 |
add:anObject afterIndex:index
|
|
503 |
"insert the argument, anObject to become located at index.
|
|
504 |
Return the argument, anObject."
|
|
505 |
|
|
506 |
^ self add:anObject beforeIndex:(index + 1)
|
|
507 |
|
|
508 |
"
|
|
509 |
|c|
|
|
510 |
c := #(4 3 2 1) asOrderedCollection.
|
|
511 |
c add:'here' afterIndex:4
|
|
512 |
"
|
13
|
513 |
!
|
|
514 |
|
|
515 |
add:newObject after:oldObject
|
|
516 |
"insert the argument, newObject after oldObject.
|
|
517 |
If oldObject is not in the receiver, report an error,
|
|
518 |
otherwise return the argument, anObject."
|
|
519 |
|
|
520 |
|idx|
|
|
521 |
|
|
522 |
idx := self indexOf:oldObject.
|
|
523 |
idx ~~ 0 ifTrue:[
|
159
|
524 |
^ self add:newObject beforeIndex:(idx + 1).
|
13
|
525 |
].
|
348
|
526 |
self errorValueNotFound:oldObject
|
13
|
527 |
|
|
528 |
"
|
|
529 |
|c|
|
|
530 |
c := #(4 3 2 1) asOrderedCollection.
|
217
|
531 |
c add:'here' after:3.
|
|
532 |
"
|
|
533 |
"
|
|
534 |
|c|
|
|
535 |
c := #(4 3 2 1) asOrderedCollection.
|
|
536 |
c add:'here' after:1.
|
|
537 |
"
|
|
538 |
"
|
|
539 |
|c|
|
|
540 |
c := #(4 3 2 1) asOrderedCollection.
|
33
|
541 |
c add:'here' after:5
|
13
|
542 |
"
|
|
543 |
!
|
|
544 |
|
|
545 |
|
|
546 |
add:newObject before:oldObject
|
|
547 |
"insert the argument, newObject before oldObject.
|
|
548 |
If oldObject is not in the receiver, report an error,
|
|
549 |
otherwise return the argument, anObject."
|
|
550 |
|
|
551 |
|idx|
|
|
552 |
|
|
553 |
idx := self indexOf:oldObject.
|
|
554 |
idx ~~ 0 ifTrue:[
|
159
|
555 |
^ self add:newObject beforeIndex:idx.
|
13
|
556 |
].
|
348
|
557 |
self errorValueNotFound:oldObject
|
13
|
558 |
|
|
559 |
"
|
|
560 |
|c|
|
|
561 |
c := #(4 3 2 1) asOrderedCollection.
|
33
|
562 |
c add:'here' before:3.
|
|
563 |
c add:'here' before:5
|
13
|
564 |
"
|
1
|
565 |
! !
|
|
566 |
|
|
567 |
!OrderedCollection methodsFor:'grow & shrink'!
|
|
568 |
|
|
569 |
grow:newSize
|
13
|
570 |
"grow the receiver to newSize"
|
1
|
571 |
|
253
|
572 |
|oldSize newContents oldLast newLast|
|
1
|
573 |
|
253
|
574 |
oldSize := lastIndex - firstIndex + 1.
|
|
575 |
newSize ~~ oldSize ifTrue:[
|
|
576 |
newLast := firstIndex + newSize - 1.
|
|
577 |
newSize < oldSize ifTrue:[
|
|
578 |
oldLast := lastIndex.
|
|
579 |
lastIndex := newLast.
|
|
580 |
"
|
|
581 |
nil out rest, to give GC a chance to reclaim things
|
|
582 |
"
|
|
583 |
contentsArray from:lastIndex + 1 to:oldLast put:nil.
|
|
584 |
] ifFalse:[
|
|
585 |
newLast <= contentsArray size ifTrue:[
|
|
586 |
lastIndex := newLast.
|
|
587 |
^ self
|
|
588 |
].
|
|
589 |
|
|
590 |
newContents := Array basicNew:newSize.
|
375
|
591 |
newContents replaceFrom:1 to:oldSize with:contentsArray startingAt:firstIndex.
|
253
|
592 |
contentsArray := newContents.
|
|
593 |
firstIndex := 1.
|
|
594 |
lastIndex := newSize
|
|
595 |
]
|
1
|
596 |
]
|
|
597 |
! !
|
|
598 |
|
|
599 |
!OrderedCollection methodsFor:'accessing'!
|
|
600 |
|
|
601 |
at:anInteger
|
|
602 |
"return the element at index, anInteger"
|
|
603 |
|
13
|
604 |
|idx|
|
|
605 |
|
|
606 |
idx := anInteger + firstIndex - 1.
|
|
607 |
((anInteger < 1) or:[idx > lastIndex]) ifTrue:[
|
159
|
608 |
^ self subscriptBoundsError:anInteger
|
1
|
609 |
] ifFalse:[
|
159
|
610 |
^ contentsArray at:idx
|
1
|
611 |
]
|
|
612 |
!
|
|
613 |
|
|
614 |
at:anInteger put:anObject
|
|
615 |
"set the element at index, to be anInteger"
|
|
616 |
|
13
|
617 |
|idx|
|
|
618 |
|
|
619 |
idx := anInteger + firstIndex - 1.
|
|
620 |
((anInteger < 1) or:[idx > lastIndex]) ifTrue:[
|
159
|
621 |
^ self subscriptBoundsError:anInteger
|
1
|
622 |
] ifFalse:[
|
159
|
623 |
^ contentsArray at:idx put:anObject
|
1
|
624 |
]
|
42
|
625 |
!
|
|
626 |
|
|
627 |
first
|
|
628 |
"return the first element"
|
|
629 |
|
|
630 |
firstIndex <= lastIndex ifTrue:[
|
159
|
631 |
^ contentsArray at:firstIndex
|
42
|
632 |
].
|
|
633 |
"error if collection is empty"
|
159
|
634 |
^ self emptyCollectionError
|
42
|
635 |
|
253
|
636 |
"
|
|
637 |
(OrderedCollection withAll:#(1 2 3 4 5)) first
|
|
638 |
(SortedCollection withAll:#(5 4 3 2 1)) first
|
|
639 |
"
|
42
|
640 |
!
|
|
641 |
|
|
642 |
last
|
|
643 |
"return the last element"
|
|
644 |
|
|
645 |
firstIndex <= lastIndex ifTrue:[
|
159
|
646 |
^ contentsArray at:lastIndex
|
42
|
647 |
].
|
|
648 |
"error if collection is empty"
|
159
|
649 |
^ self emptyCollectionError
|
42
|
650 |
|
253
|
651 |
"
|
|
652 |
(OrderedCollection withAll:#(1 2 3 4 5)) last
|
|
653 |
(SortedCollection withAll:#(5 4 3 2 1)) last
|
|
654 |
"
|
1
|
655 |
! !
|
|
656 |
|
56
|
657 |
!OrderedCollection methodsFor:'filling & replacing'!
|
13
|
658 |
|
|
659 |
replaceFrom:start to:stop with:aCollection startingAt:repStart
|
|
660 |
"redefined - can be done faster"
|
|
661 |
|
|
662 |
|end|
|
|
663 |
|
|
664 |
end := stop + firstIndex - 1.
|
|
665 |
((start >= 1) and:[end <= lastIndex]) ifTrue:[
|
293
|
666 |
aCollection class == self class ifTrue:[
|
|
667 |
contentsArray
|
|
668 |
replaceFrom:(start + firstIndex - 1)
|
|
669 |
to:end
|
|
670 |
with:aCollection contentsArray
|
|
671 |
startingAt:(repStart + aCollection firstIndex - 1).
|
|
672 |
] ifFalse:[
|
|
673 |
contentsArray
|
|
674 |
replaceFrom:(start + firstIndex - 1)
|
|
675 |
to:end
|
|
676 |
with:aCollection
|
|
677 |
startingAt:repStart.
|
|
678 |
].
|
159
|
679 |
^ self
|
13
|
680 |
].
|
|
681 |
^ super replaceFrom:start to:stop with:aCollection startingAt:repStart
|
293
|
682 |
|
|
683 |
"
|
|
684 |
|c|
|
|
685 |
|
|
686 |
c := #(1 2 3 4 5 6) asOrderedCollection.
|
|
687 |
c replaceFrom:3 to:6 with:c startingAt:2.
|
|
688 |
c
|
|
689 |
"
|
|
690 |
"
|
|
691 |
|c|
|
|
692 |
|
|
693 |
c := #(1 2 3 4 5 6) asOrderedCollection.
|
|
694 |
c replaceFrom:3 to:5 with:c startingAt:4.
|
|
695 |
c
|
|
696 |
"
|
13
|
697 |
! !
|
|
698 |
|
77
|
699 |
!OrderedCollection methodsFor:'searching'!
|
|
700 |
|
|
701 |
after:anObject
|
|
702 |
"return the element, after anObject.
|
|
703 |
If anObject is not in the receiver, report an error."
|
|
704 |
|
348
|
705 |
^ self after:anObject ifAbsent:[self errorValueNotFound:anObject]
|
77
|
706 |
|
|
707 |
"
|
|
708 |
#(4 3 2 1) asOrderedCollection after:3.
|
|
709 |
#(4 3 2 1) asOrderedCollection after:5
|
|
710 |
#(4 3 2 1) asOrderedCollection after:1
|
|
711 |
"
|
|
712 |
!
|
|
713 |
|
|
714 |
after:anObject ifAbsent:exceptionBlock
|
|
715 |
"return the element after the argument anObject, nil if there is none.
|
|
716 |
If anObject is not in the receiver, return the result from evaluating exceptionBlock."
|
|
717 |
|
|
718 |
|idx|
|
|
719 |
|
|
720 |
idx := self indexOf:anObject.
|
|
721 |
idx ~~ 0 ifTrue:[
|
159
|
722 |
idx == lastIndex ifTrue:[^ nil].
|
|
723 |
^ self at:(idx + 1).
|
77
|
724 |
].
|
|
725 |
^ exceptionBlock value
|
|
726 |
|
|
727 |
"
|
|
728 |
#(4 3 2 1) asOrderedCollection after:3.
|
|
729 |
#(4 3 2 1) asOrderedCollection after:5
|
|
730 |
#(4 3 2 1) asOrderedCollection after:1
|
|
731 |
"
|
|
732 |
!
|
|
733 |
|
|
734 |
before:anObject
|
|
735 |
"return the element before the argument, anObject.
|
|
736 |
If anObject is not in the receiver, report an error."
|
|
737 |
|
348
|
738 |
^ self before:anObject ifAbsent:[self errorValueNotFound:anObject]
|
77
|
739 |
|
|
740 |
"
|
|
741 |
#(4 3 2 1) asOrderedCollection before:3.
|
|
742 |
#(4 3 2 1) asOrderedCollection before:4
|
|
743 |
#(4 3 2 1) asOrderedCollection before:0
|
|
744 |
"
|
|
745 |
!
|
|
746 |
|
|
747 |
before:anObject ifAbsent:exceptionBlock
|
|
748 |
"return the element before the argument anObject, nil if there is none.
|
|
749 |
If anObject is not in the receiver, return the result from evaluating exceptionBlock."
|
|
750 |
|
|
751 |
|idx|
|
|
752 |
|
|
753 |
idx := self indexOf:anObject.
|
|
754 |
idx ~~ 0 ifTrue:[
|
159
|
755 |
idx == firstIndex ifTrue:[^ nil].
|
|
756 |
^ self at:(idx - 1).
|
77
|
757 |
].
|
|
758 |
^ exceptionBlock value
|
|
759 |
|
|
760 |
"
|
|
761 |
#(4 3 2 1) asOrderedCollection before:3.
|
|
762 |
#(4 3 2 1) asOrderedCollection before:5
|
|
763 |
#(4 3 2 1) asOrderedCollection before:1
|
|
764 |
#(4 3 2 1) asOrderedCollection before:4
|
|
765 |
"
|
|
766 |
! !
|
|
767 |
|
1
|
768 |
!OrderedCollection methodsFor:'private'!
|
|
769 |
|
|
770 |
setFirstIndex:newFirstIndex lastIndex:newLastIndex
|
13
|
771 |
"set first and last index"
|
|
772 |
|
1
|
773 |
firstIndex := newFirstIndex.
|
|
774 |
lastIndex := newLastIndex.
|
|
775 |
!
|
|
776 |
|
|
777 |
makeRoomAtLast
|
282
|
778 |
"grow/shift the contents for more room at the end.
|
|
779 |
Does not change the logical size.
|
|
780 |
i.e.
|
|
781 |
#(1 2 3 4 5 6) -> #(1 2 3 4 5 6 nil)"
|
1
|
782 |
|
|
783 |
|newContents
|
33
|
784 |
oldSize "{ Class:SmallInteger }"
|
|
785 |
newSize "{ Class:SmallInteger }"
|
|
786 |
startIndex "{ Class:SmallInteger }"
|
|
787 |
sz "{ Class:SmallInteger }"|
|
1
|
788 |
|
|
789 |
oldSize := contentsArray size.
|
253
|
790 |
sz := lastIndex - firstIndex + 1.
|
33
|
791 |
|
329
|
792 |
"
|
|
793 |
if there is lots of room at the beginning (> 50%),
|
|
794 |
shift instead of growing. This helps collections which get
|
|
795 |
elements removed at front and added at the end.
|
|
796 |
"
|
33
|
797 |
oldSize > (sz * 2) ifTrue:[
|
159
|
798 |
startIndex := firstIndex // 4.
|
375
|
799 |
startIndex == 0 ifTrue:[
|
|
800 |
startIndex := 1
|
|
801 |
].
|
159
|
802 |
contentsArray
|
|
803 |
replaceFrom:startIndex
|
|
804 |
to:startIndex + sz - 1
|
|
805 |
with:contentsArray
|
|
806 |
startingAt:firstIndex.
|
|
807 |
contentsArray from:startIndex + sz to:lastIndex put:nil.
|
|
808 |
firstIndex := startIndex.
|
|
809 |
lastIndex := startIndex + sz - 1.
|
|
810 |
^ self
|
33
|
811 |
].
|
10
|
812 |
newSize := oldSize * 2.
|
329
|
813 |
newSize == 0 ifTrue:[newSize := 3].
|
253
|
814 |
newContents := Array basicNew:newSize.
|
329
|
815 |
newContents
|
|
816 |
replaceFrom:1
|
|
817 |
to:oldSize
|
|
818 |
with:contentsArray
|
|
819 |
startingAt:1.
|
1
|
820 |
contentsArray := newContents
|
|
821 |
!
|
|
822 |
|
|
823 |
makeRoomAtFront
|
282
|
824 |
"grow/shift the contents for more room at the beginning.
|
|
825 |
Does not change the logical size.
|
|
826 |
i.e.
|
|
827 |
#(1 2 3 4 5 6) -> #(nil 1 2 3 4 5 6)"
|
1
|
828 |
|
|
829 |
|newContents
|
33
|
830 |
oldSize "{ Class:SmallInteger }"
|
|
831 |
newSize "{ Class:SmallInteger }"
|
|
832 |
startIndex "{ Class:SmallInteger }"
|
|
833 |
sz "{ Class:SmallInteger }"|
|
1
|
834 |
|
|
835 |
oldSize := contentsArray size.
|
93
|
836 |
oldSize == 0 ifTrue:[
|
253
|
837 |
contentsArray := Array basicNew:3.
|
159
|
838 |
firstIndex := 2. lastIndex := 1.
|
|
839 |
^ self
|
93
|
840 |
].
|
|
841 |
|
253
|
842 |
sz := lastIndex - firstIndex + 1.
|
33
|
843 |
|
329
|
844 |
"
|
|
845 |
if there is lots of room at the end (> 50%),
|
|
846 |
shift instead of growing. This helps collections
|
|
847 |
which get elements removed at the end and added at front.
|
|
848 |
"
|
33
|
849 |
oldSize > (sz * 2) ifTrue:[
|
159
|
850 |
startIndex := oldSize // 4.
|
375
|
851 |
startIndex == 0 ifTrue:[
|
|
852 |
startIndex := 1
|
|
853 |
].
|
159
|
854 |
contentsArray
|
|
855 |
replaceFrom:startIndex
|
|
856 |
to:startIndex + sz - 1
|
|
857 |
with:contentsArray
|
|
858 |
startingAt:1.
|
|
859 |
contentsArray from:1 to:(startIndex - 1) put:nil.
|
|
860 |
firstIndex := startIndex.
|
|
861 |
lastIndex := startIndex + sz - 1.
|
|
862 |
^ self
|
33
|
863 |
].
|
2
|
864 |
newSize := oldSize * 2.
|
329
|
865 |
newSize == 0 ifTrue:[ newSize := 3].
|
253
|
866 |
newContents := Array basicNew:newSize.
|
77
|
867 |
newContents
|
159
|
868 |
replaceFrom:(oldSize + 1)
|
|
869 |
to:newSize
|
|
870 |
with:contentsArray
|
|
871 |
startingAt:1.
|
1
|
872 |
contentsArray := newContents.
|
|
873 |
firstIndex := firstIndex + oldSize.
|
|
874 |
lastIndex := lastIndex + oldSize
|
|
875 |
!
|
|
876 |
|
|
877 |
makeRoomAtIndex:index
|
|
878 |
"grow the contents for inserting at index
|
282
|
879 |
Changes the logical size.
|
1
|
880 |
i.e.
|
|
881 |
#(1 2 3 4 5 6) asOrderedCollection makeRoomAtIndex:3 -> #(1 2 nil 3 4 5 6)
|
|
882 |
#(1 2 3 4 5 6) asOrderedCollection makeRoomAtIndex:1 -> #(nil 1 2 3 4 5 6)
|
|
883 |
#(1 2 3 4 5 6) asOrderedCollection makeRoomAtIndex:7 -> #(1 2 3 4 5 6 nil)"
|
|
884 |
|
|
885 |
|newContents
|
|
886 |
newSize "{ Class:SmallInteger }"
|
|
887 |
oldSize "{ Class:SmallInteger }" |
|
|
888 |
|
|
889 |
oldSize := contentsArray size.
|
68
|
890 |
((firstIndex > 1) and:[firstIndex > (oldSize // 4)]) ifTrue:[
|
159
|
891 |
"there is room (>25%) at the beginning"
|
33
|
892 |
|
159
|
893 |
index == 1 ifFalse:[
|
|
894 |
contentsArray
|
|
895 |
replaceFrom:(firstIndex - 1)
|
|
896 |
to:(index - 1)
|
|
897 |
with:contentsArray
|
|
898 |
startingAt:firstIndex.
|
|
899 |
contentsArray at:index put:nil.
|
|
900 |
].
|
|
901 |
firstIndex := firstIndex - 1.
|
|
902 |
^ self
|
33
|
903 |
].
|
|
904 |
lastIndex < (oldSize * 3 // 4) ifTrue:[
|
159
|
905 |
"there is room (>25%) at the end"
|
33
|
906 |
|
159
|
907 |
index == (lastIndex + 1) ifFalse:[
|
|
908 |
contentsArray
|
|
909 |
replaceFrom:(index + 1)
|
|
910 |
to:(lastIndex + 1)
|
|
911 |
with:contentsArray
|
|
912 |
startingAt:index.
|
|
913 |
contentsArray at:index put:nil
|
|
914 |
].
|
|
915 |
lastIndex := lastIndex + 1.
|
|
916 |
^ self
|
33
|
917 |
].
|
|
918 |
|
|
919 |
newSize := oldSize * 2.
|
253
|
920 |
newContents := Array basicNew:newSize.
|
329
|
921 |
index ~~ 1 ifTrue:[
|
|
922 |
newContents
|
|
923 |
replaceFrom:1
|
|
924 |
to:index-1
|
|
925 |
with:contentsArray
|
|
926 |
startingAt:1.
|
1
|
927 |
].
|
329
|
928 |
index ~~ newSize ifTrue:[
|
159
|
929 |
newContents
|
|
930 |
replaceFrom:index + 1
|
|
931 |
to:oldSize + 1
|
|
932 |
with:contentsArray
|
|
933 |
startingAt:index.
|
1
|
934 |
].
|
|
935 |
contentsArray := newContents.
|
|
936 |
lastIndex := lastIndex + 1
|
|
937 |
!
|
|
938 |
|
|
939 |
initContents:size
|
40
|
940 |
"setup the receiver-collection to hold size entries"
|
|
941 |
|
253
|
942 |
contentsArray := Array basicNew:size.
|
1
|
943 |
firstIndex := 1.
|
|
944 |
lastIndex := 0
|
|
945 |
! !
|
|
946 |
|
|
947 |
!OrderedCollection methodsFor:'testing'!
|
|
948 |
|
|
949 |
includes:anObject
|
33
|
950 |
"return true if anObject is in the collection. Compare using ="
|
1
|
951 |
|
33
|
952 |
|index "{ Class:SmallInteger }"|
|
1
|
953 |
|
13
|
954 |
index := contentsArray indexOf:anObject startingAt:firstIndex.
|
33
|
955 |
((index < firstIndex) or:[index > lastIndex]) ifTrue:[^ false].
|
|
956 |
^ true
|
1
|
957 |
!
|
|
958 |
|
|
959 |
identityIndexOf:anObject
|
33
|
960 |
"return the index of anObject or 0 if not found. Compare using =="
|
1
|
961 |
|
33
|
962 |
|index "{ Class:SmallInteger }"|
|
1
|
963 |
|
13
|
964 |
index := contentsArray identityIndexOf:anObject startingAt:firstIndex.
|
33
|
965 |
((index < firstIndex) or:[index > lastIndex]) ifTrue:[^ 0].
|
1
|
966 |
^ index - firstIndex + 1
|
|
967 |
!
|
|
968 |
|
|
969 |
identityIndexOf:anObject startingAt:startIndex
|
33
|
970 |
"return the index of anObject, starting search at startIndex.
|
|
971 |
Compare using ==; return 0 if not found in the collection"
|
1
|
972 |
|
33
|
973 |
|index "{ Class:SmallInteger }"|
|
1
|
974 |
|
|
975 |
index := contentsArray identityIndexOf:anObject startingAt:(startIndex + firstIndex - 1).
|
33
|
976 |
((index < firstIndex) or:[index > lastIndex]) ifTrue:[^ 0].
|
1
|
977 |
^ index - firstIndex + 1
|
|
978 |
!
|
|
979 |
|
|
980 |
indexOf:anObject
|
33
|
981 |
"return the index of anObject or 0 if not found in the collection.
|
|
982 |
Compare using ="
|
1
|
983 |
|
33
|
984 |
|index "{ Class:SmallInteger }"|
|
1
|
985 |
|
13
|
986 |
index := contentsArray indexOf:anObject startingAt:firstIndex.
|
33
|
987 |
((index < firstIndex) or:[index > lastIndex]) ifTrue:[^ 0].
|
1
|
988 |
^ index - firstIndex + 1
|
|
989 |
!
|
|
990 |
|
|
991 |
indexOf:anObject startingAt:startIndex
|
33
|
992 |
"return the index of anObject, starting search at startIndex.
|
|
993 |
Compare using =; return 0 if not found in the collection"
|
1
|
994 |
|
33
|
995 |
|index "{ Class:SmallInteger }"|
|
1
|
996 |
|
|
997 |
index := contentsArray indexOf:anObject startingAt:(startIndex + firstIndex - 1).
|
33
|
998 |
((index < firstIndex) or:[index > lastIndex]) ifTrue:[^ 0].
|
1
|
999 |
^ index - firstIndex + 1
|
|
1000 |
! !
|
|
1001 |
|
13
|
1002 |
!OrderedCollection methodsFor:'converting'!
|
|
1003 |
|
|
1004 |
asOrderedCollection
|
|
1005 |
"return the receiver as an ordered collection"
|
|
1006 |
|
|
1007 |
"could be an instance of a subclass..."
|
|
1008 |
self class == OrderedCollection ifTrue:[
|
159
|
1009 |
^ self
|
13
|
1010 |
].
|
|
1011 |
^ super asOrderedCollection
|
|
1012 |
! !
|
|
1013 |
|
217
|
1014 |
!OrderedCollection methodsFor:'enumerating'!
|
1
|
1015 |
|
|
1016 |
do:aBlock
|
|
1017 |
"evaluate the argument, aBlock for every element in the collection."
|
|
1018 |
|
|
1019 |
contentsArray from:firstIndex to:lastIndex do:aBlock
|
|
1020 |
!
|
|
1021 |
|
42
|
1022 |
reverseDo:aBlock
|
|
1023 |
"evaluate the argument, aBlock for every element in the collection
|
|
1024 |
procesing elements in reverse direction (i.e. starting with the last)"
|
|
1025 |
|
|
1026 |
contentsArray from:firstIndex to:lastIndex reverseDo:aBlock
|
|
1027 |
!
|
|
1028 |
|
3
|
1029 |
keysAndValuesDo:aTwoArgBlock
|
|
1030 |
"evaluate the argument, aBlock for every element in the collection,
|
|
1031 |
passing both index and element as arguments."
|
|
1032 |
|
33
|
1033 |
|start "{ Class:SmallInteger }"
|
|
1034 |
stop "{ Class:SmallInteger }" |
|
|
1035 |
|
|
1036 |
stop := lastIndex.
|
|
1037 |
start := firstIndex.
|
|
1038 |
start to:stop do:[:index |
|
159
|
1039 |
aTwoArgBlock value:index value:(contentsArray at:index)
|
3
|
1040 |
]
|
282
|
1041 |
|
|
1042 |
"
|
|
1043 |
#(10 20 30 40) asOrderedCollection keysAndValuesDo:[:index :value |
|
|
1044 |
Transcript show:index; show:' '; showCr:value
|
|
1045 |
]
|
|
1046 |
"
|
3
|
1047 |
!
|
|
1048 |
|
1
|
1049 |
collect:aBlock
|
|
1050 |
"evaluate the argument, aBlock for every element in the collection
|
|
1051 |
and return a collection of the results"
|
|
1052 |
|
|
1053 |
|newCollection
|
33
|
1054 |
start "{ Class:SmallInteger }"
|
|
1055 |
stop "{ Class:SmallInteger }" |
|
1
|
1056 |
|
202
|
1057 |
newCollection := self copyEmpty:(self size).
|
33
|
1058 |
stop := lastIndex.
|
|
1059 |
start := firstIndex.
|
|
1060 |
start to:stop do:[:index |
|
159
|
1061 |
newCollection add:(aBlock value:(contentsArray at:index)).
|
1
|
1062 |
].
|
|
1063 |
^ newCollection
|
282
|
1064 |
|
|
1065 |
"
|
|
1066 |
#(1 2 3 4) asOrderedCollection collect:[:i | i * i]
|
|
1067 |
#(1 2 3 4) asOrderedCollection collect:[:i | i even]
|
|
1068 |
"
|
1
|
1069 |
! !
|
33
|
1070 |
|
282
|
1071 |
!OrderedCollection methodsFor:'inspecting'!
|
33
|
1072 |
|
282
|
1073 |
inspectorClass
|
|
1074 |
"redefined to launch an OrderedCollectionInspector
|
33
|
1075 |
(instead of the default InspectorView)."
|
|
1076 |
|
282
|
1077 |
^ OrderedCollectionInspectorView
|
33
|
1078 |
|
282
|
1079 |
"
|
|
1080 |
(OrderedCollection withAll:#(3 2 1)) inspect
|
|
1081 |
(OrderedCollection withAll:#(3 2 1)) removeFirst; yourself; inspect
|
|
1082 |
#(0 8 15 3 99 2) asSortedCollection inspect
|
|
1083 |
"
|
33
|
1084 |
! !
|