Skip to content

Commit

Permalink
fix(typings): mark get/set of AbstractMatrix as abstract (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimava authored Nov 4, 2022
1 parent 5ec6888 commit d07f5c6
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions matrix.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,15 @@ export abstract class AbstractMatrix {
* @param columnIndex - Index of the element's column.
* @param value - The new value for the element.
*/
set(rowIndex: number, columnIndex: number, value: number): this;
abstract set(rowIndex: number, columnIndex: number, value: number): this;

/**
* Returns the value of the given element of the matrix.
* @param rowIndex - Index of the element's row.
* @param columnIndex - Index of the element's column.
* @returns - The value of the element.
*/
get(rowIndex: number, columnIndex: number): number;
abstract get(rowIndex: number, columnIndex: number): number;

/**
* Applies a callback for each element of the matrix. The function is called in the matrix (this) context.
Expand Down Expand Up @@ -934,6 +934,9 @@ export class Matrix extends AbstractMatrix {
constructor(data: ArrayLike<ArrayLike<number>>);
constructor(otherMatrix: AbstractMatrix);

set(rowIndex: number, columnIndex: number, value: number): this;
get(rowIndex: number, columnIndex: number): number;

/**
* Removes a column from the matrix (in place).
* @param index - Column index.
Expand Down Expand Up @@ -965,26 +968,38 @@ export default Matrix;

export class MatrixColumnView extends AbstractMatrix {
constructor(matrix: AbstractMatrix, column: number);
set(rowIndex: number, columnIndex: number, value: number): this;
get(rowIndex: number, columnIndex: number): number;
}

export class MatrixColumnSelectionView extends AbstractMatrix {
constructor(matrix: AbstractMatrix, columnIndices: ArrayLike<number>);
set(rowIndex: number, columnIndex: number, value: number): this;
get(rowIndex: number, columnIndex: number): number;
}

export class MatrixFlipColumnView extends AbstractMatrix {
constructor(matrix: AbstractMatrix);
set(rowIndex: number, columnIndex: number, value: number): this;
get(rowIndex: number, columnIndex: number): number;
}

export class MatrixFlipRowView extends AbstractMatrix {
constructor(matrix: AbstractMatrix);
set(rowIndex: number, columnIndex: number, value: number): this;
get(rowIndex: number, columnIndex: number): number;
}

export class MatrixRowView extends AbstractMatrix {
constructor(matrix: AbstractMatrix, row: number);
set(rowIndex: number, columnIndex: number, value: number): this;
get(rowIndex: number, columnIndex: number): number;
}

export class MatrixRowSelectionView extends AbstractMatrix {
constructor(matrix: AbstractMatrix, rowIndices: ArrayLike<number>);
set(rowIndex: number, columnIndex: number, value: number): this;
get(rowIndex: number, columnIndex: number): number;
}

export class MatrixSelectionView extends AbstractMatrix {
Expand All @@ -993,6 +1008,8 @@ export class MatrixSelectionView extends AbstractMatrix {
rowIndices: ArrayLike<number>,
columnIndices: ArrayLike<number>,
);
set(rowIndex: number, columnIndex: number, value: number): this;
get(rowIndex: number, columnIndex: number): number;
}

export class MatrixSubView extends AbstractMatrix {
Expand All @@ -1003,10 +1020,14 @@ export class MatrixSubView extends AbstractMatrix {
startColumn: number,
endColumn: number,
);
set(rowIndex: number, columnIndex: number, value: number): this;
get(rowIndex: number, columnIndex: number): number;
}

export class MatrixTransposeView extends AbstractMatrix {
constructor(matrix: AbstractMatrix);
set(rowIndex: number, columnIndex: number, value: number): this;
get(rowIndex: number, columnIndex: number): number;
}

export interface IWrap1DOptions {
Expand All @@ -1025,10 +1046,14 @@ export function wrap(twoDAray: ArrayLike<ArrayLike<number>>): WrapperMatrix2D;

export class WrapperMatrix1D extends AbstractMatrix {
constructor(data: ArrayLike<number>, options?: IWrap1DOptions);
set(rowIndex: number, columnIndex: number, value: number): this;
get(rowIndex: number, columnIndex: number): number;
}

export class WrapperMatrix2D extends AbstractMatrix {
constructor(data: ArrayLike<ArrayLike<number>>);
set(rowIndex: number, columnIndex: number, value: number): this;
get(rowIndex: number, columnIndex: number): number;
}

/**
Expand Down

0 comments on commit d07f5c6

Please sign in to comment.