Package org.assertj.core.util.diff
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
Initially copied from https://code.google.com/p/java-diff-utils/.
Describes the delta between original and revised texts.
- Author:
- Dmitry Naumenko
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
Applies this delta as the patch for a given targetboolean
abstract Delta.TYPE
getType()
Returns the type of deltaint
hashCode()
int
toString()
abstract void
Verifies that this delta can be used to patch the given text.
-
Field Details
-
DEFAULT_END
- See Also:
-
DEFAULT_START
- See Also:
-
-
Constructor Details
-
Delta
Construct the delta for original and revised chunks- Parameters:
original
- Chunk describing the original text. Must not benull
.revised
- Chunk describing the revised text. Must not benull
.
-
-
Method Details
-
verify
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
Applies this delta as the patch for a given target- Parameters:
target
- the given target- Throws:
IllegalStateException
- ifverify(List)
fails
-
getType
Returns the type of delta- Returns:
- the type enum
-
getOriginal
- Returns:
- The Chunk describing the original text.
-
getRevised
- Returns:
- The Chunk describing the revised text.
-
hashCode
public int hashCode() -
equals
-
lineNumber
public int lineNumber() -
toString
-