-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1fe1f88
commit 77ce836
Showing
6 changed files
with
506 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,64 @@ | ||
/** @public */ | ||
export declare class CircularBuffer { | ||
/** | ||
* The buffer | ||
* The buffer. | ||
*/ | ||
private buffer; | ||
|
||
/** | ||
* The buffer limit | ||
* The buffer size limit. | ||
*/ | ||
private limit; | ||
|
||
/** | ||
* Create a new circular buffer | ||
* Create a new circular buffer. | ||
* | ||
* @param limit - the buffer size limit | ||
* @throws if the provided limit is not a positive integer | ||
* @param limit - The buffer size limit. | ||
* @throws if the provided limit is not a positive integer. | ||
*/ | ||
constructor({ limit }: { | ||
limit: number; | ||
}); | ||
|
||
/** | ||
* Get the current state of the buffer | ||
* Get the current state of the buffer. | ||
* | ||
* @returns the contents of the buffer. | ||
*/ | ||
current(): string; | ||
|
||
/** | ||
* Get the content at the specific position in the buffer. | ||
* | ||
* @param index - the position in the buffer. | ||
* @returns the content at the specified position. | ||
* @throws if the index is out of bounds. | ||
*/ | ||
get(): string; | ||
get(index: number): string; | ||
|
||
/** | ||
* Reset the buffer, fill it with empty strings | ||
* Reset the buffer, fill it with empty strings. | ||
* | ||
* @returns no return value. | ||
*/ | ||
reset(): void; | ||
|
||
/** | ||
* Move the buffer forward by one position and add | ||
* the provided value at the end of the buffer, if | ||
* the buffer is full, the oldest value is removed | ||
* Move the buffer forward by one position and add the provided | ||
* value at the end of the buffer, if the buffer is full, the | ||
* oldest value is removed. | ||
* | ||
* @param value - the value to add to the buffer | ||
* @param value - the value to add to the buffer. | ||
* @returns no return value. | ||
*/ | ||
forward(value: string): void; | ||
|
||
/** | ||
* Move the buffer backward by one position, removing | ||
* the last value, if the buffer becomes empty, an empty | ||
* string is added at the beginning | ||
* Move the buffer backward by one position, removing the last | ||
* value, if the buffer becomes empty, an empty string is added | ||
* at the beginning. | ||
* | ||
* @returns no return value. | ||
*/ | ||
rewind(): void; | ||
} |
Oops, something went wrong.