[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Source view] [Print] [Project Stats]
A PHP diff engine for phpwiki. (Taken from phpwiki-1.3.3) Copyright © 2000, 2001 Geoffrey T. Dairiki <[email protected]> You may copy this code freely under the conditions of the GPL.
File Size: | 1076 lines (26 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
DiffOpCopy:: (2 methods):
__construct()
reverse()
DiffOpDelete:: (2 methods):
__construct()
reverse()
DiffOpAdd:: (2 methods):
__construct()
reverse()
DiffOpChange:: (2 methods):
__construct()
reverse()
DiffEngine:: (7 methods):
diff()
diffLocal()
lineHash()
diag()
lcsPos()
compareSeq()
shiftBoundaries()
Diff:: (7 methods):
__construct()
getEdits()
reverse()
isEmpty()
lcs()
orig()
closing()
MappedDiff:: (1 method):
__construct()
HWLDFWordAccumulator:: (4 methods):
flushGroup()
flushLine()
addWords()
getLines()
WordLevelDiff:: (4 methods):
__construct()
split()
orig()
closing()
Class: DiffOpCopy - X-Ref
Class: DiffOpDelete - X-Ref
Class: DiffOpChange - X-Ref
Class: DiffEngine - X-Ref
Class used internally by Diff to actually compute the diffs.diff( $from_lines, $to_lines ) X-Ref |
param: string[] $from_lines param: string[] $to_lines return: DiffOp[] |
diffLocal( $from_lines, $to_lines ) X-Ref |
param: string[] $from_lines param: string[] $to_lines |
lineHash( $line ) X-Ref |
Returns the whole line if it's small enough, or the MD5 hash otherwise param: string $line return: string |
diag( $xoff, $xlim, $yoff, $ylim, $nchunks ) X-Ref |
Divide the Largest Common Subsequence (LCS) of the sequences [XOFF, XLIM) and [YOFF, YLIM) into NCHUNKS approximately equally sized segments. Returns (LCS, PTS). LCS is the length of the LCS. PTS is an array of NCHUNKS+1 (X, Y) indexes giving the diving points between sub sequences. The first sub-sequence is contained in [X0, X1), [Y0, Y1), the second in [X1, X2), [Y1, Y2) and so on. Note that (X0, Y0) == (XOFF, YOFF) and (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM). This function assumes that the first lines of the specified portions of the two files do not match, and likewise that the last lines do not match. The caller must trim matching lines from the beginning and end of the portions it is going to specify. param: int $xoff param: int $xlim param: int $yoff param: int $ylim param: int $nchunks return: array List of two elements, integer and array[]. |
lcsPos( $ypos ) X-Ref |
param: int $ypos return: int |
compareSeq( $xoff, $xlim, $yoff, $ylim ) X-Ref |
Find LCS of two sequences. The results are recorded in the vectors $this->{x,y}changed[], by storing a 1 in the element for each line that is an insertion or deletion (ie. is not in the LCS). The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1. Note that XLIM, YLIM are exclusive bounds. All line numbers are origin-0 and discarded lines are not counted. param: int $xoff param: int $xlim param: int $yoff param: int $ylim |
shiftBoundaries( $lines, &$changed, $other_changed ) X-Ref |
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). |
__construct( $from_lines, $to_lines ) X-Ref |
Constructor. Computes diff between sequences of strings. param: string[] $from_lines An array of strings. param: string[] $to_lines An array of strings. |
getEdits() X-Ref |
return: DiffOp[] |
reverse() X-Ref |
Compute reversed Diff. SYNOPSIS: $diff = new Diff($lines1, $lines2); $rev = $diff->reverse(); return: Object A Diff object representing the inverse of the |
isEmpty() X-Ref |
Check for empty diff. return: bool True if two sequences were identical. |
lcs() X-Ref |
Compute the length of the Longest Common Subsequence (LCS). This is mostly for diagnostic purposed. return: int The length of the LCS. |
orig() X-Ref |
Get the original set of lines. This reconstructs the $from_lines parameter passed to the constructor. return: string[] The original sequence of strings. |
closing() X-Ref |
Get the closing set of lines. This reconstructs the $to_lines parameter passed to the constructor. return: string[] The sequence of strings. |
Class: MappedDiff - X-Ref
__construct( $from_lines, $to_lines,$mapped_from_lines, $mapped_to_lines ) X-Ref |
Constructor. Computes diff between sequences of strings. This can be used to compute things like case-insensitve diffs, or diffs which ignore changes in white-space. param: string[] $from_lines An array of strings. param: string[] $to_lines An array of strings. param: string[] $mapped_from_lines This array should param: string[] $mapped_to_lines This array should |
Class: HWLDFWordAccumulator - X-Ref
Class: WordLevelDiff - X-Ref
__construct( $orig_lines, $closing_lines ) X-Ref |
param: string[] $orig_lines param: string[] $closing_lines |
split( $lines ) X-Ref |
param: string[] $lines return: array[] |
orig() X-Ref |
return: string[] |
closing() X-Ref |
return: string[] |
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |