From: Jim Procter Date: Tue, 1 Nov 2016 17:17:53 +0000 (+0000) Subject: JAL-1738 JAL-345 fix broken calculation of newly marked bits X-Git-Tag: Release_2_10_1~10^2~6^2~1^2~16 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c3f7d61eb0c8950261a4b735900c1e74acf1cd85;p=jalview.git JAL-1738 JAL-345 fix broken calculation of newly marked bits --- 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; }