Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » iterate
iterate [message #533811] Mon, 17 May 2010 04:11 Go to next message
graa is currently offline graa
Messages: 42
Registered: April 2010
Member
Hi,
i have this helper i would like do iterate through a sequence(goal; w: Sequence{}... but i have an error message when i replace by string it accept. i would have a Sequence as return value.

helper context uml!PackageableElement def :Level0:String =

self.allGoal->iterate(goal; w: String=''|
w+
if (self.allRelationship.includes(Sequence{goal}))then
Sequence{}
else
goal

endif);
can you help me?
thanks
Re: iterate [message #533829 is a reply to message #533811] Mon, 17 May 2010 04:35 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHE
Messages: 129
Registered: July 2009
Senior Member
Le 17/05/2010 10:11, graa a écrit :
> Hi,
> i have this helper i would like do iterate through a sequence(goal; w:
> Sequence{}... but i have an error message when i replace by string it
> accept. i would have a Sequence as return value.
>
> helper context uml!PackageableElement def :Level0:String =
>
> self.allGoal->iterate(goal; w: String=''|
> w+
> if (self.allRelationship.includes(Sequence{goal}))then
> Sequence{}
> else
> goal
> endif);
> can you help me?
> thanks

You must return the type you have declared.
If you declared a String type for the helper, you must return a String.
If you want to return a Sequence, you must declare a Sequence for the
helper...

--
Cordialement

Vincent MAHÉ

Ingénieur Expert - Projet IDM++ - Équipe AtlanMod
École des Mines de Nantes
La Chantrerie - 4, rue Alfred Kastler
B.P. 20722 - F-44307 NANTES Cedex 3
Tel: (33)2 51 85 81 00
Re: iterate [message #533844 is a reply to message #533811] Mon, 17 May 2010 05:30 Go to previous message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 522
Registered: July 2009
Senior Member
helper context uml!PackageableElement def :Level0:Sequence(OclAny)=

self.allGoal->iterate(goal; w: Sequence(OclAny)=Sequence{}|
w.union(
if (self.allRelationship.includes(Sequence{goal}))then
Sequence{}
else
goal

endif));
Previous Topic:exit
Next Topic:[ATL] set something to null (or equivalent)
Goto Forum:
  


Current Time: Sat Jul 26 07:23:32 EDT 2014

Powered by FUDForum. Page generated in 0.08098 seconds