|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdifflib.DiffUtils
public class DiffUtils
Implements the difference and patching engine
Constructor Summary | |
---|---|
DiffUtils()
|
Method Summary | ||
---|---|---|
static
|
diff(List<T> original,
List<T> revised)
Computes the difference between the original and revised list of elements with default diff algorithm |
|
static
|
diff(List<T> original,
List<T> revised,
DiffAlgorithm<T> algorithm)
Computes the difference between the original and revised list of elements with default diff algorithm |
|
static
|
diff(List<T> original,
List<T> revised,
Equalizer<T> equalizer)
Computes the difference between the original and revised list of elements with default diff algorithm |
|
static List<String> |
generateUnifiedDiff(String original,
String revised,
List<String> originalLines,
Patch<String> patch,
int contextSize)
generateUnifiedDiff takes a Patch and some other arguments, returning the Unified Diff format text representing the Patch. |
|
static Patch<String> |
parseUnifiedDiff(List<String> diff)
Parse the given text in unified format and creates the list of deltas for it. |
|
static
|
patch(List<T> original,
Patch<T> patch)
Patch the original text with given patch |
|
static
|
unpatch(List<T> revised,
Patch<T> patch)
Unpatch the revised text for a given patch |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DiffUtils()
Method Detail |
---|
public static <T> Patch<T> diff(List<T> original, List<T> revised)
original
- The original text. Must not be null
.revised
- The revised text. Must not be null
.
null
.public static <T> Patch<T> diff(List<T> original, List<T> revised, Equalizer<T> equalizer)
original
- The original text. Must not be null
.revised
- 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, DiffAlgorithm<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 <T> List<T> patch(List<T> original, Patch<T> patch) throws PatchFailedException
original
- the original textpatch
- the given patch
PatchFailedException
- if can't apply patchpublic static <T> List<T> unpatch(List<T> revised, Patch<T> patch)
revised
- the revised textpatch
- the given patch
public static Patch<String> parseUnifiedDiff(List<String> diff)
diff
- the text in unified format
public static List<String> generateUnifiedDiff(String original, String revised, List<String> originalLines, Patch<String> patch, int contextSize)
original
- - Filename of the original (unrevised file)revised
- - Filename of the revised fileoriginalLines
- - Lines of the original filepatch
- - Patch created by the diff() functioncontextSize
- - number of lines of context output around each difference in
the file.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |