@Override public Object dupTree(Object tree) { return dupTree(tree, null); }
@Override public Object dupTree(Object tree) { return dupTree(tree, null); }
@Override public Object dupTree(Object tree) { return dupTree(tree, null); }
@Override public Object dupTree(Object tree) { return dupTree(tree, null); }
@Override public Object dupTree(Object tree) { return dupTree(tree, null); }
public Object dupTree(Object tree) { return dupTree(tree, null); }
/** This is generic in the sense that it will work with any kind of * tree (not just Tree interface). It invokes the adaptor routines * not the tree node routines to do the construction. */ public Object dupTree(Object t, Object parent) { if ( t==null ) { return null; } Object newTree = dupNode(t); // ensure new subtree root has parent/child index set setChildIndex(newTree, getChildIndex(t)); // same index in new tree setParent(newTree, parent); int n = getChildCount(t); for (int i = 0; i < n; i++) { Object child = getChild(t, i); Object newSubTree = dupTree(child, t); addChild(newTree, newSubTree); } return newTree; }
/** This is generic in the sense that it will work with any kind of * tree (not just Tree interface). It invokes the adaptor routines * not the tree node routines to do the construction. */ public Object dupTree(Object t, Object parent) { if ( t==null ) { return null; } Object newTree = dupNode(t); // ensure new subtree root has parent/child index set setChildIndex(newTree, getChildIndex(t)); // same index in new tree setParent(newTree, parent); int n = getChildCount(t); for (int i = 0; i < n; i++) { Object child = getChild(t, i); Object newSubTree = dupTree(child, t); addChild(newTree, newSubTree); } return newTree; }
/** This is generic in the sense that it will work with any kind of * tree (not just Tree interface). It invokes the adaptor routines * not the tree node routines to do the construction. */ public Object dupTree(Object t, Object parent) { if ( t==null ) { return null; } Object newTree = dupNode(t); // ensure new subtree root has parent/child index set setChildIndex(newTree, getChildIndex(t)); // same index in new tree setParent(newTree, parent); int n = getChildCount(t); for (int i = 0; i < n; i++) { Object child = getChild(t, i); Object newSubTree = dupTree(child, t); addChild(newTree, newSubTree); } return newTree; }
/** This is generic in the sense that it will work with any kind of * tree (not just Tree interface). It invokes the adaptor routines * not the tree node routines to do the construction. */ public Object dupTree(Object t, Object parent) { if ( t==null ) { return null; } Object newTree = dupNode(t); // ensure new subtree root has parent/child index set setChildIndex(newTree, getChildIndex(t)); // same index in new tree setParent(newTree, parent); int n = getChildCount(t); for (int i = 0; i < n; i++) { Object child = getChild(t, i); Object newSubTree = dupTree(child, t); addChild(newTree, newSubTree); } return newTree; }
/** This is generic in the sense that it will work with any kind of * tree (not just Tree interface). It invokes the adaptor routines * not the tree node routines to do the construction. */ public Object dupTree(Object t, Object parent) { if ( t==null ) { return null; } Object newTree = dupNode(t); // ensure new subtree root has parent/child index set setChildIndex(newTree, getChildIndex(t)); // same index in new tree setParent(newTree, parent); int n = getChildCount(t); for (int i = 0; i < n; i++) { Object child = getChild(t, i); Object newSubTree = dupTree(child, t); addChild(newTree, newSubTree); } return newTree; }
/** This is generic in the sense that it will work with any kind of * tree (not just Tree interface). It invokes the adaptor routines * not the tree node routines to do the construction. */ public Object dupTree(Object t, Object parent) { if ( t==null ) { return null; } Object newTree = dupNode(t); // ensure new subtree root has parent/child index set setChildIndex(newTree, getChildIndex(t)); // same index in new tree setParent(newTree, parent); int n = getChildCount(t); for (int i = 0; i < n; i++) { Object child = getChild(t, i); Object newSubTree = dupTree(child, t); addChild(newTree, newSubTree); } return newTree; }