/** * Construct an edit list containing a single edit. * * @param edit * the edit to return in the list. * @return list containing only {@code edit}. */ public static EditList singleton(Edit edit) { EditList res = new EditList(1); res.add(edit); return res; }
private void diffReplace(Edit r) { Edit lcs = new HistogramDiffIndex<>(maxChainLength, cmp, a, b, r) .findLongestCommonSequence(); if (lcs != null) { // If we were given an edit, we can prove a result here. // if (lcs.isEmpty()) { // An empty edit indicates there is nothing in common. // Replace the entire region. // edits.add(r); } else { queue.add(r.after(lcs)); queue.add(r.before(lcs)); } } else if (fallback instanceof LowLevelDiffAlgorithm) { LowLevelDiffAlgorithm fb = (LowLevelDiffAlgorithm) fallback; fb.diffNonCommon(edits, cmp, a, b, r); } else if (fallback != null) { SubsequenceComparator<HashedSequence<S>> cs = subcmp(); Subsequence<HashedSequence<S>> as = Subsequence.a(a, r); Subsequence<HashedSequence<S>> bs = Subsequence.b(b, r); EditList res = fallback.diffNonCommon(cs, as, bs); edits.addAll(Subsequence.toBase(res, as, bs)); } else { edits.add(r); } }
private void diffReplace(Edit r) { Edit lcs = new HistogramDiffIndex<S>(maxChainLength, cmp, a, b, r) .findLongestCommonSequence(); if (lcs != null) { // If we were given an edit, we can prove a result here. // if (lcs.isEmpty()) { // An empty edit indicates there is nothing in common. // Replace the entire region. // edits.add(r); } else { queue.add(r.after(lcs)); queue.add(r.before(lcs)); } } else if (fallback instanceof LowLevelDiffAlgorithm) { LowLevelDiffAlgorithm fb = (LowLevelDiffAlgorithm) fallback; fb.diffNonCommon(edits, cmp, a, b, r); } else if (fallback != null) { SubsequenceComparator<HashedSequence<S>> cs = subcmp(); Subsequence<HashedSequence<S>> as = Subsequence.a(a, r); Subsequence<HashedSequence<S>> bs = Subsequence.b(b, r); EditList res = fallback.diffNonCommon(cs, as, bs); edits.addAll(Subsequence.toBase(res, as, bs)); } else { edits.add(r); } }
private void diffReplace(Edit r) { Edit lcs = new HistogramDiffIndex<>(maxChainLength, cmp, a, b, r) .findLongestCommonSequence(); if (lcs != null) { // If we were given an edit, we can prove a result here. // if (lcs.isEmpty()) { // An empty edit indicates there is nothing in common. // Replace the entire region. // edits.add(r); } else { queue.add(r.after(lcs)); queue.add(r.before(lcs)); } } else if (fallback instanceof LowLevelDiffAlgorithm) { LowLevelDiffAlgorithm fb = (LowLevelDiffAlgorithm) fallback; fb.diffNonCommon(edits, cmp, a, b, r); } else if (fallback != null) { SubsequenceComparator<HashedSequence<S>> cs = subcmp(); Subsequence<HashedSequence<S>> as = Subsequence.a(a, r); Subsequence<HashedSequence<S>> bs = Subsequence.b(b, r); EditList res = fallback.diffNonCommon(cs, as, bs); edits.addAll(Subsequence.toBase(res, as, bs)); } else { edits.add(r); } }
edits.add(edits.size(), edit);
/** * Construct an edit list containing a single edit. * * @param edit * the edit to return in the list. * @return list containing only {@code edit}. */ public static EditList singleton(Edit edit) { EditList res = new EditList(1); res.add(edit); return res; }
/** * Construct an edit list containing a single edit. * * @param edit * the edit to return in the list. * @return list containing only {@code edit}. */ public static EditList singleton(Edit edit) { EditList res = new EditList(1); res.add(edit); return res; }
edits.add(edits.size(), edit);
edits.add(edits.size(), edit);