@@ -237,32 +237,32 @@ private function isBJunk(string $bString): bool
237
237
* that the junk element appears in the block. Extend it as far as possible
238
238
* by matching only junk elements in both $a and $b.
239
239
*
240
- * @param int $alo The lower constraint for the first sequence.
241
- * @param int $ahi The upper constraint for the first sequence.
242
- * @param int $blo The lower constraint for the second sequence.
243
- * @param int $bhi The upper constraint for the second sequence.
240
+ * @param int $aLower The lower constraint for the first sequence.
241
+ * @param int $aUpper The upper constraint for the first sequence.
242
+ * @param int $bLower The lower constraint for the second sequence.
243
+ * @param int $bUpper The upper constraint for the second sequence.
244
244
* @return array Array containing the longest match that includes the starting position in $a,
245
245
* start in $b and the length/size.
246
246
*/
247
- public function findLongestMatch (int $ alo , int $ ahi , int $ blo , int $ bhi ): array
247
+ public function findLongestMatch (int $ aLower , int $ aUpper , int $ bLower , int $ bUpper ): array
248
248
{
249
249
$ old = $ this ->old ;
250
250
$ new = $ this ->new ;
251
251
252
- $ bestI = $ alo ;
253
- $ bestJ = $ blo ;
252
+ $ bestI = $ aLower ;
253
+ $ bestJ = $ bLower ;
254
254
$ bestSize = 0 ;
255
255
256
256
$ j2Len = [];
257
257
$ nothing = [];
258
258
259
- for ($ i = $ alo ; $ i < $ ahi ; ++$ i ) {
259
+ for ($ i = $ aLower ; $ i < $ aUpper ; ++$ i ) {
260
260
$ newJ2Len = [];
261
261
$ jDict = $ this ->arrayGetDefault ($ this ->b2j , $ old [$ i ], $ nothing );
262
262
foreach ($ jDict as $ j ) {
263
- if ($ j < $ blo ) {
263
+ if ($ j < $ bLower ) {
264
264
continue ;
265
- } elseif ($ j >= $ bhi ) {
265
+ } elseif ($ j >= $ bUpper ) {
266
266
break ;
267
267
}
268
268
@@ -279,8 +279,8 @@ public function findLongestMatch(int $alo, int $ahi, int $blo, int $bhi): array
279
279
}
280
280
281
281
while (
282
- $ bestI > $ alo &&
283
- $ bestJ > $ blo &&
282
+ $ bestI > $ aLower &&
283
+ $ bestJ > $ bLower &&
284
284
!$ this ->isBJunk ($ new [$ bestJ - 1 ]) &&
285
285
!$ this ->linesAreDifferent ($ bestI - 1 , $ bestJ - 1 )
286
286
) {
@@ -290,17 +290,17 @@ public function findLongestMatch(int $alo, int $ahi, int $blo, int $bhi): array
290
290
}
291
291
292
292
while (
293
- $ bestI + $ bestSize < $ ahi &&
294
- ($ bestJ + $ bestSize ) < $ bhi &&
293
+ $ bestI + $ bestSize < $ aUpper &&
294
+ ($ bestJ + $ bestSize ) < $ bUpper &&
295
295
!$ this ->isBJunk ($ new [$ bestJ + $ bestSize ]) &&
296
296
!$ this ->linesAreDifferent ($ bestI + $ bestSize , $ bestJ + $ bestSize )
297
297
) {
298
298
++$ bestSize ;
299
299
}
300
300
301
301
while (
302
- $ bestI > $ alo &&
303
- $ bestJ > $ blo &&
302
+ $ bestI > $ aLower &&
303
+ $ bestJ > $ bLower &&
304
304
$ this ->isBJunk ($ new [$ bestJ - 1 ]) &&
305
305
!$ this ->linesAreDifferent ($ bestI - 1 , $ bestJ - 1 )
306
306
) {
@@ -310,8 +310,8 @@ public function findLongestMatch(int $alo, int $ahi, int $blo, int $bhi): array
310
310
}
311
311
312
312
while (
313
- $ bestI + $ bestSize < $ ahi &&
314
- $ bestJ + $ bestSize < $ bhi &&
313
+ $ bestI + $ bestSize < $ aUpper &&
314
+ $ bestJ + $ bestSize < $ bUpper &&
315
315
$ this ->isBJunk ($ new [$ bestJ + $ bestSize ]) &&
316
316
!$ this ->linesAreDifferent ($ bestI + $ bestSize , $ bestJ + $ bestSize )
317
317
) {
@@ -385,26 +385,26 @@ public function getMatchingBlocks(): array
385
385
386
386
$ matchingBlocks = [];
387
387
while (!empty ($ queue )) {
388
- [$ alo , $ ahi , $ blo , $ bhi ] = array_pop ($ queue );
389
- $ longestMatch = $ this ->findLongestMatch ($ alo , $ ahi , $ blo , $ bhi );
388
+ [$ aLower , $ aUpper , $ bLower , $ bUpper ] = array_pop ($ queue );
389
+ $ longestMatch = $ this ->findLongestMatch ($ aLower , $ aUpper , $ bLower , $ bUpper );
390
390
[$ list1 , $ list2 , $ list3 ] = $ longestMatch ;
391
391
if ($ list3 ) {
392
392
$ matchingBlocks [] = $ longestMatch ;
393
- if ($ alo < $ list1 && $ blo < $ list2 ) {
393
+ if ($ aLower < $ list1 && $ bLower < $ list2 ) {
394
394
$ queue [] = [
395
- $ alo ,
395
+ $ aLower ,
396
396
$ list1 ,
397
- $ blo ,
397
+ $ bLower ,
398
398
$ list2
399
399
];
400
400
}
401
401
402
- if ($ list1 + $ list3 < $ ahi && $ list2 + $ list3 < $ bhi ) {
402
+ if ($ list1 + $ list3 < $ aUpper && $ list2 + $ list3 < $ bUpper ) {
403
403
$ queue [] = [
404
404
$ list1 + $ list3 ,
405
- $ ahi ,
405
+ $ aUpper ,
406
406
$ list2 + $ list3 ,
407
- $ bhi
407
+ $ bUpper
408
408
];
409
409
}
410
410
}
0 commit comments