|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.common.diff.Patch
public class Patch
Marshals a patch to a list of Differences, Differences to a patch and applies a list of differences to text to patch it. 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.
Nested Class Summary | |
---|---|
static class |
Patch.PatchResults
A holder of the results of a patch, with a results indicating which patch entries were able to be applied. |
Field Summary | |
---|---|
private int |
margin
|
private static Pattern |
patchBoundaryPattern
|
private List |
patches
|
Constructor Summary | |
---|---|
Patch()
Create an empty patch. |
|
Patch(String input)
Create a Patch from a textual representation, |
|
Patch(String source,
String target)
Create a patch that can turn text1 into text2. |
|
Patch(String source,
String target,
List diffs)
Create a patch that can turn text1 into text2. |
Method Summary | |
---|---|
Patch.PatchResults |
apply(String text)
Merge this patch onto the text. |
Patch |
fromText(String input)
Parse a textual representation of patches and return a List of Patch objects. |
Patch |
make(String source,
String target,
List diffList)
Compute a list of patches to turn text1 into text2. |
void |
splitMax()
Look through the patches and break up any which are longer than the maximum limit of the match algorithm. |
String |
toText()
Take a list of patches and return a textual representation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static Pattern patchBoundaryPattern
private List patches
private int margin
Constructor Detail |
---|
public Patch()
public Patch(String input)
input
- Text representation of patchespublic Patch(String source, String target)
source
- Old texttarget
- New textpublic Patch(String source, String target, List diffs)
source
- Old texttarget
- New textdiffs
- Optional array of diff tuples for text1 to text2.Method Detail |
---|
public Patch make(String source, String target, List diffList)
source
- Old texttarget
- New textdiffList
- Optional array of diff tuples for text1 to text2.
public Patch.PatchResults apply(String text)
text
- Old text
public void splitMax()
public String toText()
public Patch fromText(String input)
input
- Text representation of patches
|
Copyright ยจ 2003-2007 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |