/**
* hold's last-searched position between calles to find(false)
*/
- int seqIndex = 0, resIndex = 0;
+ int seqIndex = 0, resIndex = -1;
public Finder(AlignmentI alignment, SequenceGroup selection)
{
this.selection = selection;
}
+ /**
+ * restart search at given sequence and residue on alignment and (optionally) contained in selection
+ * @param alignment
+ * @param selectionGroup
+ * @param seqIndex
+ * @param resIndex
+ */
public Finder(AlignmentI alignment, SequenceGroup selectionGroup,
int seqIndex, int resIndex)
{
&& !selection.getSequences(null).contains(seq))
{
seqIndex++;
- resIndex = 0;
+ resIndex = -1;
continue;
}
-
+ if (resIndex<0) {
+ resIndex=0;
+ if (regex.search(seq.getName()))
+ {
+ idMatch.addElement(seq);
+ hasResults = true;
+ if (!findAll)
+ {
+ // stop and return the match
+ found=true;
+ break;
+ }
+ }
+ }
item = seq.getSequenceAsString();
if ((selection != null)
if (!found)
{
seqIndex++;
- resIndex = 0;
+ resIndex = -1;
}
}
- for (int id = 0; id < alignment.getHeight(); id++)
+ /**
+ * We now search the Id string in the main search loop.
+ * for (int id = 0; id < alignment.getHeight(); id++)
{
if (regex.search(alignment.getSequenceAt(id).getName()))
{
idMatch.addElement(alignment.getSequenceAt(id));
hasResults = true;
}
- }
+ } */
return hasResults;
}