public final class DiffUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Patch<T> |
diff(List<T> original,
List<T> revised)
Computes the difference between two sequences of elements using the default diff algorithm.
|
static <T> Patch<T> |
diff(List<T> source,
List<T> target,
BiPredicate<T,T> equalizer)
Computes the difference between the original and revised list of elements
with default diff algorithm
|
static <T> Patch<T> |
diff(List<T> original,
List<T> revised,
boolean includeEqualParts)
Computes the difference between two sequences of elements using the default diff algorithm.
|
static <T> Patch<T> |
diff(List<T> original,
List<T> revised,
DiffAlgorithmI<T> algorithm)
Computes the difference between the original and revised list of elements
with default diff algorithm
|
static <T> Patch<T> |
diff(List<T> original,
List<T> revised,
DiffAlgorithmI<T> algorithm,
DiffAlgorithmListener progress) |
static <T> Patch<T> |
diff(List<T> original,
List<T> revised,
DiffAlgorithmI<T> algorithm,
DiffAlgorithmListener progress,
boolean includeEqualParts)
Computes the difference between the original and revised list of elements
with default diff algorithm
|
static <T> Patch<T> |
diff(List<T> original,
List<T> revised,
DiffAlgorithmListener progress)
Computes the difference between two sequences of elements using the default diff algorithm.
|
static Patch<String> |
diff(String sourceText,
String targetText,
DiffAlgorithmListener progress)
Computes the difference between two strings using the default diff algorithm.
|
static Patch<String> |
diffInline(String original,
String revised)
Computes the difference between the given texts inline.
|
static <T> List<T> |
patch(List<T> original,
Patch<T> patch)
Applies the given patch to the original list and returns the revised list.
|
static <T> List<T> |
unpatch(List<T> revised,
Patch<T> patch)
Applies the given patch to the revised list and returns the original list.
|
static void |
withDefaultDiffAlgorithmFactory(DiffAlgorithmFactory factory)
Sets the default diff algorithm factory to be used by all diff routines.
|
public static void withDefaultDiffAlgorithmFactory(DiffAlgorithmFactory factory)
factory - a DiffAlgorithmFactory represnting the new default diff algorithm factory.public static <T> Patch<T> diff(List<T> original, List<T> revised, DiffAlgorithmListener progress)
T - a generic representing the type of the elements to be compared.original - a List represnting the original sequence of elements. Must not be null.revised - a List represnting the revised sequence of elements. Must not be null.progress - a DiffAlgorithmListener represnting the progress listener. Can be null.null.public static <T> Patch<T> diff(List<T> original, List<T> revised)
T - a generic representing the type of the elements to be compared.original - a List represnting the original sequence of elements. Must not be null.revised - a List represnting the revised sequence of elements. Must not be null.null.public static <T> Patch<T> diff(List<T> original, List<T> revised, boolean includeEqualParts)
T - a generic representing the type of the elements to be compared.original - a List represnting the original sequence of elements. Must not be null.revised - a List represnting the revised sequence of elements. Must not be null.includeEqualParts - a boolean represnting whether to include equal parts in the resulting patch.null.public static Patch<String> diff(String sourceText, String targetText, DiffAlgorithmListener progress)
sourceText - a String represnting the original string. Must not be null.targetText - a String represnting the revised string. Must not be null.progress - a DiffAlgorithmListener represnting the progress listener. Can be null.null.public static <T> Patch<T> diff(List<T> source, List<T> target, BiPredicate<T,T> equalizer)
source - a List represnting the original text. Must not be null.target - a List represnting the revised text. Must not be null.equalizer - a BiPredicate represnting the equalizer object to replace the default compare
algorithm (Object.equals). If null the default equalizer of the
default algorithm is used.null.public static <T> Patch<T> diff(List<T> original, List<T> revised, DiffAlgorithmI<T> algorithm, DiffAlgorithmListener progress)
public static <T> Patch<T> diff(List<T> original, List<T> revised, DiffAlgorithmI<T> algorithm, DiffAlgorithmListener progress, boolean includeEqualParts)
original - a List represnting the original text. Must not be null.revised - a List represnting the revised text. Must not be null.algorithm - a DiffAlgorithmI represnting the diff algorithm. Must not be null.progress - a DiffAlgorithmListener represnting the diff algorithm listener.includeEqualParts - Include equal data parts into the patch.null.public static <T> Patch<T> diff(List<T> original, List<T> revised, DiffAlgorithmI<T> algorithm)
original - a List represnting the original text. Must not be null.revised - a List represnting the revised text. Must not be null.algorithm - a DiffAlgorithmI represnting the diff algorithm. Must not be null.null.public static Patch<String> diffInline(String original, String revised)
public static <T> List<T> patch(List<T> original, Patch<T> patch) throws PatchFailedException
original - a List represnting the original list.patch - a List represnting the patch to apply.PatchFailedException - if the patch cannot be applied.public static <T> List<T> unpatch(List<T> revised, Patch<T> patch)
revised - a List represnting the revised list.patch - a Patch represnting the patch to apply.PatchFailedException - if the patch cannot be applied.Copyright © 2009–2024 java-diff-utils. All rights reserved.