Class RangeDifference
java.lang.Object
org.eclipse.compare.rangedifferencer.RangeDifference
Description of a change between two or three ranges of comparable entities.
RangeDifference
objects are the elements of a compare result
returned from the RangeDifferencer
find*
methods. Clients use these objects as they are returned from the differencer.
This class is not intended to be instantiated or subclassed outside of the
Compare framework.
Note: A range in the RangeDifference
object is given as a
start index and length in terms of comparable entities. However, these entity
indices and counts are not necessarily character positions. For example, if
an entity represents a line in a document, the start index would be a line
number and the count would be in lines.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Three-way change constant indicating the same change in both right and left, that is only the ancestor is different.static final int
Two-way change constant indicating two-way change (same asRIGHT
)static final int
Three-way change constant indicating a change in both right and left.static final int
Constant indicating an unknown change kind.static final int
Three-way change constant indicating a change in left.static final int
Two-way change constant indicating no change.static final int
Three-way change constant indicating a change in right. -
Constructor Summary
ConstructorsConstructorDescriptionRangeDifference
(int kind, int rightStart, int rightLength, int leftStart, int leftLength) Creates a newRangeDifference
with the given change kind and left and right ranges.RangeDifference
(int kind, int rightStart, int rightLength, int leftStart, int leftLength, int ancestorStart, int ancestorLength) Creates a newRangeDifference
with the given change kind and left, right, and ancestor ranges. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the end index of the entity range on the ancestor side.int
Returns the number of entities on the ancestor side.int
Returns the start index of the entity range on the ancestor side.boolean
int
kind()
Returns the kind of difference.int
leftEnd()
Returns the end index of the entity range on the left side.int
Returns the number of entities on the left side.int
Returns the start index of the entity range on the left side.int
Returns the maximum number of entities in the left, right, and ancestor sides of this range.int
rightEnd()
Returns the end index of the entity range on the right side.int
Returns the number of entities on the right side.int
Returns the start index of the entity range on the right side.toString()
-
Field Details
-
NOCHANGE
public static final int NOCHANGETwo-way change constant indicating no change.- See Also:
-
CHANGE
public static final int CHANGETwo-way change constant indicating two-way change (same asRIGHT
)- See Also:
-
CONFLICT
public static final int CONFLICTThree-way change constant indicating a change in both right and left.- See Also:
-
RIGHT
public static final int RIGHTThree-way change constant indicating a change in right.- See Also:
-
LEFT
public static final int LEFTThree-way change constant indicating a change in left.- See Also:
-
ANCESTOR
public static final int ANCESTORThree-way change constant indicating the same change in both right and left, that is only the ancestor is different.- See Also:
-
ERROR
public static final int ERRORConstant indicating an unknown change kind.- See Also:
-
-
Constructor Details
-
RangeDifference
public RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength) Creates a newRangeDifference
with the given change kind and left and right ranges.- Parameters:
kind
- the kind of changerightStart
- start index of entity on right siderightLength
- number of entities on right sideleftStart
- start index of entity on left sideleftLength
- number of entities on left side
-
RangeDifference
public RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength, int ancestorStart, int ancestorLength) Creates a newRangeDifference
with the given change kind and left, right, and ancestor ranges.- Parameters:
kind
- the kind of changerightStart
- start index of entity on right siderightLength
- number of entities on right sideleftStart
- start index of entity on left sideleftLength
- number of entities on left sideancestorStart
- start index of entity on ancestor sideancestorLength
- number of entities on ancestor side
-
-
Method Details
-
kind
public int kind()Returns the kind of difference.- Returns:
- the kind of difference, one of
NOCHANGE
,CHANGE
,LEFT
,RIGHT
,ANCESTOR
,CONFLICT
,ERROR
-
ancestorStart
public int ancestorStart()Returns the start index of the entity range on the ancestor side.- Returns:
- the start index of the entity range on the ancestor side
-
ancestorLength
public int ancestorLength()Returns the number of entities on the ancestor side.- Returns:
- the number of entities on the ancestor side
-
ancestorEnd
public int ancestorEnd()Returns the end index of the entity range on the ancestor side.- Returns:
- the end index of the entity range on the ancestor side
-
rightStart
public int rightStart()Returns the start index of the entity range on the right side.- Returns:
- the start index of the entity range on the right side
-
rightLength
public int rightLength()Returns the number of entities on the right side.- Returns:
- the number of entities on the right side
-
rightEnd
public int rightEnd()Returns the end index of the entity range on the right side.- Returns:
- the end index of the entity range on the right side
-
leftStart
public int leftStart()Returns the start index of the entity range on the left side.- Returns:
- the start index of the entity range on the left side
-
leftLength
public int leftLength()Returns the number of entities on the left side.- Returns:
- the number of entities on the left side
-
leftEnd
public int leftEnd()Returns the end index of the entity range on the left side.- Returns:
- the end index of the entity range on the left side
-
maxLength
public int maxLength()Returns the maximum number of entities in the left, right, and ancestor sides of this range.- Returns:
- the maximum number of entities in the left, right, and ancestor sides of this range
-
equals
-
toString
-