difflib
Class Delta

java.lang.Object
  extended by difflib.Delta
Direct Known Subclasses:
ChangeDelta, DeleteDelta, InsertDelta

public abstract class Delta
extends Object

Describes the delta between original and revised texts.

Author:
Dmitry Naumenko

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

Constructor Detail

Delta

public Delta(Chunk original,
             Chunk revised)
Construct the delta for original and revised chunks

Parameters:
original - chunk describes the original text
revised - chunk describes the revised text
Method Detail

verify

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

Parameters:
target - the text to patch.
Throws:
PatchFailedException - if the patch cannot be applied.

applyTo

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

Parameters:
target - the given target
Throws:
PatchFailedException

restore

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

Parameters:
target - the given revised text

getType

public abstract Delta.TYPE getType()
Returns the type of delta

Returns:
the type enum

getOriginal

public Chunk getOriginal()
Returns:
the Chunk describing the original text

setOriginal

public void setOriginal(Chunk original)
Parameters:
original - the Chunk describing the original text to set

getRevised

public Chunk getRevised()
Returns:
the Chunk describing the revised text

setRevised

public void setRevised(Chunk revised)
Parameters:
revised - the Chunk describing the revised text to set

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2012. All Rights Reserved.