@Override
public Vector<PDBEntry> getAllPDBEntries()
{
- return pdbIds == null ? new Vector<PDBEntry>() : pdbIds;
+ return pdbIds == null ? new Vector<>() : pdbIds;
}
/**
* @param curs
* @return
*/
- protected int findIndex(int pos, SequenceCursor curs)
+ protected int findIndex(final int pos, SequenceCursor curs)
{
if (!isValidCursor(curs))
{
while (newPos != pos)
{
col += delta; // shift one column left or right
- if (col < 0 || col == sequence.length)
+ if (col < 0)
{
break;
}
+ if (col == sequence.length)
+ {
+ col--; // return last column if we failed to reach pos
+ break;
+ }
if (!Comparison.isGap(sequence[col]))
{
newPos += delta;
}
col++; // convert back to base 1
- updateCursor(pos, col, curs.firstColumnPosition);
+
+ /*
+ * only update cursor if we found the target position
+ */
+ if (newPos == pos)
+ {
+ updateCursor(pos, col, curs.firstColumnPosition);
+ }
return col;
}