Arbit - project tracking

Arbit - project tracking

API documentation :: Docs For Class arbitFrameworkDiff

Core::arbitFrameworkDiff

Class arbitFrameworkDiff

This is a implemntation of the common diff algorithm for arbritrary arrays of tokens.

This is a implemntation of the common diff algorithm for arbritrary arrays of tokens. This way you may diff on line / word / character / ... basis. Extensions of this class may offer ways to split your text into the desired token type and apply and return the diff for them. The diffs are not rendered by this class. This class implements the trivial intuitive diff algorithm. You may change the implementation by an optimized variant of the algorithm.;

Author(s):
Version:   $Revision: 1236 $
License:   GPL

Descendants

Child Class Description
arbitFrameworkTextDiff Wrapper around the the diff algorithm class providing diffs of texts, where the diff primarily checks for same paragraphs and performs a word wise diff on paragraphs with changes.
arbitFrameworkLineDiff This is a wraper around the diff algorithm for line based diffs, which is often used for source code or similar.

Method Summary

protected array backtraceLCS( $matrix , $old , $new , $i , $j )
Backtrace LCS LCS calculated the matrix for the determination of the LCS. function calculates the actual token list back from this matrix by backtracing the best path in the matrix.
public array diff( $old , $new )
Diff two arrays Return the diff of two arrays, as an array consisting of arbitDiffToken elements with all have a status of the token (old, added, removed), the token number and the actual content.
public array longestCommonSubsequence( $old , $new )
Calculate LCS of two token lists Calculate and return the longest common subsequence of two token arrays.

Methods

backtraceLCS

array backtraceLCS( $matrix , $old , $new , int $i , int $j )

Backtrace LCS LCS calculated the matrix for the determination of the LCS. function calculates the actual token list back from this matrix by backtracing the best path in the matrix.

Backtrace LCS LCS calculated the matrix for the determination of the LCS. This function calculates the actual token list back from this matrix by backtracing the best path in the matrix.

Parameters:
Name Type Description
$matrix array
$old array
$new array
$i int
$j int

diff

array diff( $old , $new )

Diff two arrays Return the diff of two arrays, as an array consisting of arbitDiffToken elements with all have a status of the token (old, added, removed), the token number and the actual content.

Diff two arrays Return the diff of two arrays, as an array consisting of arbitDiffToken elements with all have a status of the token (old, added, removed), the token number and the actual content.

Parameters:
Name Type Description
$old array
$new array

longestCommonSubsequence

array longestCommonSubsequence( $old , $new )

Calculate LCS of two token lists Calculate and return the longest common subsequence of two token arrays.

Calculate LCS of two token lists Calculate and return the longest common subsequence of two token arrays.

Parameters:
Name Type Description
$old array
$new array
Documentation generated on Mon, 05 Apr 2010 14:01:48 +0200 by phpDocumentor 1.4.3