Andreas Raab uploaded a new version of Collections to project The Trunk: http://source.squeak.org/trunk/Collections-ar.139.mcz
==================== Summary ====================
Name: Collections-ar.139 Author: ar Time: 29 September 2009, 9:57:47 am UUID: bbe161fd-d845-df49-9abf-9c9f13b809f8 Ancestors: Collections-ar.138, Collections-ul.138
Merging Collections-ul.138:
- reimplement #rehash, #grow and #finalizeValues:
=============== Diff against Collections-ar.138 ===============
Item was changed: ----- Method: WeakKeyDictionary>>finalizeValues: (in category 'finalization') ----- finalizeValues: finiObjects "Remove all associations with key == nil and value is in finiObjects. This method is folded with #rehash for efficiency." + + | oldArray | - | oldArray assoc newIndex | oldArray := array. array := Array new: oldArray size. tally := 0. + 1 to: array size do:[ :i | + | association | + (association := oldArray at: i) ifNotNil: [ + (association key == nil and: [ finiObjects includes: association value ]) + ifFalse:[ + array + at: (self scanForEmptySlotFor: association key) + put: association ] ] ]! - 1 to: array size do:[:i| - assoc := oldArray at: i. - assoc ifNotNil:[ - (assoc key == nil and:[finiObjects includes: assoc value]) ifFalse:[ - newIndex := self scanForNil: assoc key. - self atNewIndex: newIndex put: assoc]. - ]. - ].!
Item was changed: ----- Method: Set>>grow (in category 'private') ----- grow "Grow the elements array and reinsert the old elements" + + self growTo: array size + self growSize! - | oldElements | - oldElements := array. - array := Array new: array size + self growSize. - tally := 0. - oldElements do: - [:each | each == nil ifFalse: [self noCheckAdd: each]]!
Item was changed: ----- Method: WeakSet>>growTo: (in category 'private') ----- growTo: anInteger "Grow the elements array and reinsert the old elements"
| oldElements |
oldElements := array. array := WeakArray new: anInteger. array atAllPut: flag. + self noCheckNoGrowFillFrom: oldElements! - tally := 0. - oldElements do: - [:each | (each == flag or: [each == nil]) ifFalse: [self noCheckAdd: each]]!
Item was changed: ----- Method: Set>>rehash (in category 'private') ----- rehash + + self growTo: array size! - | newSelf | - newSelf := self species new: self size. - self do: [:each | newSelf noCheckAdd: each]. - array := newSelf array!
squeak-dev@lists.squeakfoundation.org