int (int start) { if (myHighlighterIterator == null) { return myEnd; } while (!myHighlighterIterator.atEnd()) { int end = alignOffset(myReverseIteration ? myHighlighterIterator.getStart() : myHighlighterIterator.getEnd()); if (myReverseIteration ? end < start : end > start) { return end; } if (myReverseIteration) { myHighlighterIterator.retreat(); } else { myHighlighterIterator.advance(); } } return myEnd; }