Package net.morimekta.diff
Class Bisect
- java.lang.Object
-
- net.morimekta.diff.DiffBase
-
- net.morimekta.diff.Bisect
-
public class Bisect extends DiffBase
Find the 'middle snake' of a diff, split the problem in two and return the recursively constructed diff. See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
-
-
Constructor Summary
Constructors Constructor Description Bisect(java.lang.String text1, java.lang.String text2)
Bisect two strings.Bisect(java.lang.String text1, java.lang.String text2, DiffOptions options)
Bisect two strings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Bisect
fromDelta(java.lang.String text1, java.lang.String delta)
Given the original text1, and an encoded string which describes the operations required to transform text1 into text2, compute the full diff.java.util.LinkedList<Change>
getChangeList()
Get the finished changelist.-
Methods inherited from class net.morimekta.diff.DiffBase
equals, getOptions, hashCode, levenshtein, prettyHtml, text1, text2, toDelta, toString, xIndex
-
-
-
-
Constructor Detail
-
Bisect
public Bisect(java.lang.String text1, java.lang.String text2)
Bisect two strings.- Parameters:
text1
- Source (old) string.text2
- Target (new) string.
-
Bisect
public Bisect(java.lang.String text1, java.lang.String text2, DiffOptions options)
Bisect two strings.- Parameters:
text1
- Source (old) string.text2
- Target (new) string.options
- DiffOptions to use.
-
-
Method Detail
-
getChangeList
public java.util.LinkedList<Change> getChangeList()
Description copied from class:DiffBase
Get the finished changelist.- Specified by:
getChangeList
in classDiffBase
- Returns:
- List of changes.
-
fromDelta
public static Bisect fromDelta(java.lang.String text1, java.lang.String delta) throws java.lang.IllegalArgumentException
Given the original text1, and an encoded string which describes the operations required to transform text1 into text2, compute the full diff.- Parameters:
text1
- Source string for the diff.delta
- Delta text.- Returns:
- Array of DiffBase objects or null if invalid.
- Throws:
java.lang.IllegalArgumentException
- If invalid input.
-
-