MediaWiki
1.33.0
|
This diff implementation is mainly lifted from the LCS algorithm of the Eclipse project which in turn is based on Myers' "An O(ND) difference algorithm and its variations" (http://citeseer.ist.psu.edu/myers86ond.html) with range compression (see Wu et al. More...
Public Member Functions | |
__construct ( $tooLong=2000000, $powLimit=1.45) | |
diff ( $from_lines, $to_lines) | |
Performs diff. More... | |
diff_range ( $from_lines, $to_lines) | |
getLcsLength () | |
setBailoutComplexity ( $value) | |
Sets the complexity (in comparison operations) that can't be exceeded. More... | |
Public Attributes | |
$added | |
$heuristicUsed | |
$length | |
$removed | |
Protected Member Functions | |
diffInternal (array $from, array $to) | |
Protected Attributes | |
$bailoutComplexity = 0 | |
Private Member Functions | |
find_middle_snake ( $bottoml1, $topl1, $bottoml2, $topl2, &$V, &$snake) | |
lcs_rec ( $bottoml1, $topl1, $bottoml2, $topl2, &$V, &$snake) | |
shiftBoundaries (array $lines, array &$changed, array $other_changed) | |
Adjust inserts/deletes of identical lines to join changes as much as possible. More... | |
Static Private Member Functions | |
static | findMostProgress ( $M, $N, $limit, $V) |
Private Attributes | |
$from | |
$lcsLengthCorrectedForHeuristic = false | |
$m | |
$maxDifferences | |
$n | |
$powLimit | |
$to | |
$tooLong | |
This diff implementation is mainly lifted from the LCS algorithm of the Eclipse project which in turn is based on Myers' "An O(ND) difference algorithm and its variations" (http://citeseer.ist.psu.edu/myers86ond.html) with range compression (see Wu et al.
's "An O(NP) Sequence Comparison Algorithm").
This implementation supports an upper bound on the execution time.
Some ideas (and a bit of code) are from analyze.c, from GNU diffutils-2.7, which can be found at: ftp://gnudist.gnu.org/pub/gnu/diffutils/diffutils-2.7.tar.gz
Complexity: O((M + N)D) worst case time, O(M + N + D^2) expected time, O(M + N) space
Definition at line 47 of file DiffEngine.php.
DiffEngine::__construct | ( | $tooLong = 2000000 , |
|
$powLimit = 1.45 |
|||
) |
Definition at line 70 of file DiffEngine.php.
DiffEngine::diff | ( | $from_lines, | |
$to_lines | |||
) |
Performs diff.
string[] | $from_lines | |
string[] | $to_lines |
ComplexityException |
Definition at line 84 of file DiffEngine.php.
References captcha-old\count, diffInternal(), and shiftBoundaries().
Referenced by diff_range().
DiffEngine::diff_range | ( | $from_lines, | |
$to_lines | |||
) |
Definition at line 413 of file DiffEngine.php.
|
private |
Definition at line 490 of file DiffEngine.php.
References $from, $to, findMostProgress(), and wfDebug().
Referenced by lcs_rec().
|
staticprivate |
Definition at line 714 of file DiffEngine.php.
Referenced by find_middle_snake().
DiffEngine::getLcsLength | ( | ) |
|
private |
Definition at line 448 of file DiffEngine.php.
References find_middle_snake(), and list.
Referenced by diffInternal().
DiffEngine::setBailoutComplexity | ( | $value | ) |
Sets the complexity (in comparison operations) that can't be exceeded.
int | $value |
Definition at line 141 of file DiffEngine.php.
References $value.
Referenced by Diff\__construct().
Adjust inserts/deletes of identical lines to join changes as much as possible.
We do something when a run of changed lines include a line at one end and has an excluded, identical line at the other. We are free to choose which identical line is included. ‘compareseq’ usually chooses the one at the beginning, but usually it is cleaner to consider the following identical line to be the "change".
This is extracted verbatim from analyze.c (GNU diffutils-2.7).
string[] | $lines | |
string[] | $changed | |
string[] | $other_changed |
Definition at line 162 of file DiffEngine.php.
References $lines, and captcha-old\count.
Referenced by diff().
DiffEngine::$added |
Definition at line 67 of file DiffEngine.php.
Referenced by diffInternal().
|
protected |
Definition at line 58 of file DiffEngine.php.
|
private |
Definition at line 50 of file DiffEngine.php.
Referenced by diffInternal(), and find_middle_snake().
DiffEngine::$heuristicUsed |
Definition at line 68 of file DiffEngine.php.
|
private |
Definition at line 62 of file DiffEngine.php.
DiffEngine::$length |
Definition at line 65 of file DiffEngine.php.
Referenced by getLcsLength().
|
private |
Definition at line 52 of file DiffEngine.php.
Referenced by diffInternal().
|
private |
Definition at line 61 of file DiffEngine.php.
|
private |
Definition at line 53 of file DiffEngine.php.
Referenced by diffInternal().
|
private |
Definition at line 56 of file DiffEngine.php.
Referenced by __construct().
DiffEngine::$removed |
Definition at line 66 of file DiffEngine.php.
Referenced by diffInternal().
|
private |
Definition at line 51 of file DiffEngine.php.
Referenced by diffInternal(), and find_middle_snake().
|
private |
Definition at line 55 of file DiffEngine.php.
Referenced by __construct().