IdentityDictionary.st
changeset 3 24d81bf47225
parent 1 a27a279701f8
child 10 4f1f9a91e406
equal deleted inserted replaced
2:6526dde5f3ac 3:24d81bf47225
    24 
    24 
    25 same as a Dictionary but key must be identical - not just equal.
    25 same as a Dictionary but key must be identical - not just equal.
    26 Since compare is on identity keys, hashing is also done via
    26 Since compare is on identity keys, hashing is also done via
    27 identityHash instead of hash.
    27 identityHash instead of hash.
    28 
    28 
    29 %W% %E%
    29 $Header: /cvs/stx/stx/libbasic/IdentityDictionary.st,v 1.3 1993-10-13 00:16:10 claus Exp $
    30 
    30 
    31 written jul 92 by claus
    31 written jul 92 by claus
    32 '!
    32 '!
    33 
    33 
    34 !IdentityDictionary methodsFor:'private'!
    34 !IdentityDictionary methodsFor:'private'!
    38      the index of the association containing the key, otherwise
    38      the index of the association containing the key, otherwise
    39      return the index of the first unused slot. Grow the receiver,
    39      return the index of the first unused slot. Grow the receiver,
    40      if key was not found, and no unused slots where present"
    40      if key was not found, and no unused slots where present"
    41 
    41 
    42     |index  "{ Class:SmallInteger }"
    42     |index  "{ Class:SmallInteger }"
    43      length "{ Class:SmallInteger }"
    43      length startIndex probe |
    44      startIndex
       
    45      probe |
       
    46 
    44 
    47     length := keyArray basicSize.
    45     length := keyArray basicSize.
    48     startIndex := key identityHash \\ length + 1.
    46     startIndex := key identityHash \\ length + 1.
    49 
    47 
    50     index := startIndex.
    48     index := startIndex.