[olug] [OT] Of parents and children

Kevin Lanik kevin.lanik at gmail.com
Thu Feb 24 16:48:31 UTC 2005


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



More information about the OLUG mailing list