[squeak-dev] The Trunk: Collections-ct.973.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Dec 29 02:25:10 UTC 2021


Christoph Thiede uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ct.973.mcz

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

Name: Collections-ct.973
Author: ct
Time: 29 December 2021, 3:25:08.315489 am
UUID: d4b6fdad-0d80-b74f-bcbc-6ef32983063c
Ancestors: Collections-ct.972

Removes PluggableWeakKeyDictionary for now. See: http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217861.html

=============== Diff against Collections-ct.972 ===============

Item was removed:
- WeakKeyDictionary subclass: #PluggableWeakKeyDictionary
- 	instanceVariableNames: 'hashBlock equalBlock'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Collections-Weak'!
- 
- !PluggableWeakKeyDictionary commentStamp: 'ct 12/27/2021 01:07' prior: 0!
- I combine the features of PluggableDictionary and WeakKeyDictionary, i.e., clients can supply custom blocks for comparing and hasing my keys, and I hold weakly on my keys.!

Item was removed:
- ----- Method: PluggableWeakKeyDictionary class>>integerDictionary (in category 'instance creation') -----
- integerDictionary
- 	^ self new hashBlock: [:integer | integer hash \\ 1064164 * 1009]!

Item was removed:
- ----- Method: PluggableWeakKeyDictionary>>= (in category 'comparing') -----
- = anObject
- 	"Two dictionaries are equal if
- 	 (a) they are the same 'kind' of thing.
- 	 (b) they have the same set of keys.
- 	 (c) for each (common) key, they have the same value"
- 
- 	self == anObject ifTrue: [ ^true ].
- 	self species == anObject species ifFalse: [ ^false ].
- 	hashBlock = anObject hashBlock ifFalse: [ ^false ].
- 	equalBlock = anObject equalBlock ifFalse: [ ^false ].
- 	self size = anObject size ifFalse: [ ^false ].
- 	self associationsDo: [ :association |
- 		(anObject at: association key ifAbsent: [ ^false ]) = association value
- 			ifFalse: [ ^false ] ].
- 	^true!

Item was removed:
- ----- Method: PluggableWeakKeyDictionary>>collect: (in category 'enumerating') -----
- collect: aBlock 
- 	"Evaluate aBlock with each of my values as the argument.  Collect the resulting values into a collection that is like me. Answer with the new collection."
- 	
- 	| newCollection |
- 	newCollection := (self species new: self size)
- 		hashBlock: hashBlock;
- 		equalBlock: equalBlock;
- 		yourself.
- 	self associationsDo: [ :each |
- 		newCollection at: each key put: (aBlock value: each value) ].
- 	^newCollection
- 
- !

Item was removed:
- ----- Method: PluggableWeakKeyDictionary>>copyEmpty (in category 'copying') -----
- copyEmpty
- 
- 	^super copyEmpty
- 		hashBlock: hashBlock;
- 		equalBlock: equalBlock;
- 		yourself!

Item was removed:
- ----- Method: PluggableWeakKeyDictionary>>equalBlock (in category 'accessing') -----
- equalBlock
- 	"Return the block used for comparing the elements in the receiver."
- 	^equalBlock!

Item was removed:
- ----- Method: PluggableWeakKeyDictionary>>equalBlock: (in category 'accessing') -----
- equalBlock: aBlock
- 	"Set a new equality block. The block must accept two arguments and return true if the argumets are considered to be equal, false otherwise"
- 	equalBlock := aBlock.!

Item was removed:
- ----- Method: PluggableWeakKeyDictionary>>hashBlock (in category 'accessing') -----
- hashBlock
- 	"Return the block used for hashing the elements in the receiver."
- 	^hashBlock!

Item was removed:
- ----- Method: PluggableWeakKeyDictionary>>hashBlock: (in category 'accessing') -----
- hashBlock: aBlock
- 	"Set a new hash block. The block must accept one argument and must return the hash value of the given argument."
- 	hashBlock := aBlock.!

Item was removed:
- ----- Method: PluggableWeakKeyDictionary>>scanFor: (in category 'private') -----
- scanFor: anObject 
- 	"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 raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
- 	
- 	| index start size |
- 	index := start := (hashBlock
- 		ifNil: [ anObject hash ]
- 		ifNotNil: [ hashBlock value: anObject ]) \\ (size := array size) + 1.
- 	[ 
- 		| element |
- 		((element := array at: index) == nil or: [
- 			equalBlock
- 				ifNil: [ element key = anObject ]
- 				ifNotNil: [ equalBlock value: element key value: anObject ] ])
- 			ifTrue: [ ^index ].
- 		(index := index \\ size + 1) = start ] whileFalse.
- 	self errorNoFreeSpace!

Item was removed:
- ----- Method: PluggableWeakKeyDictionary>>scanForEmptySlotFor: (in category 'private') -----
- scanForEmptySlotFor: anObject
- 	"Scan the key array for the first slot containing an empty slot (indicated by a nil). Answer the index of that slot. This method will be overridden in various subclasses that have different interpretations for matching elements."
- 	
- 	| index start size |
- 	index := start := (hashBlock
- 		ifNil: [ anObject hash ]
- 		ifNotNil: [ hashBlock value: anObject ]) \\ (size := array size) + 1.
- 	[ 
- 		(array at: index) ifNil: [ ^index ].
- 		(index := index \\ size + 1) = start ] whileFalse.
- 	self errorNoFreeSpace!



More information about the Squeak-dev mailing list