|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.common.diff.Diff
public class Diff
Computes the difference between two texts to create a list of differences. Based on the LGPL Diff_Match_Patch v1.5 javascript of Neil Fraser, Copyright (C) 2006 http://neil.fraser.name/software/diff_match_patch/
for license details.
The copyright to this program is held by it's authors.
Field Summary | |
---|---|
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 Summary | |
---|---|
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. |
Method Summary | |
---|---|
List |
compare()
Find the differences between two texts. |
private List |
compute()
Find the differences between two texts. |
String |
prettyHtml(List diffs)
Convert a Difference list into a pretty HTML report. |
int |
xIndex(List diffs,
int loc)
loc is a location in source, compute and return the equivalent location in target. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private String source
private String target
private boolean checkLines
Constructor Detail |
---|
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 diffMethod Detail |
---|
public List compare()
private List compute()
public int xIndex(List diffs, int loc)
diffs
- List of Difference objectsloc
- Location within source
public String prettyHtml(List diffs)
diffs
- List of Difference objects
|
Copyright ยจ 2003-2007 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |