Registry.st
changeset 20235 9e8a7ad991f0
parent 20118 6e87720add31
child 20244 20922299fd44
child 20993 95a1fa000736
equal deleted inserted replaced
20234:1b1281334a9a 20235:9e8a7ad991f0
   223         ].
   223         ].
   224     ] loop.
   224     ] loop.
   225 
   225 
   226     "Modified: 30.1.1997 / 15:04:34 / cg"
   226     "Modified: 30.1.1997 / 15:04:34 / cg"
   227     "Modified: 1.10.1997 / 11:25:32 / stefan"
   227     "Modified: 1.10.1997 / 11:25:32 / stefan"
       
   228 !
       
   229 
       
   230 findKeyOrNilOrDeletedEntry:key
       
   231     "Look for the key in the receiver.
       
   232      If it is found, return the index,
       
   233      otherwise the index of the first unused slot.
       
   234      Grow the receiver, if key was not found, and no unused slots were present. 
       
   235 
       
   236      Redefined to not nil values of expired keys here."
       
   237 
       
   238     |index  "{ Class:SmallInteger }"
       
   239      length "{ Class:SmallInteger }"
       
   240      startIndex probe
       
   241      delIndex "{ Class:SmallInteger }"|
       
   242 
       
   243     (OperatingSystem blockInterrupts) ifFalse:[
       
   244         "/
       
   245         "/ may never be entered with interrupts enabled
       
   246         "/
       
   247         OperatingSystem unblockInterrupts.
       
   248         self error:'unblocked call of findKeyOrNil'.
       
   249     ].
       
   250 
       
   251     delIndex := 0.
       
   252 
       
   253     length := keyArray basicSize.
       
   254     startIndex := index := self initialIndexForKey:key.
       
   255 
       
   256     [
       
   257         probe := keyArray basicAt:index.
       
   258         key == probe ifTrue:[^ index].
       
   259         probe isNil ifTrue:[
       
   260             delIndex == 0 ifTrue:[^ index].
       
   261             ^ delIndex
       
   262         ].
       
   263 
       
   264         (delIndex == 0 and:[probe == DeletedEntry]) ifTrue:[
       
   265             delIndex := index
       
   266         ].
       
   267 
       
   268         index == length ifTrue:[
       
   269             index := 1
       
   270         ] ifFalse:[
       
   271             index := index + 1
       
   272         ].
       
   273         index == startIndex ifTrue:[
       
   274             delIndex ~~ 0 ifTrue:[
       
   275                 ^ delIndex
       
   276             ].
       
   277             self grow.
       
   278             length := keyArray basicSize.
       
   279             startIndex := index := self initialIndexForKey:key.
       
   280         ].
       
   281     ] loop.
       
   282 
       
   283     "Modified: 30.1.1997 / 15:04:34 / cg"
       
   284     "Modified: 1.10.1997 / 11:25:32 / stefan"
   228 ! !
   285 ! !
   229 
   286 
   230 !Registry methodsFor:'registering objects'!
   287 !Registry methodsFor:'registering objects'!
   231 
   288 
   232 register:anObject
   289 register:anObject