IdentitySet.st
changeset 85 1343af456e28
parent 39 bcf183a31bbb
child 88 81dacba7a63a
equal deleted inserted replaced
84:1eba5946aea2 85:1343af456e28
    25 same as a Set but compares elements using == (i.e. they must be identical
    25 same as a Set but compares elements using == (i.e. they must be identical
    26 - not just equal in structure).
    26 - not just equal in structure).
    27 Since compare is on identity, hashing is also done via
    27 Since compare is on identity, hashing is also done via
    28 identityHash instead of hash.
    28 identityHash instead of hash.
    29 
    29 
    30 $Header: /cvs/stx/stx/libbasic/IdentitySet.st,v 1.6 1994-01-09 21:17:25 claus Exp $
    30 $Header: /cvs/stx/stx/libbasic/IdentitySet.st,v 1.7 1994-06-02 11:20:33 claus Exp $
    31 
    31 
    32 written jan 93 by claus
    32 written jan 93 by claus
    33 '!
    33 '!
    34 
    34 
    35 !IdentitySet methodsFor:'private'!
    35 !IdentitySet methodsFor:'private'!
    80     startIndex := key identityHash \\ length + 1.
    80     startIndex := key identityHash \\ length + 1.
    81 
    81 
    82     index := startIndex.
    82     index := startIndex.
    83     [true] whileTrue:[
    83     [true] whileTrue:[
    84         probe := keyArray basicAt:index.
    84         probe := keyArray basicAt:index.
       
    85         (probe isNil or: [key == probe]) ifTrue:[^ index].
    85         probe == DeletedEntry ifTrue:[
    86         probe == DeletedEntry ifTrue:[
    86             keyArray basicAt:index put:nil.
    87             keyArray basicAt:index put:nil.
    87             ^ index
    88             ^ index
    88         ].
    89         ].
    89         (probe isNil or: [key == probe]) ifTrue:[^ index].
    90 "/        (probe isNil or: [key == probe]) ifTrue:[^ index].
    90 
    91 
    91         index == length ifTrue:[
    92         index == length ifTrue:[
    92             index := 1
    93             index := 1
    93         ] ifFalse:[
    94         ] ifFalse:[
    94             index := index + 1
    95             index := index + 1