difflib
Class Patch<T>

java.lang.Object
  extended by difflib.Patch<T>

public class Patch<T>
extends Object

Describes the patch holding all deltas between the original and revised texts.

Author:
Dmitry Naumenko

Constructor Summary
Patch()
           
 
Method Summary
 void addDelta(Delta<T> delta)
          Add the given delta to this patch
 List<T> applyTo(List<T> target)
          Apply this patch to the given target
 List<Delta<T>> getDeltas()
          Get the list of computed deltas
 List<T> restore(List<T> target)
          Restore the text to original.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Patch

public Patch()
Method Detail

applyTo

public List<T> applyTo(List<T> target)
                throws PatchFailedException
Apply this patch to the given target

Returns:
the patched text
Throws:
PatchFailedException - if can't apply patch

restore

public List<T> restore(List<T> target)
Restore the text to original. Opposite to applyTo() method.

Parameters:
target - the given target
Returns:
the restored text

addDelta

public void addDelta(Delta<T> delta)
Add the given delta to this patch

Parameters:
delta - the given delta

getDeltas

public List<Delta<T>> getDeltas()
Get the list of computed deltas

Returns:
the deltas


Copyright © 2009-2013. All Rights Reserved.