MCDefinitionIndex.st
author Claus Gittinger <cg@exept.de>
Tue, 11 Sep 2012 23:21:15 +0200
changeset 618 bd4226d917e0
parent 366 653947f4f083
child 790 beb50bd00335
permissions -rw-r--r--
category change

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

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


!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.4 2012-09-11 21:21:15 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCDefinitionIndex.st,v 1.4 2012-09-11 21:21:15 cg Exp $'
!

version_SVN
    ^ '§Id: MCDefinitionIndex.st 7 2010-09-12 07:18:55Z vranyj1 §'
! !