From: kjvdheide Date: Thu, 16 Nov 2017 11:38:47 +0000 (+0000) Subject: JAL-2805 expanded tree and treenode interfaces X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7907e8826153967e245c409b3fc39876f92fb53b;p=jalview.git JAL-2805 expanded tree and treenode interfaces --- diff --git a/src/jalview/ext/archaeopteryx/Tree.java b/src/jalview/ext/archaeopteryx/Tree.java index de5f32a..884a359 100644 --- a/src/jalview/ext/archaeopteryx/Tree.java +++ b/src/jalview/ext/archaeopteryx/Tree.java @@ -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(); + } } diff --git a/src/jalview/ext/archaeopteryx/TreeNode.java b/src/jalview/ext/archaeopteryx/TreeNode.java index 6c2dbed..8e06d6c 100644 --- a/src/jalview/ext/archaeopteryx/TreeNode.java +++ b/src/jalview/ext/archaeopteryx/TreeNode.java @@ -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 getChildren() + public List 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 index 02b4a0a..0000000 --- a/src/jalview/ext/treeviewer/ExternalTree.java +++ /dev/null @@ -1,11 +0,0 @@ -package jalview.ext.treeviewer; - -public interface ExternalTree -{ - public void setTreeName(String name); - - public 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 index 0000000..0184227 --- /dev/null +++ b/src/jalview/ext/treeviewer/ExternalTreeI.java @@ -0,0 +1,15 @@ +package jalview.ext.treeviewer; + +public interface ExternalTreeI +{ + public void setTreeName(String name); + + public 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 index 8d6f3b8..0000000 --- a/src/jalview/ext/treeviewer/ExternalTreeNode.java +++ /dev/null @@ -1,10 +0,0 @@ -package jalview.ext.treeviewer; - -import java.util.List; - -public interface ExternalTreeNode -{ - public String getNodeName(); - - public List getChildren(); -} diff --git a/src/jalview/ext/treeviewer/ExternalTreeNodeI.java b/src/jalview/ext/treeviewer/ExternalTreeNodeI.java new file mode 100644 index 0000000..34f45bd --- /dev/null +++ b/src/jalview/ext/treeviewer/ExternalTreeNodeI.java @@ -0,0 +1,12 @@ +package jalview.ext.treeviewer; + +import java.util.List; + +public interface ExternalTreeNodeI +{ + public N getOriginalNode(); + + public String getNodeName(); + + public List getChildren(); +} diff --git a/src/jalview/ext/treeviewer/ExternalTreePanel.java b/src/jalview/ext/treeviewer/ExternalTreePanelI.java similarity index 51% rename from src/jalview/ext/treeviewer/ExternalTreePanel.java rename to src/jalview/ext/treeviewer/ExternalTreePanelI.java index e736410..c488683 100644 --- a/src/jalview/ext/treeviewer/ExternalTreePanel.java +++ b/src/jalview/ext/treeviewer/ExternalTreePanelI.java @@ -1,6 +1,6 @@ package jalview.ext.treeviewer; -public interface ExternalTreePanel +public interface ExternalTreePanelI { }