Set.st
changeset 6991 e95313d7c780
parent 6917 979bfb9267e3
child 6994 0f08c1d8c2ac
equal deleted inserted replaced
6990:a6bda971619f 6991:e95313d7c780
   186     "
   186     "
   187      Set rehashAllSubInstances
   187      Set rehashAllSubInstances
   188     "
   188     "
   189 
   189 
   190     "Created: / 24.10.1997 / 23:13:44 / cg"
   190     "Created: / 24.10.1997 / 23:13:44 / cg"
       
   191 ! !
       
   192 
       
   193 !Set methodsFor:'ST80 compatibility'!
       
   194 
       
   195 initialIndexFor:hashKey boundedBy:length
       
   196     "for ST-80 compatibility only; it is (currently) not used in this
       
   197      implementation of sets. Therefore, in ST/X it does not make sense
       
   198      to redefine it. (which may be a bad design decision, but slightly
       
   199      improves performance, by avoiding an extra message send ...)"
       
   200 
       
   201     |index "{ Class:SmallInteger }"|
       
   202 
       
   203     index := hashKey bitAnd:16r3FFFFFFF.
       
   204     index < 16r1FFFFFFF ifTrue:[
       
   205         index := index * 2
       
   206     ].
       
   207     index := index \\ length + 1.
       
   208     ^ index.
       
   209 
       
   210     "Modified: 1.3.1997 / 01:01:13 / cg"
   191 ! !
   211 ! !
   192 
   212 
   193 !Set methodsFor:'accessing'!
   213 !Set methodsFor:'accessing'!
   194 
   214 
   195 at:index
   215 at:index
   708 
   728 
   709     "Modified: 21.3.1997 / 10:32:58 / cg"
   729     "Modified: 21.3.1997 / 10:32:58 / cg"
   710 !
   730 !
   711 
   731 
   712 hashFor:aKey
   732 hashFor:aKey
   713     "return an initial index given a key."
   733     "return the arguments hash value.
       
   734      Redefined in subclasses, which use a different comparison (i.e. identity compare)"
   714 
   735 
   715     ^ aKey hash
   736     ^ aKey hash
   716 
   737 
   717     "Created: 19.3.1997 / 15:03:03 / cg"
   738     "Created: 19.3.1997 / 15:03:03 / cg"
   718 !
       
   719 
       
   720 initialIndexFor:hashKey boundedBy:length
       
   721     "for ST-80 compatibility only; it is (currently) not used in this
       
   722      implementation of sets. Therefore, in ST/X it does not make sense
       
   723      to redefine it. (which may be a bad design decision, but slightly
       
   724      improves performance, by avoiding an extra message send ...)"
       
   725 
       
   726     |index "{ Class:SmallInteger }"|
       
   727 
       
   728     index := hashKey bitAnd:16r3FFFFFFF.
       
   729     index < 16r1FFFFFFF ifTrue:[
       
   730         index := index * 2
       
   731     ].
       
   732     index := index \\ length + 1.
       
   733     ^ index.
       
   734 
       
   735     "Modified: 1.3.1997 / 01:01:13 / cg"
       
   736 !
   739 !
   737 
   740 
   738 initialIndexForKey:aKey
   741 initialIndexForKey:aKey
   739     "return an initial index given a key."
   742     "return an initial index given a key."
   740 
   743 
  1119 ! !
  1122 ! !
  1120 
  1123 
  1121 !Set class methodsFor:'documentation'!
  1124 !Set class methodsFor:'documentation'!
  1122 
  1125 
  1123 version
  1126 version
  1124     ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.79 2002-11-29 11:10:04 cg Exp $'
  1127     ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.80 2003-02-02 16:41:18 cg Exp $'
  1125 ! !
  1128 ! !
  1126 
  1129 
  1127 Set initialize!
  1130 Set initialize!