* @see jalview.datamodel.SearchResultsI#addResult(jalview.datamodel.SequenceI, int, int)
*/
@Override
- public void addResult(SequenceI seq, int start, int end)
+ public SearchResultMatchI addResult(SequenceI seq, int start, int end)
{
- matches.add(new Match(seq, start, end));
+ Match m = new Match(seq, start, end);
+ matches.add(m);
+ return m;
}
/* (non-Javadoc)
* int
* @param end
* int
+ * @return SearchResultMatchI instance created for this instance
*/
- public abstract void addResult(SequenceI seq, int start, int end);
+ public abstract SearchResultMatchI addResult(SequenceI seq, int start,
+ int end);
/**
* Quickly check if the given sequence is referred to in the search results
import java.util.BitSet;
+import org.junit.Assert;
import org.testng.annotations.Test;
public class SearchResultsTest
SearchResultsI sr = new SearchResults();
BitSet bs = new BitSet();
- sr.addResult(seq1, 1,1);
- sr.addResult(seq2, 1,2);
+ SearchResultMatchI srm = null;
+ srm = sr.addResult(seq1, 1, 1);
+ Assert.assertNotNull("addResult didn't return Match", srm);
+ srm = sr.addResult(seq2, 1, 2);
+ assertEquals("Sequence reference not set", seq2, srm.getSequence());
+ assertEquals("match start incorrect", 1, srm.getStart());
+ assertEquals("match end incorrect", 2, srm.getEnd());
// set start/end range for groups to cover matches