Recursive iQualifiedName [message #932888] |
Thu, 04 October 2012 14:36 |
Quentin Boucher 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 |
Henrik Lindberg 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
|
|
|
Powered by
FUDForum. Page generated in 0.03007 seconds