public class Patch extends Object
The GNU Lesser General Public License for details.
Modifier and Type | Class and Description |
---|---|
static class |
Patch.PatchResults
A holder of the results of a patch, with a results indicating which patch
entries were able to be applied.
|
Modifier and Type | Field and Description |
---|---|
private int |
margin |
private static Pattern |
patchBoundaryPattern |
private List<PatchEntry> |
patches |
Constructor and Description |
---|
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<Difference> diffs)
Create a patch that can turn text1 into text2.
|
Modifier and Type | Method and Description |
---|---|
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<Difference> 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.
|
private static Pattern patchBoundaryPattern
private List<PatchEntry> patches
private int margin
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<Difference> diffs)
source
- Old texttarget
- New textdiffs
- Optional array of diff tuples for text1 to text2.public Patch make(String source, String target, List<Difference> diffList)
source
- Old texttarget
- New textdiffList
- Optional array of diff tuples for text1 to text2.public Patch.PatchResults apply(String text)
text
- Old textpublic void splitMax()
public String toText()