Class Difference
java.lang.Object
org.netbeans.api.diff.Difference
- All Implemented Interfaces:
Serializable
This class represents a single difference between two files.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
This class represents a difference on a single line. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Add type of difference - a portion of a file was added in the otherstatic final int
Change type of difference - a portion of a file was changed in the otherstatic final int
Delete type of difference - a portion of a file was removed in the other -
Constructor Summary
ConstructorsConstructorDescriptionDifference
(int type, int firstStart, int firstEnd, int secondStart, int secondEnd) Creates a new instance of DifferenceDifference
(int type, int firstStart, int firstEnd, int secondStart, int secondEnd, String firstText, String secondText) Creates a new instance of DifferenceDifference
(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 -
Method Summary
Modifier and TypeMethodDescriptionint
Get the line number on which the difference ends in the first file.The list of differences on lines in the first file.int
Get the line number on which the difference starts in the first file.Get the text content of the difference in the first file.int
Get the line number on which the difference ends in the second file.The list of differences on lines in the second file.int
Get the line number on which the difference starts in the second file.Get the text content of the difference in the second file.int
getType()
Get the difference type.toString()
-
Field Details
-
DELETE
public static final int DELETEDelete type of difference - a portion of a file was removed in the other- See Also:
-
ADD
public static final int ADDAdd type of difference - a portion of a file was added in the other- See Also:
-
CHANGE
public static final int CHANGEChange type of difference - a portion of a file was changed in the other- See Also:
-
-
Constructor Details
-
Difference
public Difference(int type, int firstStart, int firstEnd, int secondStart, int secondEnd) Creates a new instance of Difference- Parameters:
type
- The type of the difference. Must be one of theDELETE
,ADD
orCHANGE
firstStart
- 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.
-
Difference
public Difference(int type, int firstStart, int firstEnd, int secondStart, int secondEnd, String firstText, String secondText) Creates a new instance of Difference- Parameters:
type
- The type of the difference. Must be one of theDELETE
,ADD
orCHANGE
firstStart
- 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.
-
Difference
public 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- Parameters:
type
- The type of the difference. Must be one of theDELETE
,ADD
orCHANGE
firstStart
- 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 ofDifference.Part
. Can benull
when there are no line differences.secondLineDiffs
- The list of differences on lines in the second file. The list contains instances ofDifference.Part
. Can benull
when there are no line differences.
-
-
Method Details
-
getType
-
getFirstStart
public int getFirstStart()Get the line number on which the difference starts in the first file.For ADD changes it returns previous line number e.g. 0 for add file start.
-
getFirstEnd
public int getFirstEnd()Get the line number on which the difference ends in the first file.Does not have any meaning for ADD changes.
-
getSecondStart
public int getSecondStart()Get the line number on which the difference starts in the second file. -
getSecondEnd
public int getSecondEnd()Get the line number on which the difference ends in the second file.Does not have any meaning for DELETE changes.
-
getFirstLineDiffs
The list of differences on lines in the first file. The list contains instances ofDifference.Part
. Can benull
when there are no line differences. -
getSecondLineDiffs
The list of differences on lines in the second file. The list contains instances ofDifference.Part
. Can benull
when there are no line differences. -
getFirstText
Get the text content of the difference in the first file. -
getSecondText
Get the text content of the difference in the second file. -
toString
-