T
- The type of objects for which the diff is constructed.public class Diff<T> extends java.lang.Object
Let N be the sum of the concatenated input strings and D the size of the delta (i.e. the number of changes required to transform one string into the other). Then the time complexity is O(ND) and the space complexity is O(D^2).
Modifier and Type | Class and Description |
---|---|
static class |
Diff.Delta<T>
Objects of this class describe the additions and deletions used to
transform between two words.
|
Modifier and Type | Method and Description |
---|---|
static <T> Diff.Delta<T> |
computeDelta(java.util.List<T> a,
java.util.List<T> b)
Applies the diff algorithm on the supplied lists and returns the delta
between them.
|
static <T> Diff.Delta<T> |
computeDelta(java.util.List<T> a,
java.util.List<T> b,
IEquator<? super T> equator)
Applies the diff algorithm on the supplied lists and returns the delta
between them.
|
static <T> Diff.Delta<T> |
computeDelta(java.util.List<T> a,
java.util.List<T> b,
int maxDeltaSize)
Applies the diff algorithm on the supplied lists and returns the delta
between them.
|
static <T> Diff.Delta<T> |
computeDelta(java.util.List<T> a,
java.util.List<T> b,
int maxDeltaSize,
IEquator<? super T> equator)
Applies the diff algorithm on the supplied lists and returns the delta
between them.
|
static <T> Diff.Delta<T> |
computeDelta(T[] a,
T[] b)
Applies the diff algorithm on the supplied arrays and returns the delta
between them.
|
static <T> Diff.Delta<T> |
computeDelta(T[] a,
T[] b,
IEquator<? super T> equator)
Applies the diff algorithm on the supplied arrays and returns the delta
between them.
|
static <T> Diff.Delta<T> |
computeDelta(T[] a,
T[] b,
int maxDeltaSize)
Applies the diff algorithm on the supplied arrays and returns the delta
between them.
|
public static <T> Diff.Delta<T> computeDelta(T[] a, T[] b)
a
- the first "word", i.e., array of objects to produce a delta
for.b
- the second "word", i.e., array of objects to produce a delta
for.public static <T> Diff.Delta<T> computeDelta(T[] a, T[] b, int maxDeltaSize)
a
- the first "word", i.e., array of objects to produce a delta
for.b
- the second "word", i.e., array of objects to produce a delta
for.maxDeltaSize
- the maximal size of the delta produced. As the running size
depends linearly on this size and the space required depends
quadratically on it, limiting this value can reduce
calculation overhead at the risk of receiving
partial/incomplete deltas.public static <T> Diff.Delta<T> computeDelta(T[] a, T[] b, IEquator<? super T> equator)
a
- the first "word", i.e., array of objects to produce a delta
for.b
- the second "word", i.e., array of objects to produce a delta
for.equator
- an object that can check whether two elements are equal.public static <T> Diff.Delta<T> computeDelta(java.util.List<T> a, java.util.List<T> b)
a
- the first "word", i.e., list of objects to produce a delta
for.b
- the second "word", i.e., list of objects to produce a delta
for.public static <T> Diff.Delta<T> computeDelta(java.util.List<T> a, java.util.List<T> b, IEquator<? super T> equator)
a
- the first "word", i.e., list of objects to produce a delta
for.b
- the second "word", i.e., list of objects to produce a delta
for.equator
- an object that can check whether two elements are equal.public static <T> Diff.Delta<T> computeDelta(java.util.List<T> a, java.util.List<T> b, int maxDeltaSize)
a
- the first "word", i.e., list of objects to produce a delta
for.b
- the second "word", i.e., list of objects to produce a delta
for.maxDeltaSize
- the maximal size of the delta produced. As the running size
depends linearly on this size and the space required depends
quadratically on it, limiting this value can reduce
calculation overhead at the risk of receiving
partial/incomplete deltas.public static <T> Diff.Delta<T> computeDelta(java.util.List<T> a, java.util.List<T> b, int maxDeltaSize, IEquator<? super T> equator)
a
- the first "word", i.e., list of objects to produce a delta
for.b
- the second "word", i.e., list of objects to produce a delta
for.maxDeltaSize
- the maximal size of the delta produced. As the running size
depends linearly on this size and the space required depends
quadratically on it, limiting this value can reduce
calculation overhead at the risk of receiving
partial/incomplete deltas.equator
- an object that can check whether two elements are equal.