|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jaxfront.core.util.diff.DiffTool
public class DiffTool
A class to compare vectors of objects. The result of comparison is a list of change objects which form an edit script. The objects
compared are traditionally lines of text from two files. Comparison options such as "ignore whitespace" are implemented by modifying the
equals and hashcode methods for the objects compared.
The basic algorithm is described in: "An O(ND) Difference Algorithm and its Variations", Eugene Myers, Algorithmica Vol. 1 No. 2, 1986, p 251.
This class outputs different results from GNU diff 1.15 on some inputs. Our results are actually better (smaller change list, smaller total size of changes), but it would be nice to know why. Perhaps there is a memory overwrite bug in GNU diff 1.15.
| Nested Class Summary | |
|---|---|
static class |
DiffTool.change
The result of comparison is an "edit script": a chain of change objects. |
static interface |
DiffTool.ScriptBuilder
|
| Field Summary | |
|---|---|
static DiffTool.ScriptBuilder |
forwardScript
Standard ScriptBuilders. |
boolean |
heuristic
When set to true, the comparison uses a heuristic to speed it up. |
boolean |
no_discards
When set to true, the algorithm returns a guarranteed minimal set of changes. |
static DiffTool.ScriptBuilder |
reverseScript
Standard ScriptBuilders. |
| Constructor Summary | |
|---|---|
DiffTool(java.lang.Object[] a,
java.lang.Object[] b)
Prepare to find differences between two arrays. |
|
| Method Summary | |
|---|---|
DiffTool.change |
diff_2(boolean reverse)
|
DiffTool.change |
diff(DiffTool.ScriptBuilder bld)
Get the results of comparison as an edit script. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final DiffTool.ScriptBuilder forwardScript
public boolean heuristic
public boolean no_discards
public static final DiffTool.ScriptBuilder reverseScript
| Constructor Detail |
|---|
public DiffTool(java.lang.Object[] a,
java.lang.Object[] b)
equals. The original Object arrays are no longer needed for computing the differences. They will be needed again later to print
the results of the comparison as an edit script, if desired.
| Method Detail |
|---|
public final DiffTool.change diff_2(boolean reverse)
public DiffTool.change diff(DiffTool.ScriptBuilder bld)
bld - an object to build the script from change flags
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||