Interface DeltaRange

All Superinterfaces:
Delta

public interface DeltaRange extends Delta
A block of text found by a TextComparison: an offset and a length in the document of each Role, together with the Delta.Kind of difference. Use TextComparison.getText(Role, int, int) to read the text a range refers to.

 const text = comp.getText(Role.REF, range.offset(Role.REF), range.length(Role.REF));
 
Since:
2.0
  • Method Details

    • getChildren

      DeltaRange[] getChildren()
      Returns the inline differences within this block of text. A text comparison first finds blocks of text that were added, deleted or are present on both sides; a second pass over the blocks present on both sides finds the individual characters that differ within them, the inline differences.
      Specified by:
      getChildren in interface Delta
      Returns:
      an array of inline DeltaRanges; empty when there are none
      Since:
      2.0
    • isResolved

      boolean isResolved()
      Answers whether this difference has been resolved by a merge.
      Returns:
      true if this difference has been resolved, false otherwise.
      Since:
      2.0
    • length

      int length(Role role)
      Returns the length, in characters, of this range in the document with the specified Role.
      Parameters:
      role - a role of this comparison; cannot be null
      Returns:
      the length of this range in the document with the specified role
      Throws:
      NullPointerException - if role is null
      IllegalArgumentException - if the specified role is not applicable to this comparison.
      Since:
      2.0
    • offset

      Returns the offset of this range in the document with the specified Role.
      Parameters:
      role - a role of this comparison; cannot be null
      Returns:
      the 0-based offset of this delta into the content of the document identified by role
      Throws:
      NullPointerException - if role is null
      IllegalArgumentException - if the specified role is not applicable to this comparison.
      Since:
      2.0