public class Diff extends Object
The GNU Lesser General Public License for details.| Modifier and Type | Field and Description |
|---|---|
private boolean |
checkLines
Whether a slightly faster less optimal diff should be run.
|
private String |
source
The baseline text.
|
private String |
target
The changed text.
|
| Constructor and Description |
|---|
Diff(String source,
String target)
Construct an object that can find the differences between two texts.
|
Diff(String source,
String target,
boolean checkLines)
Construct an object that can find the differences between two texts.
|
| Modifier and Type | Method and Description |
|---|---|
List<Difference> |
compare()
Find the differences between two texts.
|
private List<Difference> |
compute()
Find the differences between two texts.
|
String |
prettyHtml(List<Difference> diffs)
Convert a Difference list into a pretty HTML report.
|
int |
xIndex(List<Difference> diffs,
int loc)
loc is a location in source, compute and return the equivalent location
in target.
|
private String source
private String target
private boolean checkLines
public Diff(String source, String target)
source - Old string to be diffedtarget - New string to be diffedpublic Diff(String source, String target, boolean checkLines)
source - Old string to be diffedtarget - New string to be diffedcheckLines - 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 diffpublic List<Difference> compare()
private List<Difference> compute()
public int xIndex(List<Difference> diffs, int loc)
diffs - List of Difference objectsloc - Location within sourcepublic String prettyHtml(List<Difference> diffs)
diffs - List of Difference objects