Class Delta<T>

  • Type Parameters:
    T - The type of the compared elements in the 'lines'.
    Direct Known Subclasses:
    ChangeDelta, DeleteDelta, InsertDelta

    public abstract class Delta<T>
    extends Object
    Initially copied from https://code.google.com/p/java-diff-utils/.

    Describes the delta between original and revised texts.

    Author:
    Dmitry Naumenko
    • Constructor Detail

      • Delta

        public Delta​(Chunk<T> original,
                     Chunk<T> revised)
        Construct the delta for original and revised chunks
        Parameters:
        original - Chunk describing the original text. Must not be null.
        revised - Chunk describing the revised text. Must not be null.
    • Method Detail

      • verify

        public abstract void verify​(List<T> target)
                             throws IllegalStateException
        Verifies that this delta can be used to patch the given text.
        Parameters:
        target - the text to patch.
        Throws:
        IllegalStateException - if the patch cannot be applied.
      • getType

        public abstract Delta.TYPE getType()
        Returns the type of delta
        Returns:
        the type enum
      • getOriginal

        public Chunk<T> getOriginal()
        Returns:
        The Chunk describing the original text.
      • getRevised

        public Chunk<T> getRevised()
        Returns:
        The Chunk describing the revised text.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • lineNumber

        public int lineNumber()