JAL-2805 expanded tree and treenode interfaces
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Thu, 16 Nov 2017 11:38:47 +0000 (11:38 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Thu, 16 Nov 2017 11:38:47 +0000 (11:38 +0000)
src/jalview/ext/archaeopteryx/Tree.java
src/jalview/ext/archaeopteryx/TreeNode.java
src/jalview/ext/treeviewer/ExternalTree.java [deleted file]
src/jalview/ext/treeviewer/ExternalTreeI.java [new file with mode: 0644]
src/jalview/ext/treeviewer/ExternalTreeNode.java [deleted file]
src/jalview/ext/treeviewer/ExternalTreeNodeI.java [new file with mode: 0644]
src/jalview/ext/treeviewer/ExternalTreePanelI.java [moved from src/jalview/ext/treeviewer/ExternalTreePanel.java with 51% similarity]

index de5f32a..884a359 100644 (file)
@@ -1,11 +1,11 @@
 package jalview.ext.archaeopteryx;
 
-import jalview.ext.treeviewer.ExternalTree;
-import jalview.ext.treeviewer.ExternalTreeNode;
+import jalview.ext.treeviewer.ExternalTreeI;
+import jalview.ext.treeviewer.ExternalTreeNodeI;
 
 import org.forester.phylogeny.Phylogeny;
 
-public class Tree implements ExternalTree
+public class Tree implements ExternalTreeI
 {
   private final Phylogeny tree;
 
@@ -18,12 +18,13 @@ public class Tree implements ExternalTree
   public Phylogeny getOriginalTree()
   {
     return tree;
+
   }
 
   @Override
-  public ExternalTreeNode getRoot()
+  public ExternalTreeNodeI getRoot()
   {
-    ExternalTreeNode root = new TreeNode(tree.getRoot());
+    ExternalTreeNodeI root = new TreeNode(tree.getRoot());
     return root;
   }
 
@@ -33,4 +34,17 @@ public class Tree implements ExternalTree
     tree.setName(name);
 
   }
+
+  @Override
+  public ExternalTreeNodeI getNodeWithName(String name)
+  {
+    return new TreeNode(tree.getNode(name));
+
+  }
+
+  @Override
+  public String[] getAllLeafNames()
+  {
+    return tree.getAllExternalNodeNames();
+  }
 }
index 6c2dbed..8e06d6c 100644 (file)
@@ -1,12 +1,12 @@
 package jalview.ext.archaeopteryx;
 
-import jalview.ext.treeviewer.ExternalTreeNode;
+import jalview.ext.treeviewer.ExternalTreeNodeI;
 
 import java.util.List;
 
 import org.forester.phylogeny.PhylogenyNode;
 
-public class TreeNode implements ExternalTreeNode
+public class TreeNode implements ExternalTreeNodeI
 {
   private final PhylogenyNode node;
 
@@ -16,16 +16,23 @@ public class TreeNode implements ExternalTreeNode
   }
 
   @Override
+  public PhylogenyNode getOriginalNode()
+  {
+    return node;
+  }
+
+  @Override
   public String getNodeName()
   {
     return node.getName();
   }
 
   @Override
-  public List<ExternalTreeNode> getChildren()
+  public List<ExternalTreeNodeI> getChildren()
   {
     // return node.getDescendants();
     return null;
   }
 
+
 }
diff --git a/src/jalview/ext/treeviewer/ExternalTree.java b/src/jalview/ext/treeviewer/ExternalTree.java
deleted file mode 100644 (file)
index 02b4a0a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-package jalview.ext.treeviewer;
-
-public interface ExternalTree
-{
-  public void setTreeName(String name);
-
-  public <T> T getOriginalTree();
-
-  public ExternalTreeNode getRoot();
-
-}
diff --git a/src/jalview/ext/treeviewer/ExternalTreeI.java b/src/jalview/ext/treeviewer/ExternalTreeI.java
new file mode 100644 (file)
index 0000000..0184227
--- /dev/null
@@ -0,0 +1,15 @@
+package jalview.ext.treeviewer;
+
+public interface ExternalTreeI
+{
+  public void setTreeName(String name);
+
+  public <T> T getOriginalTree();
+
+  public ExternalTreeNodeI getRoot();
+
+  public ExternalTreeNodeI getNodeWithName(String name);
+
+  public String[] getAllLeafNames();
+
+}
diff --git a/src/jalview/ext/treeviewer/ExternalTreeNode.java b/src/jalview/ext/treeviewer/ExternalTreeNode.java
deleted file mode 100644 (file)
index 8d6f3b8..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-package jalview.ext.treeviewer;
-
-import java.util.List;
-
-public interface ExternalTreeNode
-{
-  public String getNodeName();
-
-  public List<ExternalTreeNode> getChildren();
-}
diff --git a/src/jalview/ext/treeviewer/ExternalTreeNodeI.java b/src/jalview/ext/treeviewer/ExternalTreeNodeI.java
new file mode 100644 (file)
index 0000000..34f45bd
--- /dev/null
@@ -0,0 +1,12 @@
+package jalview.ext.treeviewer;
+
+import java.util.List;
+
+public interface ExternalTreeNodeI
+{
+  public <N> N getOriginalNode();
+
+  public String getNodeName();
+
+  public List<ExternalTreeNodeI> getChildren();
+}
@@ -1,6 +1,6 @@
 package jalview.ext.treeviewer;
 
-public interface ExternalTreePanel
+public interface ExternalTreePanelI
 {
 
 }