public class DiffProcessor
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
DiffProcessor.Diff
Class representing one diff operation.
|
static class |
DiffProcessor.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.")} which means: delete "Hello", add "Goodbye" and keep " world."
|
Modifier and Type | Field and Description |
---|---|
float |
Diff_Timeout
Number of seconds to map a diff before giving up (0 for infinity).
|
Constructor and Description |
---|
DiffProcessor() |
Modifier and Type | Method and Description |
---|---|
void |
diff_cleanupMerge(java.util.LinkedList<DiffProcessor.Diff> diffs)
Reorder and merge like edit sections.
|
void |
diff_cleanupSemantic(java.util.LinkedList<DiffProcessor.Diff> diffs)
Reduce the number of edits by eliminating semantically trivial equalities.
|
void |
diff_cleanupSemanticLossless(java.util.LinkedList<DiffProcessor.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. e.g: The cat came. -> The cat came.
|
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<DiffProcessor.Diff> |
diff_lineMode(java.lang.String text1,
java.lang.String text2,
long deadline)
Do a quick line-level diff on both strings, then rediff the parts for greater accuracy.
|
java.util.LinkedList<DiffProcessor.Diff> |
diff_main(java.lang.String text1,
java.lang.String text2)
Find the differences between two texts.
|
java.util.LinkedList<DiffProcessor.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<DiffProcessor.Diff> diffs)
Convert a Diff list into a pretty HTML report.
|
public float Diff_Timeout
public java.util.LinkedList<DiffProcessor.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<DiffProcessor.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.util.LinkedList<DiffProcessor.Diff> diff_lineMode(java.lang.String text1, java.lang.String text2, long deadline)
text1
- Old string to be diffed.text2
- New string to be diffed.deadline
- Time when the diff should be complete by.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 void diff_cleanupSemantic(java.util.LinkedList<DiffProcessor.Diff> diffs)
diffs
- LinkedList of Diff objects.public void diff_cleanupSemanticLossless(java.util.LinkedList<DiffProcessor.Diff> diffs)
diffs
- LinkedList of Diff objects.public void diff_cleanupMerge(java.util.LinkedList<DiffProcessor.Diff> diffs)
diffs
- LinkedList of Diff objects.public java.lang.String diff_prettyHtml(java.util.LinkedList<DiffProcessor.Diff> diffs)
diffs
- LinkedList of Diff objects.