T
- The type of the compared elements in the 'lines'.public final class Chunk<T>
extends java.lang.Object
implements java.io.Serializable
Text is represented as Object[]
because the diff engine is
capable of handling more than plain ASCII. In fact, arrays or lists of any
type that implements hashCode()
and
equals()
correctly can be subject to
differencing using this library.
Constructor and Description |
---|
Chunk(int position,
java.util.List<T> lines)
Creates a chunk and saves a copy of affected lines
|
Chunk(int position,
java.util.List<T> lines,
java.util.List<java.lang.Integer> changePosition)
Creates a chunk and saves a copy of affected lines
|
Chunk(int position,
T[] lines)
Creates a chunk and saves a copy of affected lines
|
Chunk(int position,
T[] lines,
java.util.List<java.lang.Integer> changePosition)
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<java.lang.Integer> |
getChangePosition() |
java.util.List<T> |
getLines() |
int |
getPosition() |
int |
hashCode() |
int |
last()
Returns the index of the last line of the chunk.
|
void |
setLines(java.util.List<T> lines) |
int |
size() |
java.lang.String |
toString() |
VerifyChunk |
verifyChunk(java.util.List<T> target)
Verifies that this chunk's saved text matches the corresponding text in
the given sequence.
|
public Chunk(int position, java.util.List<T> lines, java.util.List<java.lang.Integer> changePosition)
position
- the start position, where 0 is the first position.lines
- the affected lineschangePosition
- the positions of changed linespublic Chunk(int position, java.util.List<T> lines)
position
- the start positionlines
- the affected linespublic Chunk(int position, T[] lines, java.util.List<java.lang.Integer> changePosition)
position
- the start positionlines
- the affected lineschangePosition
- the positions of changed linespublic Chunk(int position, T[] lines)
position
- the start positionlines
- the affected linespublic VerifyChunk verifyChunk(java.util.List<T> target) throws PatchFailedException
target
- the sequence to verify against.PatchFailedException
public int getPosition()
public void setLines(java.util.List<T> lines)
public java.util.List<T> getLines()
public java.util.List<java.lang.Integer> getChangePosition()
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