From: kjvdheide Date: Mon, 6 Nov 2017 18:11:50 +0000 (+0000) Subject: JAL-2794 simplified/clarified associating leaves to sequences X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bba68ca586f900d10cd60749708fa985c30c2256;p=jalview.git JAL-2794 simplified/clarified associating leaves to sequences --- diff --git a/src/jalview/analysis/TreeModel.java b/src/jalview/analysis/TreeModel.java index a9e721b..1c19dbf 100644 --- a/src/jalview/analysis/TreeModel.java +++ b/src/jalview/analysis/TreeModel.java @@ -130,29 +130,27 @@ public class TreeModel Vector leaves = findLeaves(top); - int i = 0; int namesleft = seqs.length; - SequenceNode j; - SequenceI nam; - String realnam; + SequenceI nodeSequence; + String nodeSequenceName; Vector 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) {