Set.st
changeset 18331 521e3c40ea23
parent 18221 5299a2514ed2
child 18335 165360a15be3
child 18466 0359b064feba
--- a/Set.st	Fri May 08 12:29:19 2015 +0200
+++ b/Set.st	Sat May 09 13:58:00 2015 +0200
@@ -157,7 +157,7 @@
      make it somewhat bigger; hashing works better if fill grade is
      below 10% (make it 75% here ..)
     "
-    ^ self basicNew setTally:(anInteger * 4 // 3)
+    ^ self basicNew initializeForCapacity:(anInteger * 4 // 3)
 ! !
 
 !Set class methodsFor:'queries'!
@@ -202,7 +202,6 @@
     "Created: / 24.10.1997 / 23:13:44 / cg"
 ! !
 
-
 !Set methodsFor:'Compatibility-ST80'!
 
 initialIndexFor:hashKey boundedBy:length
@@ -429,7 +428,7 @@
 removeAll
     "remove all elements from the receiver. Returns the receiver."
 
-    self setTally:7.
+    self initializeForCapacity:7.
 
     "Modified: 12.4.1996 / 13:35:06 / cg"
 !
@@ -816,6 +815,7 @@
 ! !
 
 
+
 !Set methodsFor:'obsolete set operations'!
 
 + aCollection
@@ -996,6 +996,24 @@
     "Created: 19.3.1997 / 15:02:41 / cg"
 !
 
+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.
+    ] ifFalse:[
+        keyArray := self keyContainerOfSize:n. 
+    ].
+    tally := 0
+
+    "Modified: / 4.8.1998 / 22:07:25 / cg"
+!
+
 invalidElementError
     "this is send when a nil is used with a Set.
      For now this is just an info-Message. Will become an error sometimes."
@@ -1073,24 +1091,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.
-    ] ifFalse:[
-	keyArray := self keyContainerOfSize:n. 
-    ].
-    tally := 0
-
-    "Modified: / 4.8.1998 / 22:07:25 / cg"
-!
-
 slotIsEmpty:aSlotValue
     "only redefined in weak subclasses, since they treat a 0-value
      as being empty"
@@ -1336,11 +1336,11 @@
 !Set class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.132 2015-04-16 16:29:45 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.133 2015-05-09 11:58:00 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.132 2015-04-16 16:29:45 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.133 2015-05-09 11:58:00 cg Exp $'
 ! !