class: SequenceableCollection
added:
#replaceLast:with:
#replaceLast:with:startingAt:
--- a/SequenceableCollection.st Sat Dec 22 15:29:34 2012 +0100
+++ b/SequenceableCollection.st Tue Jan 01 12:30:33 2013 +0100
@@ -368,7 +368,6 @@
^ self == SequenceableCollection
! !
-
!SequenceableCollection methodsFor:'Compatibility-Squeak'!
allButFirst
@@ -5420,6 +5419,39 @@
"Modified: / 20.5.1998 / 15:25:18 / cg"
!
+replaceLast:count with:replacementCollection
+ "replace the last count elements elements in the receiver
+ with elements taken from replacementCollection.
+ Return the receiver.
+
+ Notice: This operation modifies the receiver, NOT a copy;
+ therefore the change may affect all others referencing the receiver."
+
+ self replaceLast:count with:replacementCollection startingAt:1
+
+ "
+ '1234567890' replaceLast:5 with:'abcdef'
+ "
+!
+
+replaceLast:count with:replacementCollection startingAt:repStartIndex
+ "replace the last count elements elements in the receiver
+ with elements taken from replacementCollection starting at repStartIndex.
+ Return the receiver.
+
+ Notice: This operation modifies the receiver, NOT a copy;
+ therefore the change may affect all others referencing the receiver."
+
+ |sz|
+
+ sz := self size.
+ self replaceFrom:(sz - count + 1) to:sz with:replacementCollection startingAt:repStartIndex
+
+ "
+ '1234567890' replaceLast:5 with:'abcdef' startingAt:1
+ "
+!
+
startingAt:sourceStart replaceElementsIn:destColl from:destStartIndex to:destEndIndex
"replace elements in destColl with elements from the receiver.
@@ -6573,7 +6605,6 @@
"Created: 14.2.1997 / 16:13:03 / cg"
! !
-
!SequenceableCollection methodsFor:'searching'!
detect:aBlock startingAt:startIndex
@@ -8702,11 +8733,11 @@
!SequenceableCollection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.327 2012-12-21 11:55:57 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.328 2013-01-01 11:30:33 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.327 2012-12-21 11:55:57 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.328 2013-01-01 11:30:33 cg Exp $'
! !