Re: Specific Cloning Question



"Alex" <alexander.webb@xxxxxxxxx> wrote in message news:1158934564.874336.109020@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I am not entirely sure what you mean by a "recursive solution". I have
tried cloning the tree by cloning all the nodes in it. However the
problem here is that when I try to clone Node A it has a reference to
Node B as its parent so Node B gets cloned. But when I am cloning Node
B, it has a reference to Node A as its child it goes back to trying to
clone A again.

If you only clone in "one direction", you can avoid this problem. For example, cloning a node Foo wil clone it, and all of its children, but none of its parents.

Alternatively, you could wrap all your nodes in an actual Tree object, and put a clone method on the tree, and not on any of the nodes themselves, and have the tree orchestrating the cloning of the nodes.

- Oliver

.



Relevant Pages

  • Re: Specific Cloning Question
    ... tried cloning the tree by cloning all the nodes in it. ... problem here is that when I try to clone Node A it has a reference to ... Alternatively, you could wrap all your nodes in an actual Tree object, ... public MyNode subtreeCopy{ ...
    (comp.lang.java.help)
  • Re: Specific Cloning Question
    ... tried cloning the tree by cloning all the nodes in it. ... problem here is that when I try to clone Node A it has a reference to ... it has a reference to Node A as its child it goes back to trying to ... Alternatively, you could wrap all your nodes in an actual Tree object, ...
    (comp.lang.java.help)
  • Re: dual-boot - how to make second hard drive on XP machine a separate XP bootable OS?
    ... First disconnect the source HD.... ... It's OK to start up the "PARENT" OS immediately after ... Just don't start up the CLONE for its first time ... throughout the cloning process. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Clone vs. image (I promise not the same ol ground)
    ... Let me ask a question about what to clone. ... if I have cloning as part of my backup strategy can/should ... Laptops present a problem for cloning because the average ... Although the parent OS could view the clone without a problem, ...
    (microsoft.public.windowsxp.general)
  • Re: Specific Cloning Question
    ... I am not entirely sure what you mean by a "recursive solution". ... tried cloning the tree by cloning all the nodes in it. ... problem here is that when I try to clone Node A it has a reference to ... you could wrap all your nodes in an actual Tree ...
    (comp.lang.java.help)