Class Delta<T>

java.lang.Object
org.assertj.core.util.diff.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
  • Field Details

  • Constructor Details

    • 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 Details

    • 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.
    • applyTo

      public abstract void applyTo(List<T> target) throws IllegalStateException
      Applies this delta as the patch for a given target
      Parameters:
      target - the given target
      Throws:
      IllegalStateException - if verify(List) fails
    • 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
    • equals

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

      public int lineNumber()
    • toString

      public String toString()
      Overrides:
      toString in class Object