[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/diff/ -> DiffEngine.php (summary)

(no description)

File Size: 1330 lines (35 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 13 classes

_DiffOp:: (3 methods):
  reverse()
  norig()
  nclosing()

_DiffOp_Copy:: (2 methods):
  _DiffOp_Copy()
  reverse()

_DiffOp_Delete:: (2 methods):
  _DiffOp_Delete()
  reverse()

_DiffOp_Add:: (2 methods):
  _DiffOp_Add()
  reverse()

_DiffOp_Change:: (2 methods):
  _DiffOp_Change()
  reverse()

_DiffEngine:: (7 methods):
  MAX_XREF_LENGTH()
  diff()
  _line_hash()
  _diag()
  _lcs_pos()
  _compareseq()
  _shift_boundaries()

Diff:: (7 methods):
  Diff()
  reverse()
  isEmpty()
  lcs()
  orig()
  closing()
  _check()

MappedDiff:: (1 method):
  MappedDiff()

DiffFormatter:: (12 methods):
  format()
  _block()
  _start_diff()
  _end_diff()
  _block_header()
  _start_block()
  _end_block()
  _lines()
  _context()
  _added()
  _deleted()
  _changed()

_HWLDF_WordAccumulator:: (5 methods):
  _HWLDF_WordAccumulator()
  _flushGroup()
  _flushLine()
  addWords()
  getLines()

WordLevelDiff:: (5 methods):
  MAX_LINE_LENGTH()
  WordLevelDiff()
  _split()
  orig()
  closing()

DrupalDiffFormatter:: (15 methods):
  DrupalDiffFormatter()
  _start_diff()
  _end_diff()
  _block_header()
  _start_block()
  _end_block()
  _lines()
  addedLine()
  deletedLine()
  contextLine()
  emptyLine()
  _added()
  _deleted()
  _context()
  _changed()

DrupalDiffInline:: (4 methods):
  __construct()
  render()
  process_chunk()
  process_edits()


Class: _DiffOp  - X-Ref


reverse()   X-Ref
No description

norig()   X-Ref
No description

nclosing()   X-Ref
No description

Class: _DiffOp_Copy  - X-Ref


_DiffOp_Copy($orig, $closing = FALSE)   X-Ref
No description

reverse()   X-Ref
No description

Class: _DiffOp_Delete  - X-Ref


_DiffOp_Delete($lines)   X-Ref
No description

reverse()   X-Ref
No description

Class: _DiffOp_Add  - X-Ref


_DiffOp_Add($lines)   X-Ref
No description

reverse()   X-Ref
No description

Class: _DiffOp_Change  - X-Ref


_DiffOp_Change($orig, $closing)   X-Ref
No description

reverse()   X-Ref
No description

Class: _DiffEngine  - X-Ref

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 are (and a bit of code) are from 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

MAX_XREF_LENGTH()   X-Ref
No description

diff($from_lines, $to_lines)   X-Ref
No description

_line_hash($line)   X-Ref
Returns the whole line if it's small enough, or the MD5 hash otherwise.


_diag($xoff, $xlim, $yoff, $ylim, $nchunks)   X-Ref
Divide the Largest Common Subsequence (LCS) of the sequences
[XOFF, XLIM) and [YOFF, YLIM) into NCHUNKS approximately equally
sized segments.

Returns (LCS, PTS).  LCS is the length of the LCS. PTS is an
array of NCHUNKS+1 (X, Y) indexes giving the diving points between
sub sequences.  The first sub-sequence is contained in [X0, X1),
[Y0, Y1), the second in [X1, X2), [Y1, Y2) and so on.  Note
that (X0, Y0) == (XOFF, YOFF) and
(X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM).

This function assumes that the first lines of the specified portions
of the two files do not match, and likewise that the last lines do not
match.  The caller must trim matching lines from the beginning and end
of the portions it is going to specify.

_lcs_pos($ypos)   X-Ref
No description

_compareseq($xoff, $xlim, $yoff, $ylim)   X-Ref
Find LCS of two sequences.

The results are recorded in the vectors $this->{x,y}changed[], by
storing a 1 in the element for each line that is an insertion
or deletion (ie. is not in the LCS).

The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1.

Note that XLIM, YLIM are exclusive bounds.
All line numbers are origin-0 and discarded lines are not counted.

_shift_boundaries($lines, &$changed, $other_changed)   X-Ref
Adjust inserts/deletes of identical lines to join changes
as much as possible.

We do something when a run of changed lines include a
line at one end and has an excluded, identical line at the other.
We are free to choose which identical line is included.
`compareseq' usually chooses the one at the beginning,
but usually it is cleaner to consider the following identical line
to be the "change".

This is extracted verbatim from analyze.c (GNU diffutils-2.7).

Class: Diff  - X-Ref

Class representing a 'diff' between two sequences of strings.

Diff($from_lines, $to_lines)   X-Ref
Constructor.
Computes diff between sequences of strings.

param: $from_lines array An array of strings.
param: $to_lines array An array of strings.

reverse()   X-Ref
Compute reversed Diff.

SYNOPSIS:

$diff = new Diff($lines1, $lines2);
$rev = $diff->reverse();
return: object A Diff object representing the inverse of the

isEmpty()   X-Ref
Check for empty diff.

return: bool True iff two sequences were identical.

lcs()   X-Ref
Compute the length of the Longest Common Subsequence (LCS).

This is mostly for diagnostic purposed.

return: int The length of the LCS.

orig()   X-Ref
Get the original set of lines.

This reconstructs the $from_lines parameter passed to the
constructor.

return: array The original sequence of strings.

closing()   X-Ref
Get the closing set of lines.

This reconstructs the $to_lines parameter passed to the
constructor.

return: array The sequence of strings.

_check($from_lines, $to_lines)   X-Ref
Check a Diff for validity.

This is here only for debugging purposes.

Class: MappedDiff  - X-Ref

FIXME: bad name.

MappedDiff($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines)   X-Ref
Constructor.

Computes diff between sequences of strings.

This can be used to compute things like
case-insensitve diffs, or diffs which ignore
changes in white-space.

param: $from_lines array An array of strings.
param: $to_lines array An array of strings.
param: $mapped_from_lines array This array should
param: $mapped_to_lines array This array should

Class: DiffFormatter  - X-Ref

A class to format Diffs

This class formats the diff in classic diff format.
It is intended that this class be customized via inheritance,
to obtain fancier outputs.
format($diff)   X-Ref
Format a diff.

param: $diff object A Diff object.
return: string The formatted output.

_block($xbeg, $xlen, $ybeg, $ylen, &$edits)   X-Ref
No description

_start_diff()   X-Ref
No description

_end_diff()   X-Ref
No description

_block_header($xbeg, $xlen, $ybeg, $ylen)   X-Ref
No description

_start_block($header)   X-Ref
No description

_end_block()   X-Ref
No description

_lines($lines, $prefix = ' ')   X-Ref
No description

_context($lines)   X-Ref
No description

_added($lines)   X-Ref
No description

_deleted($lines)   X-Ref
No description

_changed($orig, $closing)   X-Ref
No description

Class: _HWLDF_WordAccumulator  - X-Ref


_HWLDF_WordAccumulator()   X-Ref
No description

_flushGroup($new_tag)   X-Ref
No description

_flushLine($new_tag)   X-Ref
No description

addWords($words, $tag = '')   X-Ref
No description

getLines()   X-Ref
No description

Class: WordLevelDiff  - X-Ref


MAX_LINE_LENGTH()   X-Ref
No description

WordLevelDiff($orig_lines, $closing_lines)   X-Ref
No description

_split($lines)   X-Ref
No description

orig()   X-Ref
No description

closing()   X-Ref
No description

Class: DrupalDiffFormatter  - X-Ref

Diff formatter which uses Drupal theme functions.

DrupalDiffFormatter()   X-Ref
No description

_start_diff()   X-Ref
No description

_end_diff()   X-Ref
No description

_block_header($xbeg, $xlen, $ybeg, $ylen)   X-Ref
No description

_start_block($header)   X-Ref
No description

_end_block()   X-Ref
No description

_lines($lines, $prefix=' ', $color='white')   X-Ref
No description

addedLine($line)   X-Ref
Note: you should HTML-escape parameter before calling this.


deletedLine($line)   X-Ref
Note: you should HTML-escape parameter before calling this.


contextLine($line)   X-Ref
Note: you should HTML-escape parameter before calling this.


emptyLine()   X-Ref
No description

_added($lines)   X-Ref
No description

_deleted($lines)   X-Ref
No description

_context($lines)   X-Ref
No description

_changed($orig, $closing)   X-Ref
No description

Class: DrupalDiffInline  - X-Ref

Drupal inline Diff formatter.

__construct($a, $b)   X-Ref
Constructor.


render()   X-Ref
Render differences inline using HTML markup.


process_chunk($chunk)   X-Ref
Merge chunk segments between tag delimiters.


process_edits($edits)   X-Ref
Merge copy and equivalent edits into intelligible chunks.




Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7