On Wed, Mar 11, 2009 at 9:17 PM, Ville M. Vainio <[email protected]> wrote:
> search for is at arbitrary (unknown) depth under parent. Arbitrary
> depth traversal would need a "smart" implementation in order to avoid
> scanning same nodes several times (to avoid bad performance
> surprises).
Not that the "smart", deep search couldn't be added - it just needs to
be specified explicitly to avoid surprises.
E.g.
c.find_h('@settings').select_deep_h('@enabled-plugins')
I keep on talking about "surprises", because poslist is just a list of
positions. It does not in itself make guarantees about whether the
positions can overlap in tree structure, etc. You could basically have
every position in the tree in a poslist - normal, one-level select_b
would still complete in O(N) time, looking at every node once, while
select_deep_h would scan the same node multiple times.
BTW, an unrelated thought - maybe select_b may not have the most
intuitive behaviour right now, since it looks at the *direct children*
of the nodes in poslist (just like select_h). Perhaps it should just
scan the nodes in current poslist, filtering out the nodes that don't
match.
--
Ville M. Vainio
http://tinyurl.com/vainio
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---