Back: RootNamespace-testing
Up: Class reference
Forward: RunArray class-instance creation
 
Top: GNU Smalltalk User's Guide
Contents: Table of Contents
Index: Class index
About: About this document

6.122 RunArray

Defined in namespace Smalltalk
Category: Collection-Sequenceable
My instances are OrderedCollections that automatically apply Run Length Encoding compression to the things they store. Be careful when using me: I can provide great space savings, but my instances don't grant linear access time. RunArray's behavior currently is similar to that of OrderedCollection (you can add elements to RunArrays); maybe it should behave like an ArrayedCollection.

6.122.1 RunArray class: instance creation  (class)
6.122.2 RunArray: accessing  (instance)
6.122.3 RunArray: adding  (instance)
6.122.4 RunArray: basic  (instance)
6.122.5 RunArray: copying  (instance)
6.122.6 RunArray: enumerating  (instance)
6.122.7 RunArray: removing  (instance)
6.122.8 RunArray: searching  (instance)
6.122.9 RunArray: testing  (instance)


6.122.1 RunArray class: instance creation

new
Answer an empty RunArray

new: aSize
Answer a RunArray with space for aSize runs


6.122.2 RunArray: accessing

at: anIndex
Answer the element at index anIndex

at: anIndex put: anObject
Replace the element at index anIndex with anObject and answer anObject


6.122.3 RunArray: adding

add: anObject afterIndex: anIndex
Add anObject after the element at index anIndex

addAll: aCollection afterIndex: anIndex
Add all the elements of aCollection after the one at index anIndex. If aCollection is unordered, its elements could be added in an order which is not the #do: order

addAllFirst: aCollection
Add all the elements of aCollection at the beginning of the receiver. If aCollection is unordered, its elements could be added in an order which is not the #do: order

addAllLast: aCollection
Add all the elements of aCollection at the end of the receiver. If aCol- lection is unordered, its elements could be added in an order which is not the #do: order

addFirst: anObject
Add anObject at the beginning of the receiver. Watch out: this operation can cause serious performance pitfalls

addLast: anObject
Add anObject at the end of the receiver


6.122.4 RunArray: basic

first
Answer the first element in the receiver

last
Answer the last element of the receiver

size
Answer the number of elements in the receiver


6.122.5 RunArray: copying

deepCopy
Answer a copy of the receiver containing copies of the receiver's elements (#copy is used to obtain them)

shallowCopy
Answer a copy of the receiver. The elements are not copied


6.122.6 RunArray: enumerating

do: aBlock
Enumerate all the objects in the receiver, passing each one to aBlock

objectsAndRunLengthsDo: aBlock
Enumerate all the runs in the receiver, passing to aBlock two parameters for every run: the first is the repeated object, the second is the number of copies


6.122.7 RunArray: removing

removeAtIndex: anIndex
Remove the object at index anIndex from the receiver and answer the removed object

removeFirst
Remove the first object from the receiver and answer the removed object

removeLast
Remove the last object from the receiver and answer the removed object


6.122.8 RunArray: searching

indexOf: anObject startingAt: anIndex ifAbsent: aBlock
Answer the index of the first copy of anObject in the receiver, starting the search at the element at index anIndex. If no equal object is found, answer the result of evaluating aBlock


6.122.9 RunArray: testing

= anObject
Answer true if the receiver is equal to anObject

hash
Answer an hash value for the receiver




This document was generated on May, 12 2002 using texi2html