Initial release for SPT 3.9

This commit is contained in:
2024-07-20 18:08:38 +02:00
parent 7df25ba694
commit c83da69a3e
713 changed files with 34110 additions and 1 deletions

View File

@@ -0,0 +1,56 @@
export declare class LinkedList<T> {
private head?;
private tail?;
private _length;
get length(): number;
private set length(value);
constructor();
/**
* Adds an element to the start of the list.
*/
prepend(value: T): void;
/**
* Adds an element at the given index to the list.
*/
insertAt(value: T, idx: number): void;
/**
* Adds an element to the end of the list.
*/
append(value: T): void;
/**
* Returns the first element's value.
*/
getHead(): T | undefined;
/**
* Finds the element from the list at the given index and returns it's value.
*/
get(idx: number): T | undefined;
/**
* Returns the last element's value.
*/
getTail(): T | undefined;
/**
* Finds and removes the first element from a list that has a value equal to the given value, returns it's value if it successfully removed it.
*/
remove(value: T): T | undefined;
/**
* Removes the first element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified.
*/
shift(): T | undefined;
/**
* Removes the element from the list at the given index and returns it's value.
*/
removeAt(idx: number): T | undefined;
/**
* Removes the last element from the list and returns it's value. If the list is empty, undefined is returned and the list is not modified.
*/
pop(): T | undefined;
/**
* Returns an iterable of index, value pairs for every entry in the list.
*/
entries(): IterableIterator<[number, T | undefined]>;
/**
* Returns an iterable of values in the list.
*/
values(): IterableIterator<T>;
}

View File

@@ -0,0 +1,6 @@
export declare class LinkedListNode<T> {
value: T;
prev?: LinkedListNode<T>;
next?: LinkedListNode<T>;
constructor(value: T, prev?: LinkedListNode<T>, next?: LinkedListNode<T>);
}

View File

@@ -0,0 +1,21 @@
export declare class Queue<T> {
private list;
get length(): number;
constructor();
/**
* Adds an element to the end of the queue.
*/
enqueue(element: T): void;
/**
* Iterates over the elements received and adds each one to the end of the queue.
*/
enqueueAll(elements: T[]): void;
/**
* Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified.
*/
dequeue(): T | undefined;
/**
* Returns the first element's value.
*/
peek(): T | undefined;
}