void setStateRecursive(RootedTree tree, PhyloNode base, int state) { BreadthFirstIterator bfi = new BreadthFirstIterator(tree, base); while (bfi.hasNext()) { PhyloNode n = (PhyloNode) bfi.next(); n.setState(state); } }
void setPositionRecursive(RootedTree tree, PhyloNode base, PhyloNode positionToMe) { BreadthFirstIterator bfi = new BreadthFirstIterator(tree, base); while (bfi.hasNext()) { PhyloNode n = (PhyloNode) bfi.next(); n.setPosition(positionToMe); } }
void clearCutNodes() { if (origTree != null) { if (origVertex != null && origVertex.getState() == PhyloNode.CUT) { origTree.deleteSubtree(origVertex); origTree.removeElbowsBelow(origTree.getRoot()); setStateRecursive(origTree, (PhyloNode) origTree.getRoot(), PhyloNode.NONE); origVertex.found = false; origVertex = null; origTree.modPlus(); } } }
public synchronized void paste(CachedRootedTree destTree, PhyloNode destNode) { // Translate the newick string into a RooteTree. PhyloTree tree = loadClip(); // Add the clone's vertices and edges to the destination tree. synchronized (destTree) { destTree.setHoldCalculations(true); Graphs.addGraph(destTree, tree); // Insert the clone's root vertex into the midpoint above destNode. if (destTree.getParentOf(destNode) == null) { destTree.addEdge(destNode, tree.getRoot()); } else { DefaultVertex internalVertex = destTree.createAndAddVertex(); ((PhyloNode) internalVertex).setPosition(origVertex); destTree.insertNodeBetween(destTree.getParentOf(destNode), destNode, internalVertex); destTree.addEdge(internalVertex, tree.getRoot()); } destTree.setHoldCalculations(false); destTree.modPlus(); clearCutNodes(); } }