forked from microsoft/vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiffChange.ts
More file actions
61 lines (53 loc) · 1.77 KB
/
diffChange.ts
File metadata and controls
61 lines (53 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
/**
* Represents information about a specific difference between two sequences.
*/
export class DiffChange {
/**
* The position of the first element in the original sequence which
* this change affects.
*/
public originalStart: number;
/**
* The number of elements from the original sequence which were
* affected.
*/
public originalLength: number;
/**
* The position of the first element in the modified sequence which
* this change affects.
*/
public modifiedStart: number;
/**
* The number of elements from the modified sequence which were
* affected (added).
*/
public modifiedLength: number;
/**
* Constructs a new DiffChange with the given sequence information
* and content.
*/
constructor(originalStart: number, originalLength: number, modifiedStart: number, modifiedLength: number) {
//Debug.Assert(originalLength > 0 || modifiedLength > 0, "originalLength and modifiedLength cannot both be <= 0");
this.originalStart = originalStart;
this.originalLength = originalLength;
this.modifiedStart = modifiedStart;
this.modifiedLength = modifiedLength;
}
/**
* The end point (exclusive) of the change in the original sequence.
*/
public getOriginalEnd() {
return this.originalStart + this.originalLength;
}
/**
* The end point (exclusive) of the change in the modified sequence.
*/
public getModifiedEnd() {
return this.modifiedStart + this.modifiedLength;
}
}