X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSearchResults.java;fp=src%2Fjalview%2Fdatamodel%2FSearchResults.java;h=d6545eecb9d7ac7c49005b8f7be252b116425888;hb=e20c9d416a4bd5bd9b7259c77e689589625455bf;hp=9daa75222a168c5332895894fc7a2cd27ca0af81;hpb=891ad563684679b77e918075d2f7cab43ac769fa;p=jalview.git diff --git a/src/jalview/datamodel/SearchResults.java b/src/jalview/datamodel/SearchResults.java index 9daa752..d6545ee 100755 --- a/src/jalview/datamodel/SearchResults.java +++ b/src/jalview/datamodel/SearchResults.java @@ -23,8 +23,6 @@ package jalview.datamodel; import java.util.ArrayList; import java.util.BitSet; import java.util.List; -import java.util.SortedSet; -import java.util.TreeSet; /** * Holds a list of search result matches, where each match is a contiguous @@ -37,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. @@ -233,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 @@ -249,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 @@ -403,7 +401,7 @@ public class SearchResults implements SearchResultsI @Override public List getResults() { - return List.copyOf(matches); + return matches; } /**