2007/1/24, Lukas Renggli <renggli(a)iam.unibe.ch>ch>:
Support for collections in Magritte is weak. For quite
some time I
planned to add support for multiplicities like in EMOF and UML,
however I never found the time to actually do it.
What I have is, a class with various fields I
want to have set,
including a collection of strings. The others were no problem,
MANumberDescription and so on, but I don't see anything for
handling a collection. The nearest thing I saw was
MAToManyDescription?
Yes, MAToManyDescription is what you are looking for. If you are not
using fully described objects as children, you want to check out its
subclass MAToManyScalarRelationDescription. Maybe Philippe can give
you more hints on how to use that?
The description probably looks something like this:
^ (MAToManyScalarRelationDescription selector: #flowers)
reference: MAStringDescription new;
default: #();
yourself
Yeah, that's about it. Check out ICalMagritte for examples:
descriptionComments
^(MAToManyScalarRelationDescription selector: #comments label:
'Comments' priority: 5000)
classes: (Array with: String);
reference: MAMemoDescription new;
yourself
Note that MAToManyScalarRelationDescription is really just a hack and
hopefully disappears once multiplicities are fixed. So use it with
caution.
Cheers
Philippe
I looked at
MACollection but that said it is for a collection of
*descriptions*. I tried it anyway, and it didn't understand
#default. :)
I don't have MACollection in my image, only MAContainer. As you said,
this is a collection of descriptions; not a description on collections.
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki