MCDefinitionIndex.st
author Claus Gittinger <cg@exept.de>
Mon, 14 May 2018 02:21:18 +0200
changeset 1048 582b3a028cbc
parent 790 beb50bd00335
child 1002 54b4906215ca
permissions -rw-r--r--
#FEATURE by cg class: MCMethodDefinition changed: #postloadOver:

"{ Package: 'stx:goodies/monticello' }"

Object subclass:#MCDefinitionIndex
	instanceVariableNames:'definitions'
	classVariableNames:''
	poolDictionaries:''
	category:'SCM-Monticello-Patching'
!

!MCDefinitionIndex class methodsFor:'documentation'!

documentation
"
    I'm a simple container of MCDefinitions which can be added or removed.
"
! !

!MCDefinitionIndex class methodsFor:'initialization'!

new
    ^self basicNew initialize
! !

!MCDefinitionIndex class methodsFor:'as yet unclassified'!

definitions: aCollection
	^ self new addAll: aCollection
! !

!MCDefinitionIndex methodsFor:'as yet unclassified'!

add: aDefinition
	definitions at: aDefinition description put: aDefinition
!

addAll: aCollection
	aCollection do: [:ea | self add: ea]
!

definitionLike: aDefinition ifPresent: foundBlock ifAbsent: errorBlock
	| definition |
	definition := definitions at: aDefinition description ifAbsent: [].
	^ definition
		ifNil: errorBlock
		ifNotNil: [foundBlock value: definition]
!

definitions
	^ definitions values
!

initialize
	super initialize.
	definitions := Dictionary new
!

remove: aDefinition
	definitions removeKey: aDefinition description ifAbsent: []
! !

!MCDefinitionIndex class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCDefinitionIndex.st,v 1.5 2013-05-15 11:57:02 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCDefinitionIndex.st,v 1.5 2013-05-15 11:57:02 cg Exp $'
!

version_SVN
    ^ '$Id: MCDefinitionIndex.st,v 1.5 2013-05-15 11:57:02 cg Exp $'
! !