com.unitesk.requality.eclipse.views.documents
public class DiffProcessor extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
DiffProcessor.Diff
Class representing one diff operation.
|
protected static class |
DiffProcessor.LinesToCharsResult
Internal class for returning results from diff_linesToChars().
|
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.")}
|
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 |
---|---|
protected java.util.LinkedList<DiffProcessor.Diff> |
diff_bisect(java.lang.String text1,
java.lang.String text2,
long deadline)
Find the 'middle snake' of a diff, split the problem in two
and return the recursively constructed diff.
|
protected void |
diff_charsToLines(java.util.LinkedList<DiffProcessor.Diff> diffs,
java.util.List<java.lang.String> lineArray)
Rehydrate the text in a diff from a string of line hashes to real lines of
text.
|
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.
|
protected 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<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.
|
protected DiffProcessor.LinesToCharsResult |
diff_linesToChars(java.lang.String text1,
java.lang.String text2)
Split two texts into a list of strings.
|
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.protected java.util.LinkedList<DiffProcessor.Diff> diff_bisect(java.lang.String text1, java.lang.String text2, long deadline)
text1
- Old string to be diffed.text2
- New string to be diffed.deadline
- Time at which to bail if not yet complete.protected DiffProcessor.LinesToCharsResult diff_linesToChars(java.lang.String text1, java.lang.String text2)
text1
- First string.text2
- Second string.protected void diff_charsToLines(java.util.LinkedList<DiffProcessor.Diff> diffs, java.util.List<java.lang.String> lineArray)
diffs
- LinkedList of Diff objects.lineArray
- List of unique strings.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.protected int diff_commonOverlap(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.