ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
MappedDiff Class Reference
+ Inheritance diagram for MappedDiff:
+ Collaboration diagram for MappedDiff:

Public Member Functions

 MappedDiff ($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines)
 Constructor. More...
 
- Public Member Functions inherited from Diff
 Diff ($from_lines, $to_lines)
 Constructor. More...
 
 reverse ()
 Compute reversed Diff. More...
 
 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...
 
 closing ()
 Get the closing set of lines. More...
 
 _check ($from_lines, $to_lines)
 Check a Diff for validity. More...
 

Additional Inherited Members

- Data Fields inherited from Diff
 $edits
 

Detailed Description

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

Member Function Documentation

◆ MappedDiff()

MappedDiff::MappedDiff (   $from_lines,
  $to_lines,
  $mapped_from_lines,
  $mapped_to_lines 
)

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.

Parameters
$from_linesarray An array of strings. (Typically these are lines from a file.)
$to_linesarray An array of strings.
$mapped_from_linesarray This array should have the same size number of elements as $from_lines. The elements in $mapped_from_lines and $mapped_to_lines are what is actually compared when computing the diff.
$mapped_to_linesarray This array should have the same number of elements as $to_lines.

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

1368 {
1369 $fname = 'MappedDiff::MappedDiff';
1370 //wfProfileIn( $fname );
1371
1372 assert(sizeof($from_lines) == sizeof($mapped_from_lines));
1373 assert(sizeof($to_lines) == sizeof($mapped_to_lines));
1374
1375 $this->Diff($mapped_from_lines, $mapped_to_lines);
1376
1377 $xi = $yi = 0;
1378 for ($i = 0; $i < sizeof($this->edits); $i++) {
1379 $orig = &$this->edits[$i]->orig;
1380 if (is_array($orig)) {
1381 $orig = array_slice($from_lines, $xi, sizeof($orig));
1382 $xi += sizeof($orig);
1383 }
1384
1385 $closing = &$this->edits[$i]->closing;
1386 if (is_array($closing)) {
1387 $closing = array_slice($to_lines, $yi, sizeof($closing));
1388 $yi += sizeof($closing);
1389 }
1390 }
1391 //wfProfileOut( $fname );
1392 }
Diff($from_lines, $to_lines)
Constructor.

References Diff\$edits, and Diff\Diff().

Referenced by WordLevelDiff\WordLevelDiff().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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