On 08/09/2015 23:54, Peter Uhnák wrote:
Hi,
I'm getting acquainted more with Moose and FAMIX and I am not really
sure how to proceed (mostly due to lack of documentation and link rot).
What I want to do is add "multiplicity" attribute to FAMIXAttribute.
Now I see an option:
1) create a subclass of FAMIXAttribute
You don't need to subclass, you can also
use extension
new "instance variable" can be stored in the state of the entity
for example:
FAMIXFunction>>parentModule
<MSEProperty: #parentModule type: #FAMIXModule>
<MSEComment: 'Module (typically a file) defining the function.'>
^ self privateState
attributeAt: #parentModule
ifAbsentPut: [ nil ]
FAMIXFunction>>parentModule: aModule
^ self privateState
attributeAt: #parentModule
put: (
FMMultivalueLink
on: self
update: #functions
from: self parentModule
to: aModule
)
(in this case it's a bit more complex because it is a 1-to-n relation
2) add a method.. something like
FAMIXAttribute>>multiplicity
<MSEProperty: #multiplicity type: #MyFAMIXMultiplicity>
^ multiplicity
now Moose can generate models from smalltalk source code and I would
like to infer this information.
For example for types, there is
MooseImportingContext>>computeTypeOfAttributes
So I'm assuming I would have to do something similar.
yes, two ways of doing
it:
- change the importer to compute the thing on the fly
- post process the model to add the information you want (should be easier)
And finally, if I want to help the importer and actually write that
information into the source code, I would have to add another pragma
there... something like
MyClass>>myAttribute
<MSEMultiplicity: '2..*' type: MyType>
^ myAttribute
and then modify the smalltalk importer to be able to recognize this
and produce MyFAMIXAttribute instead of the default one.
yes, you can change the
importer or post process the model as said above
- Take all FamixAttributes
- Find all FamixMethods with the same name and in the same class
- check the pragma in the smalltalk method
- update the FamixAttribute
another way would be to go from the invokers of the pragma and find the
FamixAttribute from them
nicolas
Am I on the right track? Should it be done differently?
Any pointers appreciated,
Peter
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev