/** * Creates a delta object with the given chunks from the original and revised texts. * * @param orig * @param rev */ protected Delta(Chunk orig, Chunk rev) { init(orig, rev); }
/** * Converts this revision into its RCS style string representation. * * @param s * a {@link StringBuilder StringBuffer} to which the string representation will be * appended. * @param EOL * the string to use as line separator. */ public synchronized void toRCSString(final StringBuilder s, final String EOL) { for (Delta deltas : deltas_) { deltas.toRCSString(s, EOL); } }
/** * Converts this revision into its Unix diff style string representation. * * @param s * a {@link StringBuilder StringBuffer} to which the string representation will be * appended. */ @Override public synchronized void toString(final StringBuilder s) { for (Delta delta : deltas_) { delta.toString(s); } }
/** * Applies this delta as a patch to the given text. * * @param target * the text to patch. * @throws PatchFailedException * if the patch cannot be applied. */ public final void patch(final List<Object> target) throws PatchFailedException { verify(target); try { applyTo(target); } catch (Exception e) { throw new PatchFailedException(e.getMessage()); } }
/** * Accepts a visitor. * * @param visitor * the {@link RevisionVisitor} visiting this instance */ public void accept(final RevisionVisitor visitor) { visitor.visit(this); for (Delta delta : deltas_) { delta.accept(visitor); } }
/** * Applies the series of deltas in this revision as patches to the given text. * * @param target * the text to patch. * @throws PatchFailedException * if any of the patches cannot be applied. */ public synchronized void applyTo(List target) throws PatchFailedException { ListIterator i = deltas_.listIterator(deltas_.size()); while (i.hasPrevious()) { Delta delta = (Delta)i.previous(); delta.patch(target); } }
int janchor = path.j; Delta delta = Delta.newDelta(new Chunk(orig, ianchor, i - ianchor), new Chunk(rev, janchor, j - janchor)); revision.insertDelta(delta);
/** * Applies this delta as a patch to the given text. * * @param target * the text to patch. * @throws PatchFailedException * if the patch cannot be applied. */ public final void patch(List target) throws PatchFailedException { verify(target); try { applyTo(target); } catch (Exception e) { throw new PatchFailedException(e.getMessage()); } }
/** * Accepts a visitor. * * @param visitor * the {@link RevisionVisitor} visiting this instance */ public void accept(RevisionVisitor visitor) { visitor.visit(this); Iterator<Delta> iter = deltas_.iterator(); while (iter.hasNext()) { (iter.next()).accept(visitor); } }
/** * Applies the series of deltas in this revision as patches to the given text. * * @param target * the text to patch. * @throws PatchFailedException * if any of the patches cannot be applied. */ public synchronized void applyTo(final List<Object> target) throws PatchFailedException { ListIterator<Delta> i = deltas_.listIterator(deltas_.size()); while (i.hasPrevious()) { Delta delta = i.previous(); delta.patch(target); } }
int janchor = path.j; Delta delta = Delta.newDelta(new Chunk(orig, ianchor, i - ianchor), new Chunk(rev, janchor, j - janchor)); revision.insertDelta(delta);
/** * Applies this delta as a patch to the given text. * * @param target * the text to patch. * @throws PatchFailedException * if the patch cannot be applied. */ public final void patch(List<Object> target) throws PatchFailedException { verify(target); try { applyTo(target); } catch (Exception e) { throw new PatchFailedException(e.getMessage()); } }
/** * Creates a delta object with the given chunks from the original and revised texts. * * @param orig * @param rev */ protected Delta(final Chunk orig, final Chunk rev) { init(orig, rev); }
/** * Converts this delta into its RCS style string representation. * * @param EOL * the string to use as line separator. * @return String */ public String toRCSString(final String EOL) { StringBuilder s = new StringBuilder(); toRCSString(s, EOL); return s.toString(); }
/** * Accepts a visitor. * * @param visitor * the {@link RevisionVisitor} visiting this instance */ public void accept(RevisionVisitor visitor) { visitor.visit(this); Iterator iter = deltas_.iterator(); while (iter.hasNext()) { ((Delta)iter.next()).accept(visitor); } }
/** * Converts this revision into its Unix diff style string representation. * * @param s * a {@link StringBuffer StringBuffer} to which the string representation will be * appended. */ @Override public synchronized void toString(StringBuffer s) { Iterator<Delta> i = deltas_.iterator(); while (i.hasNext()) { (i.next()).toString(s); } }
/** * Applies the series of deltas in this revision as patches to the given text. * * @param target * the text to patch. * @throws PatchFailedException * if any of the patches cannot be applied. */ public synchronized void applyTo(List<Object> target) throws PatchFailedException { ListIterator<Delta> i = deltas_.listIterator(deltas_.size()); while (i.hasPrevious()) { Delta delta = i.previous(); delta.patch(target); } }
int janchor = path.j; Delta delta = Delta.newDelta(new Chunk(orig, ianchor, i - ianchor), new Chunk(rev, janchor, j - janchor)); revision.insertDelta(delta);
/** * Creates a delta object with the given chunks from the original and revised texts. * * @param orig * @param rev */ protected Delta(Chunk orig, Chunk rev) { init(orig, rev); }
/** * Converts this delta into its RCS style string representation. * * @param EOL * the string to use as line separator. * @return String */ public String toRCSString(String EOL) { StringBuffer s = new StringBuffer(); toRCSString(s, EOL); return s.toString(); }