|
||||||||||
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/
for license details.
The copyright to this program is held by it's authors.
Field Summary | |
---|---|
private String |
source
The baseline text. |
private String |
target
The changed text. |
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 |
generate()
Explore the intersection points between the two texts. |
protected List |
path1(List vMap,
String newSource,
String newTarget)
Work from the middle back to the start to determine the path. |
protected List |
path2(List vMap,
String newSource,
String newTarget)
Work from the middle back to the end to determine the path. |
void |
setSource(String newSource)
|
void |
setTarget(String newTarget)
|
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 String source
private String target
Constructor Detail |
---|
public DifferenceEngine()
public DifferenceEngine(String source, String target)
source
- Old string to be diffedtarget
- New string to be diffedMethod Detail |
---|
public void setSource(String newSource)
newSource
- the source to setpublic void setTarget(String newTarget)
newTarget
- the target to setpublic List generate()
protected List path1(List 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 path2(List 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
-
|
Copyright ยจ 2003-2007 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |