public class Difference extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Difference.Part
This class represents a difference on a single line.
|
Modifier and Type | Field and Description |
---|---|
static int |
ADD
Add type of difference - a portion of a file was added in the other
|
static int |
CHANGE
Change type of difference - a portion of a file was changed in the other
|
static int |
DELETE
Delete type of difference - a portion of a file was removed in the other
|
Constructor and Description |
---|
Difference(int type,
int firstStart,
int firstEnd,
int secondStart,
int secondEnd)
Creates a new instance of Difference
|
Difference(int type,
int firstStart,
int firstEnd,
int secondStart,
int secondEnd,
String firstText,
String secondText)
Creates a new instance of Difference
|
Difference(int type,
int firstStart,
int firstEnd,
int secondStart,
int secondEnd,
String firstText,
String secondText,
Difference.Part[] firstLineDiffs,
Difference.Part[] secondLineDiffs)
Creates a new instance of Difference
|
Modifier and Type | Method and Description |
---|---|
int |
getFirstEnd()
Get the line number on which the difference ends in the first file.
|
Difference.Part[] |
getFirstLineDiffs()
The list of differences on lines in the first file.
|
int |
getFirstStart()
Get the line number on which the difference starts in the first file.
|
String |
getFirstText()
Get the text content of the difference in the first file.
|
int |
getSecondEnd()
Get the line number on which the difference ends in the second file.
|
Difference.Part[] |
getSecondLineDiffs()
The list of differences on lines in the second file.
|
int |
getSecondStart()
Get the line number on which the difference starts in the second file.
|
String |
getSecondText()
Get the text content of the difference in the second file.
|
int |
getType()
Get the difference type.
|
String |
toString() |
public static final int DELETE
public static final int ADD
public static final int CHANGE
public Difference(int type, int firstStart, int firstEnd, int secondStart, int secondEnd)
type
- The type of the difference. Must be one of the DELETE,
ADD or CHANGEfirstStart
- The line number on which the difference starts in the first file.firstEnd
- The line number on which the difference ends in the first file.secondStart
- The line number on which the difference starts in the second file.secondEnd
- The line number on which the difference ends in the second file.public Difference(int type, int firstStart, int firstEnd, int secondStart, int secondEnd, String firstText, String secondText)
type
- The type of the difference. Must be one of the DELETE,
ADD or CHANGEfirstStart
- The line number on which the difference starts in the first file.firstEnd
- The line number on which the difference ends in the first file.secondStart
- The line number on which the difference starts in the second file.secondEnd
- The line number on which the difference ends in the second file.firstText
- The text content of the difference in the first file.secondText
- The text content of the difference in the second file.public Difference(int type, int firstStart, int firstEnd, int secondStart, int secondEnd, String firstText, String secondText, Difference.Part[] firstLineDiffs, Difference.Part[] secondLineDiffs)
type
- The type of the difference. Must be one of the DELETE,
ADD or CHANGEfirstStart
- The line number on which the difference starts in the first file.firstEnd
- The line number on which the difference ends in the first file.secondStart
- The line number on which the difference starts in the second file.secondEnd
- The line number on which the difference ends in the second file.firstText
- The text content of the difference in the first file.secondText
- The text content of the difference in the second file.firstLineDiffs
- The list of differences on lines in the first file.
The list contains instances of Difference.Part
.
Can be null
when there are no line differences.secondLineDiffs
- The list of differences on lines in the second file.
The list contains instances of Difference.Part
.
Can be null
when there are no line differences.public int getType()
public int getFirstStart()
For ADD changes it returns previous line number e.g. 0 for add file start.
public int getFirstEnd()
Does not have any meaning for ADD changes.
public int getSecondStart()
public int getSecondEnd()
Does not have any meaning for DELETE changes.
public Difference.Part[] getFirstLineDiffs()
Difference.Part
.
Can be null
when there are no line differences.public Difference.Part[] getSecondLineDiffs()
Difference.Part
.
Can be null
when there are no line differences.public String getFirstText()
public String getSecondText()