RunArray.st
changeset 305 9d20b26c1e1a
parent 303 b30b08669004
child 306 f2ccc4707a71
--- a/RunArray.st	Sat May 11 14:35:51 1996 +0200
+++ b/RunArray.st	Sun May 12 14:19:17 1996 +0200
@@ -358,7 +358,7 @@
 
         "/ check if merge into next is possible
 
-        runIndex < runSz ifTrue:[
+        runIndex < (runSz-1) ifTrue:[
             nextIdx := runIndex + 2.
             nextVal := contentsArray at:nextIdx+1.
             nextVal = anObject ifTrue:[
@@ -450,7 +450,7 @@
     runIndex > 1 ifTrue:[
         newRuns replaceFrom:1 to:runIndex-1 with:contentsArray.
     ].
-    newRuns replaceFrom:runIndex+6 to:(runSz+4) with:contentsArray startingAt:runIndex+2.
+    newRuns replaceFrom:runIndex+6 to:runSz with:contentsArray startingAt:runIndex+2.
 
     l2 := len - (index - runOffset).
     l1 := len - l2.
@@ -505,7 +505,7 @@
      Transcript showCr:c.   
     "
 
-    "Modified: 11.5.1996 / 13:34:21 / cg"
+    "Modified: 12.5.1996 / 12:44:33 / cg"
 !
 
 size
@@ -681,6 +681,18 @@
     ]
 
     "Modified: 11.5.1996 / 13:35:03 / cg"
+!
+
+runsDo:aBlock 
+    "Evaluate aBlock with each of the receiver's runs, passing
+     length and value as arguments."
+
+    contentsArray notNil ifTrue:[
+        contentsArray pairWiseDo:aBlock
+    ]
+
+    "Modified: 11.5.1996 / 13:35:03 / cg"
+    "Created: 12.5.1996 / 11:06:51 / cg"
 ! !
 
 !RunArray methodsFor:'printing & storing'!
@@ -825,5 +837,5 @@
 !RunArray class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/RunArray.st,v 1.6 1996-05-11 12:28:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/RunArray.st,v 1.7 1996-05-12 12:19:17 cg Exp $'
 ! !