Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.697.mcz==================== Summary ====================
Name: Collections-ul.697
Author: ul
Time: 2 June 2016, 8:31:09.211811 pm
UUID: 4d7d52f4-cdbb-423f-9923-aee902c885b0
Ancestors: Collections-ul.696
Heap revamp #2.
Deprecated the now unusued #fullySort, #reSort, #sorts:before:, #trim and #updateObjectIndex:
Bonus: do not re-sort the receiver of SortedCollection >> #sortBlock: when it only has one element.
=============== Diff against Collections-ul.696 ===============
Item was removed:
- ----- Method: Heap>>fullySort (in category 'accessing') -----
- fullySort
- "Fully sort the heap.
- This method preserves the heap invariants and can thus be sent safely"
- self privateReverseSort.
- 1 to: tally // 2 do: [:i | array swap: i with: 1 + tally - i]!
Item was removed:
- ----- Method: Heap>>reSort (in category 'accessing') -----
- reSort
- "Resort the entire heap"
- self isEmpty ifTrue:[^self].
- tally // 2 to: 1 by: -1 do:[:i| self downHeap: i].!
Item was removed:
- ----- Method: Heap>>sorts:before: (in category 'testing') -----
- sorts: element1 before: element2
- "Return true if element1 should be sorted before element2.
- This method defines the sort order in the receiver"
- ^sortBlock == nil
- ifTrue:[element1 <= element2]
- ifFalse:[sortBlock value: element1 value: element2].!
Item was removed:
- ----- Method: Heap>>trim (in category 'growing') -----
- trim
- "Remove any empty slots in the receiver."
- self growTo: self size.!
Item was removed:
- ----- Method: Heap>>updateObjectIndex: (in category 'private') -----
- updateObjectIndex: index
- "If indexUpdateBlock is not nil, notify the object at index of its new position in the heap array."
- indexUpdateBlock ifNotNil: [
- indexUpdateBlock value: (array at: index) value: index]!
Item was changed:
----- Method: SortedCollection>>sortBlock: (in category 'accessing') -----
sortBlock: aBlock
"Make the argument, aBlock, be the criterion for ordering elements of the
receiver."
sortBlock := aBlock.
"sortBlocks with side effects may not work right"
+ self size > 1 ifTrue: [self reSort]!
- self size > 0 ifTrue: [self reSort]!