-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsub.js
More file actions
28 lines (24 loc) · 723 Bytes
/
sub.js
File metadata and controls
28 lines (24 loc) · 723 Bytes
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
import { checkRange } from './utilMatrix.js';
import BaseView from './base.js';
export default class MatrixSubView extends BaseView {
constructor(matrix, startRow, endRow, startColumn, endColumn) {
checkRange(matrix, startRow, endRow, startColumn, endColumn);
super(matrix, endRow - startRow + 1, endColumn - startColumn + 1);
this.startRow = startRow;
this.startColumn = startColumn;
}
set(rowIndex, columnIndex, value) {
this.matrix.set(
this.startRow + rowIndex,
this.startColumn + columnIndex,
value,
);
return this;
}
get(rowIndex, columnIndex) {
return this.matrix.get(
this.startRow + rowIndex,
this.startColumn + columnIndex,
);
}
}