rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
23 lines • 792 B
TypeScript
/**
* @public
* Presents an array as if it were circular, going past the end or start loops around.
*
* @remarks
* Supports negative indexes.
*/
export declare class CircularBuffer<TValue> {
private readonly values;
readonly size: number;
static createEmpty<TValue>(size: number): CircularBuffer<TValue>;
static createOne<TValue>(initialValues: TValue[]): CircularBuffer<TValue>;
clone(): CircularBuffer<TValue>;
getValue(index: number): TValue;
setValue(index: number, value: TValue): void;
/**
* returns the value stored at the index and sets the provided value
*/
getSetValue(index: number, value: TValue): TValue;
protected constructor(values: TValue[]);
private getAdjustedIndex;
}
//# sourceMappingURL=circular-buffer.d.ts.map