MediaWiki  REL1_22
Diff Class Reference

Class representing a 'diff' between two sequences of strings. More...

Inheritance diagram for Diff:

List of all members.

Public Member Functions

 __construct ($from_lines, $to_lines)
 Constructor.
 _check ($from_lines, $to_lines)
 Check a Diff for validity.
 closing ()
 Get the closing set of lines.
 isEmpty ()
 Check for empty diff.
 lcs ()
 Compute the length of the Longest Common Subsequence (LCS).
 orig ()
 Get the original set of lines.
 reverse ()
 Compute reversed Diff.

Public Attributes

 $edits

Detailed Description

Class representing a 'diff' between two sequences of strings.

Todo:
document
Access:
private

Definition at line 656 of file DairikiDiff.php.


Constructor & Destructor Documentation

Diff::__construct ( from_lines,
to_lines 
)

Constructor.

Computes diff between sequences of strings.

Parameters:
$from_linesarray An array of strings. (Typically these are lines from a file.)
$to_linesarray An array of strings.

Reimplemented in WordLevelDiff.

Definition at line 667 of file DairikiDiff.php.

References edits.


Member Function Documentation

Diff::_check ( from_lines,
to_lines 
)

Check a Diff for validity.

This is here only for debugging purposes.

Parameters:
$from_lines
$to_lines

Definition at line 768 of file DairikiDiff.php.

References $rev, as, closing(), edits, lcs(), orig(), reverse(), wfProfileIn(), and wfProfileOut().

Get the closing set of lines.

This reconstructs the $to_lines parameter passed to the constructor.

Returns:
array The sequence of strings.

Reimplemented in WordLevelDiff.

Definition at line 750 of file DairikiDiff.php.

References $lines, array(), as, and edits.

Referenced by _check().

Check for empty diff.

Returns:
bool True if two sequences were identical.

Definition at line 697 of file DairikiDiff.php.

References as, and edits.

Diff::lcs ( )

Compute the length of the Longest Common Subsequence (LCS).

This is mostly for diagnostic purposed.

Returns:
int The length of the LCS.

Definition at line 713 of file DairikiDiff.php.

References as, and edits.

Referenced by _check().

Get the original set of lines.

This reconstructs the $from_lines parameter passed to the constructor.

Returns:
array The original sequence of strings.

Reimplemented in WordLevelDiff.

Definition at line 731 of file DairikiDiff.php.

References $lines, array(), as, and edits.

Referenced by _check().

Compute reversed Diff.

SYNOPSIS:

$diff = new Diff($lines1, $lines2); $rev = $diff->reverse();

Returns:
Object A Diff object representing the inverse of the original diff.

Definition at line 683 of file DairikiDiff.php.

References $rev, array(), as, and edits.

Referenced by _check().


Member Data Documentation

Diff::$edits

Definition at line 657 of file DairikiDiff.php.


The documentation for this class was generated from the following file: