Class Patch<T>
java.lang.Object
com.github.difflib.patch.Patch<T>
- Type Parameters:
T- The type of the compared elements in the 'lines'.
- All Implemented Interfaces:
Serializable
Describes the patch holding all deltas between the original and revised
texts.
- Author:
- Dmitry Naumenko
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ConflictOutput<T> Standard Patch behaviour to throw an exception for pathching conflicts.static final ConflictOutput<String> Git like merge conflict output. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDelta(AbstractDelta<T> delta) Add the given delta to this patchapplyFuzzy(List<T> target, int maxFuzz) Apply this patch to the given targetstatic <T> Patch<T> static <T> Patch<T> Get the list of computed deltasRestore the text to original.toString()withConflictOutput(ConflictOutput<T> conflictOutput) Alter normal conflict output behaviour to e.g. inclide some conflict statements in the result, like git does it.
-
Field Details
-
CONFLICT_PRODUCES_EXCEPTION
Standard Patch behaviour to throw an exception for pathching conflicts. -
CONFLICT_PRODUCES_MERGE_CONFLICT
Git like merge conflict output.
-
-
Constructor Details
-
Patch
public Patch() -
Patch
public Patch(int estimatedPatchSize)
-
-
Method Details
-
applyTo
Apply this patch to the given target- Returns:
- the patched text
- Throws:
PatchFailedException- if can't apply patch
-
applyFuzzy
- Throws:
PatchFailedException
-
withConflictOutput
Alter normal conflict output behaviour to e.g. inclide some conflict statements in the result, like git does it. -
restore
-
addDelta
Add the given delta to this patch- Parameters:
delta- the given delta
-
getDeltas
-
toString
-
generate
-
generate
-