Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo 3]Decision outgoing are switching
[Acceleo 3]Decision outgoing are switching [message #718494] Wed, 24 August 2011 13:58 Go to next message
Norman  is currently offline Norman Friend
Messages: 17
Registered: June 2011
Junior Member
Hi everybody,

every generation i do my outgoing flows from a decision node are switching. I do:

[outgoing->asOrderedSet()->first().name/]
[outgoing->asOrderedSet()->last().name/]

if there are 2 outgoing flows called OF1,OF2 the return is:

OF1
OF2

and after one or more generation it switches to:

OF2
OF1

and back.

Greetings,
Norman
Re: [Acceleo 3]Decision outgoing are switching [message #719120 is a reply to message #718494] Fri, 26 August 2011 06:48 Go to previous messageGo to next message
Norman  is currently offline Norman Friend
Messages: 17
Registered: June 2011
Junior Member
i solved my problem, for all having the same:

instead of this

[for (out : ControlFlow | node.outgoing)]

use this and its ordered

[for (out : ControlFlow | node.eContainer().eContents(ControlFlow)->select(node.outgoing.source.name->intersection(source->asBag().name)->notEmpty() and node.outgoing.target.name->intersection(target->asBag().name)->notEmpty()))]
Re: [Acceleo 3]Decision outgoing are switching [message #719141 is a reply to message #719120] Fri, 26 August 2011 07:35 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1639
Registered: July 2009
Senior Member
Hi Norman,

The problem here is that the "outgoing" reference is not ordered. The "asOrderedSet" method indeed takes its values and make sure that further calls will always be in the same order... but the original collection being in a random order, the new ordered set, that takes its own order from that original collection, will also be random.

I can see two choices here. Either you use the ordered "eContents" as you did here, or you re-sort the collection yourself. Something like this should do :

node.outgoing->asOrderedSet()->sortedBy(name)

Laurent Goubet
Obeo
Previous Topic:[Acceleo] generating current date/time
Next Topic:[Xpand] cannot start workflow from a plugin
Goto Forum:
  


Current Time: Sun Dec 21 02:07:24 GMT 2014

Powered by FUDForum. Page generated in 0.07974 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software