return curs.residuePosition; // easy case :-)
}
- if (curs.lastColumnPosition > 0 && curs.lastColumnPosition <= col)
+ if (curs.lastColumnPosition > 0 && curs.lastColumnPosition < col)
{
/*
* sequence lies entirely to the left of col
return end + 1;
}
- if (curs.firstColumnPosition > 0 && curs.firstColumnPosition >= col)
+ if (curs.firstColumnPosition > 0 && curs.firstColumnPosition > col)
{
/*
* sequence lies entirely to the right of col
assertEquals(14, sq.findPosition(99));
assertEquals("test:Pos13:Col10:startCol3:endCol10:tok12",
PA.getValue(sq, "cursor").toString());
+
+ /*
+ * gapped sequence ending in non-gap
+ */
+ sq = new Sequence("test/8-13", "--AB-C-DEF");
+ assertEquals(13, sq.findPosition(9));
+ assertEquals("test:Pos13:Col10:startCol3:endCol10:tok0",
+ PA.getValue(sq, "cursor").toString());
+ sq.sequenceChanged();
+ assertEquals(12, sq.findPosition(8));
+ cursor = (SequenceCursor) PA.getValue(sq, "cursor");
+ assertEquals("test:Pos12:Col9:startCol3:endCol10:tok1",
+ cursor.toString());
+ // findPosition with cursor accepts base 1 column values
+ assertEquals(13, ((Sequence) sq).findPosition(10, cursor));
+ assertEquals(13, sq.findPosition(9));
+ assertEquals("test:Pos13:Col10:startCol3:endCol10:tok1",
+ PA.getValue(sq, "cursor").toString());
}
@Test(groups = { "Functional" })