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
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDelta.TYPESpecifies the type of the delta.
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_ENDstatic StringDEFAULT_STARTprivate Chunk<T>originalThe original chunk.private Chunk<T>revisedThe revised chunk.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidapplyTo(List<T> target)Applies this delta as the patch for a given targetbooleanequals(Object obj)Chunk<T>getOriginal()Chunk<T>getRevised()abstract Delta.TYPEgetType()Returns the type of deltainthashCode()intlineNumber()StringtoString()abstract voidverify(List<T> target)Verifies that this delta can be used to patch the given text.
-
-
-
Field Detail
-
DEFAULT_END
public static final String DEFAULT_END
- See Also:
- Constant Field Values
-
DEFAULT_START
public static final String DEFAULT_START
- See Also:
- Constant Field Values
-
-
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.
-
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- ifverify(List)fails
-
getType
public abstract Delta.TYPE getType()
Returns the type of delta- Returns:
- the type enum
-
lineNumber
public int lineNumber()
-
-