Class LCS
java.lang.Object
org.hippoecm.frontend.plugins.standards.diff.LCS
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Elemental change in an array of values.static enum
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> List<LCS.Change<T>>
getChangeSet
(T[] a, T[] b) Constructs the minimal changeset to turn the first array into the second one.static <T> List<T>
getLongestCommonSubsequence
(T[] a, T[] b) Find the longest common subsequence between arrays a and b.static <T extends Serializable>
List<LCS.Change<T>>getSerializableChangeSet
(T[] a, T[] b) Constructs the minimal changeset to turn the first array into the second one.
-
Method Details
-
getSerializableChangeSet
Constructs the minimal changeset to turn the first array into the second one. The returned changeset is guaranteed to be serializable.- Type Parameters:
T
- the type of the array elements- Parameters:
a
- the first arrayb
- the second array- Returns:
- the minimal changeset
-
getChangeSet
Constructs the minimal changeset to turn the first array into the second one. The returned changeset is only serializable when T is serializable.- Type Parameters:
T
- the type of the array elements- Parameters:
a
- the first arrayb
- the second array- Returns:
- the minimal changeset
-
getLongestCommonSubsequence
Find the longest common subsequence between arrays a and b. The algorithm that's implemented creates an index of the items in the smallest array and iterates over the largest one. During this iteration, for each sub-array consisting of the elements 0..j of the small array (j < |smallest|), the sequence with most common elements is maintained.The execution time and memory usage are linear for typical inputs, but will be quadratic in the worst case.
-