|[Acceleo] Random order in UML for sequence of datatypes [message #1221354]
||Tue, 17 December 2013 14:03
| Johan Hardy
Registered: December 2012
I'm developing a generator UML to C based on Acceleo. One of my transformations is the generation of typedef in C. With the help of a profile, I mapped a stereotype called typedef on the meta-class datatype.
In the template, when I want to generate all the types and for instance the typedefs, I filter all the types of a Class to get a sequence of datatypes (with the stereotype 'typedef' applied). Here is my transformation:
[query public getAllTypedef(seq : Sequence(uml::DataType)) : Sequence(uml::DataType) =
seq->select(d : uml::DataType | (hasStereotype(d, 'functional_C::Typedef')))->asSequence()/]
[template public genHTypedef(c : uml::Class) post(trim())]
[let seq : Sequence(uml::DataType) = getAllTypedef(ownedElement->filter(uml::DataType)->asSequence())]
[for (d : uml::DataType | seq )]
My problem is that the typedefs are not generated in the same order from one generation to another AND the MODEL REMAINS the same. For example, Class A with datatype B and datatype C gives at the first generation:
And, for the second generation (the class remains the same) :
Does anyone know why the sequence of datatypes has different order from one generation to another ?
Does anyone know how to solve this problem ?
[Updated on: Wed, 18 December 2013 12:14]
Report message to a moderator
|Re: [Acceleo] Random order in UML for sequence of datatypes [message #1248381 is a reply to message #1247965]
||Mon, 17 February 2014 07:36
| Ed Willink
Registered: July 2009
It is not a problem so there is no need for a workaround. It is a user
misconception that there was an order.
If you want to impose 'your' order you need to use a ordering algorithm
such as the OCL sortedBy iteration.
On 16/02/2014 20:47, Furkan Eke wrote:
> This obviously brings a problem where one needs to revise the
> generated code during the development of the very Acceleo engine for
> her/his domain.
> Can this problem be solved with a workaround like: prior to generation
> a sorting of the relevant elements based on their names?
> How should one change the query for such a solution?
Powered by FUDForum
. Page generated in 0.01898 seconds