test_class.file: feya/libraries/archive_diff/diff.generator/src/test/java/com/google/archivepatcher/generator/bsdiff/BsDiffTest.java
test_class.identifier: BsDiffTest
test_case.body: @Test
    public void searchForMatchShortGroupArrayTest() throws IOException {
      final String s1 = "asdf;1234;this should match;5678";
      final String s2 = "hkjl.9999.00vbn,``'=-this should match.9900-mmmnmn,,,.x??'";
      final byte[] s1b = s1.getBytes(Charset.forName("US-ASCII"));
      final byte[] s2b = s2.getBytes(Charset.forName("US-ASCII"));
      final RandomAccessObject s1ro = new RandomAccessObject.RandomAccessByteArrayObject(s1b);
      final RandomAccessObject s2ro = new RandomAccessObject.RandomAccessByteArrayObject(s2b);
      final RandomAccessObject groupArrayRO =
          intArrayToRandomAccessObject(BsDiffTestData.SHORT_GROUP_ARRAY);
  
      BsDiff.Match ret = BsDiff.searchForMatch(groupArrayRO, s1ro, s2ro, 0, 0, 12);
      Assert.assertEquals(0, ret.length);
      Assert.assertEquals(10, ret.start);
    }
test_case.class_method_signature: BsDiffTest.searchForMatchShortGroupArrayTest()
test_case.full_signature: @Test public void searchForMatchShortGroupArrayTest()
test_case.identifier: searchForMatchShortGroupArrayTest
test_case.invocations: getBytes forName getBytes forName intArrayToRandomAccessObject searchForMatch assertEquals assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void searchForMatchShortGroupArrayTest()
focal_class.file: feya/libraries/archive_diff/diff.generator/src/main/java/com/google/archivepatcher/generator/bsdiff/BsDiff.java
focal_class.identifier: BsDiff
focal_class.class_method_signature: BsDiff.lengthOfMatch(
        final RandomAccessObject oldData,
        final int oldStart,
        final RandomAccessObject newData,
        final int newStart)
focal_class.full_signature: static int lengthOfMatch(
        final RandomAccessObject oldData,
        final int oldStart,
        final RandomAccessObject newData,
        final int newStart)
focal_class.identifier: lengthOfMatch
focal_class.modifiers: static
focal_class.parameters: (
        final RandomAccessObject oldData,
        final int oldStart,
        final RandomAccessObject newData,
        final int newStart)
focal_class.return: int
focal_class.signature: int lengthOfMatch(
        final RandomAccessObject oldData,
        final int oldStart,
        final RandomAccessObject newData,
        final int newStart)
focal_class.class_method_signature: BsDiff.searchForMatchBaseCase(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_class.full_signature: static Match searchForMatchBaseCase(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_class.identifier: searchForMatchBaseCase
focal_class.modifiers: static
focal_class.parameters: (
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_class.return: Match
focal_class.signature: Match searchForMatchBaseCase(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_class.class_method_signature: BsDiff.searchForMatch(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_class.full_signature: static Match searchForMatch(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_class.identifier: searchForMatch
focal_class.modifiers: static
focal_class.parameters: (
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_class.return: Match
focal_class.signature: Match searchForMatch(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_method.body: static Match searchForMatch(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
        throws IOException {
      if (oldDataRangeStartB - oldDataRangeStartA < 2) {
        return searchForMatchBaseCase(
            groupArray, oldData, newData, newStart, oldDataRangeStartA, oldDataRangeStartB);
      }
  
      // Cut range in half and search again
      final int rangeLength = oldDataRangeStartB - oldDataRangeStartA;
      final int pivot = oldDataRangeStartA + (rangeLength / 2);
      groupArray.seekToIntAligned(pivot);
      final int groupArrayPivot = groupArray.readInt();
      if (BsUtil.lexicographicalCompare(
              oldData,
              groupArrayPivot,
              (int) oldData.length() - groupArrayPivot,
              newData,
              newStart,
              (int) newData.length() - newStart)
          < 0) {
        return searchForMatch(groupArray, oldData, newData, newStart, pivot, oldDataRangeStartB);
      }
      return searchForMatch(groupArray, oldData, newData, newStart, oldDataRangeStartA, pivot);
    }
focal_method.class_method_signature: BsDiff.searchForMatch(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_method.full_signature: static Match searchForMatch(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_method.identifier: searchForMatch
focal_method.invocations: searchForMatchBaseCase seekToIntAligned readInt lexicographicalCompare length length searchForMatch searchForMatch
focal_method.modifiers: static
focal_method.parameters: (
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)
focal_method.return: Match
focal_method.signature: Match searchForMatch(
        final RandomAccessObject groupArray,
        final RandomAccessObject oldData,
        final RandomAccessObject newData,
        final int newStart,
        final int oldDataRangeStartA,
        final int oldDataRangeStartB)