initial checkin
authorClaus Gittinger <cg@exept.de>
Wed, 22 Nov 2006 14:12:15 +0100
changeset 63 150479ea08e3
parent 62 bf41d3e3e19d
child 64 7af753750409
initial checkin
MCDefinitionIndex.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MCDefinitionIndex.st	Wed Nov 22 14:12:15 2006 +0100
@@ -0,0 +1,55 @@
+"{ 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 $'
+! !