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 class
Delta.TYPE
Specifies the type of the delta.
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_END
static String
DEFAULT_START
private Chunk<T>
original
The original chunk.private Chunk<T>
revised
The revised chunk.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
applyTo(List<T> target)
Applies this delta as the patch for a given targetboolean
equals(Object obj)
Chunk<T>
getOriginal()
Chunk<T>
getRevised()
abstract Delta.TYPE
getType()
Returns the type of deltaint
hashCode()
int
lineNumber()
String
toString()
abstract void
verify(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()
-
-