X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Ftreeviewer%2FTreeI.java;h=fbda8f1c37442371742dda63beb7cd574b5ceaf6;hb=01982168e80062f30c7ea08ceced49030cbfaffd;hp=702ff61f0137578626870866924678968f7e8b2d;hpb=61d2fe973679dd35d3e471ced017a558f2d6e27b;p=jalview.git diff --git a/src/jalview/ext/treeviewer/TreeI.java b/src/jalview/ext/treeviewer/TreeI.java index 702ff61..fbda8f1 100644 --- a/src/jalview/ext/treeviewer/TreeI.java +++ b/src/jalview/ext/treeviewer/TreeI.java @@ -7,42 +7,70 @@ 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 { - public TreeNodeI getRoot(); - - public TreeNodeI getNodeWithName(String name); + /** + * 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 TreeNodeI getFurthestNode(); + public String[] getAllLeafNames(); public TreeNodeI[] getAllNodes(); - public String[] getAllLeafNames(); + public TreeNodeI getFurthestNode(); + + public double getHeight(boolean adjustForCollapsedSubtrees); public List getNodeSequences(); - public void setTreeName(String treeTitle); + public TreeNodeI getNodeWithName(String name); - public void setRerootable(boolean b); + public TreeNodeI getRoot(); - public void setRooted(boolean b); + 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 String getTreeName(); - - public void setRoot(TreeNodeI rootNode); + public Iterator iterateInLevelOrder(); - public double getHeight(boolean adjustForCollapsedSubtrees); + public Iterator iterateInPostOrder(); public Iterator iterateInPreOrder(); - public Iterator iterateInLevelOrder(); + /** + * 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 Iterator iterateInPostOrder(); + public void setRerootable(boolean b); - TreeFrameI createTreeViewerFromTree(String instanceTitle); + public void setRoot(TreeNodeI rootNode); - public void writeToXml(File outputFile) throws IOException; + public void setRooted(boolean b); + + public void setTreeName(String treeTitle); }