Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] "If then else" with multiple code lines Syntax problem
[ATL] "If then else" with multiple code lines Syntax problem [message #92985] Tue, 21 October 2008 15:50 Go to next message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
Hi,
I have a problem writing this recursive helper, it seems like i cannot
have multiple code lines in the "if then else" statement of a helper! Do
you have a solution for this?


helper context UML2!Package def : getAllChildren () :
OrderedSet(UML2!Package) =
self.nestedPackage->iterate( child ; elements : OrderedSet(UML2!Package) =
OrderedSet{} |
if not(child.packageIsLeaf()) then
{elements.append(child);
elements.union(child.getAllChildren ());
}
else
{ elements.append(child);}
endif
)
;

Can anybody help ?!!

Skander TURKI
skander.turki@gmail.com
Université de Bretagne-Sud, Lorient
Lab-STICC (Lanester) laboratory
Re: [ATL] "If then else" with multiple code lines Syntax problem [message #93000 is a reply to message #92985] Tue, 21 October 2008 16:06 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
ATL helpers are not imperative functions you don't have the right to
write this.

the expresssions in statements must return a result

Skander a écrit :
> Hi, I have a problem writing this recursive helper, it seems like i
> cannot have multiple code lines in the "if then else" statement of a
> helper! Do you have a solution for this?
>
>
> helper context UML2!Package def : getAllChildren () :
> OrderedSet(UML2!Package) =
> self.nestedPackage->iterate( child ; elements :
> OrderedSet(UML2!Package) = OrderedSet{} |
> if not(child.packageIsLeaf()) then
> {elements.append(child);
> elements.union(child.getAllChildren ());
> }
> else
> { elements.append(child);}
> endif
> )
> ;
>
> Can anybody help ?!!
>
> Skander TURKI
> skander.turki@gmail.com
> Université de Bretagne-Sud, Lorient
> Lab-STICC (Lanester) laboratory
>




Re: [ATL] "If then else" with multiple code lines Syntax problem [message #93063 is a reply to message #93000] Wed, 22 October 2008 12:10 Go to previous message
Alfons Laarman is currently offline Alfons LaarmanFriend
Messages: 71
Registered: July 2009
Member
"Tristan FAURE" <tristan.faure@atosorigin.com> schreef in bericht
news:gdkum7$g9q$1@build.eclipse.org...
> ATL helpers are not imperative functions you don't have the right to write
> this.
>
> the expresssions in statements must return a result
>

exactly.
And in Ocl there is also an if statement, however the syntax is different:

let x:Boolean=true in if x then 'yes' else 'no' endif

Regards,

Alfons
Previous Topic:[QVTO] Trace meta-model ?
Next Topic:[ATL] Model Copy/Clone
Goto Forum:
  


Current Time: Thu Apr 18 20:02:14 GMT 2024

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

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

Back to the top