@Test public void searchForMatchLongGroupArrayTest() throws IOException { final RandomAccessObject groupArray2RO = intArrayToRandomAccessObject(BsDiffTestData.LONG_GROUP_ARRAY_100); final int scan = 1; BsDiff.Match ret = BsDiff.searchForMatch( groupArray2RO, BsDiffTestData.LONG_DATA_99_RO, BsDiffTestData.LONG_DATA_104_NEW_RO, scan, 0, BsDiffTestData.LONG_DATA_99.length); Assert.assertEquals(0, ret.length); Assert.assertEquals(52, ret.start); }
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); } 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); }
BsDiff { 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); } 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); } }
BsDiff { 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); } 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); }  }
BsDiff { 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); } 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); }   }
BsDiff { 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); } 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); }    }