ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
Diff Class Reference
+ Inheritance diagram for Diff:
+ Collaboration diagram for Diff:

Public Member Functions

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

Data Fields

 $edits

Detailed Description

Definition at line 1188 of file class.WordLevelDiff.php.

Member Function Documentation

Diff::_check (   $from_lines,
  $to_lines 
)

Check a Diff for validity.

This is here only for debugging purposes.

Definition at line 1295 of file class.WordLevelDiff.php.

{
if ($edit->closing)
array_splice($lines, sizeof($lines), 0, $edit->closing);
}
return $lines;
}
function _check ($from_lines, $to_lines) {
$fname = 'Diff::_check';
//wfProfileIn( $fname );
if (serialize($from_lines) != serialize($this->orig()))
trigger_error("Reconstructed original doesn't match", E_USER_ERROR);
if (serialize($to_lines) != serialize($this->closing()))
trigger_error("Reconstructed closing doesn't match", E_USER_ERROR);
$rev = $this->reverse();
if (serialize($to_lines) != serialize($rev->orig()))
trigger_error("Reversed original doesn't match", E_USER_ERROR);
if (serialize($from_lines) != serialize($rev->closing()))
Diff::closing ( )

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 1280 of file class.WordLevelDiff.php.

{
Diff::Diff (   $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.

Definition at line 1200 of file class.WordLevelDiff.php.

{
var $edits;
Diff::isEmpty ( )

Check for empty diff.

Returns
bool True iff two sequences were identical.

Definition at line 1230 of file class.WordLevelDiff.php.

{
$rev = $this;
$rev->edits = array();
foreach ($this->edits as $edit) {
$rev->edits[] = $edit->reverse();
}
return $rev;
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 1245 of file class.WordLevelDiff.php.

{
if ($edit->type != 'copy')
return false;
}
return true;
}
Diff::orig ( )

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 1262 of file class.WordLevelDiff.php.

{
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 1216 of file class.WordLevelDiff.php.

{

Field Documentation

Diff::$edits

Definition at line 1190 of file class.WordLevelDiff.php.


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