Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » i++
i++ [message #535214] Fri, 21 May 2010 15:19 Go to next message
graa is currently offline graaFriend
Messages: 42
Registered: April 2010
Member
hi,

how i can do i++ in ocl ?

thanks
Re: i++ [message #535222 is a reply to message #535214] Fri, 21 May 2010 15:46 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7103
Registered: July 2009
Senior Member
On 21/05/2010 16:19, graa wrote:
> hi,
>
> how i can do i++ in ocl ?
>
> thanks
OCL is a side effect free language, so it is impossible.

However if you look at why you want to do i++ there may be a solution.

For instance, one standard idiom that handles loop counters is

Sequence{1..size}->forAll(...)

Regards

Ed Willink
Re: i++ [message #535252 is a reply to message #535214] Fri, 21 May 2010 18:08 Go to previous message
wafaa is currently offline wafaaFriend
Messages: 163
Registered: January 2010
Location: Egypt
Senior Member
hi graa

sylivana has replied to u

Sylvain EVEILLARD wrote on Tue, 18 May 2010 13:23
You can't have braces in OCL because you can't execute multiple operations in an OCL IF. And finally, you can't make assignments in OCL (<-).

For the increase of counter you can use an ATL workaround :
let fakeLet : OclAny = thisModule.refSetValue('counter',thisModule.counter + 1) in





it is not direct way, fake....
Previous Topic:[ATL] Applying stereotypes in refinement mode
Next Topic:.ecore
Goto Forum:
  


Current Time: Tue Apr 20 20:51:57 GMT 2021

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

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

Back to the top