Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Public Attributes | List of all members
MappedWikiDiff Class Reference

FIXME: bad name. More...

Inheritance diagram for MappedWikiDiff:
WikiDiff WordLevelWikiDiff

Public Member Functions

 __construct ($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines)
 Constructor. More...
 
 _check ($from_lines, $to_lines)
 Check a WikiDiff for validity. More...
 
 closing ()
 Get the closing set of lines. 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...
 
 reverse ()
 Compute reversed WikiDiff. More...
 
 WikiDiff ($from_lines, $to_lines)
 Old syntax of class constructor. More...
 

Public Attributes

 $edits
 

Detailed Description

FIXME: bad name.

Constructor & Destructor Documentation

◆ __construct()

MappedWikiDiff::__construct (   $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.

Member Function Documentation

◆ _check()

WikiDiff::_check (   $from_lines,
  $to_lines 
)
inherited

Check a WikiDiff for validity.

This is here only for debugging purposes.

◆ closing()

WikiDiff::closing ( )
inherited

Get the closing set of lines.

This reconstructs the $to_lines parameter passed to the constructor.

Return values
arrayThe sequence of strings.

Reimplemented in WordLevelWikiDiff.

◆ isEmpty()

WikiDiff::isEmpty ( )
inherited

Check for empty diff.

Return values
boolTrue iff two sequences were identical.

◆ lcs()

WikiDiff::lcs ( )
inherited

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

This is mostly for diagnostic purposed.

Return values
intThe length of the LCS.

◆ orig()

WikiDiff::orig ( )
inherited

Get the original set of lines.

This reconstructs the $from_lines parameter passed to the constructor.

Return values
arrayThe original sequence of strings.

Reimplemented in WordLevelWikiDiff.

◆ reverse()

WikiDiff::reverse ( )
inherited

Compute reversed WikiDiff.

SYNOPSIS:

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

Return values
objectA WikiDiff object representing the inverse of the original diff.

◆ WikiDiff()

WikiDiff::WikiDiff (   $from_lines,
  $to_lines 
)
inherited

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated:
since Moodle 3.1

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