MCDefinitionIndex.st
author Claus Gittinger <cg@exept.de>
Wed, 22 Nov 2006 14:12:15 +0100
changeset 63 150479ea08e3
child 253 210420763f65
permissions -rw-r--r--
initial checkin

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

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


!MCDefinitionIndex class methodsFor:'as yet unclassified'!

definitions: aCollection
	^ self new addAll: aCollection
!

new
	^ self basicNew initialize
! !

!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
	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.1 2006-11-22 13:12:15 cg Exp $'
! !