The Trunk: Collections-ul.190.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-ul.190.mcz

commits-2
Andreas Raab uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.190.mcz

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

Name: Collections-ul.190
Author: ul
Time: 13 November 2009, 2:40:52 am
UUID: 0eb718d2-fbcb-664c-b0d9-1350c528cc80
Ancestors: Collections-ul.186

In Set and subclasses:
- reimplemented #fixCollisionsFrom:
- removed #keyAt: and #swap:with:
Load Kernel-ul.297 before this

=============== Diff against Collections-ul.186 ===============

Item was added:
+ ----- Method: KeyedSet>>fixCollisionsFrom: (in category 'private') -----
+ fixCollisionsFrom: start
+ "The element at start has been removed and replaced by nil.
+ This method moves forward from there, relocating any entries
+ that had been placed below due to collisions with this one."
+
+ | element index |
+ index := start.
+ [ (element := array at: (index := index \\ array size + 1)) == nil ] whileFalse: [
+ | newIndex |
+ (newIndex := self scanFor: (keyBlock value: element)) = index ifFalse: [
+ array swap: index with: newIndex ] ]!

Item was changed:
  ----- Method: WeakSet>>fixCollisionsFrom: (in category 'private') -----
  fixCollisionsFrom: start
-
  "The element at start has been removed and replaced by flag.
  This method moves forward from there, relocating any entries
  that had been placed below due to collisions with this one."
 
  | element index |
  index := start.
+ [ (element := array at: (index := index \\ array size + 1)) == flag ] whileFalse: [
- [ (element := self keyAt: (index := index \\ array size + 1)) == flag ] whileFalse: [
  | newIndex |
  (newIndex := self scanFor: element) = index ifFalse: [
+ array swap: index with: newIndex ] ]
- self swap: index with: newIndex ] ]
  !

Item was changed:
  ----- Method: Set>>fixCollisionsFrom: (in category 'private') -----
  fixCollisionsFrom: start
  "The element at start has been removed and replaced by nil.
  This method moves forward from there, relocating any entries
  that had been placed below due to collisions with this one."
 
  | element index |
  index := start.
+ [ (element := array at: (index := index \\ array size + 1)) == nil ] whileFalse: [
- [ (element := self keyAt: (index := index \\ array size + 1)) == nil ] whileFalse: [
  | newIndex |
  (newIndex := self scanFor: element) = index ifFalse: [
+ array swap: index with: newIndex ] ]!
- self swap: index with: newIndex ] ]!

Item was added:
+ ----- Method: Dictionary>>fixCollisionsFrom: (in category 'private') -----
+ fixCollisionsFrom: start
+ "The element at start has been removed and replaced by nil.
+ This method moves forward from there, relocating any entries
+ that had been placed below due to collisions with this one."
+
+ | element index |
+ index := start.
+ [ (element := array at: (index := index \\ array size + 1)) == nil ] whileFalse: [
+ | newIndex |
+ (newIndex := self scanFor: element key) = index ifFalse: [
+ array swap: index with: newIndex ] ]!

Item was removed:
- ----- Method: KeyedSet>>keyAt: (in category 'private') -----
- keyAt: index
-
- ^keyBlock value: (array at: index)!

Item was removed:
- ----- Method: Set>>keyAt: (in category 'private') -----
- keyAt: index
- "May be overridden by subclasses so that fixCollisions will work"
- ^ array at: index!

Item was removed:
- ----- Method: Set>>swap:with: (in category 'private') -----
- swap: oneIndex with: otherIndex
- "May be overridden by subclasses so that fixCollisions will work"
-
- array swap: oneIndex with: otherIndex
- !

Item was removed:
- ----- Method: Dictionary>>keyAt: (in category 'private') -----
- keyAt: index
- "May be overridden by subclasses so that fixCollisions will work"
- | assn |
- assn := array at: index.
- assn == nil ifTrue: [^ nil]
- ifFalse: [^ assn key]!