diffChange.js 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. /*---------------------------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for license information.
  4. *--------------------------------------------------------------------------------------------*/
  5. /**
  6. * Represents information about a specific difference between two sequences.
  7. */
  8. export class DiffChange {
  9. /**
  10. * Constructs a new DiffChange with the given sequence information
  11. * and content.
  12. */
  13. constructor(originalStart, originalLength, modifiedStart, modifiedLength) {
  14. //Debug.Assert(originalLength > 0 || modifiedLength > 0, "originalLength and modifiedLength cannot both be <= 0");
  15. this.originalStart = originalStart;
  16. this.originalLength = originalLength;
  17. this.modifiedStart = modifiedStart;
  18. this.modifiedLength = modifiedLength;
  19. }
  20. /**
  21. * The end point (exclusive) of the change in the original sequence.
  22. */
  23. getOriginalEnd() {
  24. return this.originalStart + this.originalLength;
  25. }
  26. /**
  27. * The end point (exclusive) of the change in the modified sequence.
  28. */
  29. getModifiedEnd() {
  30. return this.modifiedStart + this.modifiedLength;
  31. }
  32. }