Class RangeDifference
- java.lang.Object
-
- org.eclipse.compare.rangedifferencer.RangeDifference
-
public class RangeDifference extends Object
Description of a change between two or three ranges of comparable entities.RangeDifferenceobjects are the elements of a compare result returned from theRangeDifferencerfind*methods. Clients use these objects as they are returned from the differencer. This class is not intended to be instantiated outside of the Compare framework.Note: A range in the
RangeDifferenceobject 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:
RangeDifferencer- Restriction:
- This class is not intended to be instantiated by clients.
-
-
Field Summary
Fields Modifier and Type Field Description static intANCESTORThree-way change constant indicating the same change in both right and left, that is only the ancestor is different.protected intancestorLengthprotected intancestorStartstatic intCHANGETwo-way change constant indicating two-way change (same asRIGHT)static intCONFLICTThree-way change constant indicating a change in both right and left.static intERRORConstant indicating an unknown change kind.protected intkindthe kind of change: NOCHANGE, CHANGE, LEFT, RIGHT, ANCESTOR, CONFLICT, ERRORstatic intLEFTThree-way change constant indicating a change in left.protected intleftLengthprotected intleftStartstatic intNOCHANGETwo-way change constant indicating no change.static intRIGHTThree-way change constant indicating a change in right.protected intrightLengthprotected intrightStart
-
Constructor Summary
Constructors Modifier Constructor Description protectedRangeDifference(int changeKind)Creates a new range difference with the given change kind.protectedRangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength)Creates a newRangeDifferencewith the given change kind and left and right ranges.protectedRangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength, int ancestorStart, int ancestorLength)Creates a newRangeDifferencewith the given change kind and left, right, and ancestor ranges.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intancestorEnd()Returns the end index of the entity range on the ancestor side.intancestorLength()Returns the number of entities on the ancestor side.intancestorStart()Returns the start index of the entity range on the ancestor side.booleanequals(Object obj)inthashCode()intkind()Returns the kind of difference.intleftEnd()Returns the end index of the entity range on the left side.intleftLength()Returns the number of entities on the left side.intleftStart()Returns the start index of the entity range on the left side.intmaxLength()Returns the maximum number of entities in the left, right, and ancestor sides of this range.intrightEnd()Returns the end index of the entity range on the right side.intrightLength()Returns the number of entities on the right side.intrightStart()Returns the start index of the entity range on the right side.StringtoString()
-
-
-
Field Detail
-
NOCHANGE
public static final int NOCHANGE
Two-way change constant indicating no change.- See Also:
- Constant Field Values
-
CHANGE
public static final int CHANGE
Two-way change constant indicating two-way change (same asRIGHT)- See Also:
- Constant Field Values
-
CONFLICT
public static final int CONFLICT
Three-way change constant indicating a change in both right and left.- See Also:
- Constant Field Values
-
RIGHT
public static final int RIGHT
Three-way change constant indicating a change in right.- See Also:
- Constant Field Values
-
LEFT
public static final int LEFT
Three-way change constant indicating a change in left.- See Also:
- Constant Field Values
-
ANCESTOR
public static final int ANCESTOR
Three-way change constant indicating the same change in both right and left, that is only the ancestor is different.- See Also:
- Constant Field Values
-
ERROR
public static final int ERROR
Constant indicating an unknown change kind.- See Also:
- Constant Field Values
-
kind
protected int kind
the kind of change: NOCHANGE, CHANGE, LEFT, RIGHT, ANCESTOR, CONFLICT, ERROR- Since:
- org.eclipse.compare.core 3.5
-
leftStart
protected int leftStart
- Since:
- org.eclipse.compare.core 3.5
-
leftLength
protected int leftLength
- Since:
- org.eclipse.compare.core 3.5
-
rightStart
protected int rightStart
- Since:
- org.eclipse.compare.core 3.5
-
rightLength
protected int rightLength
- Since:
- org.eclipse.compare.core 3.5
-
ancestorStart
protected int ancestorStart
- Since:
- org.eclipse.compare.core 3.5
-
ancestorLength
protected int ancestorLength
- Since:
- org.eclipse.compare.core 3.5
-
-
Constructor Detail
-
RangeDifference
protected RangeDifference(int changeKind)
Creates a new range difference with the given change kind.- Parameters:
changeKind- the kind of change- Since:
- org.eclipse.compare.core 3.5
-
RangeDifference
protected RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength)Creates a newRangeDifferencewith 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- Since:
- org.eclipse.compare.core 3.5
-
RangeDifference
protected RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength, int ancestorStart, int ancestorLength)Creates a newRangeDifferencewith 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- Since:
- org.eclipse.compare.core 3.5
-
-
Method Detail
-
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
-
-