X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fext%2Ftreeviewer%2FTreeI.java;fp=src%2Fjalview%2Fext%2Ftreeviewer%2FTreeI.java;h=08c3d04c899f236ebef648987f43cbe55db7e1c0;hb=4a3def9f59cefe629c9a33d87483283aee085928;hp=0000000000000000000000000000000000000000;hpb=eca4795050a0f7eca3d5dece68eaa54987cebd15;p=jalview.git diff --git a/src/jalview/ext/treeviewer/TreeI.java b/src/jalview/ext/treeviewer/TreeI.java new file mode 100644 index 0000000..08c3d04 --- /dev/null +++ b/src/jalview/ext/treeviewer/TreeI.java @@ -0,0 +1,89 @@ +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 implementing a phylogenetic tree. + * + * @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(); + + /** + * Gets the node that has the maximum branch length from the root (or top + * level node if tree is unrooted). + * + * @return + */ + public TreeNodeI getFurthestNode(); + + /** + * Returns the longest total branch length from the root to a leaf node. + * + * @param adjustForCollapsedSubtrees + * true if nodes part of a collapsed (hidden) subtree should be + * considered. + * @return + */ + public double getMaximumLength(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); + +}