@Nullable
 public Range getRangeForLine(int line) {
   synchronized (myLock) {
     for (final Range range : myRanges) {
       if (range.isSelectedByLine(line)) return range;
     }
     return null;
   }
 }
 @Nullable
 public Range getNextRange(int line) {
   synchronized (myLock) {
     for (Range range : myRanges) {
       if (line < range.getLine2() && !range.isSelectedByLine(line)) {
         return range;
       }
     }
     return null;
   }
 }
 @Nullable
 public Range getPrevRange(int line) {
   synchronized (myLock) {
     for (int i = myRanges.size() - 1; i >= 0; i--) {
       Range range = myRanges.get(i);
       if (line > range.getLine1() && !range.isSelectedByLine(line)) {
         return range;
       }
     }
     return null;
   }
 }