ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 1618 of file class.WordLevelDiff.php.

Constructor & Destructor Documentation

◆ __construct()

WordLevelDiff::__construct (   $orig_lines,
  $closing_lines 
)

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

1633 {

Member Function Documentation

◆ _split()

WordLevelDiff::_split (   $lines)

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

References array.

1636  {
1637  $fname = 'WordLevelDiff::WordLevelDiff';
1638  //wfProfileIn( $fname );
1639 
1640  list ($orig_words, $orig_stripped) = $this->_split($orig_lines);
1641  list ($closing_words, $closing_stripped) = $this->_split($closing_lines);
1642 
1643  parent::__construct($orig_words, $closing_words,
1644  $orig_stripped, $closing_stripped);
1645  //wfProfileOut( $fname );
1646  }
1647 
1648  function _split($lines) {
1649  $fname = 'WordLevelDiff::_split';
1650  //wfProfileIn( $fname );
1651 
1652  $words = array();
1653  $stripped = array();
1654  $first = true;
1655  foreach ( $lines as $line ) {
1656  # If the line is too long, just pretend the entire line is one big word
1657  # This prevents resource exhaustion problems
1658  if ( $first ) {
1659  $first = false;
1660  } else {
1661  $words[] = "\n";
1662  $stripped[] = "\n";
1663  }
1664  if ( strlen( $line ) > self::MAX_LINE_LENGTH ) {
1665  $words[] = $line;
Create styles array
The data for the language used.

◆ closing()

WordLevelDiff::closing ( )

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

References $orig, and _HWLDF_WordAccumulator\addWords().

1686  {
1687  if ($edit->type == 'copy')
1688  $orig->addWords($edit->orig);
1689  elseif ($edit->orig)
1690  $orig->addWords($edit->orig, 'del');
1691  }
1692  $lines = $orig->getLines();
1693  //wfProfileOut( $fname );
1694  return $lines;
1695  }
1696 
1697  function closing () {
+ Here is the call graph for this function:

◆ orig()

WordLevelDiff::orig ( )

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

References array.

1667  {
1668  $m = array();
1669  if (preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
1670  $line, $m))
1671  {
1672  $words = array_merge( $words, $m[0] );
1673  $stripped = array_merge( $stripped, $m[1] );
1674  }
1675  }
1676  }
1677  //wfProfileOut( $fname );
1678  return array($words, $stripped);
1679  }
1680 
1681  function orig () {
Create styles array
The data for the language used.

Field Documentation

◆ MAX_LINE_LENGTH

const WordLevelDiff::MAX_LINE_LENGTH = 10000

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


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