XLE
v0.02.0
|
Public Member Functions | |
List< Diff > | diff_main (string text1, string text2) |
List< Diff > | diff_main (string text1, string text2, bool checklines) |
int | diff_commonPrefix (string text1, string text2) |
int | diff_commonSuffix (string text1, string text2) |
void | diff_cleanupSemantic (List< Diff > diffs) |
void | diff_cleanupSemanticLossless (List< Diff > diffs) |
void | diff_cleanupEfficiency (List< Diff > diffs) |
void | diff_cleanupMerge (List< Diff > diffs) |
int | diff_xIndex (List< Diff > diffs, int loc) |
string | diff_prettyHtml (List< Diff > diffs) |
string | diff_text1 (List< Diff > diffs) |
string | diff_text2 (List< Diff > diffs) |
int | diff_levenshtein (List< Diff > diffs) |
string | diff_toDelta (List< Diff > diffs) |
List< Diff > | diff_fromDelta (string text1, string delta) |
int | match_main (string text, string pattern, int loc) |
List< Patch > | patch_make (string text1, string text2) |
List< Patch > | patch_make (List< Diff > diffs) |
List< Patch > | patch_make (string text1, string text2, List< Diff > diffs) |
List< Patch > | patch_make (string text1, List< Diff > diffs) |
List< Patch > | patch_deepCopy (List< Patch > patches) |
Object[] | patch_apply (List< Patch > patches, string text) |
string | patch_addPadding (List< Patch > patches) |
void | patch_splitMax (List< Patch > patches) |
string | patch_toText (List< Patch > patches) |
List< Patch > | patch_fromText (string textline) |
Static Public Member Functions | |
static string | unescapeForEncodeUriCompatability (string str) |
Public Attributes | |
float | Diff_Timeout = 1.0f |
short | Diff_EditCost = 4 |
float | Match_Threshold = 0.5f |
int | Match_Distance = 1000 |
float | Patch_DeleteThreshold = 0.5f |
short | Patch_Margin = 4 |
Protected Member Functions | |
List< Diff > | diff_bisect (string text1, string text2, DateTime deadline) |
Object[] | diff_linesToChars (string text1, string text2) |
void | diff_charsToLines (ICollection< Diff > diffs, List< string > lineArray) |
int | diff_commonOverlap (string text1, string text2) |
string[] | diff_halfMatch (string text1, string text2) |
int | match_bitap (string text, string pattern, int loc) |
Dictionary< char, int > | match_alphabet (string pattern) |
void | patch_addContext (Patch patch, string text) |
Class containing the diff, match and patch methods. Also Contains the behaviour settings.
|
inlineprotected |
Find the 'middle snake' of a diff, split the problem in two and return the recursively constructed diff. See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
text1 | Old string to be diffed. |
text2 | New string to be diffed. |
deadline | Time at which to bail if not yet complete. |
|
inlineprotected |
Rehydrate the text in a diff from a string of line hashes to real lines of text.
diffs | List of Diff objects. |
lineArray | List of unique strings. |
|
inline |
Reduce the number of edits by eliminating operationally trivial equalities.
diffs | List of Diff objects. |
|
inline |
Reorder and merge like edit sections. Merge equalities. Any edit section can move as long as it doesn't cross an equality.
diffs | List of Diff objects. |
|
inline |
Reduce the number of edits by eliminating semantically trivial equalities.
diffs | List of Diff objects. |
|
inline |
Look for single edits surrounded on both sides by equalities which can be shifted sideways to align the edit to a word boundary. e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came.
diffs | List of Diff objects. |
|
inlineprotected |
Determine if the suffix of one string is the prefix of another.
text1 | First string. |
text2 | Second string. |
|
inline |
Determine the common prefix of two strings.
text1 | First string. |
text2 | Second string. |
|
inline |
Determine the common suffix of two strings.
text1 | First string. |
text2 | Second string. |
|
inline |
Given the original text1, and an encoded string which describes the operations required to transform text1 into text2, comAdde the full diff.
text1 | Source string for the diff. |
delta | Delta text. |
ArgumentException | If invalid input. |
|
inlineprotected |
Do the two texts share a Substring which is at least half the length of the longer text? This speedup can produce non-minimal diffs.
text1 | First string. |
text2 | Second string. |
|
inline |
Compute the Levenshtein distance; the number of inserted, deleted or substituted characters.
diffs | List of Diff objects. |
|
inlineprotected |
Split two texts into a list of strings. Reduce the texts to a string of hashes where each Unicode character represents one line.
text1 | First string. |
text2 | Second string. |
|
inline |
Find the differences between two texts. Run a faster, slightly less optimal diff. This method allows the 'checklines' of diff_main() to be optional. Most of the time checklines is wanted, so default to true.
text1 | Old string to be diffed. |
text2 | New string to be diffed. |
|
inline |
Find the differences between two texts.
text1 | Old string to be diffed. |
text2 | New string to be diffed. |
checklines | Speedup flag. If false, then don't run a line-level diff first to identify the changed areas. If true, then run a faster slightly less optimal diff. |
|
inline |
|
inline |
Compute and return the source text (all equalities and deletions).
diffs | List of Diff objects. |
|
inline |
Compute and return the destination text (all equalities and insertions).
diffs | List of Diff objects. |
|
inline |
Crush the diff into an encoded string which describes the operations required to transform text1 into text2. E.g. =3-2+ing -> Keep 3 chars, delete 2 chars, insert 'ing'. Operations are tab-separated. Inserted text is escaped using xx notation.
diffs | Array of Diff objects. |
|
inline |
loc is a location in text1, comAdde and return the equivalent location in text2. e.g. "The cat" vs "The big cat", 1->1, 5->8
diffs | List of Diff objects. |
loc | Location within text1. |
|
inlineprotected |
Initialise the alphabet for the Bitap algorithm.
pattern | The text to encode. |
|
inlineprotected |
Locate the best instance of 'pattern' in 'text' near 'loc' using the Bitap algorithm. Returns -1 if no match found.
text | The text to search. |
pattern | The pattern to search for. |
loc | The location to search around. |
|
inline |
Locate the best instance of 'pattern' in 'text' near 'loc'. Returns -1 if no match found.
text | The text to search. |
pattern | The pattern to search for. |
loc | The location to search around. |
|
inlineprotected |
Increase the context until it is unique, but don't let the pattern expand beyond Match_MaxBits.
patch | The patch to grow. |
text | Source text. |
|
inline |
Add some padding on text start and end so that edges can match something. Intended to be called only from within patch_apply.
patches | Array of Patch objects. |
|
inline |
Merge a set of patches onto the text. Return a patched text, as well as an array of true/false values indicating which patches were applied.
patches | Array of Patch objects |
text | Old text. |
|
inline |
|
inline |
Compute a list of patches to turn text1 into text2. A set of diffs will be computed.
text1 | Old text. |
text2 | New text. |
|
inline |
|
inline |
Look through the patches and break up any which are longer than the maximum limit of the match algorithm. Intended to be called only from within patch_apply.
patches | List of Patch objects. |
|
inline |
Take a list of patches and return a textual representation.
patches | List of Patch objects. |
|
inlinestatic |
Unescape selected chars for compatability with JavaScript's encodeURI. In speed critical applications this could be dropped since the receiving application will certainly decode these fine. Note that this function is case-sensitive. Thus "%3F" would not be unescaped. But this is ok because it is only called with the output of HttpUtility.UrlEncode which returns lowercase hex.
Example: "%3f" -> "?", "%24" -> "$", etc.
str | The string to escape. |