-
Notifications
You must be signed in to change notification settings - Fork 0
Generic C# (.net/mono) Diff and Longest Common Subsequence utility class ( currently broken )
License
inorton/csdiff
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
csdiff (c) 2009 Ian Norton About ------ csdiff contains two simple classes, LCS and Diff, the former uses dynamic programming to deduce the longest common substring from two sequences of the same generic type. The latter uses the LCS class to construct a diff style description between the two sequences. The LCS implementation is as described here: http://www.ics.uci.edu/~eppstein/161/960229.html and has characteristic quadratic time and space limitations but with some optimization to reduce the problem set. Usage ------ Some examples (which are unit tests) are in csdiff/tests/. --- using csdiff; public namespace myprog { public class myprog { public static void Main( string[] argv ) { MyType[] group1 = ... MyType[] group2 = ... Diff d = new Diff<MyType>( group1, group2 ); // Get the LCS List<MyType> lcs = d.Sequence; // Get the Diff List<csdiff.Change<MyType>> diff = d.Changes; // or for types with a meaningful ToString() method you can do this. string[] ax = "the quick brown fox ate fish".Split(" "); string[] bx = "the quick blue fox ate cheese".Split(" "); Diff mydiff = new Diff<string>( ax, bx ); Console.WriteLine( mydiff.ToString() ); // should print:- // // 2 - brown // 2 + blue // 5 - fish // 5 + cheese } } } License -------- This is released under a BSD compatible license ( see LICENSE )
About
Generic C# (.net/mono) Diff and Longest Common Subsequence utility class ( currently broken )
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published