Chore: add more docs annotations (#30847)

This commit is contained in:
Ryan McKinley 2021-02-02 21:51:09 -08:00 committed by GitHub
parent c9c7bfbcaa
commit 3a343aa547
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 11 deletions

View File

@ -1,6 +1,9 @@
import { MutableVector } from '../types/vector'; import { MutableVector } from '../types/vector';
import { FunctionalVector } from './FunctionalVector'; import { FunctionalVector } from './FunctionalVector';
/**
* @public
*/
export class ArrayVector<T = any> extends FunctionalVector<T> implements MutableVector<T> { export class ArrayVector<T = any> extends FunctionalVector<T> implements MutableVector<T> {
buffer: T[]; buffer: T[];

View File

@ -1,6 +1,11 @@
import { Vector } from '../types'; import { Vector } from '../types';
import { FunctionalVector } from './FunctionalVector'; import { FunctionalVector } from './FunctionalVector';
/**
* This will force all values to be numbers
*
* @public
*/
export class AsNumberVector extends FunctionalVector<number> { export class AsNumberVector extends FunctionalVector<number> {
constructor(private field: Vector) { constructor(private field: Vector) {
super(); super();

View File

@ -2,6 +2,9 @@ import { Vector } from '../types/vector';
import { vectorToArray } from './vectorToArray'; import { vectorToArray } from './vectorToArray';
import { BinaryOperation } from '../utils/binaryOperators'; import { BinaryOperation } from '../utils/binaryOperators';
/**
* @public
*/
export class BinaryOperationVector implements Vector<number> { export class BinaryOperationVector implements Vector<number> {
constructor(private left: Vector<number>, private right: Vector<number>, private operation: BinaryOperation) {} constructor(private left: Vector<number>, private right: Vector<number>, private operation: BinaryOperation) {}

View File

@ -14,6 +14,8 @@ interface CircularOptions<T> {
* *
* This supports adding to the 'head' or 'tail' and will grow the buffer * This supports adding to the 'head' or 'tail' and will grow the buffer
* to match a configured capacity. * to match a configured capacity.
*
* @public
*/ */
export class CircularVector<T = any> extends FunctionalVector<T> implements MutableVector<T> { export class CircularVector<T = any> extends FunctionalVector<T> implements MutableVector<T> {
private buffer: T[]; private buffer: T[];

View File

@ -1,5 +1,8 @@
import { Vector } from '../types/vector'; import { Vector } from '../types/vector';
/**
* @public
*/
export class ConstantVector<T = any> implements Vector<T> { export class ConstantVector<T = any> implements Vector<T> {
constructor(private value: T, private len: number) {} constructor(private value: T, private len: number) {}

View File

@ -1,10 +1,15 @@
import { Vector } from '../types/vector'; import { Vector } from '../types/vector';
import { DisplayProcessor } from '../types'; import { DisplayProcessor } from '../types';
import { formattedValueToString } from '../valueFormats'; import { formattedValueToString } from '../valueFormats';
import { vectorToArray } from './vectorToArray'; import { FunctionalVector } from './FunctionalVector';
export class FormattedVector<T = any> implements Vector<string> { /**
constructor(private source: Vector<T>, private formatter: DisplayProcessor) {} * @public
*/
export class FormattedVector<T = any> extends FunctionalVector<string> {
constructor(private source: Vector<T>, private formatter: DisplayProcessor) {
super();
}
get length() { get length() {
return this.source.length; return this.source.length;
@ -14,12 +19,4 @@ export class FormattedVector<T = any> implements Vector<string> {
const v = this.source.get(index); const v = this.source.get(index);
return formattedValueToString(this.formatter(v)); return formattedValueToString(this.formatter(v));
} }
toArray(): string[] {
return vectorToArray(this);
}
toJSON(): string[] {
return this.toArray();
}
} }