--- a/IdentityDictionary.st Thu Aug 11 06:44:08 2016 +0200
+++ b/IdentityDictionary.st Fri Aug 12 06:44:59 2016 +0200
@@ -110,6 +110,12 @@
] loop.
!
+findIdentical:key ifAbsent:aBlock
+ "IdentityDictionary does identity compare anyway..."
+
+ ^ self find:key ifAbsent:aBlock
+!
+
findKeyOrNil:key
"Look for the key in the receiver.
If it is found, return the index of the first unused slot.
@@ -160,6 +166,51 @@
"Modified: 26.3.1996 / 20:00:44 / cg"
!
+findKeyOrNilOrDeletedEntry:key
+ "Look for the key in the receiver.
+ If it is found, return the index of the first unused slot.
+ Grow the receiver, if key was not found, and no unused slots were present."
+
+ |index "{ Class:SmallInteger }"
+ length "{ Class:SmallInteger }"
+ startIndex probe
+ delIndex "{ Class:SmallInteger }"|
+
+ delIndex := 0.
+
+ length := keyArray basicSize.
+ startIndex := index := self initialIndexForKey:key.
+
+ [
+ probe := keyArray basicAt:index.
+ key == probe ifTrue:[^ index]. "<--- == is different from inherited"
+ probe isNil ifTrue:[
+ delIndex == 0 ifTrue:[^ index].
+ ^ delIndex
+ ].
+
+ (delIndex == 0 and:[probe == DeletedEntry]) ifTrue:[
+ delIndex := index
+ ].
+
+ index == length ifTrue:[
+ index := 1
+ ] ifFalse:[
+ index := index + 1
+ ].
+ index == startIndex ifTrue:[
+ delIndex ~~ 0 ifTrue:[
+ ^ delIndex
+ ].
+ self grow.
+ length := keyArray basicSize.
+ startIndex := index := self initialIndexForKey:key.
+ ].
+ ] loop.
+
+ "Modified: 26.3.1996 / 20:00:44 / cg"
+!
+
hashFor:aKey
"return an initial index given a key."
@@ -198,5 +249,9 @@
version
^ '$Header$'
+!
+
+version_CVS
+ ^ '$Header$'
! !