T
- The type of the compared elements in the 'lines'.public final class Patch<T>
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
ConflictOutput<T> |
CONFLICT_PRODUCES_EXCEPTION
Standard Patch behaviour to throw an exception for pathching conflicts.
|
static ConflictOutput<java.lang.String> |
CONFLICT_PRODUCES_MERGE_CONFLICT
Git like merge conflict output.
|
Modifier and Type | Method and Description |
---|---|
void |
addDelta(AbstractDelta<T> delta)
Add the given delta to this patch
|
java.util.List<T> |
applyTo(java.util.List<T> target)
Apply this patch to the given target
|
static <T> Patch<T> |
generate(java.util.List<T> original,
java.util.List<T> revised,
java.util.List<Change> changes) |
static <T> Patch<T> |
generate(java.util.List<T> original,
java.util.List<T> revised,
java.util.List<Change> _changes,
boolean includeEquals) |
java.util.List<AbstractDelta<T>> |
getDeltas()
Get the list of computed deltas
|
java.util.List<T> |
restore(java.util.List<T> target)
Restore the text to original.
|
java.lang.String |
toString() |
Patch |
withConflictOutput(ConflictOutput<T> conflictOutput)
Alter normal conflict output behaviour to e.g.
|
public final ConflictOutput<T> CONFLICT_PRODUCES_EXCEPTION
public static final ConflictOutput<java.lang.String> CONFLICT_PRODUCES_MERGE_CONFLICT
public java.util.List<T> applyTo(java.util.List<T> target) throws PatchFailedException
PatchFailedException
- if can't apply patchpublic Patch withConflictOutput(ConflictOutput<T> conflictOutput)
public java.util.List<T> restore(java.util.List<T> target)
target
- the given targetpublic void addDelta(AbstractDelta<T> delta)
delta
- the given deltapublic java.util.List<AbstractDelta<T>> getDeltas()
public java.lang.String toString()
toString
in class java.lang.Object
public static <T> Patch<T> generate(java.util.List<T> original, java.util.List<T> revised, java.util.List<Change> changes)