Class ChangeDelta<T>

  • Type Parameters:
    T - The type of the compared elements in the 'lines'.

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

    Describes the change-delta between original and revised texts.

    • Constructor Detail

      • ChangeDelta

        public ChangeDelta​(Chunk<T> original,
                           Chunk<T> revised)
        Creates a change delta with the two given chunks.
        Parameters:
        original - The original chunk. Must not be null.
        revised - The original chunk. Must not be null.
    • Method Detail

      • applyTo

        public void applyTo​(java.util.List<T> target)
                     throws java.lang.IllegalStateException
        Applies this delta as the patch for a given target
        Specified by:
        applyTo in class Delta<T>
        Parameters:
        target - the given target
        Throws:
        java.lang.IllegalStateException - if Delta.verify(List) fails
      • verify

        public void verify​(java.util.List<T> target)
                    throws java.lang.IllegalStateException
        Verifies that this delta can be used to patch the given text.
        Specified by:
        verify in class Delta<T>
        Parameters:
        target - the text to patch.
        Throws:
        java.lang.IllegalStateException - if the patch cannot be applied.
      • getType

        public Delta.TYPE getType()
        Description copied from class: Delta
        Returns the type of delta
        Specified by:
        getType in class Delta<T>
        Returns:
        the type enum