Added TreeBuilder as parameter to the converter constructor
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Thu, 26 Oct 2017 15:12:04 +0000 (16:12 +0100)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Thu, 26 Oct 2017 15:12:04 +0000 (16:12 +0100)
src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java
src/jalview/ext/archaeopteryx/ArchaeopteryxTreeConverter.java

index 7ca870c..3bd9d19 100644 (file)
@@ -28,8 +28,9 @@ public final class ArchaeopteryxInit
   public static MainFrame createInstance(
           TreeBuilder calculatedTree)
   {
-    ArchaeopteryxTreeBuilder aptxTreeBuilder = new ArchaeopteryxTreeBuilder();
-    Phylogeny aptxTree = aptxTreeBuilder.buildAptxTree(calculatedTree);
+    ArchaeopteryxTreeConverter aptxTreeBuilder = new ArchaeopteryxTreeConverter(
+            calculatedTree);
+    Phylogeny aptxTree = aptxTreeBuilder.buildAptxTree();
     Phylogeny[] aptxTrees = { aptxTree }; // future possibility to load in
                                           // several trees simultaneously
 
index e159763..780acee 100644 (file)
@@ -7,11 +7,7 @@ import jalview.math.MatrixI;
 import org.forester.phylogeny.Phylogeny;
 import org.forester.phylogeny.PhylogenyNode;
 
-public class ArchaeopteryxTreeBuilder // cannot inherit
-                                                        // TreeBuilder as that
-                                                        // demands the use of
-                                                        // SequenceNode (instead
-                                                        // of PhylogenyNode)
+public class ArchaeopteryxTreeConverter
 {
   protected SequenceI[] sequences;
 
@@ -26,27 +22,29 @@ public class ArchaeopteryxTreeBuilder // cannot inherit
   }
 
 
-  public ArchaeopteryxTreeBuilder()
+  public ArchaeopteryxTreeConverter(TreeBuilder calculatedTree)
   {
+    this.sequences = calculatedTree.getSequences();
+    this.distances = calculatedTree.getDistances();
 
     this.rootNode = new PhylogenyNode();
     this.rootNode.setName("root");
 
   }
 
-  public ArchaeopteryxTreeBuilder(PhylogenyNode treeRoot)
+  public ArchaeopteryxTreeConverter(PhylogenyNode treeRoot,
+          TreeBuilder calculatedTree)
   {
-
+    this(calculatedTree);
     this.rootNode = treeRoot;
 
   }
 
-  public Phylogeny buildAptxTree(TreeBuilder tree)
+  public Phylogeny buildAptxTree()
   {
-    this.sequences = tree.getSequences();
-    this.distances = tree.getDistances();
 
-    aptxTree.setName(
+
+    this.aptxTree.setName(
             "PLEASE FIX ME reheaheth35yheqhb3q5hyq3bt3q5u4jwqjwuh6");
 
     // final NeighborJoiningF nj = NeighborJoiningF.createInstance(false, 5);