[ Index ]
 

Code source de DokuWiki 2006-11-06

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/inc/ -> DifferenceEngine.php (sommaire)

(pas de description)

Poids: 1062 lignes (28 kb)
Inclus ou requis: 2 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 13 classes

_DiffOp:: (3 méthodes):
  reverse()
  norig()
  nclosing()

_DiffOp_Copy:: (2 méthodes):
  _DiffOp_Copy()
  reverse()

_DiffOp_Delete:: (2 méthodes):
  _DiffOp_Delete()
  reverse()

_DiffOp_Add:: (2 méthodes):
  _DiffOp_Add()
  reverse()

_DiffOp_Change:: (2 méthodes):
  _DiffOp_Change()
  reverse()

_DiffEngine:: (5 méthodes):
  diff()
  _diag()
  _lcs_pos()
  _compareseq()
  _shift_boundaries()

Diff:: (7 méthodes):
  Diff()
  reverse()
  isEmpty()
  lcs()
  orig()
  closing()
  _check()

MappedDiff:: (1 méthode):
  MappedDiff()

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

_HWLDF_WordAccumulator:: (5 méthodes):
  _HWLDF_WordAccumulator()
  _flushGroup()
  _flushLine()
  addWords()
  getLines()

WordLevelDiff:: (4 méthodes):
  WordLevelDiff()
  _split()
  orig()
  closing()

UnifiedDiffFormatter:: (5 méthodes):
  UnifiedDiffFormatter()
  _block_header()
  _added()
  _deleted()
  _changed()

TableDiffFormatter:: (14 méthodes):
  TableDiffFormatter()
  _pre()
  _block_header()
  _start_block()
  _end_block()
  _lines()
  addedLine()
  deletedLine()
  emptyLine()
  contextLine()
  _added()
  _deleted()
  _context()
  _changed()


Classe: _DiffOp  - X-Ref

A PHP diff engine for phpwiki. (Taken from phpwiki-1.3.3)

Additions by Axel Boldt for MediaWiki

reverse()   X-Ref
Pas de description

norig()   X-Ref
Pas de description

nclosing()   X-Ref
Pas de description

Classe: _DiffOp_Copy  - X-Ref

_DiffOp_Copy($orig, $closing = false)   X-Ref
Pas de description

reverse()   X-Ref
Pas de description

Classe: _DiffOp_Delete  - X-Ref

_DiffOp_Delete($lines)   X-Ref
Pas de description

reverse()   X-Ref
Pas de description

Classe: _DiffOp_Add  - X-Ref

_DiffOp_Add($lines)   X-Ref
Pas de description

reverse()   X-Ref
Pas de description

Classe: _DiffOp_Change  - X-Ref

_DiffOp_Change($orig, $closing)   X-Ref
Pas de description

reverse()   X-Ref
Pas de description

Classe: _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.

diff($from_lines, $to_lines)   X-Ref
Pas de description

_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
Pas de 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).

Classe: 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.

Classe: 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

Classe: 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
Pas de description

_start_diff()   X-Ref
Pas de description

_end_diff()   X-Ref
Pas de description

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

_start_block($header)   X-Ref
Pas de description

_end_block()   X-Ref
Pas de description

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

_context($lines)   X-Ref
Pas de description

_added($lines)   X-Ref
Pas de description

_deleted($lines)   X-Ref
Pas de description

_changed($orig, $closing)   X-Ref
Pas de description

Classe: _HWLDF_WordAccumulator  - X-Ref

_HWLDF_WordAccumulator()   X-Ref
Pas de description

_flushGroup($new_tag)   X-Ref
Pas de description

_flushLine($new_tag)   X-Ref
Pas de description

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

getLines()   X-Ref
Pas de description

Classe: WordLevelDiff  - X-Ref

WordLevelDiff($orig_lines, $closing_lines)   X-Ref
Pas de description

_split($lines)   X-Ref
Pas de description

orig()   X-Ref
Pas de description

closing()   X-Ref
Pas de description

Classe: UnifiedDiffFormatter  - X-Ref

"Unified" diff formatter.

This class formats the diff in classic "unified diff" format.
UnifiedDiffFormatter($context_lines = 4)   X-Ref
Pas de description

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

_added($lines)   X-Ref
Pas de description

_deleted($lines)   X-Ref
Pas de description

_changed($orig, $final)   X-Ref
Pas de description

Classe: TableDiffFormatter  - X-Ref

Wikipedia Table style diff formatter.

TableDiffFormatter()   X-Ref
Pas de description

_pre($text)   X-Ref
Pas de description

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

_start_block( $header )   X-Ref
Pas de description

_end_block()   X-Ref
Pas de description

_lines( $lines, $prefix=' ', $color="white" )   X-Ref
Pas de description

addedLine( $line )   X-Ref
Pas de description

deletedLine( $line )   X-Ref
Pas de description

emptyLine()   X-Ref
Pas de description

contextLine( $line )   X-Ref
Pas de description

_added($lines)   X-Ref
Pas de description

_deleted($lines)   X-Ref
Pas de description

_context( $lines )   X-Ref
Pas de description

_changed( $orig, $closing )   X-Ref
Pas de description



Généré le : Tue Apr 3 20:47:31 2007 par Balluche grâce à PHPXref 0.7