ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
WordLevelDiff Class Reference
+ Inheritance diagram for WordLevelDiff:
+ Collaboration diagram for WordLevelDiff:

Public Member Functions

 __construct ($orig_lines, $closing_lines)
 
 _split ($lines)
 
 orig ()
 
 closing ()
 
- Public Member Functions inherited from MappedDiff
 __construct ( $from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines)
 Constructor. More...
 
- Public Member Functions inherited from Diff
 __construct ($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...
 

Data Fields

const MAX_LINE_LENGTH = 10000
 
- Data Fields inherited from Diff
 $edits
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

WordLevelDiff::__construct (   $orig_lines,
  $closing_lines 
)

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

1784 {
1785  public const MAX_LINE_LENGTH = 10000;
1786 
1787  public function __construct($orig_lines, $closing_lines)
1788  {
__construct($orig_lines, $closing_lines)

Member Function Documentation

◆ _split()

WordLevelDiff::_split (   $lines)

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

1805  {
1806  $fname = 'WordLevelDiff::_split';
1807  //wfProfileIn( $fname );
1808 
1809  $words = array();
1810  $stripped = array();
1811  $first = true;
1812  foreach ($lines as $line) {
1813  # If the line is too long, just pretend the entire line is one big word
1814  # This prevents resource exhaustion problems
1815  if ($first) {
1816  $first = false;
1817  } else {
1818  $words[] = "\n";
1819  $stripped[] = "\n";
1820  }
1821  if (strlen($line) > self::MAX_LINE_LENGTH) {
1822  $words[] = $line;
1823  $stripped[] = $line;
1824  } else {

◆ closing()

WordLevelDiff::closing ( )

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

1846  {
1847  if ($edit->type == 'copy') {
1848  $orig->addWords($edit->orig);
1849  } elseif ($edit->orig) {
1850  $orig->addWords($edit->orig, 'del');
1851  }
1852  }
1853  $lines = $orig->getLines();
1854  //wfProfileOut( $fname );
1855  return $lines;
1856  }
1857 
1858  public function closing()
1859  {
1860  $fname = 'WordLevelDiff::closing';

◆ orig()

WordLevelDiff::orig ( )

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

1827  : (?!< \n) [^\S\n])? /xs',
1828  $line,
1829  $m
1830  )) {
1831  $words = array_merge($words, $m[0]);
1832  $stripped = array_merge($stripped, $m[1]);
1833  }
1834  }
1835  }
1836  //wfProfileOut( $fname );
1837  return array($words, $stripped);
1838  }
1839 
1840  public function orig()
1841  {
1842  $fname = 'WordLevelDiff::orig';
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Field Documentation

◆ MAX_LINE_LENGTH

const WordLevelDiff::MAX_LINE_LENGTH = 10000

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


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