/** * Compute a list of patches to turn text1 into text2. * text2 is ignored, diffs are the delta between text2 and text2. * * @param text1 Old text * @param text2 Ignored. * @param diffs Array of Diff objects for text1 to text2. * @return LinkedList of Patch objects. * @deprecated Prefer {@link #patchMake(java.lang.String, java.util.LinkedList) }. */ public LinkedList<Patch> patchMake(String text1, String text2, LinkedList<Diff> diffs) { return patchMake(text1, diffs); }
/** * Compute a list of patches to turn text1 into text2. * text1 will be derived from the provided diffs. * * @param diffs Array of Diff objects for text1 to text2. * @return LinkedList of Patch objects. */ public LinkedList<Patch> patchMake(LinkedList<Diff> diffs) { if (diffs == null) { throw new IllegalArgumentException("Null inputs. (patchMake)"); } // No origin string provided, compute our own. String text1 = diffText1(diffs); return patchMake(text1, diffs); }
/** * Compute a list of patches to turn text1 into text2. * A set of diffs will be computed. * * @param text1 Old text. * @param text2 New text. * @return LinkedList of Patch objects. */ public LinkedList<Patch> patchMake(String text1, String text2) { if (text1 == null || text2 == null) { throw new IllegalArgumentException("Null inputs. (patchMake)"); } // No diffs provided, compute our own. LinkedList<Diff> diffs = diffMain(text1, text2, true); if (diffs.size() > 2) { diff_cleanupSemantic(diffs); diffCleanupEfficiency(diffs); } return patchMake(text1, diffs); }
private LinkedList<Patch> patchesFrom(final DiffMatchPatchEdit edit) { return diffMatchPatch.patchMake(asDiffUtilDiffs(edit.diff().diffs())); }