|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jaxfront.core.util.diff.diff_match_patch
public class diff_match_patch
Class containing the diff, match and patch methods. Also contains the behaviour settings.
| Nested Class Summary | |
|---|---|
static class |
diff_match_patch.Diff
Class representing one diff operation. |
static class |
diff_match_patch.Operation
The data structure representing a diff is a Linked list of Diff objects: {Diff(Operation.DELETE, "Hello"), Diff(Operation.INSERT, "Goodbye"), Diff(Operation.EQUAL, " world.")} |
static class |
diff_match_patch.Patch
Class representing one patch operation. |
| Field Summary | |
|---|---|
short |
Diff_DualThreshold
The size beyond which the double-ended diff activates. |
short |
Diff_EditCost
Cost of an empty edit operation in terms of edit characters. |
float |
Diff_Timeout
Number of seconds to map a diff before giving up (0 for infinity). |
int |
Match_Distance
How far to search for a match (0 = exact location, 1000+ = broad match). |
float |
Match_Threshold
At what point is no match declared (0.0 = perfection, 1.0 = very loose). |
float |
Patch_DeleteThreshold
When deleting a large block of text (over ~64 characters), how close does the contents have to match the expected contents. (0.0 = perfection, 1.0 = very loose). |
short |
Patch_Margin
Chunk size for context length. |
| Constructor Summary | |
|---|---|
diff_match_patch()
|
|
| Method Summary | |
|---|---|
void |
diff_cleanupEfficiency(java.util.LinkedList<diff_match_patch.Diff> diffs)
Reduce the number of edits by eliminating operationally trivial equalities. |
void |
diff_cleanupMerge(java.util.LinkedList<diff_match_patch.Diff> diffs)
Reorder and merge like edit sections. |
void |
diff_cleanupSemantic(java.util.LinkedList<diff_match_patch.Diff> diffs)
Reduce the number of edits by eliminating semantically trivial equalities. |
void |
diff_cleanupSemanticLossless(java.util.LinkedList<diff_match_patch.Diff> diffs)
Look for single edits surrounded on both sides by equalities which can be shifted sideways to align the edit to a word boundary. |
int |
diff_commonOverlap(java.lang.String text1,
java.lang.String text2)
Determine if the suffix of one string is the prefix of another. |
int |
diff_commonPrefix(java.lang.String text1,
java.lang.String text2)
Determine the common prefix of two strings |
int |
diff_commonSuffix(java.lang.String text1,
java.lang.String text2)
Determine the common suffix of two strings |
java.util.LinkedList<diff_match_patch.Diff> |
diff_fromDelta(java.lang.String text1,
java.lang.String delta)
Given the original text1, and an encoded string which describes the operations required to transform text1 into text2, compute the full diff. |
int |
diff_levenshtein(java.util.LinkedList<diff_match_patch.Diff> diffs)
Compute the Levenshtein distance; the number of inserted, deleted or substituted characters. |
java.util.LinkedList<diff_match_patch.Diff> |
diff_main(java.lang.String text1,
java.lang.String text2)
Find the differences between two texts. |
java.util.LinkedList<diff_match_patch.Diff> |
diff_main(java.lang.String text1,
java.lang.String text2,
boolean checklines)
Find the differences between two texts. |
java.lang.String |
diff_prettyHtml(java.util.LinkedList<diff_match_patch.Diff> diffs)
Convert a Diff list into a pretty HTML report. |
java.lang.String |
diff_prettyHtml(java.util.LinkedList<diff_match_patch.Diff> diffs,
java.lang.String insertColor,
java.lang.String deleteColor)
|
java.lang.String |
diff_text1(java.util.LinkedList<diff_match_patch.Diff> diffs)
Compute and return the source text (all equalities and deletions). |
java.lang.String |
diff_text2(java.util.LinkedList<diff_match_patch.Diff> diffs)
Compute and return the destination text (all equalities and insertions). |
java.lang.String |
diff_toDelta(java.util.LinkedList<diff_match_patch.Diff> diffs)
Crush the diff into an encoded string which describes the operations required to transform text1 into text2. |
int |
diff_xIndex(java.util.LinkedList<diff_match_patch.Diff> diffs,
int loc)
loc is a location in text1, compute and return the equivalent location in text2. |
int |
match_main(java.lang.String text,
java.lang.String pattern,
int loc)
Locate the best instance of 'pattern' in 'text' near 'loc'. |
java.lang.String |
patch_addPadding(java.util.LinkedList<diff_match_patch.Patch> patches)
Add some padding on text start and end so that edges can match something. |
java.lang.Object[] |
patch_apply(java.util.LinkedList<diff_match_patch.Patch> patches,
java.lang.String text)
Merge a set of patches onto the text. |
java.util.LinkedList<diff_match_patch.Patch> |
patch_deepCopy(java.util.LinkedList<diff_match_patch.Patch> patches)
Given an array of patches, return another array that is identical. |
java.util.List<diff_match_patch.Patch> |
patch_fromText(java.lang.String textline)
Parse a textual representation of patches and return a List of Patch objects. |
java.util.LinkedList<diff_match_patch.Patch> |
patch_make(java.util.LinkedList<diff_match_patch.Diff> diffs)
Compute a list of patches to turn text1 into text2. |
java.util.LinkedList<diff_match_patch.Patch> |
patch_make(java.lang.String text1,
java.util.LinkedList<diff_match_patch.Diff> diffs)
Compute a list of patches to turn text1 into text2. |
java.util.LinkedList<diff_match_patch.Patch> |
patch_make(java.lang.String text1,
java.lang.String text2)
Compute a list of patches to turn text1 into text2. |
void |
patch_splitMax(java.util.LinkedList<diff_match_patch.Patch> patches)
Look through the patches and break up any which are longer than the maximum limit of the match algorithm. |
java.lang.String |
patch_toText(java.util.List<diff_match_patch.Patch> patches)
Take a list of patches and return a textual representation. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public short Diff_DualThreshold
public short Diff_EditCost
public float Diff_Timeout
public int Match_Distance
public float Match_Threshold
public float Patch_DeleteThreshold
public short Patch_Margin
| Constructor Detail |
|---|
public diff_match_patch()
| Method Detail |
|---|
public void diff_cleanupEfficiency(java.util.LinkedList<diff_match_patch.Diff> diffs)
diffs - LinkedList of Diff objects.public void diff_cleanupMerge(java.util.LinkedList<diff_match_patch.Diff> diffs)
diffs - LinkedList of Diff objects.public void diff_cleanupSemantic(java.util.LinkedList<diff_match_patch.Diff> diffs)
diffs - LinkedList of Diff objects.public void diff_cleanupSemanticLossless(java.util.LinkedList<diff_match_patch.Diff> diffs)
diffs - LinkedList of Diff objects.
public int diff_commonOverlap(java.lang.String text1,
java.lang.String text2)
text1 - First string.text2 - Second string.
public int diff_commonPrefix(java.lang.String text1,
java.lang.String text2)
text1 - First string.text2 - Second string.
public int diff_commonSuffix(java.lang.String text1,
java.lang.String text2)
text1 - First string.text2 - Second string.
public java.util.LinkedList<diff_match_patch.Diff> diff_fromDelta(java.lang.String text1,
java.lang.String delta)
throws java.lang.IllegalArgumentException
text1 - Source string for the diff.delta - Delta text.
java.lang.IllegalArgumentException - If invalid input.public int diff_levenshtein(java.util.LinkedList<diff_match_patch.Diff> diffs)
diffs - LinkedList of Diff objects.
public java.util.LinkedList<diff_match_patch.Diff> diff_main(java.lang.String text1,
java.lang.String text2)
text1 - Old string to be diffed.text2 - New string to be diffed.
public java.util.LinkedList<diff_match_patch.Diff> diff_main(java.lang.String text1,
java.lang.String text2,
boolean checklines)
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
public java.lang.String diff_prettyHtml(java.util.LinkedList<diff_match_patch.Diff> diffs)
diffs - LinkedList of Diff objects.
public java.lang.String diff_prettyHtml(java.util.LinkedList<diff_match_patch.Diff> diffs,
java.lang.String insertColor,
java.lang.String deleteColor)
public java.lang.String diff_text1(java.util.LinkedList<diff_match_patch.Diff> diffs)
diffs - LinkedList of Diff objects.
public java.lang.String diff_text2(java.util.LinkedList<diff_match_patch.Diff> diffs)
diffs - LinkedList of Diff objects.
public java.lang.String diff_toDelta(java.util.LinkedList<diff_match_patch.Diff> diffs)
diffs - Array of diff tuples.
public int diff_xIndex(java.util.LinkedList<diff_match_patch.Diff> diffs,
int loc)
diffs - LinkedList of Diff objects.loc - Location within text1.
public int match_main(java.lang.String text,
java.lang.String pattern,
int loc)
text - The text to search.pattern - The pattern to search for.loc - The location to search around.
public java.lang.String patch_addPadding(java.util.LinkedList<diff_match_patch.Patch> patches)
patches - Array of patch objects.
public java.lang.Object[] patch_apply(java.util.LinkedList<diff_match_patch.Patch> patches,
java.lang.String text)
patches - Array of patch objectstext - Old text.
public java.util.LinkedList<diff_match_patch.Patch> patch_deepCopy(java.util.LinkedList<diff_match_patch.Patch> patches)
patches - Array of patch objects.
public java.util.List<diff_match_patch.Patch> patch_fromText(java.lang.String textline)
throws java.lang.IllegalArgumentException
textline - Text representation of patches.
java.lang.IllegalArgumentException - If invalid input.public java.util.LinkedList<diff_match_patch.Patch> patch_make(java.util.LinkedList<diff_match_patch.Diff> diffs)
diffs - Array of diff tuples for text1 to text2.
public java.util.LinkedList<diff_match_patch.Patch> patch_make(java.lang.String text1,
java.util.LinkedList<diff_match_patch.Diff> diffs)
text1 - Old text.diffs - Array of diff tuples for text1 to text2.
public java.util.LinkedList<diff_match_patch.Patch> patch_make(java.lang.String text1,
java.lang.String text2)
text1 - Old text.text2 - New text.
public void patch_splitMax(java.util.LinkedList<diff_match_patch.Patch> patches)
patches - LinkedList of Patch objects.public java.lang.String patch_toText(java.util.List<diff_match_patch.Patch> patches)
patches - List of Patch objects.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||