package jalview.ext.treeviewer; import jalview.datamodel.SequenceI; import java.io.File; import java.io.IOException; import java.util.Iterator; import java.util.List; /** * Interface for a generic phylogenetic tree, this does not necessarily have to * be part of a tree panel. * * @author kjvanderheide * */ public interface TreeI { /** * Uses this tree as the basis for a new tree frame. * * @param instanceTitle * name of the new tree frame. * @return */ TreeFrameI createTreeViewerFromTree(String instanceTitle); public String[] getAllLeafNames(); public TreeNodeI[] getAllNodes(); public TreeNodeI getFurthestNode(); public double getHeight(boolean adjustForCollapsedSubtrees); public List getNodeSequences(); public TreeNodeI getNodeWithName(String name); public TreeNodeI getRoot(); public String getTreeName(); /** * Check if the tree actually contains any nodes. * * @return true if tree has no nodes (or is deleted), false otherwise. */ public boolean isEmpty(); public Iterator iterateInLevelOrder(); public Iterator iterateInPostOrder(); public Iterator iterateInPreOrder(); /** * This should write the tree to the richest file format available for * compatibility reasons as this is the method used when Jalview saves a tree * to its project. * * @param outputFile * File that tree should be written to * @throws IOException */ public void outputAsFile(File outputFile) throws IOException; public void setRerootable(boolean b); public void setRoot(TreeNodeI rootNode); public void setRooted(boolean b); public void setTreeName(String treeTitle); }