Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
// Copyright Jerome Benoit. 2023. All Rights Reserved.
/**
// Copyright Jerome Benoit. 2023. All Rights Reserved.
/**
- * @typeParam T - Type of node data.
+ * @typeParam T - Type of linked list node data.
+export class LinkedListNode<T> {
- public next?: Node<T>
- public prev?: Node<T>
+ public next?: LinkedListNode<T>
+ public prev?: LinkedListNode<T>
public constructor (data: T) {
this.data = data
public constructor (data: T) {
this.data = data
* @internal
*/
export class Deque<T> {
* @internal
*/
export class Deque<T> {
- private head?: Node<T>
- private tail?: Node<T>
+ private head?: LinkedListNode<T>
+ private tail?: LinkedListNode<T>
/** The size of the deque. */
public size!: number
/** The maximum size of the deque. */
/** The size of the deque. */
public size!: number
/** The maximum size of the deque. */
* @returns The new size of the queue.
*/
public push (data: T): number {
* @returns The new size of the queue.
*/
public push (data: T): number {
- const node = new Node(data)
+ const node = new LinkedListNode(data)
if (this.tail == null) {
this.head = this.tail = node
} else {
if (this.tail == null) {
this.head = this.tail = node
} else {
* @returns The new size of the queue.
*/
public unshift (data: T): number {
* @returns The new size of the queue.
*/
public unshift (data: T): number {
- const node = new Node(data)
+ const node = new LinkedListNode(data)
if (this.head == null) {
this.head = this.tail = node
} else {
if (this.head == null) {
this.head = this.tail = node
} else {
Writable
} from './utility-types.js'
export type { CircularArray } from './circular-array.js'
Writable
} from './utility-types.js'
export type { CircularArray } from './circular-array.js'
-export type { Deque, Node } from './deque.js'
+export type { Deque, LinkedListNode } from './deque.js'
export { availableParallelism } from './utils.js'
export { availableParallelism } from './utils.js'