--- a/OrderedCollection.st Thu Feb 04 13:08:47 1999 +0100
+++ b/OrderedCollection.st Mon Feb 08 12:38:31 1999 +0100
@@ -666,7 +666,8 @@
"remove the first element from the collection; return the element.
If there is no element in the receiver collection, raise an error."
- |anObject fI "{ Class: SmallInteger }" |
+ |anObject
+ fI "{ Class: SmallInteger }" |
fI := firstIndex.
@@ -696,7 +697,7 @@
(SortedCollection withAll:#(5 4 3 2 1)) removeFirst; yourself
"
- "Modified: / 30.7.1998 / 13:19:59 / cg"
+ "Modified: / 5.2.1999 / 23:22:58 / cg"
!
removeFirst:n
@@ -795,7 +796,9 @@
Please use yourself in a cascade, if you need the receivers value
when using this method."
- |nDeleted "{ Class: SmallInteger }"
+ |nDeleted "{ Class: SmallInteger }"
+ fI "{ Class: SmallInteger }"
+ lI "{ Class: SmallInteger }"
newLastIndex sz|
sz := self size.
@@ -811,16 +814,19 @@
].
nDeleted == 0 ifTrue:[^ self].
+ fI := firstIndex.
+ lI := lastIndex.
+
"/
"/ can be done faster, when removing the first elements
"/
startIndex == 1 ifTrue:[
"/ nil out (helps GC)
contentsArray
- from:firstIndex
- to:firstIndex + nDeleted - 1
+ from:fI
+ to:fI + nDeleted - 1
put:nil.
- firstIndex := firstIndex + nDeleted
+ firstIndex := fI := fI + nDeleted
] ifFalse:[
"/
"/ can be done faster, when removing the last elements
@@ -828,10 +834,10 @@
stopIndex == sz ifTrue:[
"/ nil out (helps GC)
contentsArray
- from:lastIndex - nDeleted + 1
- to:lastIndex
+ from:lI - nDeleted + 1
+ to:lI
put:nil.
- lastIndex := lastIndex - nDeleted
+ lastIndex := lI := lI - nDeleted
] ifFalse:[
"/
"/ must shuffle
@@ -839,25 +845,25 @@
"/ for big collections, try to copy the smallest
"/ possible number of elements
- newLastIndex := lastIndex - nDeleted.
+ newLastIndex := lI - nDeleted.
contentsArray
- replaceFrom:(firstIndex + startIndex - 1)
+ replaceFrom:(fI + startIndex - 1)
to:newLastIndex
with:contentsArray
- startingAt:(firstIndex + stopIndex).
+ startingAt:(fI + stopIndex).
"/ nil out rest (helps GC)
contentsArray
from:(newLastIndex + 1)
- to:lastIndex
+ to:lI
put:nil.
- lastIndex := newLastIndex.
+ lastIndex := lI := newLastIndex.
]
].
- firstIndex > lastIndex ifTrue:[
+ fI > lI ifTrue:[
"reset to avoid ever growing"
firstIndex := 1.
lastIndex := 0
@@ -871,7 +877,7 @@
#(1 2 3 4 5) asOrderedCollection removeFromIndex:3 toIndex:6
"
- "Modified: 8.2.1997 / 19:31:05 / cg"
+ "Modified: / 5.2.1999 / 23:22:07 / cg"
!
removeIdentical:anObject ifAbsent:exceptionBlock
@@ -1765,5 +1771,5 @@
!OrderedCollection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.68 1998-07-30 16:06:34 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.69 1999-02-08 11:38:31 cg Exp $'
! !