|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.common.diff.PatchEntry
public class PatchEntry
A PatchEntry is a single "instruction" in a Patch, consisting of a interval
over which differences are applied and the differences that should be
applied.
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 List<Difference> |
diffs
|
private static int |
margin
|
private static int |
MARGIN
Chunk size for context length. |
private static Pattern |
newlinePattern
|
private static Pattern |
patchPattern
|
private int |
sourceLength
|
private int |
sourceStart
|
private int |
targetLength
|
private int |
targetStart
|
Constructor Summary | |
---|---|
PatchEntry()
|
|
PatchEntry(String patchText)
|
Method Summary | |
---|---|
void |
addContext(String text)
|
void |
addDifference(Difference diff)
|
void |
adjustSourceLength(int adjustment)
|
void |
adjustSourceStart(int adjustment)
|
void |
adjustTargetLength(int adjustment)
|
void |
adjustTargetStart(int adjustment)
|
private String |
decode(String str)
Undo encoding |
private String |
encode(String str)
This algorithm allows for \n to be included in a difference. |
PatchEntry |
fromText(String input)
Parse a textual representation of a patch entry and populate this patch entry. |
private String |
getCoordinates(int start,
int length)
|
int |
getDifferenceCount()
|
Difference |
getFirstDifference()
|
Difference |
getLastDifference()
|
static int |
getMargin()
|
int |
getSourceLength()
|
int |
getSourceStart()
|
String |
getSourceText()
|
int |
getTargetLength()
|
int |
getTargetStart()
|
String |
getTargetText()
|
boolean |
hasDifferences()
|
Iterator<Difference> |
iterator()
|
Difference |
removeFirstDifference()
|
protected void |
setDifferences(List<Difference> newDiffs)
|
static void |
setMargin(int newMargin)
|
void |
setSourceLength(int length)
|
void |
setSourceStart(int start)
|
void |
setTargetLength(int length)
|
void |
setTargetStart(int start)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final int MARGIN
private static int margin
private static Pattern newlinePattern
private static Pattern patchPattern
private List<Difference> diffs
private int sourceStart
private int targetStart
private int sourceLength
private int targetLength
Constructor Detail |
---|
public PatchEntry()
public PatchEntry(String patchText)
Method Detail |
---|
public int getSourceStart()
public void setSourceStart(int start)
start
- the sourceStart to setpublic void adjustSourceStart(int adjustment)
adjustment
- the adjustment to sourceStartpublic int getTargetStart()
public void setTargetStart(int start)
start
- the targetStart to setpublic void adjustTargetStart(int adjustment)
adjustment
- the adjustment to targetStartpublic int getSourceLength()
public void setSourceLength(int length)
length
- the sourceLength to setpublic void adjustSourceLength(int adjustment)
adjustment
- the adjustment to sourceLengthpublic int getTargetLength()
public void setTargetLength(int length)
length
- the targetLength to setpublic void adjustTargetLength(int adjustment)
adjustment
- the adjustment to targetLengthpublic String toString()
toString
in class Object
public PatchEntry fromText(String input)
input
- Text representation of this patch entry
public String getSourceText()
public String getTargetText()
public void addContext(String text)
public void addDifference(Difference diff)
public int getDifferenceCount()
public boolean hasDifferences()
public Iterator<Difference> iterator()
iterator
in interface Iterable<Difference>
public Difference getFirstDifference()
public Difference removeFirstDifference()
public Difference getLastDifference()
protected void setDifferences(List<Difference> newDiffs)
public static void setMargin(int newMargin)
newMargin
- the margin to setpublic static int getMargin()
private String getCoordinates(int start, int length)
private String encode(String str)
str
- the unencoded string
private String decode(String str)
str
- the encoded string
|
Copyright ยจ 2003-2015 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |