[olug] [OT] Of parents and children

David Walker olug at grax.com
Fri Feb 25 01:48:00 UTC 2005


I would say you can't just move a node into its children.  It doesn't make 
sense logically to me.

I would require the mover to perform the necessary gymnastics.  I believe 
anything else would always have unintended consequences.  Think about a file 
system.  If you want a directory that is in the root to be somewhere else you 
have to complete several moves to get your desired effect.

For example
1.  Move nodes 2 and 3 to under root
2.  Move node 1 to be a child of node 4

I do not think you can guarantee that the user intended for your example node 
3 to go under the root or to stay a child of node 1.  Forcing them into 
multiple moves is the only way to ensure they achieve the desired result.

On Thursday 24 February 2005 10:48 am, Kevin Lanik wrote:
> Slightly off topic, but an interesting programming problem here. I'm
> programming in objective-c (language doesn't matter much though) and I
> basically have a tree. My problem is that I'd like to be able to take
> a node and move it into one of it's children (or, since there is X
> level of depth) or somewhere in it's own lineage. It's been decided to
> preserve as much hierarchy as possible, so if a node moves to it's
> subnode it retains its children. For example, node 1's parent is the
> root node: it has children 2 and 3. 2 has children 4 and 5. I want to
> move node 1 into node 4's list. The first of two scenarios now is that
> node 2's parent becomes the root node and node 1's parent  becomes
> node 4, all other nodes stay the same. The other scenario makes node
> 4's parent the root node and node 1's parent 4, with all other nodes
> retaining thier parents. Does this make sense? The current solution is
> that we don't allow a node to be dropped in one of its children (or
> down the line) but would choosing one of these two be more appropriate
> than the other? I know this isn't exactly the forum for the question,
> but who doesn't enjoy a puzzler!
>  -Kevin
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug



More information about the OLUG mailing list