JAL-2794 simplified/clarified associating leaves to sequences
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Mon, 6 Nov 2017 18:11:50 +0000 (18:11 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Mon, 6 Nov 2017 18:11:50 +0000 (18:11 +0000)
src/jalview/analysis/TreeModel.java

index a9e721b..1c19dbf 100644 (file)
@@ -130,29 +130,27 @@ public class TreeModel
 
     Vector<SequenceNode> leaves = findLeaves(top);
 
-    int i = 0;
     int namesleft = seqs.length;
 
-    SequenceNode j;
-    SequenceI nam;
-    String realnam;
+    SequenceI nodeSequence;
+    String nodeSequenceName;
     Vector<SequenceI> one2many = new Vector<>();
     // int countOne2Many = 0;
-    while (i < leaves.size())
+
+    for (SequenceNode sn : leaves)
     {
-      j = leaves.elementAt(i++);
-      realnam = j.getName();
-      nam = null;
+      nodeSequenceName = sn.getName();
+      nodeSequence = null;
 
       if (namesleft > -1)
       {
-        nam = algnIds.findIdMatch(realnam);
+        nodeSequence = algnIds.findIdMatch(nodeSequenceName);
       }
 
-      if (nam != null)
+      if (nodeSequence != null)
       {
-        j.setElement(nam);
-        if (one2many.contains(nam))
+        sn.setElement(nodeSequence);
+        if (one2many.contains(nodeSequence))
         {
           // countOne2Many++;
           // if (jalview.bin.Cache.log.isDebugEnabled())
@@ -161,14 +159,14 @@ public class TreeModel
         }
         else
         {
-          one2many.addElement(nam);
+          one2many.addElement(nodeSequence);
           namesleft--;
         }
       }
       else
       {
-        j.setElement(new Sequence(realnam, "THISISAPLACEHLDER"));
-        j.setPlaceholder(true);
+        sn.setElement(new Sequence(nodeSequenceName, "THISISAPLACEHLDER"));
+        sn.setPlaceholder(true);
       }
     }
     // if (jalview.bin.Cache.log.isDebugEnabled() && countOne2Many>0) {