Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » how to write "for" logic in ATL
how to write "for" logic in ATL [message #967318] Thu, 01 November 2012 17:20 Go to next message
Kosala Yapa is currently offline Kosala YapaFriend
Messages: 159
Registered: September 2010
Senior Member
Hi there,

for (int n=0; n<100;n++){

}


How to write this logic in atl?


ATL for logic used in collection is a bit different to this requirement. Here, iteration needs to happen until the condition becomes false.



Thanks in advance!
K
Re: how to write &quot;for&quot; logic in ATL [message #968378 is a reply to message #967318] Fri, 02 November 2012 12:14 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4154
Registered: July 2009
Senior Member
Hi

The OCL idiom is

Sequence{0..99}->forAll(n | ... )

Regards

Ed Willink



On 01/11/2012 17:20, Kosala Yapa wrote:
> Hi there,
>
> for (int n=0; n<100;n++){
>
> }
>
>
> How to write this logic in atl?
>
>
> ATL for logic used in collection is a bit different to this
> requirement. Here, iteration needs to happen until the condition
> becomes false.
>
>
>
> Thanks in advance!
> K
Re: how to write &quot;for&quot; logic in ATL [message #968453 is a reply to message #968378] Fri, 02 November 2012 13:24 Go to previous messageGo to next message
Kosala Yapa is currently offline Kosala YapaFriend
Messages: 159
Registered: September 2010
Senior Member
Thanks a mil Ed
Re: how to write &quot;for&quot; logic in ATL [message #969690 is a reply to message #968378] Sat, 03 November 2012 13:02 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 167
Registered: September 2012
Senior Member

Op 02/11/12 13:14, Ed Willink schreef:
> The OCL idiom is
>
> Sequence{0..99}->forAll(n | ... )
>
> On 01/11/2012 17:20, Kosala Yapa wrote:
>> for (int n=0; n<100;n++){
>>
>> }
>>
>> How to write this logic in atl?
>>
>> ATL for logic used in collection is a bit different to this requirement.
>> Here, iteration needs to happen until the condition becomes false.

I suppose I can add the following bit of knowledge to this:

http://c2.com/cgi/wiki?RecursionVsLoop

In ATL, you should use recursion rather than loops. It is equally expressive,
and fits better into ATL's mainly functional programming model.

Cheers,
Dennis


Cheers,
Dennis
Previous Topic:how to define an array
Next Topic:ATL logic help
Goto Forum:
  


Current Time: Thu Nov 27 03:13:42 GMT 2014

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

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