PPContextMemento.st
changeset 421 7e08b31e0dae
parent 377 6112a403a52d
child 650 4c6ed0a28d18
equal deleted inserted replaced
420:b2f2f15cef26 421:7e08b31e0dae
    48 	
    48 	
    49 	^ self propertyAt: aKey ifAbsent: [ self error: 'Property not found' ]
    49 	^ self propertyAt: aKey ifAbsent: [ self error: 'Property not found' ]
    50 !
    50 !
    51 
    51 
    52 propertyAt: aKey ifAbsent: aBlock
    52 propertyAt: aKey ifAbsent: aBlock
    53         "Answer the property value associated with aKey or, if aKey isn't found, answer the result of evaluating aBlock."
    53 	"Answer the property value associated with aKey or, if aKey isn't found, answer the result of evaluating aBlock."
    54 
    54 	
    55         properties isNil
    55 	properties isNil
    56                 ifTrue: [ ^  aBlock value ]
    56 		ifTrue: [ ^ aBlock value ]
    57                 ifFalse: [ 
    57 		ifFalse: [ 
    58                         (properties includesKey: aKey) ifTrue: [ 
    58 			(properties includesKey: aKey) ifTrue: [ 
    59                                 ^ (properties at: aKey) copy
    59 				^ (properties at: aKey) copy
    60                         ].
    60 			].
    61                         ^ aBlock value
    61 			^ aBlock value
    62                 ]
    62 		]
    63 
       
    64     "Created: / 03-10-2014 / 02:17:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    65 !
    63 !
    66 
    64 
    67 propertyAt: aKey ifAbsentPut: aBlock
    65 propertyAt: aKey ifAbsentPut: aBlock
    68 	"Answer the property associated with aKey or, if aKey isn't found store the result of evaluating aBlock as new value."
    66 	"Answer the property associated with aKey or, if aKey isn't found store the result of evaluating aBlock as new value."
    69 	
    67