|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.crosswire.common.diff.DifferenceEngine
public class DifferenceEngine
Builds a map of a baseline/source text and a changed/target text, navigating
it to determine 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/
The GNU Lesser General Public License for details.| Field Summary | |
|---|---|
private String |
source
Made final because we now rely on caching the string lengths (they could be cached at method level if require non-final in future) The baseline text. |
private int |
sourceLength
|
private String |
target
The changed text. |
private int |
targetLength
|
private static float |
timeout
|
private static float |
TIMEOUT
Number of seconds to map a diff before giving up. |
| Constructor Summary | |
|---|---|
DifferenceEngine()
Empty Difference Engine, which won't find anything. |
|
DifferenceEngine(String source,
String target)
Find the differences between two texts. |
|
| Method Summary | |
|---|---|
List<Difference> |
generate()
Explore the intersection points between the two texts. |
protected List<Difference> |
path1(List<Set<String>> vMap,
String newSource,
String newTarget)
Work from the middle back to the start to determine the path. |
protected List<Difference> |
path2(List<Set<String>> vMap,
String newSource,
String newTarget)
Work from the middle back to the end to determine the path. |
static void |
setTimeout(float newTimeout)
Set the timeout for the diff operation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final float TIMEOUT
private static float timeout
private final String source
private final String target
private final int targetLength
private final int sourceLength
| Constructor Detail |
|---|
public DifferenceEngine()
public DifferenceEngine(String source,
String target)
source - Old string to be diffedtarget - New string to be diffed| Method Detail |
|---|
public List<Difference> generate()
protected List<Difference> path1(List<Set<String>> vMap,
String newSource,
String newTarget)
vMap - List of path sets.newSource - Old string fragment to be diffednewTarget - New string fragment to be diffed
protected List<Difference> path2(List<Set<String>> vMap,
String newSource,
String newTarget)
vMap - List of path sets.newSource - Old string fragment to be diffednewTarget - New string fragment to be diffed
public static void setTimeout(float newTimeout)
newTimeout - the new timeout
|
Copyright ยจ 2003-2015 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||