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 java.lang.ObjectInitially copied from https://code.google.com/p/java-diff-utils/.Describes the delta between original and revised texts.
-
-
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 java.lang.StringDEFAULT_ENDstatic java.lang.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(java.util.List<T> target)Applies this delta as the patch for a given targetbooleanequals(java.lang.Object obj)Chunk<T>getOriginal()Chunk<T>getRevised()abstract Delta.TYPEgetType()Returns the type of deltainthashCode()intlineNumber()java.lang.StringtoString()abstract voidverify(java.util.List<T> target)Verifies that this delta can be used to patch the given text.
-
-
-
Field Detail
-
DEFAULT_END
public static final java.lang.String DEFAULT_END
- See Also:
- Constant Field Values
-
DEFAULT_START
public static final java.lang.String DEFAULT_START
- See Also:
- Constant Field Values
-
-
Method Detail
-
verify
public abstract void verify(java.util.List<T> target) throws java.lang.IllegalStateException
Verifies that this delta can be used to patch the given text.- Parameters:
target- the text to patch.- Throws:
java.lang.IllegalStateException- if the patch cannot be applied.
-
applyTo
public abstract void applyTo(java.util.List<T> target) throws java.lang.IllegalStateException
Applies this delta as the patch for a given target- Parameters:
target- the given target- Throws:
java.lang.IllegalStateException- ifverify(List)fails
-
getType
public abstract Delta.TYPE getType()
Returns the type of delta- Returns:
- the type enum
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
lineNumber
public int lineNumber()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-