--- a/IdentitySet.st Thu Nov 22 15:55:08 2001 +0100
+++ b/IdentitySet.st Fri Nov 23 11:13:43 2001 +0100
@@ -61,16 +61,17 @@
return the value of evaluating aBlock.
Redefined to compare for identity instead of equality"
- |index "{ Class:SmallInteger }"
- length startIndex probe |
+ |index "{ Class:SmallInteger }"
+ length "{ Class:SmallInteger }"
+ startIndex probe |
length := keyArray basicSize.
"/
"/ length < 10 ifTrue:[
-"/ "assuming, that for small sets the overhead of hashing
-"/ is large ..."
-"/ ^ keyArray identityIndexOf:key ifAbsent:aBlock.
+"/ "assuming, that for small sets the overhead of hashing
+"/ is large ..."
+"/ ^ keyArray identityIndexOf:key ifAbsent:aBlock.
"/ ].
"/
@@ -82,18 +83,18 @@
startIndex := index.
[true] whileTrue:[
- probe := (keyArray basicAt:index).
- probe == key ifTrue:[^ index].
- probe isNil ifTrue:[^ aBlock value].
+ probe := keyArray basicAt:index.
+ probe == key ifTrue:[^ index]. "<<<< == is different from inherited"
+ (self slotIsEmpty:probe) ifTrue:[^ aBlock value].
- index == length ifTrue:[
- index := 1
- ] ifFalse:[
- index := index + 1
- ].
- index == startIndex ifTrue:[
- ^ aBlock value
- ]
+ index == length ifTrue:[
+ index := 1
+ ] ifFalse:[
+ index := index + 1
+ ].
+ index == startIndex ifTrue:[
+ ^ aBlock value
+ ]
]
!
@@ -191,5 +192,5 @@
!IdentitySet class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/IdentitySet.st,v 1.25 2000-08-22 19:52:01 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/IdentitySet.st,v 1.26 2001-11-23 10:12:03 martin Exp $'
! !