Searches for a given PRE value. @param pre PRE value @return index of the record where the PRE is found, or the insertion point if not found
(final int pre)
| 290 | * @return index of the record where the PRE is found, or the insertion point if not found |
| 291 | */ |
| 292 | private int findPre(final int pre) { |
| 293 | int low = 0; |
| 294 | int high = rows - 1; |
| 295 | while(low <= high) { |
| 296 | final int mid = low + high >>> 1; |
| 297 | final int midValMin = pres[mid]; |
| 298 | final int midValMax = midValMin + nids[mid] - fids[mid]; |
| 299 | if(midValMax < pre) low = mid + 1; |
| 300 | else if(midValMin > pre) high = mid - 1; |
| 301 | else return mid; // key found |
| 302 | } |
| 303 | return low; // key not found. |
| 304 | } |
| 305 | |
| 306 | /** |
| 307 | * Binary search of a key in a list. If there are several hits the last one is returned. |