Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Acceleo : How do I compare the value of the current and the previous iteration in a for loop(Acceleo )
Acceleo : How do I compare the value of the current and the previous iteration in a for loop [message #1733932] Thu, 02 June 2016 10:09 Go to next message
Hassen Bazar is currently offline Hassen BazarFriend
Messages: 1
Registered: June 2016
Junior Member
Is it possible to compare the value of the current and the previous iteration in a for loop in Acceleo ? Knowing that LET can be defined inside for loop but it will be mutable at each current iteration, therefore the previous value will be lost and we will get always only the current value.
Any idea guys ?
Thanks.
Re: Acceleo : How do I compare the value of the current and the previous iteration in a for loop [message #1733986 is a reply to message #1733932] Thu, 02 June 2016 16:11 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The pure OCL solution is to use the integer Sequence idiom

Sequence{1..N}->forAll(i : Integer | ... ->at(i) ...)

this allows you to refer to i+1/i-1 or whatever.

IIRC Acceleo has a secret "i" variable that dioes this for free. However
it is not in accord with the OMG MOFM2T specification.

Regards

Ed Willink


On 02/06/2016 13:24, Hassen Bazar wrote:
> Is it possible to compare the value of the current and the previous
> iteration in a for loop in Acceleo ? Knowing that LET can be defined
> inside for loop but it will be mutable at each current iteration,
> therefore the previous value will be lost and we will get always only
> the current value. Any idea guys ? Thanks.
Previous Topic:Is there a better [let] construct for multiple variable context
Next Topic:JET tag library documentation?
Goto Forum:
  


Current Time: Thu Mar 28 17:27:31 GMT 2024

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

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

Back to the top