--- a/RunArray.st Fri Jun 21 00:54:36 2013 +0200
+++ b/RunArray.st Mon Jun 24 19:53:30 2013 +0200
@@ -731,6 +731,31 @@
!RunArray methodsFor:'converting'!
+asArray
+ "return a new array, containing the receiver's elements."
+
+ |newCollection dstIndex|
+
+ contentsArray isNil ifTrue:[^ Array new].
+
+ newCollection := Array new:(self size).
+ dstIndex := 1.
+ contentsArray pairWiseDo:[:len :value |
+ newCollection from:dstIndex to:(dstIndex + len - 1) put:value.
+ dstIndex := dstIndex + len.
+ ].
+ ^ newCollection
+
+ "
+ |r|
+
+ r := RunArray withAll:#(1 2 3 3 3 3 4 4 4 5 6 7 7 7 7 7 7 7).
+ Transcript showCR:r.
+ Transcript showCR:r asArray.
+ Transcript showCR:r asRunArray.
+ "
+!
+
asOrderedCollection
"return a new orderedCollection, containing the receiver's elements."
@@ -1331,10 +1356,10 @@
!RunArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/RunArray.st,v 1.33 2013-06-03 18:40:19 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/RunArray.st,v 1.34 2013-06-24 17:53:30 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic2/RunArray.st,v 1.33 2013-06-03 18:40:19 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/RunArray.st,v 1.34 2013-06-24 17:53:30 cg Exp $'
! !