[squeak-dev] The Trunk: Collections-ar.141.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Sep 30 05:03:49 UTC 2009


Andreas Raab uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ar.141.mcz

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

Name: Collections-ar.141
Author: ar
Time: 29 September 2009, 10:03:18 am
UUID: 77f402bd-4b08-bb41-8d16-a0576783e35f
Ancestors: Collections-ar.140, Collections-ul.140

Merging Collections-ul.140:

- removed unused #scanForNil: implementations (replaced by #scanForEmptySlotFor:), updated comments in #scanFor:

=============== Diff against Collections-ar.140 ===============

Item was changed:
  ----- Method: WeakIdentityKeyDictionary>>scanFor: (in category 'private') -----
  scanFor: anObject
- 	"ar 10/21/2000: The method has been copied to this location to indicate that whenever #scanFor: changes #scanForNil: must be changed in the receiver as well."
  	"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or zero if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
  	| element start finish hash |
  	finish := array size.
  	finish > 4096
  		ifTrue: [hash := anObject identityHash * (finish // 4096)]
  		ifFalse: [hash := anObject identityHash].
  	start := (hash \\ finish) + 1.
  
  	"Search from (hash mod size) to the end."
  	start to: finish do:
  		[:index | ((element := array at: index) == nil or: [element key == anObject])
  			ifTrue: [^ index ]].
  
  	"Search from 1 to where we started."
  	1 to: start-1 do:
  		[:index | ((element := array at: index) == nil or: [element key == anObject])
  			ifTrue: [^ index ]].
  
  	^ 0  "No match AND no empty slot"!

Item was changed:
  ----- Method: WeakKeyDictionary>>scanFor: (in category 'private') -----
  scanFor: anObject
- 	"ar 10/21/2000: The method has been copied to this location to indicate that whenever #scanFor: changes #scanForNil: must be changed in the receiver as well."
  	"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or zero if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
  	| element start finish |
  	finish := array size.
  	start := (anObject hash \\ finish) + 1.
  	
  	"Search from (hash mod size) to the end."
  	start to: finish do:
  		[:index | ((element := array at: index) == nil or: [element key = anObject])
  			ifTrue: [^ index ]].
  
  	"Search from 1 to where we started."
  	1 to: start-1 do:
  		[:index | ((element := array at: index) == nil or: [element key = anObject])
  			ifTrue: [^ index ]].
  
  	^ 0  "No match AND no empty slot"!

Item was removed:
- ----- Method: WeakIdentityKeyDictionary>>scanForNil: (in category 'private') -----
- scanForNil: anObject
- 	"Private. Scan the key array for the first slot containing nil (indicating an empty slot). Answer the index of that slot."
- 	| start finish hash |
- 	finish := array size.
- 	finish > 4096
- 		ifTrue: [hash := anObject identityHash * (finish // 4096)]
- 		ifFalse: [hash := anObject identityHash].
- 	start := (hash \\ array size) + 1.
- 
- 	"Search from (hash mod size) to the end."
- 	start to: finish do:
- 		[:index | (array at: index) == nil ifTrue: [^ index ]].
- 
- 	"Search from 1 to where we started."
- 	1 to: start-1 do:
- 		[:index | (array at: index) == nil ifTrue: [^ index ]].
- 
- 	^ 0  "No match AND no empty slot"!

Item was removed:
- ----- Method: WeakKeyDictionary>>scanForNil: (in category 'private') -----
- scanForNil: anObject
- 	"Private. Scan the key array for the first slot containing nil (indicating an empty slot). Answer the index of that slot."
- 	| start finish |
- 	start := (anObject hash \\ array size) + 1.
- 	finish := array size.
- 
- 	"Search from (hash mod size) to the end."
- 	start to: finish do:
- 		[:index | (array at: index) == nil ifTrue: [^ index ]].
- 
- 	"Search from 1 to where we started."
- 	1 to: start-1 do:
- 		[:index | (array at: index) == nil ifTrue: [^ index ]].
- 
- 	^ 0  "No match AND no empty slot"!




More information about the Squeak-dev mailing list