Class Hunk3
- java.lang.Object
-
- org.apache.jackrabbit.vault.util.diff.Hunk3
-
public class Hunk3 extends Object
A hunk3 represents a block of a change from the 3-way diff. it can either be a modification on the left side (for whichgetLeftRange()
is notnull
), or a change on the right side (for whichgetRightRange()
is notnull
. if the left and the right ranges arenull
this hunk represents an unmodified block of the base document. if both ranges are NOTnull
it represents a conflicting block.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Range
getBaseRange()
Returns the range of the base document this hunk spans.Range
getLeftRange()
Returns the range of the left document this hunk spans.static String
getMarker(String[] fmt, Document doc)
Returns the marker string for the given format and documentRange
getRightRange()
Returns the range of the right document this hunk spans.Hunk3
next()
Returns the next hunk in this chain ornull
of this hunk is the last one.String
toString()
generate a debug stringvoid
write(DiffWriter out, boolean showBase)
Writes this hunk to a writer.
-
-
-
Field Detail
-
MARKER_L
public static final String[] MARKER_L
the left document marker pattern
-
MARKER_R
public static final String[] MARKER_R
the right document marker pattern
-
MARKER_B
public static final String[] MARKER_B
the base document marker pattern
-
MARKER_M
public static final String[] MARKER_M
the separation marker pattern
-
-
Method Detail
-
next
public Hunk3 next()
Returns the next hunk in this chain ornull
of this hunk is the last one.- Returns:
- the next hunk.
-
getBaseRange
public Range getBaseRange()
Returns the range of the base document this hunk spans.- Returns:
- the base range.
-
getLeftRange
public Range getLeftRange()
Returns the range of the left document this hunk spans. can benull
.- Returns:
- the left range.
-
getRightRange
public Range getRightRange()
Returns the range of the right document this hunk spans. can benull
.- Returns:
- the right range.
-
write
public void write(DiffWriter out, boolean showBase) throws IOException
Writes this hunk to a writer. if this hunk represents a conflict it is included in a merge-like manner using the separators defined above.- Parameters:
out
- the writershowBase
- include the block of the base document in case of a conflict as well.- Throws:
IOException
- if a I/O error occurs.
-
toString
public String toString()
generate a debug string
-
-