MooseGroupRuntimeStorage

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

MooseGroupRuntimeStorage

Usman Bhatti
We have 

Collection variableSubclass: #MooseGroupStorage
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Moose-Core'


MooseGroupStorage variableSubclass: #MooseGroupRuntimeStorage
instanceVariableNames: 'byName elements byType'
classVariableNames: ''
poolDictionaries: ''
category: 'Moose-Core'


at: uniqueName ifAbsent: exceptionBlock 

| entity na | 
na := uniqueName asSymbol.
"look first by name and if not found"
entity := byName at: na ifAbsent: [nil]. 
entity notNil ifTrue: [^entity]. 
"iterates over all the elements"
entity := self 
detect: [:each | na == each mooseName asSymbol] 
ifNone: exceptionBlock. 
entity notNil ifTrue: [byName at: na put: entity]. 
^entity

Now I could not find where the byName dictionary is set.
Does anybody know?

Stef


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: MooseGroupRuntimeStorage

Tudor Girba-2
Hi,

Open the browser, select the MooseGroupRuntimeStorage class, then spawn the variables dedicated browser, and then you will see that byName is initialized in initialize:.

Cheers,
Doru


On 7 Nov 2011, at 14:24, Usman Bhatti wrote:

> We have
>
> Collection variableSubclass: #MooseGroupStorage
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Moose-Core'
>
>
> MooseGroupStorage variableSubclass: #MooseGroupRuntimeStorage
> instanceVariableNames: 'byName elements byType'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Moose-Core'
>
>
> at: uniqueName ifAbsent: exceptionBlock
>
> | entity na |
> na := uniqueName asSymbol.
> "look first by name and if not found"
> entity := byName at: na ifAbsent: [nil].
> entity notNil ifTrue: [^entity].
> "iterates over all the elements"
> entity := self
> detect: [:each | na == each mooseName asSymbol]
> ifNone: exceptionBlock.
> entity notNil ifTrue: [byName at: na put: entity].
> ^entity
>
> Now I could not find where the byName dictionary is set.
> Does anybody know?
>
> Stef
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
www.tudorgirba.com

"We are all great at making mistakes."








_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: MooseGroupRuntimeStorage

Stéphane Ducasse
Strange because I did that and I could not get it.


On Nov 7, 2011, at 10:32 PM, Tudor Girba wrote:

> Hi,
>
> Open the browser, select the MooseGroupRuntimeStorage class, then spawn the variables dedicated browser, and then you will see that byName is initialized in initialize:.
>
> Cheers,
> Doru
>
>
> On 7 Nov 2011, at 14:24, Usman Bhatti wrote:
>
>> We have
>>
>> Collection variableSubclass: #MooseGroupStorage
>> instanceVariableNames: ''
>> classVariableNames: ''
>> poolDictionaries: ''
>> category: 'Moose-Core'
>>
>>
>> MooseGroupStorage variableSubclass: #MooseGroupRuntimeStorage
>> instanceVariableNames: 'byName elements byType'
>> classVariableNames: ''
>> poolDictionaries: ''
>> category: 'Moose-Core'
>>
>>
>> at: uniqueName ifAbsent: exceptionBlock
>>
>> | entity na |
>> na := uniqueName asSymbol.
>> "look first by name and if not found"
>> entity := byName at: na ifAbsent: [nil].
>> entity notNil ifTrue: [^entity].
>> "iterates over all the elements"
>> entity := self
>> detect: [:each | na == each mooseName asSymbol]
>> ifNone: exceptionBlock.
>> entity notNil ifTrue: [byName at: na put: entity].
>> ^entity
>>
>> Now I could not find where the byName dictionary is set.
>> Does anybody know?
>>
>> Stef
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> www.tudorgirba.com
>
> "We are all great at making mistakes."
>
>
>
>
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: MooseGroupRuntimeStorage

Stéphane Ducasse
In reply to this post by Tudor Girba-2

> Hi,
>
> Open the browser, select the MooseGroupRuntimeStorage class, then spawn the variables dedicated browser, and then you will see that byName is initialized in initialize:.

I found it in fact. This is not my question :)
Now I could not find who is using it to add new binding this is what I mean by "set it".

especially because I have some doubts on the real advantage to inherit from Collection.
The do: is redefined to iterate on the elements but there is no at:put: in Collection and I could not find one in the

So my question is data get put in that dictionary?




>> at: uniqueName ifAbsent: exceptionBlock
>>
>> | entity na |
>> na := uniqueName asSymbol.
>> "look first by name and if not found"
>> entity := byName at: na ifAbsent: [nil].
>> entity notNil ifTrue: [^entity].
>> "iterates over all the elements"
>> entity := self
>> detect: [:each | na == each mooseName asSymbol]
>> ifNone: exceptionBlock.
>> entity notNil ifTrue: [byName at: na put: entity].
>> ^entity

BTW this method is better that the original one because at:ifAbsent: aBlock and not nil + comment.
I should commit it.

add: only fill up the byType

add: anElement

        | key group |
        key := anElement class.
        group := byType
                at: key
                ifAbsentPut: [ OrderedCollection new ].
        group add: anElement.
        elements add: anElement.
        ^ anElement


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev