Package com.day.util.diff
Class Hunk3
java.lang.Object
com.day.util.diff.Hunk3
A hunk3 represents a block of a change from the 3-way diff. it can either be
a modification on the left side (for which
getLeftRange()
is not
null
), or a change on the right side (for which
getRightRange()
is not null
. if the left and the right
ranges are null
this hunk represents an unmodified block of the
base document. if both ranges are NOT null
it represents a
conflicting block.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the range of the base document this hunk spans.Returns the range of the left document this hunk spans.static String
Returns the marker string for the given format and documentReturns the range of the right document this hunk spans.next()
Returns the next hunk in this chain ornull
of this hunk is the last one.toString()
generate a debug stringvoid
write
(DiffWriter out, boolean showBase) Writes this hunk to a writer.
-
Field Details
-
MARKER_L
the left document marker pattern -
MARKER_R
the right document marker pattern -
MARKER_B
the base document marker pattern -
MARKER_M
the separation marker pattern
-
-
Constructor Details
-
Hunk3
Constructs a new hunk and appends it to the previous one.- Parameters:
base
- the base documentleft
- the left documentright
- the right documentprev
- the previous hunk
-
-
Method Details
-
next
Returns the next hunk in this chain ornull
of this hunk is the last one.- Returns:
- the next hunk.
-
getBaseRange
Returns the range of the base document this hunk spans.- Returns:
- the base range.
-
getLeftRange
Returns the range of the left document this hunk spans. can benull
.- Returns:
- the left range.
-
getRightRange
Returns the range of the right document this hunk spans. can benull
.- Returns:
- the right range.
-
write
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
generate a debug string -
getMarker
Returns the marker string for the given format and document- Parameters:
fmt
- the marker formatdoc
- the document ornull
.- Returns:
- the marker string
-