JAL-1340 simpler and more efficient interactive highlighting of redundant sequences
authorJim Procter <jprocter@dundee.ac.uk>
Mon, 28 Apr 2014 12:31:59 +0000 (13:31 +0100)
committerJim Procter <jprocter@dundee.ac.uk>
Mon, 28 Apr 2014 12:31:59 +0000 (13:31 +0100)
src/jalview/appletgui/RedundancyPanel.java
src/jalview/gui/RedundancyPanel.java

index 345c906..048a514 100644 (file)
@@ -19,7 +19,7 @@
 package jalview.appletgui;
 
 import java.util.*;
-
+import java.util.List;
 import java.awt.*;
 import java.awt.event.*;
 
@@ -143,19 +143,16 @@ public class RedundancyPanel extends SliderPanel implements Runnable,
 
     float value = slider.getValue();
 
+    List<SequenceI> redundantSequences = new ArrayList<SequenceI>();
     for (int i = 0; i < redundancy.length; i++)
     {
-      if (value > redundancy[i])
-      {
-        redundantSeqs.removeElement(originalSequences[i]);
-      }
-      else if (!redundantSeqs.contains(originalSequences[i]))
+      if (value <= redundancy[i])
       {
-        redundantSeqs.addElement(originalSequences[i]);
+        redundantSequences.add(originalSequences[i]);
       }
     }
 
-    ap.idPanel.idCanvas.setHighlighted(redundantSeqs);
+    ap.idPanel.idCanvas.setHighlighted(redundantSequences);
     PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true);
 
   }
index 3ff0ca3..323d7f1 100755 (executable)
@@ -173,21 +173,15 @@ public class RedundancyPanel extends GSliderPanel implements Runnable
     }
 
     float value = slider.getValue();
-
+    List<SequenceI> redundantSequences = new ArrayList<SequenceI>();
     for (int i = 0; i < redundancy.length; i++)
     {
-      if (value > redundancy[i])
-      {
-        redundantSeqs.remove(originalSequences[i]);
-      }
-      else if (!redundantSeqs.contains(originalSequences[i]))
+      if (value <= redundancy[i])
       {
-        redundantSeqs.add(originalSequences[i]);
+        redundantSequences.add(originalSequences[i]);
       }
-
     }
-
-    ap.idPanel.idCanvas.setHighlighted(redundantSeqs);
+    ap.idPanel.idCanvas.setHighlighted(redundantSequences);
   }
 
   /**