difflib
Class Patch

java.lang.Object
  extended by difflib.Patch

public class Patch
extends java.lang.Object

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

Author:
Dmitry Naumenko

Constructor Summary
Patch()
           
 
Method Summary
 void addDelta(Delta delta)
          Add the given delta to this patch
 java.util.List<?> applyTo(java.util.List<?> target)
          Apply this patch to the given target
 Delta getDelta(int index)
          Get the specific delta from patch deltas
 java.util.List<Delta> getDeltas()
          Get the list of computed deltas
 java.util.List<?> restore(java.util.List<?> target)
          Restore the text to original.
 void setDeltas(java.util.List<Delta> deltas)
           
 
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 java.util.List<?> applyTo(java.util.List<?> target)
                          throws PatchFailedException
Apply this patch to the given target

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

restore

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

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

addDelta

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

Parameters:
delta - the given delta

setDeltas

public void setDeltas(java.util.List<Delta> deltas)
Parameters:
deltas - the deltas to set

getDeltas

public java.util.List<Delta> getDeltas()
Get the list of computed deltas

Returns:
the deltas

getDelta

public Delta getDelta(int index)
Get the specific delta from patch deltas

Parameters:
index - the index of delta
Returns:
the needed delta