|[Acceleo] How to access elements in for loop OR use a java service for that? [message #1781208]
||Fri, 02 February 2018 18:50
| Francesco Cagnetta
Registered: January 2018
I'm Francesco and I'm quite new to this world, but working hard on it for my thesis project.
My situation is this:
I have an Ecore metamodel and a Xmi model built according to the Ecore metamodel.
I am using Acceleo in order to transform the model into C# code.
Everything is working fine, BUT I can't find a way to avoid iterations on elements that I don't want to operate on. I'm sorry if my English is not perfect. I'll try to explain an example.
I want to print a line of code that respects this selection: for every Actor that is not the main actor and is located just one time and is the protagonist of a scoring rule and is not the protagonist of any activity.
So I have a Collection of Actors (all different), a Collection of Locations (each contains an Actor element, there can be more of the same actor), a Collection of Scoring Rules (each contains an Actor element, there can be more of the same actor), a Collection of Activities (each contains an Actor Element, there can be more of the same actor).
Hence, my problem is that I can't stop the for loop with a boolean control (if this is possible please let me know how) so it will print more lines for the same actor if it meets the requirements. For example, an actor can be the protagonist of two scoring rules and it will print the line 2 times (I want just one).
I thought about using a Java service, but I don't know how to import the classes of the metamodel in order to use them in Java (I don't even know if this is possible, I'm completely new to Java services).
I tried many different ways of code for this behaviour, but every one took me at the same point because, in the end, they're logically the same thing.
Thank you for your time, I will appreciate a lot your help,
Powered by FUDForum
. Page generated in 0.01889 seconds