Skip to content

Commit

Permalink
fixed bugs in BinarySearcherOverPlainSource related to incorrect offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
Aklakan committed Sep 9, 2024
1 parent ecd0c3d commit 3ef7007
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ public static Match binarySearch(
if (SearchMode.LEFT.equals(searchMode) || SearchMode.BOTH.equals(searchMode)) {
// Find the start of a run:
// Continue searching left - if there is no match then return the candidate result
Match expandLeft = binarySearch(in, SearchMode.LEFT, depth + 1, start, nextDelimPos - 1, delimiter, prefix, cache);
// Match expandLeft = binarySearch(in, SearchMode.LEFT, depth + 1, start, nextDelimPos - 1, delimiter, prefix, cache);
Match expandLeft = binarySearch(in, SearchMode.LEFT, depth + 1, start, mid - 1, delimiter, prefix, cache);
if (expandLeft != null) {
left = expandLeft.start();
}
Expand All @@ -219,7 +220,8 @@ public static Match binarySearch(
}
result = new Match(left, right);
} else if(cmp < 0) {
result = binarySearch(in, searchMode, depth + 1, start, nextDelimPos - 1, delimiter, prefix, cache);
// result = binarySearch(in, searchMode, depth + 1, start, nextDelimPos - 1, delimiter, prefix, cache);
result = binarySearch(in, searchMode, depth + 1, start, mid - 1, delimiter, prefix, cache);
} else {
result = binarySearch(in, searchMode, depth + 1, nextDelimPos + 1, end, delimiter, prefix, cache);
}
Expand Down

0 comments on commit 3ef7007

Please sign in to comment.