Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Looking for a sample recursive hepler?
Looking for a sample recursive hepler? [message #88839] Sat, 23 August 2008 09:56 Go to next message
Eclipse UserFriend
Originally posted by: zhuangguotao.hotmail.com

hello,

I want to look for a sample recursive hepler.

Pls everyone help me.

Thanks!
Re: Looking for a sample recursive hepler? [message #88853 is a reply to message #88839] Sat, 23 August 2008 14:35 Go to previous messageGo to next message
Alfons Laarman is currently offline Alfons LaarmanFriend
Messages: 71
Registered: July 2009
Member
Hi,

'i'.repeat(5) --> 'iiiii'
helper context String def : repeat(i : Integer) : String =
self.repeatRec('', i, 0);
helper context String def : repeatRec(acc : String, n : Integer, c :
Integer) : String =
if c < n then self.repeatRec(acc+self, n, c+1) else acc endif;

This gets all EFeatures of an EClass, it walks over the inheritance
hierarchy:
helper def : allFeatures(t : OclType) : Set(OclAny) =
t.eStructuralFeatures->union(t.eSuperTypes->collect(st |
thisModule.allFeatures(st))->flatten()->asSet());

Regards,
Alfons

"Zhuang" <zhuangguotao@hotmail.com> schreef in bericht
news:8f0bfacf726538b0aee697779f1f507d$1@www.eclipse.org...
> hello,
>
> I want to look for a sample recursive hepler.
> Pls everyone help me.
>
> Thanks!
>
Re: Looking for a sample recursive hepler? [message #88868 is a reply to message #88853] Sat, 23 August 2008 20:34 Go to previous message
Eclipse UserFriend
Originally posted by: zhuangguotao.hotmail.com

Dear Alfons Laarman,

Thanks a lot for your rapid reply and help.

Zhuang
Previous Topic:[QVTO] Parser error using ParameterDirectionKind enumeration
Next Topic:[ATL]How to get the element type by the element's attribute?
Goto Forum:
  


Current Time: Thu Apr 25 18:49:30 GMT 2024

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

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

Back to the top