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