difflib
Class ChangeDelta

java.lang.Object
  extended by difflib.Delta
      extended by difflib.ChangeDelta

public class ChangeDelta
extends Delta

Describes the change-delta between original and revised texts.

Author:
Dmitry Naumenko

Nested Class Summary
 
Nested classes/interfaces inherited from class difflib.Delta
Delta.TYPE
 
Constructor Summary
ChangeDelta(Chunk original, Chunk revised)
          
 
Method Summary
 void applyTo(List<Object> target)
          Applies this delta as the patch for a given target
 Delta.TYPE getType()
          Returns the type of delta
 void restore(List<Object> target)
          Cancel this delta for a given revised text.
 String toString()
           
 void verify(List<?> target)
          Verifies that this delta can be used to patch the given text.
 
Methods inherited from class difflib.Delta
equals, getOriginal, getRevised, hashCode, setOriginal, setRevised
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChangeDelta

public ChangeDelta(Chunk original,
                   Chunk revised)

Method Detail

applyTo

public void applyTo(List<Object> target)
             throws PatchFailedException
Applies this delta as the patch for a given target

Specified by:
applyTo in class Delta
Parameters:
target - the given target
Throws:
PatchFailedException

restore

public void restore(List<Object> target)
Cancel this delta for a given revised text. The action is opposite to patch.

Specified by:
restore in class Delta
Parameters:
target - the given revised text

verify

public void verify(List<?> target)
            throws PatchFailedException
Verifies that this delta can be used to patch the given text.

Specified by:
verify in class Delta
Parameters:
target - the text to patch.
Throws:
PatchFailedException - if the patch cannot be applied.

toString

public String toString()
Overrides:
toString in class Object

getType

public Delta.TYPE getType()
Description copied from class: Delta
Returns the type of delta

Specified by:
getType in class Delta
Returns:
the type enum


Copyright © 2012. All Rights Reserved.