CachingRegistry.st
branchjv
changeset 20398 8cb53f870d39
parent 20079 8d884971c2ed
parent 20388 db4b243d97ce
child 20577 a27e7b3031cb
equal deleted inserted replaced
20397:59b59d09f64e 20398:8cb53f870d39
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 1999 by eXept Software AG
     4  COPYRIGHT (c) 1999 by eXept Software AG
     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
    61 
    63 
    62     [class variables:]
    64     [class variables:]
    63 "
    65 "
    64 ! !
    66 ! !
    65 
    67 
       
    68 !CachingRegistry methodsFor:'enumerating'!
       
    69 
       
    70 detect:aBlock ifNone:exceptionValue
       
    71     "... additionaly move it to the front of the LRU chain"
       
    72 
       
    73     keyArray validElementsDo:[:obj |
       
    74         (obj ~~ DeletedEntry and:[aBlock value:obj]) ifTrue:[
       
    75             keptReferences 
       
    76                 removeIdentical:obj ifAbsent:[];
       
    77                 addLast:obj.
       
    78             ^ obj
       
    79         ].
       
    80     ].
       
    81     ^ exceptionValue value
       
    82 ! !
       
    83 
    66 !CachingRegistry methodsFor:'private'!
    84 !CachingRegistry methodsFor:'private'!
    67 
    85 
    68 cacheSize:aNumber
    86 cacheSize:aNumber
    69     keptReferences := OrderedCollection new:aNumber.
    87     keptReferences := OrderedCollection new:aNumber.
    70     cacheSize := aNumber.
    88     cacheSize := aNumber.