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<SequenceI> 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<TreeNodeI> iterateInLevelOrder();
- public double getHeight(boolean adjustForCollapsedSubtrees);
+ public Iterator<TreeNodeI> iterateInPostOrder();
public Iterator<TreeNodeI> iterateInPreOrder();
- public Iterator<TreeNodeI> 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<TreeNodeI> 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);
}