Yes, you can say that.
So I looked at the tests and what it all uses. And together with Stephan I made an implementation that at least holds up all tests. Of course, we have rewritten the FAMIXNavigationPluginTestsResource.
The specifics:
> we have introduced a method that says wether it has a unique moose name, and therefor should be cached by name and be updated if it is out of sync. It is set to true for a namedEntity and for a MooseFile.
> we have created the possibility to clear the moose name. Note there are two methods: one that also updates the model, and one that only clears the moose name. The method resetMooseName should be called if appropriate. Do not call the method that only clears the moose name, since this method destroys the cache.
> the moose name is now cached in a moose entity, and therefor will only change if the "clearMooseName" method is called. This method should be called if:
1. The object returns true on "hasUniqueMooseNameInModel"
2. The mooseName changes because of a change.
I.E. The implementation of setting the signature of a behavioralEntity should be:
signature: aString
signature := aString.
self resetMooseName
> the implementation of resetMooseName should call all its children that depend on the moose name of this entity, to also reset their moose name. (so this is expensive)
> The lookup is now a dictionary lookup, that returns immediately. I probably should add a guard that checks if the object already exists, but I don't want to change too much at the same time, so I'll leave it for now.
Important notes:
> This implementation makes it possible to rename things AFTER they have been added to the model. This is however rather expensive. So if possible, one should avoid renaming and reorganizing things after they have been added to the model.
> This causes the lookup to be cheap. A entityByName: is relative cheap. This was rather expensive, but now no longer is.
All tests we have run (all famix tests in moose, including java, etc. ) are green now, so I will check this in.
Cheers,
Stephan and Diego
On Sep 18, 2013, at 9:40 PM, Tudor Girba wrote:
Man, this is messed up :).
The mooseName should better be cached as it is not expected to change. The tests fail precisely because it is the tests that want to go around these issue and introduce namespaces artificially after the actual import. Take a look at:
FAMIXNavigationPluginTestsResource>>importModel
But, for associations we have no benefit of caching them by name because we never look them up by name. That is why in the case of association we should use a different Storage type that does not build a cache.
Cheers,
Doru
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev