'From Pharo1.2a of ''11 June 2010'' [Latest update: #12220] on 31 October 2010 at 2:53:13 am'! !WeakRegistry methodsFor: 'accessing' stamp: 'IgorStasenko 10/31/2010 02:50'! size "Use #associationsDo: , to count associations with non-nil keys" | count | count := 0. self protected: [ valueDictionary associationsDo: [:ass | count := count +1 ]]. ^ count! ! !WeakRegistry methodsFor: 'adding' stamp: 'IgorStasenko 10/31/2010 02:44'! add: anObject executor: anExecutor " with new finalization, we can simply override associations with key == nil in valueDictionary " self protected: [ | finItem | finItem := valueDictionary at: anObject ifAbsent: [ WeakFinalizationList hasNewFinalization ifTrue: [ valueDictionary overridingAt: anObject put: (WeakFinalizerItem new list: list object: anObject) ] ifFalse: [ valueDictionary at: anObject put: (WeakFinalizerItem new list: list object: anObject) ] ]. finItem add: anExecutor ]. ^ anObject ! !