Lines Matching defs:diffs

159     LinkedList<Diff> diffs;
161 diffs = new LinkedList<Diff>();
162 diffs.add(new Diff(Operation.EQUAL, text1));
163 return diffs;
179 diffs = diff_compute(text1, text2, checklines);
183 diffs.addFirst(new Diff(Operation.EQUAL, commonprefix));
186 diffs.addLast(new Diff(Operation.EQUAL, commonsuffix));
189 diff_cleanupMerge(diffs);
190 return diffs;
206 LinkedList<Diff> diffs = new LinkedList<Diff>();
210 diffs.add(new Diff(Operation.INSERT, text2));
211 return diffs;
216 diffs.add(new Diff(Operation.DELETE, text1));
217 return diffs;
227 diffs.add(new Diff(op, longtext.substring(0, i)));
228 diffs.add(new Diff(Operation.EQUAL, shorttext));
229 diffs.add(new Diff(op, longtext.substring(i + shorttext.length())));
230 return diffs;
247 diffs = diffs_a;
248 diffs.add(new Diff(Operation.EQUAL, mid_common));
249 diffs.addAll(diffs_b);
250 return diffs;
266 diffs = diff_map(text1, text2);
267 if (diffs == null) {
269 diffs = new LinkedList<Diff>();
270 diffs.add(new Diff(Operation.DELETE, text1));
271 diffs.add(new Diff(Operation.INSERT, text2));
276 diff_charsToLines(diffs, linearray);
278 diff_cleanupSemantic(diffs);
282 diffs.add(new Diff(Operation.EQUAL, ""));
287 ListIterator<Diff> pointer = diffs.listIterator();
320 diffs.removeLast(); // Remove the dummy entry at the end.
322 return diffs;
391 * @param diffs LinkedList of Diff objects.
394 protected void diff_charsToLines(LinkedList<Diff> diffs,
397 for (Diff diff : diffs) {
531 // Number of diffs equals number of characters, no commonality at all.
785 * @param diffs LinkedList of Diff objects.
787 public void diff_cleanupSemantic(LinkedList<Diff> diffs) {
788 if (diffs.isEmpty()) {
794 ListIterator<Diff> pointer = diffs.listIterator();
852 diff_cleanupMerge(diffs);
854 diff_cleanupSemanticLossless(diffs);
862 * @param diffs LinkedList of Diff objects.
864 public void diff_cleanupSemanticLossless(LinkedList<Diff> diffs) {
871 ListIterator<Diff> pointer = diffs.listIterator();
996 * @param diffs LinkedList of Diff objects.
998 public void diff_cleanupEfficiency(LinkedList<Diff> diffs) {
999 if (diffs.isEmpty()) {
1005 ListIterator<Diff> pointer = diffs.listIterator();
1097 diff_cleanupMerge(diffs);
1105 * @param diffs LinkedList of Diff objects.
1107 public void diff_cleanupMerge(LinkedList<Diff> diffs) {
1108 diffs.add(new Diff(Operation.EQUAL, "")); // Add a dummy entry at the end.
1109 ListIterator<Diff> pointer = diffs.listIterator();
1197 if (diffs.getLast().text.length() == 0) {
1198 diffs.removeLast(); // Remove the dummy entry at the end.
1209 pointer = diffs.listIterator();
1248 diff_cleanupMerge(diffs);
1257 * @param diffs LinkedList of Diff objects.
1261 public int diff_xIndex(LinkedList<Diff> diffs, int loc) {
1267 for (Diff aDiff : diffs) {
1295 * @param diffs LinkedList of Diff objects.
1298 public String diff_prettyHtml(LinkedList<Diff> diffs) {
1301 for (Diff aDiff : diffs) {
1328 * @param diffs LinkedList of Diff objects.
1331 public String diff_text1(LinkedList<Diff> diffs) {
1333 for (Diff aDiff : diffs) {
1344 * @param diffs LinkedList of Diff objects.
1347 public String diff_text2(LinkedList<Diff> diffs) {
1349 for (Diff aDiff : diffs) {
1361 * @param diffs LinkedList of Diff objects.
1364 public int diff_levenshtein(LinkedList<Diff> diffs) {
1368 for (Diff aDiff : diffs) {
1394 * @param diffs Array of diff tuples.
1397 public String diff_toDelta(LinkedList<Diff> diffs) {
1399 for (Diff aDiff : diffs) {
1438 LinkedList<Diff> diffs = new LinkedList<Diff>();
1463 diffs.add(new Diff(Operation.INSERT, param));
1488 diffs.add(new Diff(Operation.EQUAL, text));
1490 diffs.add(new Diff(Operation.DELETE, text));
1503 return diffs;
1716 patch.diffs.addFirst(new Diff(Operation.EQUAL, prefix));
1722 patch.diffs.addLast(new Diff(Operation.EQUAL, suffix));
1736 * A set of diffs will be computed.
1745 // No diffs provided, compute our own.
1746 LinkedList<Diff> diffs = diff_main(text1, text2, true);
1747 if (diffs.size() > 2) {
1748 diff_cleanupSemantic(diffs);
1749 diff_cleanupEfficiency(diffs);
1751 return patch_make(text1, diffs);
1757 * text1 will be derived from the provided diffs.
1758 * @param diffs Array of diff tuples for text1 to text2.
1761 public LinkedList<Patch> patch_make(LinkedList<Diff> diffs) {
1762 if (diffs == null) {
1766 String text1 = diff_text1(diffs);
1767 return patch_make(text1, diffs);
1773 * text2 is ignored, diffs are the delta between text1 and text2.
1776 * @param diffs Array of diff tuples for text1 to text2.
1778 * @deprecated Prefer patch_make(String text1, LinkedList<Diff> diffs).
1781 LinkedList<Diff> diffs) {
1782 return patch_make(text1, diffs);
1788 * text2 is not provided, diffs are the delta between text1 and text2.
1790 * @param diffs Array of diff tuples for text1 to text2.
1793 public LinkedList<Patch> patch_make(String text1, LinkedList<Diff> diffs) {
1794 if (text1 == null || diffs == null) {
1799 if (diffs.isEmpty()) {
1805 // Start with text1 (prepatch_text) and apply the diffs until we arrive at
1810 for (Diff aDiff : diffs) {
1811 if (patch.diffs.isEmpty() && aDiff.operation != Operation.EQUAL) {
1819 patch.diffs.add(aDiff);
1826 patch.diffs.add(aDiff);
1832 && !patch.diffs.isEmpty() && aDiff != diffs.getLast()) {
1834 patch.diffs.add(aDiff);
1841 if (!patch.diffs.isEmpty()) {
1865 if (!patch.diffs.isEmpty()) {
1883 for (Diff aDiff : aPatch.diffs) {
1885 patchCopy.diffs.add(diffCopy);
1926 String text1 = diff_text1(aPatch.diffs);
1965 text = text.substring(0, start_loc) + diff_text2(aPatch.diffs)
1970 LinkedList<Diff> diffs = diff_main(text1, text2, false);
1972 && diff_levenshtein(diffs) / (float) text1.length()
1977 diff_cleanupSemanticLossless(diffs);
1979 for (Diff aDiff : aPatch.diffs) {
1981 int index2 = diff_xIndex(diffs, index1);
1989 + text.substring(start_loc + diff_xIndex(diffs,
2030 LinkedList<Diff> diffs = patch.diffs;
2031 if (diffs.isEmpty() || diffs.getFirst().operation != Operation.EQUAL) {
2033 diffs.addFirst(new Diff(Operation.EQUAL, nullPadding));
2038 } else if (paddingLength > diffs.getFirst().text.length()) {
2040 Diff firstDiff = diffs.getFirst();
2052 diffs = patch.diffs;
2053 if (diffs.isEmpty() || diffs.getLast().operation != Operation.EQUAL) {
2055 diffs.addLast(new Diff(Operation.EQUAL, nullPadding));
2058 } else if (paddingLength > diffs.getLast().text.length()) {
2060 Diff lastDiff = diffs.getLast();
2097 while (!bigpatch.diffs.isEmpty()) {
2105 patch.diffs.add(new Diff(Operation.EQUAL, precontext));
2107 while (!bigpatch.diffs.isEmpty()
2109 diff_type = bigpatch.diffs.getFirst().operation;
2110 diff_text = bigpatch.diffs.getFirst().text;
2115 patch.diffs.addLast(bigpatch.diffs.removeFirst());
2117 } else if (diff_type == Operation.DELETE && patch.diffs.size() == 1
2118 && patch.diffs.getFirst().operation == Operation.EQUAL
2124 patch.diffs.add(new Diff(diff_type, diff_text));
2125 bigpatch.diffs.removeFirst();
2138 patch.diffs.add(new Diff(diff_type, diff_text));
2139 if (diff_text.equals(bigpatch.diffs.getFirst().text)) {
2140 bigpatch.diffs.removeFirst();
2142 bigpatch.diffs.getFirst().text = bigpatch.diffs.getFirst().text
2148 precontext = diff_text2(patch.diffs);
2152 if (diff_text1(bigpatch.diffs).length() > Patch_Margin) {
2153 postcontext = diff_text1(bigpatch.diffs).substring(0, Patch_Margin);
2155 postcontext = diff_text1(bigpatch.diffs);
2160 if (!patch.diffs.isEmpty()
2161 && patch.diffs.getLast().operation == Operation.EQUAL) {
2162 patch.diffs.getLast().text += postcontext;
2164 patch.diffs.add(new Diff(Operation.EQUAL, postcontext));
2264 patch.diffs.add(new Diff(Operation.DELETE, line));
2267 patch.diffs.add(new Diff(Operation.INSERT, line));
2270 patch.diffs.add(new Diff(Operation.EQUAL, line));
2341 public LinkedList<Diff> diffs;
2349 * Constructor. Initializes with an empty list of diffs.
2352 this.diffs = new LinkedList<Diff>();
2382 for (Diff aDiff : this.diffs) {