org.crosswire.common.diff
Class PatchEntry
java.lang.Object
org.crosswire.common.diff.PatchEntry
public class PatchEntry
- extends Object
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/
- Author:
- DM Smith [dmsmith555 at yahoo dot com]
- See Also:
for license details.
The copyright to this program is held by it's authors.
MARGIN
private static final int MARGIN
- Chunk size for context length.
- See Also:
- Constant Field Values
margin
private static int margin
newlinePattern
private static Pattern newlinePattern
patchPattern
private static Pattern patchPattern
diffs
private List diffs
sourceStart
private int sourceStart
targetStart
private int targetStart
sourceLength
private int sourceLength
targetLength
private int targetLength
PatchEntry
public PatchEntry()
PatchEntry
public PatchEntry(String patchText)
getSourceStart
public int getSourceStart()
- Returns:
- the sourceStart
setSourceStart
public void setSourceStart(int start)
- Parameters:
start
- the sourceStart to set
adjustSourceStart
public void adjustSourceStart(int adjustment)
- Parameters:
adjustment
- the adjustment to sourceStart
getTargetStart
public int getTargetStart()
- Returns:
- the targetStart
setTargetStart
public void setTargetStart(int start)
- Parameters:
start
- the targetStart to set
adjustTargetStart
public void adjustTargetStart(int adjustment)
- Parameters:
adjustment
- the adjustment to targetStart
getSourceLength
public int getSourceLength()
- Returns:
- the sourceLength
setSourceLength
public void setSourceLength(int length)
- Parameters:
length
- the sourceLength to set
adjustSourceLength
public void adjustSourceLength(int adjustment)
- Parameters:
adjustment
- the adjustment to sourceLength
getTargetLength
public int getTargetLength()
- Returns:
- the targetLength
setTargetLength
public void setTargetLength(int length)
- Parameters:
length
- the targetLength to set
adjustTargetLength
public void adjustTargetLength(int adjustment)
- Parameters:
adjustment
- the adjustment to targetLength
toString
public String toString()
- Overrides:
toString
in class Object
fromText
public PatchEntry fromText(String input)
- Parse a textual representation of a patch entry and populate this patch entry.
- Parameters:
input
- Text representation of this patch entry
- Returns:
- this patch entry
getSourceText
public String getSourceText()
getTargetText
public String getTargetText()
addContext
public void addContext(String text)
addDifference
public void addDifference(Difference diff)
getDifferenceCount
public int getDifferenceCount()
hasDifferences
public boolean hasDifferences()
iterator
public Iterator iterator()
getFirstDifference
public Difference getFirstDifference()
removeFirstDifference
public Difference removeFirstDifference()
getLastDifference
public Difference getLastDifference()
setDifferences
protected void setDifferences(List newDiffs)
setMargin
public static void setMargin(int newMargin)
- Parameters:
newMargin
- the margin to set
getMargin
public static int getMargin()
- Returns:
- the margin
getCoordinates
private String getCoordinates(int start,
int length)