/** * Populates <code>subtree</code> with the subtree of <code>tree</code> which is rooted at <code> * root</code>. * * @param <N> the node type * @param <E> the edge type * @param tree the tree whose subtree is to be extracted * @param subTree the tree instance which is to be populated with the subtree of <code>tree</code> * @param root the root of the subtree to be extracted */ // does this need to be a public method? (or even separate?) public static <N, E> void growSubTree( CTreeNetwork<N, E> tree, MutableCTreeNetwork<N, E> subTree, N root) { checkNotNull(tree, "tree"); checkNotNull(subTree, "subTree"); checkNotNull(root, "root"); for (N kid : tree.successors(root)) { E edge = tree.edgesConnecting(root, kid).iterator().next(); // guaranteed to be only one edge subTree.addEdge(root, kid, edge); growSubTree(tree, subTree, kid); } }