MediaWiki  1.27.2
Diff Class Reference

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

Inheritance diagram for Diff:
Collaboration diagram for Diff:

Public Member Functions

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

Public Attributes

DiffOp[] $edits
 

Detailed Description

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

Todo:
document
Access:
private

Definition at line 438 of file DairikiDiff.php.

Constructor & Destructor Documentation

Diff::__construct (   $from_lines,
  $to_lines 
)

Constructor.

Computes diff between sequences of strings.

Parameters
string[]$from_lines An array of strings. Typically these are lines from a file.
string[]$to_lines An array of strings.

Definition at line 453 of file DairikiDiff.php.

References edits.

Member Function Documentation

Diff::closing ( )

Get the closing set of lines.

This reconstructs the $to_lines parameter passed to the constructor.

Returns
string[] The sequence of strings.

Definition at line 548 of file DairikiDiff.php.

References $lines, as, and edits.

Diff::getEdits ( )
Returns
DiffOp[]

Definition at line 461 of file DairikiDiff.php.

References $edits.

Diff::isEmpty ( )

Check for empty diff.

Returns
bool True if two sequences were identical.

Definition at line 492 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 509 of file DairikiDiff.php.

References as, and edits.

Diff::orig ( )

Get the original set of lines.

This reconstructs the $from_lines parameter passed to the constructor.

Returns
string[] The original sequence of strings.

Definition at line 528 of file DairikiDiff.php.

References $lines, as, and edits.

Diff::reverse ( )

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 476 of file DairikiDiff.php.

References $rev, as, and edits.

Member Data Documentation

DiffOp [] Diff::$edits

Definition at line 443 of file DairikiDiff.php.

Referenced by getEdits().


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