IdSet.st
changeset 3 24d81bf47225
parent 1 a27a279701f8
child 10 4f1f9a91e406
equal deleted inserted replaced
2:6526dde5f3ac 3:24d81bf47225
    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 %W% %E%
    30 $Header: /cvs/stx/stx/libbasic/Attic/IdSet.st,v 1.3 1993-10-13 00:16:12 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'!
    39      the index of the slot containing the key, otherwise
    39      the index of the slot containing the key, otherwise
    40      return the value of evaluating aBlock.
    40      return the value of evaluating aBlock.
    41      Redefined to compare for identity instead of equality"
    41      Redefined to compare for identity instead of equality"
    42 
    42 
    43     |index      "{ Class:SmallInteger }"
    43     |index      "{ Class:SmallInteger }"
    44      length     "{ Class:SmallInteger }"
    44      length startIndex probe |
    45      startIndex "{ Class:SmallInteger }" 
       
    46      probe |
       
    47 
    45 
    48     length := contentsArray basicSize.
    46     length := contentsArray basicSize.
    49     startIndex := key identityHash \\ length + 1.
    47     startIndex := key identityHash \\ length + 1.
    50 
    48 
    51     index := startIndex.
    49     index := startIndex.
    68 findElementOrNil:key
    66 findElementOrNil:key
    69     "Look for the key in the receiver.  Redefined to compare for
    67     "Look for the key in the receiver.  Redefined to compare for
    70      identity instead of equality"
    68      identity instead of equality"
    71 
    69 
    72     |index      "{ Class:SmallInteger }"
    70     |index      "{ Class:SmallInteger }"
    73      length     "{ Class:SmallInteger }"
    71      length startIndex probe |
    74      startIndex "{ Class:SmallInteger }"
       
    75      probe |
       
    76 
    72 
    77     length := contentsArray basicSize.
    73     length := contentsArray basicSize.
    78     startIndex := key identityHash \\ length + 1.
    74     startIndex := key identityHash \\ length + 1.
    79 
    75 
    80     index := startIndex.
    76     index := startIndex.