T
- The type of the compared elements in the 'lines'.public class Chunk<T>
extends java.lang.Object
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 implements hashCode()
and
equals()
correctly can be subject to
differencing using this library.
Modifier and Type | Field and Description |
---|---|
private java.util.List<T> |
lines |
private int |
position |
Constructor and Description |
---|
Chunk(int position,
java.util.List<T> lines)
Creates a chunk and saves a copy of affected lines
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.util.List<T> |
getLines() |
int |
getPosition() |
int |
hashCode() |
int |
last()
Returns the index of the last line of the chunk.
|
int |
size()
Return the chunk size
|
java.lang.String |
toString() |
void |
verify(java.util.List<T> target)
Verifies that this chunk's saved text matches the corresponding text in
the given sequence.
|
private final int position
private java.util.List<T> lines
public Chunk(int position, java.util.List<T> lines)
position
- the start positionlines
- the affected linespublic void verify(java.util.List<T> target) throws java.lang.IllegalStateException
target
- the sequence to verify against.java.lang.IllegalStateException
public int getPosition()
public java.util.List<T> getLines()
public int size()
public int last()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object