@constructorfleet/ultimate-govee
Version:
Library for interacting with Govee devices written in Typescript.
42 lines • 1.53 kB
TypeScript
/**
* Represents a fixed-length Last-In-First-Out (LIFO) stack that stores elements of type T.
*/
export declare class FixedLengthStack<T> {
private stack;
private readonly maxSize;
/**
* Creates a new FixedLengthStack instance with the specified maximum size.
* @param maxSize The maximum number of elements that the stack can hold (must be greater than 0).
*/
constructor(maxSize: number);
/**
* Retrieves the element at the front of the stack (the most recently added item) without removing it.
* @returns The element at the front of the stack, or undefined if the stack is empty.
*/
peek(): T | undefined;
/**
* Retrieves the elements in the stack without removing them.
* @returns The elements in the stack.
*/
peekAll(): T[] | undefined;
/**
* Adds an item to the end of the stack. If the stack is full, the oldest item is removed.
* @param item The item to add to the stack.
*/
enstack(item: T): void;
/**
* Removes and returns the item at the front of the stack. If the stack is empty, returns undefined.
* @returns The item at the front of the stack, or undefined if the stack is empty.
*/
destack(): T | undefined;
/**
* Returns the current size of the stack.
* @returns The number of elements in the stack.
*/
size(): number;
/**
* Clears all elements from the stack, making it empty.
*/
clear(): void;
}
//# sourceMappingURL=fixed-length-stack.d.ts.map