[Pkg] The Trunk: Collections-ul.823.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Mar 22 11:09:19 UTC 2019


Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.823.mcz

==================== Summary ====================

Name: Collections-ul.823
Author: ul
Time: 22 March 2019, 12:04:40.596433 pm
UUID: 2fef1e34-e45a-4f70-bb7b-56aa1c610df9
Ancestors: Collections-pre.822

Fixed bug in Heap >> #upHeap:. When the first element of a Heap was removed, the index of the first object was not always updated.

=============== Diff against Collections-pre.822 ===============

Item was changed:
  ----- Method: Heap>>upHeap: (in category 'private-heap') -----
  upHeap: anIndex
  	"Check the heap upwards for correctness starting at anIndex.
  	 Everything below anIndex is ok."
  
  	| index parentValue parentIndex value |
+ 	anIndex = 1 ifTrue: [
+ 		indexUpdateBlock ifNotNil: [ indexUpdateBlock value: (array at: 1) value: 1 ].
+ 		^self ].
- 	anIndex = 1 ifTrue: [ ^self ].
  	value := array at: (index := anIndex).
  	[ index > 1 and: [
  		parentValue := array at: (parentIndex := index bitShift: -1).
  		sortBlock
  			ifNil: [ value <= parentValue ]
  			ifNotNil: [ sortBlock value: value value: parentValue ] ] ]
  		whileTrue: [
  			array at: index put: parentValue.
  			indexUpdateBlock ifNotNil: [ indexUpdateBlock value: parentValue value: index ].
  			index := parentIndex ].
  	array at: index put: value.
  	indexUpdateBlock ifNotNil: [ indexUpdateBlock value: value value: index ]!



More information about the Packages mailing list