From ad9fc20de0dcc3737c75a777915973497791e393 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 28 Apr 2014 13:31:59 +0100 Subject: [PATCH] JAL-1340 simpler and more efficient interactive highlighting of redundant sequences --- src/jalview/appletgui/RedundancyPanel.java | 13 +++++-------- src/jalview/gui/RedundancyPanel.java | 14 ++++---------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/jalview/appletgui/RedundancyPanel.java b/src/jalview/appletgui/RedundancyPanel.java index 345c906..048a514 100644 --- a/src/jalview/appletgui/RedundancyPanel.java +++ b/src/jalview/appletgui/RedundancyPanel.java @@ -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 redundantSequences = new ArrayList(); 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); } diff --git a/src/jalview/gui/RedundancyPanel.java b/src/jalview/gui/RedundancyPanel.java index 3ff0ca3..323d7f1 100755 --- a/src/jalview/gui/RedundancyPanel.java +++ b/src/jalview/gui/RedundancyPanel.java @@ -173,21 +173,15 @@ public class RedundancyPanel extends GSliderPanel implements Runnable } float value = slider.getValue(); - + List redundantSequences = new ArrayList(); 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); } /** -- 1.7.10.2