From c3f7d61eb0c8950261a4b735900c1e74acf1cd85 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 1 Nov 2016 17:17:53 +0000 Subject: [PATCH] JAL-1738 JAL-345 fix broken calculation of newly marked bits --- src/jalview/datamodel/SearchResults.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/jalview/datamodel/SearchResults.java b/src/jalview/datamodel/SearchResults.java index a5bf8aa..3cb34de 100755 --- a/src/jalview/datamodel/SearchResults.java +++ b/src/jalview/datamodel/SearchResults.java @@ -275,9 +275,9 @@ public class SearchResults implements SearchResultsI public int markColumns(SequenceCollectionI sqcol, BitSet bs) { int count = 0; + BitSet mask = new BitSet(); for (SequenceI s : sqcol.getSequences()) { - BitSet mask = new BitSet(); int[] cols = getResults(s, sqcol.getStartRes(), sqcol.getEndRes()); if (cols != null) { @@ -286,13 +286,13 @@ public class SearchResults implements SearchResultsI mask.set(cols[pair], cols[pair + 1] + 1); } } - // find columns that were already selected - BitSet compl = (BitSet) mask.clone(); - compl.and(bs); - count += compl.cardinality(); - // and mark ranges not already marked - bs.or(mask); } + // compute columns that were newly selected + BitSet original = (BitSet) bs.clone(); + original.and(mask); + count = mask.cardinality() - original.cardinality(); + // and mark ranges not already marked + bs.or(mask); return count; } -- 1.7.10.2