ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
WordLevelDiff Class Reference
+ Inheritance diagram for WordLevelDiff:
+ Collaboration diagram for WordLevelDiff:

Public Member Functions

 WordLevelDiff ($orig_lines, $closing_lines)
 
 _split ($lines)
 
 orig ()
 
 closing ()
 
- Public Member Functions inherited from MappedDiff
 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...
 

Data Fields

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

Detailed Description

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

Member Function Documentation

◆ _split()

WordLevelDiff::_split (   $lines)

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

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  $this->MappedDiff($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;
MappedDiff($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines)
Constructor.

◆ closing()

WordLevelDiff::closing ( )

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

References _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.

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 () {

◆ WordLevelDiff()

WordLevelDiff::WordLevelDiff (   $orig_lines,
  $closing_lines 
)

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

1633 {

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: