Dictionary.st
branchjv
changeset 18335 165360a15be3
parent 18120 e3a375d5f6a8
parent 18332 68976cee1b99
child 18345 fb699032075a
--- a/Dictionary.st	Sun May 10 07:10:08 2015 +0100
+++ b/Dictionary.st	Mon May 11 06:58:50 2015 +0200
@@ -249,6 +249,7 @@
     ^ true
 ! !
 
+
 !Dictionary methodsFor:'accessing'!
 
 associationAt:aKey
@@ -920,7 +921,7 @@
 
     tally := tally - 1.
     tally == 0 ifTrue:[
-        self setTally:0
+        self initializeForCapacity:0
     ] ifFalse:[
 "/        index == keyArray basicSize ifTrue:[
 "/            next := 1
@@ -995,7 +996,7 @@
                 keyArray basicAt:idx put:nil.
                 tally := tally - 1.
                 tally == 0 ifTrue:[
-                    self setTally:0.
+                    self initializeForCapacity:0.
                     ^ oldKey
                 ].
 
@@ -1420,7 +1421,6 @@
     valueArray := valueArray shallowCopy
 ! !
 
-
 !Dictionary methodsFor:'enumerating'!
 
 allKeysDo:aBlock
@@ -1967,6 +1967,26 @@
     ]
 !
 
+initializeForCapacity:minSize
+    "initialize the contents array (for at least minSize slots)
+     and set tally to zero.
+     The size is increased to the next prime for better hashing behavior."
+
+    |n|
+
+    n := self class goodSizeFrom:minSize.
+    n == keyArray size ifTrue:[
+        keyArray atAllPut:nil.
+        valueArray atAllPut:nil.
+    ] ifFalse:[
+        keyArray := self keyContainerOfSize:n.
+        valueArray := self valueContainerOfSize:n.
+    ].
+    tally := 0
+
+    "Modified: / 5.8.1998 / 10:48:51 / cg"
+!
+
 rehash
     "rehash contents - is done by re-adding all elements to a new, empty key/value array pair)."
 
@@ -2024,26 +2044,6 @@
     ]
 !
 
-setTally:count
-    "initialize the contents array (for at least count slots)
-     and set tally to zero.
-     The size is increased to the next prime for better hashing behavior."
-
-    |n|
-
-    n := self class goodSizeFrom:count.
-    n == keyArray size ifTrue:[
-	keyArray atAllPut:nil.
-	valueArray atAllPut:nil.
-    ] ifFalse:[
-	keyArray := self keyContainerOfSize:n.
-	valueArray := self valueContainerOfSize:n.
-    ].
-    tally := 0
-
-    "Modified: / 5.8.1998 / 10:48:51 / cg"
-!
-
 valueContainerOfSize:n
     "return a container for values of size n.
      Extracted to make life of weak subclasses easier ..."
@@ -2263,13 +2263,14 @@
     ^ aVisitor visitDictionary:self with:aParameter
 ! !
 
+
 !Dictionary class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Dictionary.st,v 1.124 2015-03-25 22:22:36 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Dictionary.st,v 1.125 2015-05-09 11:58:24 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Dictionary.st,v 1.124 2015-03-25 22:22:36 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Dictionary.st,v 1.125 2015-05-09 11:58:24 cg Exp $'
 ! !