Back: SmallInteger-builtins
Up: Class reference
Forward: SortedCollection class-hacking
 
Top: GNU Smalltalk User's Guide
Contents: Table of Contents
Index: Class index
About: About this document

6.131 SortedCollection

Defined in namespace Smalltalk
Category: Collections-Sequenceable
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:.

6.131.1 SortedCollection class: hacking  (class)
6.131.2 SortedCollection class: instance creation  (class)
6.131.3 SortedCollection: basic  (instance)
6.131.4 SortedCollection: copying  (instance)
6.131.5 SortedCollection: disabled  (instance)
6.131.6 SortedCollection: enumerating  (instance)
6.131.7 SortedCollection: saving and loading  (instance)
6.131.8 SortedCollection: searching  (instance)


6.131.1 SortedCollection class: hacking

defaultSortBlock
Answer a default sort block for the receiver.


6.131.2 SortedCollection class: instance creation

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


6.131.3 SortedCollection: basic

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.


6.131.4 SortedCollection: copying

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


6.131.5 SortedCollection: disabled

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.

at: index put: anObject
This method should not be called for instances of this class.


6.131.6 SortedCollection: enumerating

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


6.131.7 SortedCollection: saving and loading

postLoad
Restore the default sortBlock if it is nil

preStore
Store the default sortBlock as nil


6.131.8 SortedCollection: searching

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




This document was generated on May, 12 2002 using texi2html