Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Recursive iQualifiedName
Recursive iQualifiedName [message #932888] Thu, 04 October 2012 14:36 Go to next message
Quentin Boucher is currently offline Quentin BoucherFriend
Messages: 27
Registered: July 2012
Junior Member
Hello,

I read Christian's blog post about iQualifiedNames where he uses the name of an element and its container. However, I would like to know if it is possible to create qualified names in a recursive way.

For example:
A {
   B {
      C,
      D {
         E,
         F
      }
   },
   G
}


We would like to use A, A.B, A.G, A.B.C, A.B.D, A.B.D.E & A.B.D.F as qualified names.
But, since we don't know how deep the element is nested in a hierarchy we were wondering if it was possible to do it in a recursive way, i.e. append the name of an element (which is a String, e.g. F) to the qualified name of its ancestors (which is of QualifiedName type).

Thank you for your answer!
Re: Recursive iQualifiedName [message #933009 is a reply to message #932888] Thu, 04 October 2012 16:42 Go to previous message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
On 2012-04-10 16:36, Quentin Boucher wrote:
> Hello,
>
> I read Christian's blog post about iQualifiedNames where he uses the
> name of an element and its container. However, I would like to know if
> it is possible to create qualified names in a recursive way.
>
> For example:
>
> A {
> B {
> C,
> D {
> E,
> F
> }
> },
> G
> }
>
>
> We would like to use A, A.B, A.G, A.B.C, A.B.D, A.B.D.E & A.B.D.F as
> qualified names.
> But, since we don't know how deep the element is nested in a hierarchy
> we were wondering if it was possible to do it in a recursive way, i.e.
> append the name of an element (which is a String, e.g. F) to the
> qualified name of its ancestors (which is of QualifiedName type).
>

Yes.

Just differentiate between name() and qualifiedName(), where the
qualified name is parent.qualifiedName().append(name())

- henrik
Previous Topic:DSL serialization in multiple resources with cross references
Next Topic:problem for define dsl
Goto Forum:
  


Current Time: Thu Mar 28 17:55:33 GMT 2024

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

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

Back to the top