Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Escape from a for loop
Escape from a for loop [message #1049932] Fri, 26 April 2013 13:18 Go to next message
Mohamed Mussa is currently offline Mohamed MussaFriend
Messages: 43
Registered: August 2010
Location: Canada
Member
Hi,

Is there a way to escape an imperative loop?

like break in Java

Thanks in advance.

Mohamed
Re: Escape from a for loop [message #1049993 is a reply to message #1049932] Fri, 26 April 2013 14:57 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
Registered: July 2009
Senior Member
Hello,

As indicated from the ATL user guide, such loops are made to navigate over collections and to terminate at the end of this navigation.
Note that using imperative constructs in ATL is not recommended in the general case and should be reserved only for a few particular situations.
The recommended style for ATL is declarative, which is applicable in a very large majority of the transformation scenarios.

Hugo


--------------------------------------------------------
Hugo Bruneliere, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Re: Escape from a for loop [message #1050022 is a reply to message #1049993] Fri, 26 April 2013 15:32 Go to previous messageGo to next message
Mohamed Mussa is currently offline Mohamed MussaFriend
Messages: 43
Registered: August 2010
Location: Canada
Member
Thanks Hugo,

I am using the imperative code for pre-evaluation of my models to select & merge only the targeted fragments.

More precisely, I am comparing the behavior of two UML lifelines, one from each model, and merge them if applicable. So, I have to arrange the events according to their model specification.

I believe I have to make a NOP statement for the rest of the loop.

Regards,

Mohamed
Re: Escape from a for loop [message #1050028 is a reply to message #1050022] Fri, 26 April 2013 15:40 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
Registered: July 2009
Senior Member
You could implement this filtering/merging operation in OCL using its different iteration expressions, and put this as a condition in the source pattern of the concerned matched rule(s) (cf. the ATL language reference documentation containing all the relevant information about these). This is exactly the role of such conditions in declarative rules.

Hugo


--------------------------------------------------------
Hugo Bruneliere, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Re: Escape from a for loop [message #1050042 is a reply to message #1050028] Fri, 26 April 2013 16:04 Go to previous message
Mohamed Mussa is currently offline Mohamed MussaFriend
Messages: 43
Registered: August 2010
Location: Canada
Member
Thanks
Previous Topic:Transform between Rose model and UML model
Next Topic:[ATL] EMFTVM: PackageNotFoundException: Package with uri not found
Goto Forum:
  


Current Time: Thu Apr 25 02:20:40 GMT 2024

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

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

Back to the top