public final class MeyersDiff<T> extends java.lang.Object implements DiffAlgorithmI<T>
Modifier and Type | Field and Description |
---|---|
private java.util.function.BiPredicate<T,T> |
equalizer |
Constructor and Description |
---|
MeyersDiff() |
MeyersDiff(java.util.function.BiPredicate<T,T> equalizer) |
Modifier and Type | Method and Description |
---|---|
private PathNode |
buildPath(java.util.List<T> orig,
java.util.List<T> rev,
DiffAlgorithmListener progress)
Computes the minimum diffpath that expresses de differences between the
original and revised sequences, according to Gene Myers differencing
algorithm.
|
private java.util.List<Change> |
buildRevision(PathNode actualPath,
java.util.List<T> orig,
java.util.List<T> rev)
Constructs a
Patch from a difference path. |
java.util.List<Change> |
computeDiff(java.util.List<T> source,
java.util.List<T> target,
DiffAlgorithmListener progress)
Computes the changeset to patch the source list to the target list.
|
static DiffAlgorithmFactory |
factory()
Factory to create instances of this specific diff algorithm.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
computeDiff
public java.util.List<Change> computeDiff(java.util.List<T> source, java.util.List<T> target, DiffAlgorithmListener progress)
computeDiff
in interface DiffAlgorithmI<T>
source
- source datatarget
- target dataprogress
- progress listenerprivate PathNode buildPath(java.util.List<T> orig, java.util.List<T> rev, DiffAlgorithmListener progress)
orig
- The original sequence.rev
- The revised sequence.Path
accross the differences graph.DifferentiationFailedException
- if a diff path could not be found.private java.util.List<Change> buildRevision(PathNode actualPath, java.util.List<T> orig, java.util.List<T> rev)
Patch
from a difference path.public static DiffAlgorithmFactory factory()