"{ Encoding: utf8 }"
"{ Package: 'stx:libbasic2' }"
"{ NameSpace: Smalltalk }"
Collection subclass:#VirtualDictionary
instanceVariableNames:'fetchBlock'
classVariableNames:''
poolDictionaries:''
category:'Collections-Unordered'
!
!VirtualDictionary class methodsFor:'documentation'!
documentation
"
a collection which looks like a (read-only) dictionary to the outside,
but invokes a pluggable fetchBlock to retrieve keys.
[author:]
cg
[instance variables:]
[class variables:]
[see also:]
"
! !
!VirtualDictionary methodsFor:'accessing'!
at:aKey
^ self at:aKey ifAbsent:nil
!
at:aKey ifAbsent:exceptionValue
|value|
value := fetchBlock value:aKey.
value isNil ifTrue:[
^ exceptionValue value
].
^ value
!
fetchBlock:something
fetchBlock := something.
! !
!VirtualDictionary methodsFor:'queries'!
includesKey:aKey
^ (fetchBlock value:aKey) notNil
! !
!VirtualDictionary class methodsFor:'documentation'!
version
^ '$Header$'
!
version_CVS
^ '$Header$'
! !