Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Script

Used by MyersBinaryDiff.diff to incrementally report the result.

Each callback method can short-circuit processing by returning false, in which case no further callbacks will be called and the diff result will be REPLACE.

MyersBinaryDiff guarantees:

  • If match is called with (s1, l1), a later match (s2, l2) will have s2 > s1 + l1 unless there is an intermediate insert, in which case it is possible that s2 == s1 + l1.
  • If insert is called with (s1, l1), a later insert (s2, l2) will have s2 > s1 + l1.
  • There will never be adjacent inserts. Any two inserts will be separated by at least one match.

Hierarchy

Index

Methods

Methods

delete

  • delete(aStart?: undefined | number, length?: undefined | number): boolean
  • Parameters

    • Optional aStart: undefined | number
    • Optional length: undefined | number

      the length of the insert. Implementations may assume this value is is greater than 1 and bStart + length + bOffset is less than the length of the {@code b} array supplied to diff.

    Returns boolean

    true to continue processing

insert

  • insert(bStart: number, length: number): boolean
  • Parameters

    • bStart: number

      offset from the start of the b data, ignoring the bOffset supplied to diff

    • length: number

      the length of the insert. Implementations may assume this value is is greater than 1 and bStart + length + bOffset is less than the length of the {@code b} array supplied to diff.

    Returns boolean

    true to continue processing

match

  • match(aStart: number, length: number): boolean
  • Parameters

    • aStart: number

      offset from the start of the a data, ignoring the aOffset supplied to diff

    • length: number

      the length of the match. Implementations may assume this value is is greater than 1 and aStart + length + bOffset is less than the length of the a array supplied to diff.

    Returns boolean

    true to continue processing

Copyright © 2025 DiffusionData Ltd. All Rights Reserved.