*/
package jalview.analysis;
+import jalview.api.FinderI;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Range;
import jalview.datamodel.SearchResultMatchI;
/**
* Implements the search algorithm for the Find dialog
*/
-public class Finder
+public class Finder implements FinderI
{
/*
* matched residue locations
/*
* sequences matched by id or description
*/
- private Vector<SequenceI> idMatch;
+ private Vector<SequenceI> idMatches;
/*
* the alignment to search over
private SequenceGroup selection;
/*
- * set true for case-sensitive search (default is false)
- */
- private boolean caseSensitive;
-
- /*
- * set true to search sequence description (default is false)
- */
- private boolean includeDescription;
-
- /*
- * set true to return all matches (default is next match only)
- */
- private boolean findAll;
-
- /*
* sequence index in alignment to search from
*/
private int sequenceIndex;
/*
* column position in sequence to search from, base 0
* - absolute column number including any hidden columns
- * (position of last match for a repeat search)
+ * (position after start of last match for a repeat search)
*/
private int columnIndex;
/**
- * Constructor to start searching an alignment, optionally restricting results
- * to a selection
+ * Constructor for searching an alignment
*
* @param al
- * @param sel
*/
- public Finder(AlignmentI al, SequenceGroup sel)
+ public Finder(AlignmentI al)
{
- this(al, sel, 0, -1);
+ this.alignment = al;
+ this.sequenceIndex = 0;
+ this.columnIndex = -1;
}
- /**
- * Constructor to resume search at given sequence and residue on alignment and
- * (optionally) restricted to a selection
- *
- * @param al
- * @param sel
- * @param seqindex
- * @param colindex
- */
- public Finder(AlignmentI al, SequenceGroup sel, int seqindex,
- int colindex)
+ @Override
+ public void findAll(String theSearchString, SequenceGroup sg,
+ boolean matchCase, boolean searchDescription)
{
- this.alignment = al;
- this.selection = sel;
- this.sequenceIndex = seqindex;
- this.columnIndex = colindex;
+ /*
+ * search from the start
+ */
+ sequenceIndex = 0;
+ columnIndex = -1;
+
+ doFind(theSearchString, sg, matchCase, searchDescription, true);
+
+ /*
+ * reset to start for next search
+ */
+ sequenceIndex = 0;
+ columnIndex = -1;
}
- /**
- * Performs a find for the given search string. By default the next match is
- * found, but if setFindAll(true) has been called, then all matches are found.
- * Sequences matched by id or description can be retrieved by getIdMatch(),
- * and matched residue patterns by getSearchResults().
- *
- * @param theSearchString
- * @return
- */
- public void find(String theSearchString)
+ @Override
+ public void findNext(String theSearchString, SequenceGroup sg,
+ boolean matchCase, boolean searchDescription)
{
- if (findAll)
+ doFind(theSearchString, sg, matchCase, searchDescription, false);
+
+ if (searchResults.isEmpty() && idMatches.isEmpty())
{
+ /*
+ * search failed - reset to start for next search
+ */
sequenceIndex = 0;
columnIndex = -1;
}
+ }
- String searchString = caseSensitive ? theSearchString
+ /**
+ * Performs a 'find next' or 'find all', optionally restricted to the
+ * specified selection region
+ *
+ * @param theSearchString
+ * @param selectionRegion
+ * @param matchCase
+ * @param searchDescription
+ * @param findAll
+ */
+ protected void doFind(String theSearchString, SequenceGroup selectionRegion,
+ boolean matchCase, boolean searchDescription, boolean findAll)
+ {
+ this.selection = selectionRegion;
+ String searchString = matchCase ? theSearchString
: theSearchString.toUpperCase();
Regex searchPattern = new Regex(searchString);
- searchPattern.setIgnoreCase(!caseSensitive);
+ searchPattern.setIgnoreCase(!matchCase);
+
searchResults = new SearchResults();
- idMatch = new Vector<>();
+ idMatches = new Vector<>();
if (selection != null && selection.getSize() < 1)
{
while (sequenceIndex < end)
{
SequenceI seq = alignment.getSequenceAt(sequenceIndex);
- boolean found = findNext(seq, searchString, searchPattern);
+ boolean found = findNextMatch(seq, searchString, searchPattern,
+ searchDescription);
if (found && !findAll)
{
return;
* @param seq
* @param searchString
* @param searchPattern
+ * @param matchDescription
* @return
*/
- protected boolean findNext(SequenceI seq, String searchString,
- Regex searchPattern)
+ protected boolean findNextMatch(SequenceI seq, String searchString,
+ Regex searchPattern, boolean matchDescription)
{
if (selection != null && !selection.contains(seq))
{
* at start of sequence; try find by residue number, in sequence id,
* or (optionally) in sequence description
*/
- if (doNonMotifSearches(seq, searchString, searchPattern))
+ if (doNonMotifSearches(seq, searchString, searchPattern,
+ matchDescription))
{
return true;
}
* @param seq
* @param searchString
* @param searchPattern
+ * @param includeDescription
* @return
*/
protected boolean doNonMotifSearches(SequenceI seq, String searchString,
- Regex searchPattern)
+ Regex searchPattern, boolean includeDescription)
{
/*
* position sequence search to start of sequence
protected boolean searchSequenceDescription(SequenceI seq, Regex searchPattern)
{
String desc = seq.getDescription();
- if (desc != null && searchPattern.search(desc) && !idMatch.contains(seq))
+ if (desc != null && searchPattern.search(desc) && !idMatches.contains(seq))
{
- idMatch.addElement(seq);
+ idMatches.addElement(seq);
return true;
}
return false;
*/
protected boolean searchSequenceName(SequenceI seq, Regex searchPattern)
{
- if (searchPattern.search(seq.getName()) && !idMatch.contains(seq))
+ if (searchPattern.search(seq.getName()) && !idMatches.contains(seq))
{
- idMatch.addElement(seq);
+ idMatches.addElement(seq);
return true;
}
return false;
return false;
}
- /**
- * Sets whether the search is case sensitive (default is no)
- *
- * @param value
+ /* (non-Javadoc)
+ * @see jalview.analysis.FinderI#getIdMatch()
*/
- public void setCaseSensitive(boolean value)
+ @Override
+ public Vector<SequenceI> getIdMatches()
{
- this.caseSensitive = value;
+ return idMatches;
}
- /**
- * Sets whether search returns all matches. Default is to return the next
- * match only.
- *
- * @param value
- */
- public void setFindAll(boolean value)
- {
- this.findAll = value;
- }
-
- /**
- * Returns the (possibly empty) list of sequences matched on sequence name or
- * description
- *
- * @return
- */
- public Vector<SequenceI> getIdMatch()
- {
- return idMatch;
- }
-
- /**
- * Answers the search results (possibly empty) from the last search
- *
- * @return
+ /* (non-Javadoc)
+ * @see jalview.analysis.FinderI#getSearchResults()
*/
+ @Override
public SearchResultsI getSearchResults()
{
return searchResults;
}
-
- /**
- * Answers the absolute column position (base 0, including any hidden columns)
- * of the start of the last sequence motif (residue pattern) match found. A
- * 'Find next' will search from the next position.
- *
- * @return
- */
- public int getColumnIndex()
- {
- return columnIndex;
- }
-
- /**
- * Answers the offset in the alignment (0..) of the sequence in which the last
- * match was found (if any)
- *
- * @return
- */
- public int getSequenceIndex()
- {
- return sequenceIndex;
- }
-
- /**
- * Sets whether search also searches in sequence description text (default is
- * no)
- *
- * @param value
- */
- public void setIncludeDescription(boolean value)
- {
- this.includeDescription = value;
- }
}
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
+import jalview.api.FinderI;
import jalview.bin.Cache;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+import junit.extensions.PA;
+
public class FinderTest
{
@BeforeClass(alwaysRun = true)
/*
* find next match only
*/
- Finder f = new Finder(al, null);
- f.find("E.H"); // 'E, any character, H'
+ Finder f = new Finder(al);
+ f.findNext("E.H", null, false, false); // 'E, any character, H'
// should match seq2 efH only
SearchResultsI sr = f.getSearchResults();
assertEquals(sr.getSize(), 1);
assertEquals(matches.get(0).getStart(), 5);
assertEquals(matches.get(0).getEnd(), 7);
- f = new Finder(al, null);
- f.setFindAll(true);
- f.find("E.H"); // 'E, any character, H'
+ f = new Finder(al);
+ f.findAll("E.H", null, false, false); // 'E, any character, H'
// should match seq2 efH and seq3 EFH
sr = f.getSearchResults();
assertEquals(sr.getSize(), 2);
@Test(groups = "Functional")
public void testFind_residueNumber()
{
- Finder f = new Finder(al, null);
+ Finder f = new Finder(al);
/*
* find first match should return seq1 residue 9
*/
- f.find("9");
+ f.findNext("9", null, false, false);
SearchResultsI sr = f.getSearchResults();
assertEquals(sr.getSize(), 1);
List<SearchResultMatchI> matches = sr.getResults();
/*
* find all matches should return seq1 and seq4 (others are too short)
*/
- f = new Finder(al, null);
- f.setFindAll(true);
- f.find("9");
+ f = new Finder(al);
+ f.findAll("9", null, false, false);
sr = f.getSearchResults();
assertEquals(sr.getSize(), 2);
matches = sr.getResults();
/*
* parsing of search string as integer is strict
*/
- f = new Finder(al, null);
- f.find(" 9");
+ f = new Finder(al);
+ f.findNext(" 9", null, false, false);
assertTrue(f.getSearchResults().isEmpty());
}
* start at second sequence; colIndex of -1
* means sequence id / description is searched
*/
- Finder f = new Finder(al, null, 1, -1);
- f.find("e"); // matches id
+ Finder f = new Finder(al);
+ PA.setValue(f, "sequenceIndex", 1);
+ PA.setValue(f, "columnIndex", -1);
+ f.findNext("e", null, false, false); // matches id
assertTrue(f.getSearchResults().isEmpty());
- assertEquals(f.getIdMatch().size(), 1);
- assertSame(f.getIdMatch().get(0), al.getSequenceAt(1));
+ assertEquals(f.getIdMatches().size(), 1);
+ assertSame(f.getIdMatches().get(0), al.getSequenceAt(1));
// colIndex is now 0 - for use in next find next
// searching A--BCDefHI
- assertEquals(f.getColumnIndex(), 0);
- f = new Finder(al, null, 1, 0);
- f.find("e"); // matches in sequence
- assertTrue(f.getIdMatch().isEmpty());
+ assertEquals(PA.getValue(f, "columnIndex"), 0);
+ f = new Finder(al);
+ PA.setValue(f, "sequenceIndex", 1);
+ PA.setValue(f, "columnIndex", 0);
+ f.findNext("e", null, false, false); // matches in sequence
+ assertTrue(f.getIdMatches().isEmpty());
assertEquals(f.getSearchResults().getSize(), 1);
List<SearchResultMatchI> matches = f.getSearchResults().getResults();
assertEquals(matches.get(0).getStart(), 5);
assertEquals(matches.get(0).getEnd(), 5);
assertSame(matches.get(0).getSequence(), al.getSequenceAt(1));
// still in the second sequence
- assertEquals(f.getSequenceIndex(), 1);
+ assertEquals(PA.getValue(f, "sequenceIndex"), 1);
// next column position to search from is 7
- assertEquals(f.getColumnIndex(), 7);
+ assertEquals(PA.getValue(f, "columnIndex"), 7);
// find next from end of sequence - finds next sequence id
- f = new Finder(al, null, 1, 7);
- f.find("e");
- assertEquals(f.getIdMatch().size(), 1);
- assertSame(f.getIdMatch().get(0), al.getSequenceAt(2));
+ f = new Finder(al);
+ PA.setValue(f, "sequenceIndex", 1);
+ PA.setValue(f, "columnIndex", 7);
+ f.findNext("e", null, false, false);
+ assertEquals(f.getIdMatches().size(), 1);
+ assertSame(f.getIdMatches().get(0), al.getSequenceAt(2));
assertTrue(f.getSearchResults().isEmpty());
}
/*
* find first match only
*/
- Finder f = new Finder(al2, null);
- f.setIncludeDescription(true);
- f.find("rAF");
- assertEquals(f.getIdMatch().size(), 1);
- assertSame(f.getIdMatch().get(0), al2.getSequenceAt(0));
+ Finder f = new Finder(al2);
+ f.findNext("rAF", null, false, true);
+ assertEquals(f.getIdMatches().size(), 1);
+ assertSame(f.getIdMatches().get(0), al2.getSequenceAt(0));
assertTrue(f.getSearchResults().isEmpty());
/*
* find all matches
*/
- f = new Finder(al2, null);
- f.setFindAll(true);
- f.setIncludeDescription(true);
- f.find("rAF");
- assertEquals(f.getIdMatch().size(), 2);
- assertSame(f.getIdMatch().get(0), al2.getSequenceAt(0));
- assertSame(f.getIdMatch().get(1), al2.getSequenceAt(1));
+ f = new Finder(al2);
+ f.findAll("rAF", null, false, true);
+ assertEquals(f.getIdMatches().size(), 2);
+ assertSame(f.getIdMatches().get(0), al2.getSequenceAt(0));
+ assertSame(f.getIdMatches().get(1), al2.getSequenceAt(1));
assertTrue(f.getSearchResults().isEmpty());
/*
* case sensitive
*/
- f = new Finder(al2, null);
- f.setFindAll(true);
- f.setCaseSensitive(true);
- f.setIncludeDescription(true);
-
- f.find("RAF");
- assertEquals(f.getIdMatch().size(), 1);
- assertSame(f.getIdMatch().get(0), al2.getSequenceAt(0));
+ f = new Finder(al2);
+ f.findAll("RAF", null, true, true);
+ assertEquals(f.getIdMatches().size(), 1);
+ assertSame(f.getIdMatches().get(0), al2.getSequenceAt(0));
assertTrue(f.getSearchResults().isEmpty());
/*
al2.getSequenceAt(0).setDescription("the efh sequence");
al2.getSequenceAt(0).setName("mouseEFHkinase");
al2.getSequenceAt(1).setName("humanEFHkinase");
- f = new Finder(al2, null);
- f.setFindAll(true);
- f.setIncludeDescription(true);
+ f = new Finder(al2);
/*
* sequence matches should have no duplicates
*/
- f.find("EFH");
- assertEquals(f.getIdMatch().size(), 2);
- assertSame(f.getIdMatch().get(0), al2.getSequenceAt(0));
- assertSame(f.getIdMatch().get(1), al2.getSequenceAt(1));
+ f.findAll("EFH", null, false, true);
+ assertEquals(f.getIdMatches().size(), 2);
+ assertSame(f.getIdMatches().get(0), al2.getSequenceAt(0));
+ assertSame(f.getIdMatches().get(1), al2.getSequenceAt(1));
assertEquals(f.getSearchResults().getSize(), 2);
SearchResultMatchI match = f.getSearchResults().getResults().get(0);
@Test(groups = "Functional")
public void testFindAll_sequenceIds()
{
- Finder f = new Finder(al, null);
- f.setFindAll(true);
+ Finder f = new Finder(al);
/*
* case insensitive; seq1 occurs twice in sequence id but
* only one match should be returned
*/
- f.find("SEQ1");
- assertEquals(f.getIdMatch().size(), 1);
- assertSame(f.getIdMatch().get(0), al.getSequenceAt(0));
+ f.findAll("SEQ1", null, false, false);
+ assertEquals(f.getIdMatches().size(), 1);
+ assertSame(f.getIdMatches().get(0), al.getSequenceAt(0));
SearchResultsI searchResults = f.getSearchResults();
assertTrue(searchResults.isEmpty());
/*
* case sensitive
*/
- f = new Finder(al, null);
- f.setFindAll(true);
- f.setCaseSensitive(true);
- f.find("SEQ1");
+ f = new Finder(al);
+ f.findAll("SEQ1", null, true, false);
searchResults = f.getSearchResults();
assertTrue(searchResults.isEmpty());
*/
AlignmentI al2 = new Alignment(al);
al2.addSequence(new Sequence("aBz", "xyzabZpqrAbZ"));
- f = new Finder(al2, null);
- f.setFindAll(true);
- f.find("ABZ");
- assertEquals(f.getIdMatch().size(), 1);
- assertSame(f.getIdMatch().get(0), al2.getSequenceAt(4));
+ f = new Finder(al2);
+ f.findAll("ABZ", null, false, false);
+ assertEquals(f.getIdMatches().size(), 1);
+ assertSame(f.getIdMatches().get(0), al2.getSequenceAt(4));
searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 2);
SearchResultMatchI match = searchResults.getResults().get(0);
/*
* efh should be matched in seq2 only
*/
- Finder f = new Finder(al, null);
- f.find("EfH");
+ FinderI f = new Finder(al);
+ f.findNext("EfH", null, false, false);
SearchResultsI searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 1);
SearchResultMatchI match = searchResults.getResults().get(0);
/*
* I should be found in seq1 (twice) and seq2 (once)
*/
- f = new Finder(al, null);
- f.find("I"); // find next: seq1/16
+ f = new Finder(al);
+ f.findNext("I", null, false, false); // find next: seq1/16
searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 1);
match = searchResults.getResults().get(0);
assertEquals(match.getStart(), 16);
assertEquals(match.getEnd(), 16);
- f.find("I"); // find next: seq1/18
+ f.findNext("I", null, false, false); // find next: seq1/18
searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 1);
match = searchResults.getResults().get(0);
assertEquals(match.getStart(), 18);
assertEquals(match.getEnd(), 18);
- f.find("I"); // find next: seq2/8
+ f.findNext("I", null, false, false); // find next: seq2/8
searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 1);
match = searchResults.getResults().get(0);
assertEquals(match.getStart(), 8);
assertEquals(match.getEnd(), 8);
- f.find("I");
+ f.findNext("I", null, false, false);
assertTrue(f.getSearchResults().isEmpty());
+
+ /*
+ * find should reset to start of alignment after a failed search
+ */
+ f.findNext("I", null, false, false); // find next: seq1/16
+ searchResults = f.getSearchResults();
+ assertEquals(searchResults.getSize(), 1);
+ match = searchResults.getResults().get(0);
+ assertSame(match.getSequence(), al.getSequenceAt(0));
+ assertEquals(match.getStart(), 16);
+ assertEquals(match.getEnd(), 16);
}
/**
@Test(groups = "Functional")
public void testFind_maximalResultOnly()
{
- Finder f = new Finder(al, null);
- f.setFindAll(true);
- f.find("M+");
+ Finder f = new Finder(al);
+ f.findAll("M+", null, false, false);
SearchResultsI searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 1);
SearchResultMatchI match = searchResults.getResults().get(0);
@Test(groups = "Functional")
public void testFind_findAll()
{
- Finder f = new Finder(al, null);
- f.setFindAll(true);
- f.find("EfH");
+ Finder f = new Finder(al);
+ f.findAll("EfH", null, false, false);
SearchResultsI searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 2);
SearchResultMatchI match = searchResults.getResults().get(0);
/*
* find all I should find 2 positions in seq1, 1 in seq2
*/
- f.find("I");
+ f.findAll("I", null, false, false);
searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 3);
match = searchResults.getResults().get(0);
@Test(groups = "Functional")
public void testFind_findAllCaseSensitive()
{
- Finder f = new Finder(al, null);
- f.setCaseSensitive(true);
- f.setFindAll(true);
+ Finder f = new Finder(al);
/*
* BC should match seq1/9-10 and seq2/2-3
*/
- f.find("BC");
+ f.findAll("BC", null, true, false);
SearchResultsI searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 2);
SearchResultMatchI match = searchResults.getResults().get(0);
/*
* bc should match seq3/1-2
*/
- f = new Finder(al, null);
- f.setCaseSensitive(true);
- f.setFindAll(true);
- f.find("bc");
+ f = new Finder(al);
+ f.findAll("bc", null, true, false);
searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 1);
match = searchResults.getResults().get(0);
assertEquals(match.getStart(), 1);
assertEquals(match.getEnd(), 2);
- f.find("bC");
+ f.findAll("bC", null, true, false);
assertTrue(f.getSearchResults().isEmpty());
}
sg.addSequence(al.getSequenceAt(1), false);
sg.addSequence(al.getSequenceAt(2), false);
- Finder f = new Finder(al, sg);
- f.find("b");
- assertTrue(f.getIdMatch().isEmpty());
+ FinderI f = new Finder(al);
+ f.findNext("b", sg, false, false);
+ assertTrue(f.getIdMatches().isEmpty());
SearchResultsI searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 1);
SearchResultMatchI match = searchResults.getResults().get(0);
/*
* a second Find should not return the 'b' in seq3 as outside the selection
*/
- f.find("b");
+ f.findNext("b", sg, false, false);
assertTrue(f.getSearchResults().isEmpty());
- assertTrue(f.getIdMatch().isEmpty());
+ assertTrue(f.getIdMatches().isEmpty());
- f = new Finder(al, sg);
- f.find("d");
- assertTrue(f.getIdMatch().isEmpty());
+ f = new Finder(al);
+ f.findNext("d", sg, false, false);
+ assertTrue(f.getIdMatches().isEmpty());
searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 1);
match = searchResults.getResults().get(0);
assertSame(match.getSequence(), al.getSequenceAt(1));
assertEquals(match.getStart(), 4);
assertEquals(match.getEnd(), 4);
- f.find("d");
- assertTrue(f.getIdMatch().isEmpty());
+ f.findNext("d", sg, false, false);
+ assertTrue(f.getIdMatches().isEmpty());
searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 1);
match = searchResults.getResults().get(0);
/*
* search for 'e' should match two sequence ids and one residue
*/
- Finder f = new Finder(al, sg);
- f.setFindAll(true);
- f.find("e");
- assertEquals(f.getIdMatch().size(), 2);
- assertSame(f.getIdMatch().get(0), al.getSequenceAt(1));
- assertSame(f.getIdMatch().get(1), al.getSequenceAt(2));
+ Finder f = new Finder(al);
+ f.findAll("e", sg, false, false);
+ assertEquals(f.getIdMatches().size(), 2);
+ assertSame(f.getIdMatches().get(0), al.getSequenceAt(1));
+ assertSame(f.getIdMatches().get(1), al.getSequenceAt(2));
SearchResultsI searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 1);
SearchResultMatchI match = searchResults.getResults().get(0);
/*
* search for 'Q' should match two sequence ids only
*/
- f = new Finder(al, sg);
- f.setFindAll(true);
- f.find("Q");
- assertEquals(f.getIdMatch().size(), 2);
- assertSame(f.getIdMatch().get(0), al.getSequenceAt(1));
- assertSame(f.getIdMatch().get(1), al.getSequenceAt(2));
+ f = new Finder(al);
+ f.findAll("Q", sg, false, false);
+ assertEquals(f.getIdMatches().size(), 2);
+ assertSame(f.getIdMatches().get(0), al.getSequenceAt(1));
+ assertSame(f.getIdMatches().get(1), al.getSequenceAt(2));
assertTrue(f.getSearchResults().isEmpty());
}
/*
* search for 'I' should match two sequence positions
*/
- Finder f = new Finder(al, sg);
- f.setFindAll(true);
- f.find("I");
- assertTrue(f.getIdMatch().isEmpty());
+ Finder f = new Finder(al);
+ f.findAll("I", sg, false, false);
+ assertTrue(f.getIdMatches().isEmpty());
SearchResultsI searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 2);
SearchResultMatchI match = searchResults.getResults().get(0);
* find all search for D should ignore hidden positions in seq1 and seq3,
* find the visible D in seq2
*/
- Finder f = new Finder(al, null);
- f.setFindAll(true);
- f.find("D");
+ Finder f = new Finder(al);
+ f.findAll("D", null, false, false);
SearchResultsI searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 1);
SearchResultMatchI match = searchResults.getResults().get(0);
* find all 'aaa' should find end of seq4 only
*/
hc.hideColumns(2, 5);
- f = new Finder(al, null);
- f.find("aaa");
+ f = new Finder(al);
+ f.findAll("aaa", null, false, false);
searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 1);
match = searchResults.getResults().get(0);
/*
* find all 'BE' should not match across hidden columns in seq1
*/
- f.find("BE");
+ f.findAll("BE", null, false, false);
assertTrue(f.getSearchResults().isEmpty());
/*
*/
hc.revealAllHiddenColumns(new ColumnSelection());
hc.hideColumns(8, 13);
- f = new Finder(al, null);
- f.find("H");
+ f = new Finder(al);
+ f.findNext("H", null, false, false);
searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 1);
match = searchResults.getResults().get(0);
* find all search for A or H
* should match seq2/1, seq2/7, not seq3/6
*/
- Finder f = new Finder(al, sg);
- f.setFindAll(true);
- f.find("[AH]");
+ Finder f = new Finder(al);
+ f.findAll("[AH]", sg, false, false);
SearchResultsI searchResults = f.getSearchResults();
assertEquals(searchResults.getSize(), 2);
SearchResultMatchI match = searchResults.getResults().get(0);