public final class DiffUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> Patch<T> |
diff(List<T> original,
List<T> revised) |
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) |
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 the original and revised list of elements with default diff
algorithm
|
static Patch<String> |
diff(String sourceText,
String targetText,
DiffAlgorithmListener progress)
Computes the difference between the original and revised text.
|
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)
Patch the original text with given patch
|
static <T> List<T> |
unpatch(List<T> revised,
Patch<T> patch)
Unpatch the revised text for a given patch
|
public static <T> Patch<T> diff(List<T> original, List<T> revised, DiffAlgorithmListener progress)
T
- types to be diffedoriginal
- The original text. Must not be null
.revised
- The revised text. Must not be null
.progress
- progress listenernull
.public static Patch<String> diff(String sourceText, String targetText, DiffAlgorithmListener progress)
public static <T> Patch<T> diff(List<T> source, List<T> target, BiPredicate<T,T> equalizer)
source
- The original text. Must not be null
.target
- The revised text. Must not be null
.equalizer
- 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
- The original text. Must not be null
.revised
- The revised text. Must not be null
.algorithm
- The diff algorithm. Must not be null
.progress
- 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
- The original text. Must not be null
.revised
- The revised text. Must not be null
.algorithm
- The diff algorithm. Must not be null
.null
.public static Patch<String> diffInline(String original, String revised)
original
- revised
- public static <T> List<T> patch(List<T> original, Patch<T> patch) throws PatchFailedException
original
- the original textpatch
- the given patchPatchFailedException
- if can't apply patchCopyright © 2009–2020 java-diff-utils. All rights reserved.