* Implements the search algorithms for the Find dialog box.
*/
SearchResults searchResults;
+
AlignmentI alignment;
+
jalview.datamodel.SequenceGroup selection = null;
+
Vector idMatch = null;
+
boolean caseSensitive = false;
+
boolean findAll = false;
+
com.stevesoft.pat.Regex regex = null;
+
/**
* hold's last-searched position between calles to find(false)
*/
int seqIndex = 0, resIndex = 0;
+
public Finder(AlignmentI alignment, SequenceGroup selection)
{
this.alignment = alignment;
}
public Finder(AlignmentI alignment, SequenceGroup selectionGroup,
- int seqIndex, int resIndex)
+ int seqIndex, int resIndex)
{
this(alignment, selectionGroup);
this.seqIndex = seqIndex;
String item = null;
boolean found = false;
- ////// is the searchString a residue number?
+ // //// is the searchString a residue number?
try
{
int res = Integer.parseInt(searchString);
searchResults.addResult(seq, res, res);
hasResults = true;
- }
- catch (NumberFormatException ex)
+ } catch (NumberFormatException ex)
{
}
- ///////////////////////////////////////////////
+ // /////////////////////////////////////////////
int end = alignment.getHeight();
if (selection != null)
{
- if ( (selection.getSize() < 1) ||
- ( (selection.getEndRes() - selection.getStartRes()) < 2))
+ if ((selection.getSize() < 1)
+ || ((selection.getEndRes() - selection.getStartRes()) < 2))
{
selection = null;
}
{
seq = (Sequence) alignment.getSequenceAt(seqIndex);
- if ( (selection != null) && !selection.getSequences(null).contains(seq))
+ if ((selection != null)
+ && !selection.getSequences(null).contains(seq))
{
seqIndex++;
resIndex = 0;
}
item = seq.getSequenceAsString();
- if(!caseSensitive)
+ if (!caseSensitive)
item = item.toUpperCase();
- if ( (selection != null) &&
- (selection.getEndRes() < alignment.getWidth() - 1))
+ if ((selection != null)
+ && (selection.getEndRes() < alignment.getWidth() - 1))
{
item = item.substring(0, selection.getEndRes() + 1);
}
- ///Shall we ignore gaps???? - JBPNote: Add Flag for forcing this or not
+ // /Shall we ignore gaps???? - JBPNote: Add Flag for forcing this or not
StringBuffer noGapsSB = new StringBuffer();
int insertCount = 0;
Vector spaces = new Vector();
{
resIndex = regex.matchedFrom();
- if ( (selection != null) &&
- ( (resIndex +
- Integer.parseInt(spaces.elementAt(resIndex).toString())) <
- selection.getStartRes()))
+ if ((selection != null)
+ && ((resIndex + Integer.parseInt(spaces.elementAt(
+ resIndex).toString())) < selection.getStartRes()))
{
continue;
}
- int sres = seq.findPosition(resIndex +
- Integer.parseInt(spaces.elementAt(
- resIndex)
- .toString()));
- int eres = seq.findPosition(regex.matchedTo() - 1 +
- Integer.parseInt(spaces.elementAt(regex.
- matchedTo() -
- 1).toString()));
+ int sres = seq
+ .findPosition(resIndex
+ + Integer.parseInt(spaces.elementAt(resIndex)
+ .toString()));
+ int eres = seq.findPosition(regex.matchedTo()
+ - 1
+ + Integer.parseInt(spaces
+ .elementAt(regex.matchedTo() - 1).toString()));
searchResults.addResult(seq, sres, eres);
hasResults = true;
}
/**
- * @param alignment the alignment to set
+ * @param alignment
+ * the alignment to set
*/
public void setAlignment(AlignmentI alignment)
{
}
/**
- * @param caseSensitive the caseSensitive to set
+ * @param caseSensitive
+ * the caseSensitive to set
*/
public void setCaseSensitive(boolean caseSensitive)
{
}
/**
- * @param findAll the findAll to set
+ * @param findAll
+ * the findAll to set
*/
public void setFindAll(boolean findAll)
{
}
/**
- * @param selection the selection to set
+ * @param selection
+ * the selection to set
*/
public void setSelection(jalview.datamodel.SequenceGroup selection)
{
}
/**
- * @param resIndex the resIndex to set
+ * @param resIndex
+ * the resIndex to set
*/
public void setResIndex(int resIndex)
{
}
/**
- * @param seqIndex the seqIndex to set
+ * @param seqIndex
+ * the seqIndex to set
*/
public void setSeqIndex(int seqIndex)
{