WeakIdentitySet.st
changeset 187 a5dc8e2fa93f
parent 159 514c749165c3
child 216 a8abff749575
equal deleted inserted replaced
186:a4c3032fc825 187:a5dc8e2fa93f
     1 "
     1 "
     2  COPYRIGHT (c) 1994 by Claus Gittinger
     2  COPYRIGHT (c) 1994 by Claus Gittinger
     3               All Rights Reserved
     3 	      All Rights Reserved
     4 
     4 
     5  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
     6  only in accordance with the terms of that license and with the
     6  only in accordance with the terms of that license and with the
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
    17        category:'Collections-Unordered'
    17        category:'Collections-Unordered'
    18 !
    18 !
    19 
    19 
    20 WeakIdentitySet comment:'
    20 WeakIdentitySet comment:'
    21 COPYRIGHT (c) 1994 by Claus Gittinger
    21 COPYRIGHT (c) 1994 by Claus Gittinger
    22               All Rights Reserved
    22 	      All Rights Reserved
    23 
    23 
    24 $Header: /cvs/stx/stx/libbasic/WeakIdentitySet.st,v 1.3 1994-10-10 00:29:15 claus Exp $
    24 $Header: /cvs/stx/stx/libbasic/WeakIdentitySet.st,v 1.4 1994-10-28 01:31:00 claus Exp $
    25 '!
    25 '!
    26 
    26 
    27 !WeakIdentitySet class methodsFor:'documentation'!
    27 !WeakIdentitySet class methodsFor:'documentation'!
    28 
    28 
    29 copyright
    29 copyright
    30 "
    30 "
    31  COPYRIGHT (c) 1994 by Claus Gittinger
    31  COPYRIGHT (c) 1994 by Claus Gittinger
    32               All Rights Reserved
    32 	      All Rights Reserved
    33 
    33 
    34  This software is furnished under a license and may be used
    34  This software is furnished under a license and may be used
    35  only in accordance with the terms of that license and with the
    35  only in accordance with the terms of that license and with the
    36  inclusion of the above copyright notice.   This software may not
    36  inclusion of the above copyright notice.   This software may not
    37  be provided or otherwise made available to, or used by, any
    37  be provided or otherwise made available to, or used by, any
    40 "
    40 "
    41 !
    41 !
    42 
    42 
    43 version
    43 version
    44 "
    44 "
    45 $Header: /cvs/stx/stx/libbasic/WeakIdentitySet.st,v 1.3 1994-10-10 00:29:15 claus Exp $
    45 $Header: /cvs/stx/stx/libbasic/WeakIdentitySet.st,v 1.4 1994-10-28 01:31:00 claus Exp $
    46 "
    46 "
    47 !
    47 !
    48 
    48 
    49 documentation
    49 documentation
    50 "
    50 "
    67     "return a good array size for the given argument.
    67     "return a good array size for the given argument.
    68      Since WeakIdentitySets are mostly used for dependency management, we typically
    68      Since WeakIdentitySets are mostly used for dependency management, we typically
    69      have only one element in the set. Therefore use exact size for small sets
    69      have only one element in the set. Therefore use exact size for small sets
    70      (instead of rounding up to the prime 11)."
    70      (instead of rounding up to the prime 11)."
    71 
    71 
    72     arg <= 10 ifTrue:[^ arg].
    72     arg <= 10 ifTrue:[
       
    73 	arg < 1 ifTrue:[^ 1].
       
    74 	^ arg.
       
    75     ].
    73     ^ super goodSizeFor:arg
    76     ^ super goodSizeFor:arg
    74 !
    77 !
    75 
    78 
    76 keyContainerOfSize:n
    79 keyContainerOfSize:n
    77     "return a container for keys and values of size n.
    80     "return a container for keys and values of size n.