MediaWiki REL1_40
|
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. | |
getLcsLength () | |
setBailoutComplexity ( $value) | |
Sets the complexity (in comparison operations) that can't be exceeded. | |
Public Attributes | |
array | $added |
bool | $heuristicUsed |
int | $length |
array | $removed |
Protected Member Functions | |
diffInternal (array $from, array $to) | |
Protected Attributes | |
int | $bailoutComplexity = 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.
'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 ) |
int | $tooLong | |
float | $powLimit |
Definition at line 87 of file DiffEngine.php.
DiffEngine::diff | ( | $from_lines, | |
$to_lines ) |
Performs diff.
string[] | $from_lines | |
string[] | $to_lines |
ComplexityException |
Definition at line 101 of file DiffEngine.php.
References diffInternal().
|
protected |
DiffEngine::getLcsLength | ( | ) |
DiffEngine::setBailoutComplexity | ( | $value | ) |
Sets the complexity (in comparison operations) that can't be exceeded.
int | $value |
Definition at line 158 of file DiffEngine.php.
Referenced by Diff\__construct().
array DiffEngine::$added |
Definition at line 79 of file DiffEngine.php.
Referenced by diffInternal().
|
protected |
Definition at line 65 of file DiffEngine.php.
bool DiffEngine::$heuristicUsed |
Definition at line 81 of file DiffEngine.php.
int DiffEngine::$length |
Definition at line 75 of file DiffEngine.php.
Referenced by getLcsLength().
array DiffEngine::$removed |
Definition at line 77 of file DiffEngine.php.
Referenced by diffInternal().