X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSearchResults.java;h=546dd6fe229151cb68c55c04e9c86ff533dfbe9d;hb=ca160187a050f6d4e50158cd5b51f75c83a7179e;hp=8bca20d1726e42c07779dce43c977615d2aae9c8;hpb=2989fded65d7eb892018bcf783425fe23bc679d9;p=jalview.git diff --git a/src/jalview/datamodel/SearchResults.java b/src/jalview/datamodel/SearchResults.java index 8bca20d..546dd6f 100755 --- a/src/jalview/datamodel/SearchResults.java +++ b/src/jalview/datamodel/SearchResults.java @@ -22,12 +22,7 @@ package jalview.datamodel; import java.util.ArrayList; import java.util.BitSet; -import java.util.Collections; import java.util.List; -import java.util.SortedSet; -import java.util.TreeSet; - -import com.google.common.collect.Lists; /** * Holds a list of search result matches, where each match is a contiguous @@ -40,7 +35,7 @@ public class SearchResults implements SearchResultsI { private int count; - private SortedSet matches = new TreeSet<>(); + private ArrayList matches = new ArrayList<>(); /** * One match consists of a sequence reference, start and end positions. @@ -236,12 +231,7 @@ public class SearchResults implements SearchResultsI { Match m = new Match(sequence, start, end); - Match toAdd=null; - if (matches.contains(m)) - { - return false; - } boolean appending=false; // we dynamically maintain an interval to add as we test each range in the list @@ -252,6 +242,11 @@ public class SearchResults implements SearchResultsI { if (thatm.getSequence()==sequence) { + if (thatm.contains(sequence,cstart,cend)) + { + // found a match containing the current range. nothing else to do except report if we operated on the list + return appending; + } if (thatm.adjacent(sequence, cstart, cend)) { // update the match to add with the adjacent start/end @@ -355,7 +350,7 @@ public class SearchResults implements SearchResultsI else { // debug - // System.err.println("Outwith bounds!" + matchStart+">"+end +" or " + // jalview.bin.Console.errPrintln("Outwith bounds!" + matchStart+">"+end +" or " // + matchEnd+"<"+start); } } @@ -406,7 +401,7 @@ public class SearchResults implements SearchResultsI @Override public List getResults() { - return List.copyOf(matches); + return matches; } /**