--- a/Set.st Tue Jan 15 16:02:07 2013 +0100
+++ b/Set.st Tue Jan 15 17:33:48 2013 +0100
@@ -1066,28 +1066,26 @@
].
^ count
+
+ "
+ self allSubInstances
+ collect:[:each| each collisionCount -> each]
+ thenSelect:[:each| each key > 0]
+ "
!
collisionsFor:key
"Return the number of searches - 1 required for key"
|index "{ Class:SmallInteger }"
- length "{ Class:SmallInteger }"
- hash "{ Class:SmallInteger }"
- step "{ Class:SmallInteger }"
- startIndex probe count|
+ length "{ Class:SmallInteger }" startIndex probe count|
length := keyArray basicSize.
- hash := (self hashFor:key) bitAnd:16r3FFFFFFF.
- hash < 16r1FFFFFFF ifTrue:[
- hash := hash * 2
- ].
- startIndex := index := hash \\ length + 1.
- step:= hash // length + 1.
+ startIndex := index := self initialIndexForKey:key.
count := 0.
[true] whileTrue:[
- probe := (keyArray basicAt:index).
+ probe := keyArray basicAt:index.
(probe notNil and:[key = probe]) ifTrue:[^ count].
(self slotIsEmpty:probe) ifTrue:[self error:'non existing key'].
@@ -1125,6 +1123,7 @@
^ tally
! !
+
!Set methodsFor:'testing'!
capacity
@@ -1226,11 +1225,12 @@
!Set class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.115 2012-08-13 17:11:21 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.116 2013-01-15 16:33:48 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.115 2012-08-13 17:11:21 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.116 2013-01-15 16:33:48 stefan Exp $'
! !
+
Set initialize!