ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
WordLevelDiff Class Reference
+ Inheritance diagram for WordLevelDiff:
+ Collaboration diagram for WordLevelDiff:

Public Member Functions

 WordLevelDiff ($orig_lines, $closing_lines)
 _split ($lines)
 orig ()
 Get the original set of lines.
 closing ()
 Get the closing set of lines.
- Public Member Functions inherited from MappedDiff
 MappedDiff ($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines)
 Constructor.
- Public Member Functions inherited from Diff
 Diff ($from_lines, $to_lines)
 Constructor.
 reverse ()
 Compute reversed Diff.
 isEmpty ()
 Check for empty diff.
 lcs ()
 Compute the length of the Longest Common Subsequence (LCS).
 _check ($from_lines, $to_lines)
 Check a Diff for validity.

Data Fields

const MAX_LINE_LENGTH = 10000

Detailed Description

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

Member Function Documentation

WordLevelDiff::_split (   $lines)

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

{
$fname = 'WordLevelDiff::WordLevelDiff';
//wfProfileIn( $fname );
list ($orig_words, $orig_stripped) = $this->_split($orig_lines);
list ($closing_words, $closing_stripped) = $this->_split($closing_lines);
$this->MappedDiff($orig_words, $closing_words,
$orig_stripped, $closing_stripped);
//wfProfileOut( $fname );
}
function _split($lines) {
$fname = 'WordLevelDiff::_split';
//wfProfileIn( $fname );
$words = array();
$stripped = array();
$first = true;
foreach ( $lines as $line ) {
# If the line is too long, just pretend the entire line is one big word
# This prevents resource exhaustion problems
if ( $first ) {
$first = false;
} else {
$words[] = "\n";
$stripped[] = "\n";
}
if ( strlen( $line ) > self::MAX_LINE_LENGTH ) {
$words[] = $line;
WordLevelDiff::closing ( )

Get the closing set of lines.

This reconstructs the $to_lines parameter passed to the constructor.

Returns
array The sequence of strings.

Reimplemented from Diff.

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

References _HWLDF_WordAccumulator\addWords().

{
if ($edit->type == 'copy')
$orig->addWords($edit->orig);
elseif ($edit->orig)
$orig->addWords($edit->orig, 'del');
}
$lines = $orig->getLines();
//wfProfileOut( $fname );
return $lines;
}
function closing () {

+ Here is the call graph for this function:

WordLevelDiff::orig ( )

Get the original set of lines.

This reconstructs the $from_lines parameter passed to the constructor.

Returns
array The original sequence of strings.

Reimplemented from Diff.

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

{
$m = array();
if (preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
$line, $m))
{
$words = array_merge( $words, $m[0] );
$stripped = array_merge( $stripped, $m[1] );
}
}
}
//wfProfileOut( $fname );
return array($words, $stripped);
}
function orig () {
WordLevelDiff::WordLevelDiff (   $orig_lines,
  $closing_lines 
)

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

{

Field Documentation

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: