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,
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)
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) throws DiffException
original
- The original text. Must not be null
.revised
- The revised text. Must not be null
.progress
- progress listenernull
.DiffException
public static <T> Patch<T> diff(List<T> original, List<T> revised) throws DiffException
DiffException
public static Patch<String> diff(String sourceText, String targetText, DiffAlgorithmListener progress) throws DiffException
DiffException
public static <T> Patch<T> diff(List<T> source, List<T> target, BiPredicate<T,T> equalizer) throws DiffException
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
.DiffException
public static <T> Patch<T> diff(List<T> original, List<T> revised, DiffAlgorithmI<T> algorithm, DiffAlgorithmListener progress) throws DiffException
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.null
.DiffException
public static <T> Patch<T> diff(List<T> original, List<T> revised, DiffAlgorithmI<T> algorithm) throws DiffException
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
.DiffException
public static Patch<String> diffInline(String original, String revised) throws DiffException
original
- revised
- DiffException
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–2018 java-diff-utils. All rights reserved.