UNPKG

sb-element

Version:

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.0.1. It is a component library constructed around the SCSS library [Sb-Theming](https://github.com/SeverinBuchser/SbTheming) and supports [Angular Schematics]

53 lines (52 loc) 1.71 kB
/** * A queue class with basic queue operations. * * The queue class handles dequeuing and enqueuing of elements, as well as * length management. The [dequeue]{@link #dequeue} method checks for an empty * queue, but does not produce an error if the queue is empty. Instead it * returns `undefinded`. */ export declare class Queue<T> { /** * The actual queue, which holds the elements. */ private queue; /** * Enqueues an element into the `Queue`. * * It appends an element to the [queue]{@link #queue} `Array`. * * @param{T} value The element to add to the `Queue` */ enqueue(value: T): void; /** * Removes (dequeues) the next element in the `Queue`. * * The next element is the first element of the [queue]{@link #queue} `Array`. * The method therefore gets the first element of this `Array` and shifts the * `Array` by one to the left. * * If the `Queue` is empty (the [queue]{@link #queue} `Array` is empty), the * method will return `undefined` instead of throwing an error. * * @returns{T | undefined} The first element in the queue or `undefined` if the * `Queue` is empty */ dequeue(): T | undefined; /** * Gets the current length of the `Queue`. * * The method returns the length of the [queue]{@link #queue} `Array`. * * @returns{number} The length of the `Queue` */ get length(): number; /** * Checks if the `Queue` is empty or not. * * The `Queue` if the [queue]{@link #queue} `Array` is empty. * * @returns{boolean} `true` if the queue is empty or `false` otherwise */ isEmpty(): boolean; }