--- a/RGAbstractContainer.st Wed Sep 02 09:18:30 2015 +0100
+++ b/RGAbstractContainer.st Wed Sep 02 18:29:03 2015 +0100
@@ -1,143 +1,1 @@
-"{ Package: 'stx:goodies/ring' }"
-
-"{ NameSpace: Smalltalk }"
-
-RGDefinition subclass:#RGAbstractContainer
- instanceVariableNames:'elements'
- classVariableNames:''
- poolDictionaries:''
- category:'Ring-Core-Containers'
-!
-
-RGAbstractContainer comment:'This is the abstract class for container-based elements.
Elements are separated in groups by kind (e.g classes, methods, pools, etc.)
Subclasses have to define the kind of collection for a particular group of entities.
For a container the use of a dictionary or another collection (e.g. SortedCollection) to store group of elements is independent.
'
-!
-
-
-!RGAbstractContainer methodsFor:'accessing'!
-
-elements
- "Retrieves the elements"
-
- ^elements
-! !
-
-!RGAbstractContainer methodsFor:'adding/removing'!
-
-addElement: anObject
-
- anObject addInContainer: self
-!
-
-addElement: anObject in: aCollection
-
- aCollection isDictionary
- ifTrue: [ aCollection at: anObject fullName put: anObject ]
- ifFalse:[ aCollection add: anObject ]
-!
-
-addElements: aCollection
- aCollection do:[:each | each addElement: each ]
-
- "Created: / 01-09-2015 / 21:39:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-removeElement: anObject
-
- anObject removeFromContainer: self
-!
-
-removeElement: anObject from: aCollection
-
- aCollection isDictionary
- ifTrue: [ aCollection removeKey: anObject fullName ifAbsent:[ ] ]
- ifFalse:[ aCollection remove: anObject ifAbsent:[ ] ]
-! !
-
-!RGAbstractContainer methodsFor:'initialization'!
-
-initialize
-
- super initialize.
- elements:= IdentityDictionary new.
-! !
-
-!RGAbstractContainer methodsFor:'initialize-release'!
-
-flushElements
-
- elements:= IdentityDictionary new
-! !
-
-!RGAbstractContainer methodsFor:'iterating elements'!
-
-elementsDo: aBlock
- elements valuesDo: [ :collection | collection do: [ :each | aBlock value: each ] ]
-! !
-
-!RGAbstractContainer methodsFor:'lookup elements'!
-
-elementNamed: elementName
- | aSymbol found |
-
- aSymbol:= elementName asSymbol.
- elements do:[ :collection|
- (found:= self elementNamed: aSymbol in: collection) notNil ifTrue:[ ^found ] ].
- ^nil
-!
-
-elementNamed: elementName in: aCollection
- | aSymbol |
-
- aSymbol:= elementName asSymbol.
- ^aCollection isDictionary
- ifTrue: [ aCollection at: aSymbol ifAbsent: [ nil ] ]
- ifFalse:[ aCollection detect:[ :each| each fullName = aSymbol ] ifNone:[ nil ] ]
-! !
-
-!RGAbstractContainer methodsFor:'managing elements groups'!
-
-elementsCategorized: aSymbol
- "Retrieves a group of elements.
- If does not exist set an Set"
-
- ^elements at: aSymbol ifAbsentPut:[ Set ]
-!
-
-elementsCategorized: aSymbol with: aCollection
- "Allows to define other groups of elements with a particular kind of collection"
-
- elements at: aSymbol put: aCollection
-!
-
-removeElementsCategorized: aSymbol
- "Deletes a group of elements"
-
- elements removeKey: aSymbol ifAbsent:[ ]
-! !
-
-!RGAbstractContainer methodsFor:'testing'!
-
-includesElement: anRGDefinition
-
- ^anRGDefinition isIncludedInContainer: self
-!
-
-includesElementNamed: elementName
-
- ^ elements anySatisfy: [ :collection | self includesElementNamed: elementName asSymbol in: collection ]
-!
-
-includesElementNamed: elementName in: aCollection
-
- ^aCollection isDictionary
- ifTrue: [ aCollection includesKey: elementName asSymbol ]
- ifFalse:[ aCollection anySatisfy: [ :each| each name = elementName asSymbol ] ]
-! !
-
-!RGAbstractContainer class methodsFor:'documentation'!
-
-version_HG
-
- ^ '$Changeset: <not expanded> $'
-! !
-
+"{ Package: 'stx:goodies/ring' }"
"{ NameSpace: Smalltalk }"
RGDefinition subclass:#RGAbstractContainer
instanceVariableNames:'elements'
classVariableNames:''
poolDictionaries:''
category:'Ring-Core-Containers'
!
RGAbstractContainer comment:'This is the abstract class for container-based elements.
Elements are separated in groups by kind (e.g classes, methods, pools, etc.)
Subclasses have to define the kind of collection for a particular group of entities.
For a container the use of a dictionary or another collection (e.g. SortedCollection) to store group of elements is independent.
'
!
!RGAbstractContainer methodsFor:'accessing'!
elements
"Retrieves the elements"
^elements
! !
!RGAbstractContainer methodsFor:'adding/removing'!
addElement: anObject
anObject addInContainer: self
!
addElement: anObject in: aCollection
aCollection isDictionary
ifTrue: [ aCollection at: anObject fullName put: anObject ]
ifFalse:[ aCollection add: anObject ]
!
addElements: aCollection
aCollection do:[:each | each addElement: each ]
"Created: / 01-09-2015 / 21:39:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
removeElement: anObject
anObject removeFromContainer: self
!
removeElement: anObject from: aCollection
aCollection isDictionary
ifTrue: [ aCollection removeKey: anObject fullName ifAbsent:[ ] ]
ifFalse:[ aCollection remove: anObject ifAbsent:[ ] ]
! !
!RGAbstractContainer methodsFor:'initialization'!
initialize
super initialize.
elements:= Dictionary new.
"Modified: / 02-09-2015 / 11:13:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!RGAbstractContainer methodsFor:'initialize-release'!
flushElements
elements:= IdentityDictionary new
! !
!RGAbstractContainer methodsFor:'iterating elements'!
elementsDo: aBlock
elements valuesDo: [ :collection | collection do: [ :each | aBlock value: each ] ]
! !
!RGAbstractContainer methodsFor:'lookup elements'!
elementNamed: elementName
| aSymbol found |
aSymbol:= elementName asSymbol.
elements do:[ :collection|
(found:= self elementNamed: aSymbol in: collection) notNil ifTrue:[ ^found ] ].
^nil
!
elementNamed: elementName in: aCollection
| aSymbol |
aSymbol:= elementName asSymbol.
^aCollection isDictionary
ifTrue: [ aCollection at: aSymbol ifAbsent: [ nil ] ]
ifFalse:[ aCollection detect:[ :each| each fullName = aSymbol ] ifNone:[ nil ] ]
! !
!RGAbstractContainer methodsFor:'managing elements groups'!
elementsCategorized: aSymbol
"Retrieves a group of elements.
If does not exist set an Set"
^elements at: aSymbol ifAbsentPut:[ Set ]
!
elementsCategorized: aSymbol with: aCollection
"Allows to define other groups of elements with a particular kind of collection"
elements at: aSymbol put: aCollection
!
removeElementsCategorized: aSymbol
"Deletes a group of elements"
elements removeKey: aSymbol ifAbsent:[ ]
! !
!RGAbstractContainer methodsFor:'testing'!
includesElement: anRGDefinition
^anRGDefinition isIncludedInContainer: self
!
includesElementNamed: elementName
^ elements anySatisfy: [ :collection | self includesElementNamed: elementName asSymbol in: collection ]
!
includesElementNamed: elementName in: aCollection
^aCollection isDictionary
ifTrue: [ aCollection includesKey: elementName asSymbol ]
ifFalse:[ aCollection anySatisfy: [ :each| each name = elementName asSymbol ] ]
! !
!RGAbstractContainer class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !
\ No newline at end of file
--- a/RGClassDefinition.st Wed Sep 02 09:18:30 2015 +0100
+++ b/RGClassDefinition.st Wed Sep 02 18:29:03 2015 +0100
@@ -202,6 +202,20 @@
^classVariables collect:[ :cvar| cvar name ]
!
+classVariableNames: aStringOrCollection
+ | classVariableNames |
+
+ aStringOrCollection isString ifTrue:[
+ classVariableNames := ((aStringOrCollection tokensBasedOn: Character space) reject:[:e | e isEmpty])
+ ] ifFalse:[
+ classVariableNames := aStringOrCollection.
+ ].
+ classVariables := OrderedCollection new.
+ self addClassVariables: classVariableNames
+
+ "Created: / 31-08-2015 / 15:34:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
removeClassVarNamed: aString
self removeVariable: (self classVarNamed: aString) from: classVariables
@@ -298,6 +312,27 @@
ifTrue: [ self superclass allSharedPools , sharedPools ]
!
+poolDictionaryNames
+ ^ self sharedPoolNames
+
+ "Created: / 31-08-2015 / 15:43:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+poolDictionaryNames: aStringOrCollection
+
+ | poolDictionaryNames |
+
+ aStringOrCollection isString ifTrue:[
+ poolDictionaryNames := ((aStringOrCollection tokensBasedOn: Character space) reject:[:e | e isEmpty])
+ ] ifFalse:[
+ poolDictionaryNames := aStringOrCollection.
+ ].
+ sharedPools := OrderedCollection new.
+ self addSharedPools: poolDictionaryNames
+
+ "Created: / 31-08-2015 / 15:43:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
removeSharedPool: aRGPoolVariableDefinition
self removeVariable: aRGPoolVariableDefinition from: sharedPools
--- a/RGClassDescriptionDefinition.st Wed Sep 02 09:18:30 2015 +0100
+++ b/RGClassDescriptionDefinition.st Wed Sep 02 18:29:03 2015 +0100
@@ -102,6 +102,20 @@
ifNone: [ nil ]
!
+instanceVariableNames: aStringOrCollection
+ | instanceVariableNames |
+
+ aStringOrCollection isString ifTrue:[
+ instanceVariableNames := ((aStringOrCollection tokensBasedOn: Character space) reject:[:e | e isEmpty])
+ ] ifFalse:[
+ instanceVariableNames := aStringOrCollection.
+ ].
+ instanceVariables := OrderedCollection new.
+ self addInstanceVariables: instanceVariableNames
+
+ "Created: / 31-08-2015 / 15:30:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
removeInstVarNamed: aString
self removeVariable: (self instanceVariableNamed: aString) from: instanceVariables
--- a/RGContainer.st Wed Sep 02 09:18:30 2015 +0100
+++ b/RGContainer.st Wed Sep 02 18:29:03 2015 +0100
@@ -83,7 +83,9 @@
definedClasses
"Retrieves classes (traits are included)"
- ^self elements at: #definedClasses ifAbsentPut:[ IdentityDictionary new ]
+ ^self elements at: #definedClasses ifAbsentPut:[ Dictionary new ]
+
+ "Modified: / 02-09-2015 / 12:01:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
definedClasses: aCollection
@@ -95,7 +97,9 @@
methods
"Retrieves methods defined in the container"
- ^self elements at: #methods ifAbsentPut:[ IdentityDictionary new ]
+ ^self elements at: #methods ifAbsentPut:[ Dictionary new ]
+
+ "Modified: / 02-09-2015 / 12:02:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
methods: aCollection
@@ -107,7 +111,9 @@
packages
"Retrieves the children packages defined in the receiver"
- ^self elements at: #packages ifAbsentPut:[ IdentityDictionary new ]
+ ^self elements at: #packages ifAbsentPut:[ Dictionary new ]
+
+ "Modified: / 02-09-2015 / 12:02:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
packages: aCollection
@@ -358,9 +364,11 @@
initialize
super initialize.
- self definedClasses: IdentityDictionary new.
- self methods: IdentityDictionary new.
- self packages: IdentityDictionary new.
+ self definedClasses: Dictionary new.
+ self methods: Dictionary new.
+ self packages: Dictionary new.
+
+ "Modified: / 02-09-2015 / 12:02:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!RGContainer methodsFor:'iterating'!
--- a/RGDefinition.st Wed Sep 02 09:18:30 2015 +0100
+++ b/RGDefinition.st Wed Sep 02 18:29:03 2015 +0100
@@ -136,7 +136,9 @@
annotations
- ^annotations ifNil:[ annotations:= IdentityDictionary new ]
+ ^annotations ifNil:[ annotations:= Dictionary new ]
+
+ "Modified: / 02-09-2015 / 12:02:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
hasAnnotationNamed: annotationName
--- a/RGMethodDefinition.st Wed Sep 02 09:18:30 2015 +0100
+++ b/RGMethodDefinition.st Wed Sep 02 18:29:03 2015 +0100
@@ -130,6 +130,18 @@
"Modified: / 29-08-2015 / 11:20:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+category
+ ^ self protocol
+
+ "Modified (format): / 31-08-2015 / 16:38:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+category: anObject
+ self protocol: anObject
+
+ "Created: / 31-08-2015 / 16:37:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
compiledMethod
"Retrieves the compiled method of this definition if exists"
@@ -291,11 +303,6 @@
!RGMethodDefinition methodsFor:'backward compatibility'!
-category
-
- ^ self protocol
-!
-
messages
^ self method messages
--- a/RGNamespace.st Wed Sep 02 09:18:30 2015 +0100
+++ b/RGNamespace.st Wed Sep 02 18:29:03 2015 +0100
@@ -97,8 +97,10 @@
initialize
super initialize.
- self globalVariables: IdentityDictionary new.
- self pools: IdentityDictionary new.
+ self globalVariables: Dictionary new.
+ self pools: Dictionary new.
+
+ "Modified: / 02-09-2015 / 11:15:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!RGNamespace methodsFor:'removing elements'!
--- a/RGPackage.st Wed Sep 02 09:18:30 2015 +0100
+++ b/RGPackage.st Wed Sep 02 18:29:03 2015 +0100
@@ -151,9 +151,11 @@
initialize
super initialize.
- self withoutPackages. "By default the receiver has no child packages"
- self extensionMethods: IdentityDictionary new.
+ self withoutPackages. "By default the receiver has no child packages"
+ self extensionMethods: Dictionary new.
self categories: OrderedCollection new.
+
+ "Modified: / 02-09-2015 / 12:02:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!RGPackage methodsFor:'lookup'!
--- a/tests/RGMetatraitDefinitionTest.st Wed Sep 02 09:18:30 2015 +0100
+++ b/tests/RGMetatraitDefinitionTest.st Wed Sep 02 18:29:03 2015 +0100
@@ -12,6 +12,7 @@
RGMetatraitDefinitionTest comment:'SUnit tests for Ring classtrait definitions'
!
+
!RGMetatraitDefinitionTest methodsFor:'testing'!
testAsClassTraitfinition
@@ -27,3 +28,10 @@
"Modified: / 29-08-2015 / 09:46:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!RGMetatraitDefinitionTest class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+