IdentityDictionary.st
branchjv
changeset 20079 8d884971c2ed
parent 19559 d35a89d5c0ec
parent 20039 cd328445cac7
child 20131 4118d61ddba0
equal deleted inserted replaced
20078:a680abc90e84 20079:8d884971c2ed
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 1992 by Claus Gittinger
     4  COPYRIGHT (c) 1992 by Claus Gittinger
     3 	      All Rights Reserved
     5 	      All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
    96 
    98 
    97     startIndex := index := self initialIndexForKey:key.
    99     startIndex := index := self initialIndexForKey:key.
    98 
   100 
    99     [
   101     [
   100         probe := keyArray basicAt:index.
   102         probe := keyArray basicAt:index.
   101         probe == key ifTrue:[^ index].         "<<<< == is different from inherited"
   103         probe == key ifTrue:[^ index].         "<--- == is different from inherited"
   102         probe isNil ifTrue:[^ aBlock value].
   104         probe isNil ifTrue:[^ aBlock value].
   103 
   105 
   104         index == length ifTrue:[
   106         index == length ifTrue:[
   105             index := 1
   107             index := 1
   106         ] ifFalse:[
   108         ] ifFalse:[
   128     length := keyArray basicSize.
   130     length := keyArray basicSize.
   129     startIndex := index := self initialIndexForKey:key.
   131     startIndex := index := self initialIndexForKey:key.
   130 
   132 
   131     [
   133     [
   132         probe := keyArray basicAt:index.
   134         probe := keyArray basicAt:index.
   133         key == probe ifTrue:[^ index].              "<<<< == is different from inherited"   
   135         key == probe ifTrue:[^ index].              "<--- == is different from inherited"   
   134         probe isNil ifTrue:[
   136         probe isNil ifTrue:[
   135             delIndex == 0 ifTrue:[^ index].
   137             delIndex == 0 ifTrue:[^ index].
   136             keyArray basicAt:delIndex put:nil.
   138             keyArray basicAt:delIndex put:nil.
   137             ^ delIndex
   139             ^ delIndex
   138         ].
   140         ].
   139 
   141 
   140         probe == DeletedEntry ifTrue:[
   142         (delIndex == 0 and:[probe == DeletedEntry]) ifTrue:[
   141             delIndex == 0 ifTrue:[
   143             delIndex := index
   142                 delIndex := index
       
   143             ]
       
   144         ].
   144         ].
   145 
   145 
   146         index == length ifTrue:[
   146         index == length ifTrue:[
   147             index := 1
   147             index := 1
   148         ] ifFalse:[
   148         ] ifFalse:[
   151         index == startIndex ifTrue:[
   151         index == startIndex ifTrue:[
   152             delIndex ~~ 0 ifTrue:[
   152             delIndex ~~ 0 ifTrue:[
   153                 keyArray basicAt:delIndex put:nil.
   153                 keyArray basicAt:delIndex put:nil.
   154                 ^ delIndex
   154                 ^ delIndex
   155             ].
   155             ].
   156             ^ self grow findKeyOrNil:key
   156             self grow.
       
   157             length := keyArray basicSize.
       
   158             startIndex := index := self initialIndexForKey:key.
   157         ].
   159         ].
   158     ] loop.
   160     ] loop.
   159 
   161 
   160     "Modified: 26.3.1996 / 20:00:44 / cg"
   162     "Modified: 26.3.1996 / 20:00:44 / cg"
   161 !
   163 !