C# Class Git.Core.Diff

Show file Open project: igorgue/git-sharp

Public Methods

Method Description
DiffBlobs ( Blob blobA, Blob blobB ) : System.Item[]
DiffInt ( int ArrayA, int ArrayB ) : System.Item[]

Find the difference in 2 arrays of integers.

DiffText ( string TextA, string TextB, bool trimSpace, bool ignoreSpace, bool ignoreCase ) : System.Item[]

Find the difference in 2 text documents, comparing by textlines. The algorithm itself is comparing 2 arrays of numbers so when comparing 2 text documents each line is converted into a (hash) number. This hash-value is computed by storing all textlines into a common hashtable so i can find dublicates in there, and generating a new number each time a new textline is inserted.

Private Methods

Method Description
CreateDiffs ( DiffData DataA, DiffData DataB ) : System.Item[]

Scan the tables of which lines are inserted and deleted, producing an edit script in forward order.

DiffCodes ( string aText, Hashtable h, bool trimSpace, bool ignoreSpace, bool ignoreCase ) : int[]

This function converts all textlines of the text into unique numbers for every unique textline so further work can work only with simple numbers.

LCS ( DiffData DataA, int LowerA, int UpperA, DiffData DataB, int LowerB, int UpperB, int DownVector, int UpVector ) : void

This is the divide-and-conquer implementation of the longes common-subsequence (LCS) algorithm. The published algorithm passes recursively parts of the A and B sequences. To avoid copying these arrays the lower and upper bounds are passed while the sequences stay constant.

Optimize ( DiffData Data ) : void

If a sequence of modified lines starts with a line that contains the same content as the line that appends the changes, the difference sequence is modified so that the appended line and not the starting line is marked as modified. This leads to more readable diff sequences when comparing text files.

SMS ( DiffData DataA, int LowerA, int UpperA, DiffData DataB, int LowerB, int UpperB, int DownVector, int UpVector ) : SMSRD

This is the algorithm to find the Shortest Middle Snake (SMS).

Method Details

DiffBlobs() public static method

public static DiffBlobs ( Blob blobA, Blob blobB ) : System.Item[]
blobA Blob
blobB Blob
return System.Item[]

DiffInt() public static method

Find the difference in 2 arrays of integers.
public static DiffInt ( int ArrayA, int ArrayB ) : System.Item[]
ArrayA int A-version of the numbers (usualy the old one)
ArrayB int B-version of the numbers (usualy the new one)
return System.Item[]

DiffText() public static method

Find the difference in 2 text documents, comparing by textlines. The algorithm itself is comparing 2 arrays of numbers so when comparing 2 text documents each line is converted into a (hash) number. This hash-value is computed by storing all textlines into a common hashtable so i can find dublicates in there, and generating a new number each time a new textline is inserted.
public static DiffText ( string TextA, string TextB, bool trimSpace, bool ignoreSpace, bool ignoreCase ) : System.Item[]
TextA string A-version of the text (usualy the old one)
TextB string B-version of the text (usualy the new one)
trimSpace bool When set to true, all leading and trailing whitespace characters are stripped out before the comparation is done.
ignoreSpace bool When set to true, all whitespace characters are converted to a single space character before the comparation is done.
ignoreCase bool When set to true, all characters are converted to their lowercase equivivalence before the comparation is done.
return System.Item[]