1 package jalview.ext.treeviewer;
3 import jalview.datamodel.SequenceI;
6 import java.io.IOException;
7 import java.util.Iterator;
11 * Interface for implementing a phylogenetic tree.
13 * @author kjvanderheide
16 public interface TreeI
19 * Uses this tree as the basis for a new tree frame.
21 * @param instanceTitle
22 * name of the new tree frame.
25 TreeFrameI createTreeViewerFromTree(String instanceTitle);
27 public String[] getAllLeafNames();
29 public TreeNodeI[] getAllNodes();
32 * Gets the node that has the maximum branch length from the root (or top
33 * level node if tree is unrooted).
37 public TreeNodeI getFurthestNode();
40 * Returns the longest total branch length from the root to a leaf node.
42 * @param adjustForCollapsedSubtrees
43 * true if nodes part of a collapsed (hidden) subtree should be
47 public double getMaximumLength(boolean adjustForCollapsedSubtrees);
49 public List<SequenceI> getNodeSequences();
51 public TreeNodeI getNodeWithName(String name);
53 public TreeNodeI getRoot();
55 public String getTreeName();
58 * Check if the tree actually contains any nodes.
60 * @return true if tree has no nodes (or is deleted), false otherwise.
62 public boolean isEmpty();
64 public Iterator<TreeNodeI> iterateInLevelOrder();
66 public Iterator<TreeNodeI> iterateInPostOrder();
68 public Iterator<TreeNodeI> iterateInPreOrder();
71 * This should write the tree to the richest file format available for
72 * compatibility reasons as this is the method used when Jalview saves a tree
76 * File that tree should be written to
79 public void outputAsFile(File outputFile) throws IOException;
81 public void setRerootable(boolean b);
83 public void setRoot(TreeNodeI rootNode);
85 public void setRooted(boolean b);
87 public void setTreeName(String treeTitle);