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.

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 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:
Restriction:
This class is not intended to be instantiated by clients.
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Three-way change constant indicating the same change in both right and left, that is only the ancestor is different.
    protected int
     
    protected int
     
    static final int
    Two-way change constant indicating two-way change (same as RIGHT)
    static final int
    Three-way change constant indicating a change in both right and left.
    static final int
    Constant indicating an unknown change kind.
    protected int
    the kind of change: NOCHANGE, CHANGE, LEFT, RIGHT, ANCESTOR, CONFLICT, ERROR
    static final int
    Three-way change constant indicating a change in left.
    protected int
     
    protected int
     
    static final int
    Two-way change constant indicating no change.
    static final int
    Three-way change constant indicating a change in right.
    protected int
     
    protected int
     
  • Constructor Summary Link icon

    Constructors
    Modifier
    Constructor
    Description
    protected
    RangeDifference(int changeKind)
    Creates a new range difference with the given change kind.
    protected
    RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength)
    Creates a new RangeDifference with the given change kind and left and right ranges.
    protected
    RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength, int ancestorStart, int ancestorLength)
    Creates a new RangeDifference with the given change kind and left, right, and ancestor ranges.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    int
    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
     
    int
    Returns the kind of difference.
    int
    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
    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.
     

    Methods inherited from class java.lang.Object Link icon

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details Link icon

    • NOCHANGE Link icon

      public static final int NOCHANGE
      Two-way change constant indicating no change.
      See Also:
    • CHANGE Link icon

      public static final int CHANGE
      Two-way change constant indicating two-way change (same as RIGHT)
      See Also:
    • CONFLICT Link icon

      public static final int CONFLICT
      Three-way change constant indicating a change in both right and left.
      See Also:
    • LEFT Link icon

      public static final int LEFT
      Three-way change constant indicating a change in left.
      See Also:
    • ANCESTOR Link icon

      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:
    • ERROR Link icon

      public static final int ERROR
      Constant indicating an unknown change kind.
      See Also:
    • kind Link icon

      protected int kind
      the kind of change: NOCHANGE, CHANGE, LEFT, RIGHT, ANCESTOR, CONFLICT, ERROR
      Since:
      org.eclipse.compare.core 3.5
    • leftStart Link icon

      protected int leftStart
      Since:
      org.eclipse.compare.core 3.5
    • leftLength Link icon

      protected int leftLength
      Since:
      org.eclipse.compare.core 3.5
    • rightStart Link icon

      protected int rightStart
      Since:
      org.eclipse.compare.core 3.5
    • rightLength Link icon

      protected int rightLength
      Since:
      org.eclipse.compare.core 3.5
    • ancestorStart Link icon

      protected int ancestorStart
      Since:
      org.eclipse.compare.core 3.5
    • ancestorLength Link icon

      protected int ancestorLength
      Since:
      org.eclipse.compare.core 3.5
  • Constructor Details Link icon

    • RangeDifference Link icon

      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 Link icon

      protected RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength)
      Creates a new RangeDifference with the given change kind and left and right ranges.
      Parameters:
      kind - the kind of change
      rightStart - start index of entity on right side
      rightLength - number of entities on right side
      leftStart - start index of entity on left side
      leftLength - number of entities on left side
      Since:
      org.eclipse.compare.core 3.5
    • RangeDifference Link icon

      protected RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength, int ancestorStart, int ancestorLength)
      Creates a new RangeDifference with the given change kind and left, right, and ancestor ranges.
      Parameters:
      kind - the kind of change
      rightStart - start index of entity on right side
      rightLength - number of entities on right side
      leftStart - start index of entity on left side
      leftLength - number of entities on left side
      ancestorStart - start index of entity on ancestor side
      ancestorLength - number of entities on ancestor side
      Since:
      org.eclipse.compare.core 3.5
  • Method Details Link icon

    • kind Link icon

      public int kind()
      Returns the kind of difference.
      Returns:
      the kind of difference, one of NOCHANGE, CHANGE, LEFT, RIGHT, ANCESTOR, CONFLICT, ERROR
    • ancestorStart Link icon

      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 Link icon

      public int ancestorLength()
      Returns the number of entities on the ancestor side.
      Returns:
      the number of entities on the ancestor side
    • ancestorEnd Link icon

      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 Link icon

      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 Link icon

      public int rightLength()
      Returns the number of entities on the right side.
      Returns:
      the number of entities on the right side
    • rightEnd Link icon

      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 Link icon

      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 Link icon

      public int leftLength()
      Returns the number of entities on the left side.
      Returns:
      the number of entities on the left side
    • leftEnd Link icon

      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 Link icon

      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 Link icon

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object