Package org.assertj.core.util.diff
Class Chunk<T>
- java.lang.Object
-
- org.assertj.core.util.diff.Chunk<T>
-
- Type Parameters:
T- The type of the compared elements in the 'lines'.
public class Chunk<T> extends java.lang.ObjectCopy from https://code.google.com/p/java-diff-utils/.Holds the information about the part of text involved in the diff process
Text is represented as
Object[]because the diff engine is capable of handling more than plain ascci. In fact, arrays or lists of any type that implementshashCode()andequals()correctly can be subject to differencing using this library.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.util.List<T>getLines()intgetPosition()inthashCode()intlast()Returns the index of the last line of the chunk.intsize()Return the chunk sizejava.lang.StringtoString()voidverify(java.util.List<T> target)Verifies that this chunk's saved text matches the corresponding text in the given sequence.
-
-
-
Field Detail
-
position
private final int position
-
lines
private java.util.List<T> lines
-
-
Constructor Detail
-
Chunk
public Chunk(int position, java.util.List<T> lines)Creates a chunk and saves a copy of affected lines- Parameters:
position- the start positionlines- the affected lines
-
-
Method Detail
-
verify
public void verify(java.util.List<T> target) throws java.lang.IllegalStateException
Verifies that this chunk's saved text matches the corresponding text in the given sequence.- Parameters:
target- the sequence to verify against.- Throws:
java.lang.IllegalStateException
-
getPosition
public int getPosition()
- Returns:
- the start position of chunk in the text
-
getLines
public java.util.List<T> getLines()
- Returns:
- the affected lines
-
size
public int size()
Return the chunk size- Returns:
- the chunk size
-
last
public int last()
Returns the index of the last line of the chunk.- Returns:
- the index of the last line of the chunk.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-