Category: Collections-Sequenceable
Superclass: OrderedCollection
I am a collection of objects, stored and accessed according to some sorting criteria. I store things using heap sort and quick sort. My instances have a comparison block associated with them; this block takes two arguments and is a predicate which returns true if the first argument should be sorted earlier than the second. The default block is [ :a :b | a <= b ], but I will accept any block that conforms to the above criteria -- actually any object which responds to #value:value:.

Method category index

hacking (class)
instance creation (class)
accessing (instance)
basic (instance)
copying (instance)
disabled (instance)
enumerating (instance)
printing (instance)
removing (instance)
saving and loading (instance)
searching (instance)
sorting (instance)

hacking (class)

defaultSortBlock
Answer a default sort block for the receiver.

top


instance creation (class)

new
Answer a new collection with a default size and sort block

new: aSize

Answer a new collection with a default sort block and the given size

sortBlock: aSortBlock

Answer a new collection with a default size and the given sort block

top


accessing (instance)

at: anIndex
Answer the anIndex-th item of the receiver

at: anIndex put: anObject

Store anObject at the anIndex-th item of the receiver, answer anObject

first

Answer the first item of the receiver

top


basic (instance)

last
Answer the last item of the receiver

removeLast

Remove an object from the end of the receiver. Fail if the receiver is empty

sortBlock

Answer the receiver's sort criteria

sortBlock: aSortBlock

Change the sort criteria for a sorted collection, resort the elements of the collection, and return it.

top


copying (instance)

copyEmpty: newSize
Answer an empty copy of the receiver, with the same sort block as the receiver

top


disabled (instance)

add: anObject afterIndex: i
This method should not be called for instances of this class.

addAll: aCollection afterIndex: i

This method should not be called for instances of this class.

addAllFirst: aCollection

This method should not be called for instances of this class.

addAllLast: aCollection

This method should not be called for instances of this class.

addFirst: anObject

This method should not be called for instances of this class.

addLast: anObject

This method should not be called for instances of this class.

top


enumerating (instance)

beConsistent
Prepare the receiver to be walked through with #do: or another enumeration method.

do: aBlock

Evaluate aBlock for all the elements in the collection

top


printing (instance)

examineOn: aStream
Print all the instance variables and objects in the receiver on aStream

top


removing (instance)

removeFirst
Remove an object from the start of the receiver. Fail if the receiver is empty

top


saving and loading (instance)

postLoad
Restore the default sortBlock if it is nil

preStore

Store the default sortBlock as nil

top


searching (instance)

includes: anObject
Private - Answer whether the receiver includes an item which is equal to anObject

indexOf: anObject startingAt: index ifAbsent: aBlock

Answer the first index > anIndex which contains anElement. Invoke exceptionBlock and answer its result if no item is found

occurrencesOf: anObject

Answer how many occurrences of anObject can be found in the receiver

top


sorting (instance)

sort
Sort the contents of the receiver according to the given sort block, which accepts pair of items and returns true if the first item is less than the second one. Fails if the collections's sort block is not the same as the default sort block.

sort: sortBlock

Sort the contents of the receiver according to the given sort block, which accepts pair of items and returns true if the first item is less than the second one. Fails if the sort block is not the same as the collection's sort block.

top