[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.modeling.m2m] Re: [ATL] sequence & collect

Hi,

What about doing this:

items <- Sequence { classes->collect( class | thisModule.Do( class ) ) } -> union(Sequence { classes->collect( class | thisModule.Do( class ) ) })

lazy rule Do {
 ...
 to
    a : MM!A { refB <- b },
    b : MM!B { refC <- c },
    c : MM!C {}
--    aa : MM!A { refB <- bb },
--    bb : MM!B { refC <- cc },
--    cc : MM!C {}
}

Then you will have two MM!A element in items (as "aa" is the same as "a")

Or maybe you should try to do this:

lazy rule Do {
 ...
 to
    a : MM!A { refB <- b },
    b : MM!B { refC <- c },
    c : MM!C {}
    aa : MM!A { refB <- bb },
    bb : MM!B { refC <- cc },
    cc : MM!C {}
do {
Sequence{a, aa};
}
}


Be careful, i'm not sure that this latter trick will work as well as with called rules (http://wiki.eclipse.org/index.php/ATL_Language_Troubleshooter#ATL_Called_Rules_Troubles)


Regards,
Mikael

Gediminas wrote:

observe strange effect with sequence & collect:

items <- Sequence { classes->collect( class | thisModule.Do( class ) ) }

lazy rule Do {
 ...
 to
    a : MM!A { refB <- b },
    b : MM!B { refC <- c },
    c : MM!C {},
    aa : MM!A { refB <- bb },
    bb : MM!B { refC <- cc },
    cc : MM!C {}
}

produces a in the items sequence and aa not in the items sequence. Why this happen? I suggest, that must be items={a,aa}, not items={a}




-- Mikaël Barbero - PhD Candidate ATLAS Group (INRIA & LINA) - University of Nantes 2, rue de la Houssinière 44322 Nantes Cedex 3 - France tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00 email: Mikael.Barbero@{gmail.com, univ-nantes.fr} http://www.sciences.univ-nantes.fr/lina/atl/