#FEATURE
authorClaus Gittinger <cg@exept.de>
Sat, 05 Mar 2016 10:40:09 +0100
changeset 19299 ab722ea7efc2
parent 19298 cfacc6b159c5
child 19300 e55b50337eb5
#FEATURE class: SequenceableCollection added: #from:count:put:
SequenceableCollection.st
--- a/SequenceableCollection.st	Fri Mar 04 19:16:25 2016 +0100
+++ b/SequenceableCollection.st	Sat Mar 05 10:40:09 2016 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -400,6 +398,8 @@
     ^ self == SequenceableCollection
 ! !
 
+
+
 !SequenceableCollection methodsFor:'Compatibility-Squeak'!
 
 allButFirst
@@ -712,6 +712,7 @@
     ^ self replaceFrom:start to:stop with:anArray startingAt:repStart
 ! !
 
+
 !SequenceableCollection methodsFor:'accessing'!
 
 after:anObject
@@ -3468,6 +3469,24 @@
     "
 !
 
+from:startIndex count:numberOfElements put:newElement
+    "replace numberOfElements elements from startIndex of the collection
+     by the argument, newElement.
+     Notice: This operation modifies the receiver, NOT a copy;
+     therefore the change may affect all others referencing the receiver."
+
+    ^ self
+        from:startIndex
+        to:(startIndex + numberOfElements - 1)
+        put:newElement
+
+    "
+     #($a $b $c $d $e $f $g) copy from:2 count:3 put:nil
+     '1234567890' copy from:2 count:5 put:$*
+     '1234567890' copy from:2 count:20 put:$* -> error
+    "
+!
+
 from:startIndex to:endIndex
     "Create a ReindexedCollection from the receiver.
      The new collection represents the elements starting at startIndex to endIndex.
@@ -7765,6 +7784,7 @@
     "Created: 14.2.1997 / 16:13:03 / cg"
 ! !
 
+
 !SequenceableCollection methodsFor:'searching'!
 
 detect:aBlock startingAt:startIndex