class DiffEngine

Class used internally by Diff to actually compute the diffs.

The algorithm used here is mostly lifted from the perl module Algorithm::Diff (version 1.06) by Ned Konz, which is available at: http://www.perl.com/CPAN/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip

More ideas are taken from: http://www.ics.uci.edu/~eppstein/161/960229.html

Some ideas (and a bit of code) are from analyze.c, from GNU diffutils-2.7, which can be found at: ftp://gnudist.gnu.org/pub/gnu/diffutils/diffutils-2.7.tar.gz

closingly, some ideas (subdivision by NCHUNKS > 2, and some optimizations) are my own.

Line length limits for robustness added by Tim Starling, 2005-08-31

@author Geoffrey T. Dairiki, Tim Starling @private @subpackage DifferenceEngine

Hierarchy

File

core/lib/Drupal/Component/Diff/Engine/DiffEngine.php, line 30

Namespace

Drupal\Component\Diff\Engine

Members

Name Modifiers Type Description
DiffEngine::diff public function
DiffEngine::MAX_XREF_LENGTH constant
DiffEngine::USE_ASSERTS constant
DiffEngine::_compareseq protected function Find LCS of two sequences.
DiffEngine::_diag protected function Divide the Largest Common Subsequence (LCS) of the sequences [XOFF, XLIM) and [YOFF, YLIM) into NCHUNKS approximately equally sized segments.
DiffEngine::_lcs_pos protected function
DiffEngine::_line_hash protected function Returns the whole line if it's small enough, or the MD5 hash otherwise.
DiffEngine::_shift_boundaries protected function Adjust inserts/deletes of identical lines to join changes as much as possible.

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Diff!Engine!DiffEngine.php/class/DiffEngine/8.1.x