|
Re: [ATL] Set boolean flag if object is referenced [message #521450 is a reply to message #521429] |
Wed, 17 March 2010 15:50 |
Vincent MAHE Messages: 129 Registered: July 2009 |
Senior Member |
|
|
Bernhard L. a écrit :
> Hello,
>
> I have been playing around with ATL a little bit and am trying to solve
> the following:
>
> My input model contains a collection (0...*) of classes and a reference
> to one of these classes.
>
> My output model contains the same collection, but instead of the
> reference to one of the classes, every class contains a boolean flag.
>
> What I want is that the transformation sets the boolean flag to "true"
> in the class that is referenced in the input model.
>
> Any ideas how to accomplish this?
>
>
> I tried something like the following:
>
> module In2Out;
> create OUT : OutModel from IN : InModel;
>
> helper def : isFinishStation(station : InModel!Station) : Boolean =
> if (station = self.finishStation) then
Here "self" refers to the current station.... (if I'm correct).
You need to refer to the input "model" (or anything else) which have the
reference.
You may try to get "station" container [container] and see its
"finishStation" property ...
> true
> else
> false
> endif;
>
> rule Level2Level {
> from
> s : InModel!Level
> to
> t : OutModel!Level (
> stations <- s.stations
> )
> }
>
> rule Station2Station {
> from
> s : InModel!Station
> to
> t : OutModel!Station (
> name <- s.name,
> isFinishStation <- thisModule.isFinishStation(s)
> )
> }
>
>
> If I run the transformation then it produces an output model without any
> errors on the console.
> But the boolean flag is never set to true.
>
> Thanks for the help,
> Bernhard
--
Cordialement
Vincent MAHÉ
Ingénieur plate-forme - Cesar/Artemisia - Équipe Espresso
IRISA-INRIA, Campus de Beaulieu, 35042 Rennes cedex, France
Tél: +33 (0) 2 99 84 71 00, Fax: +33 (0) 2 99 84 71 71
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02919 seconds