Add stub implementation for my best friend, the humble circular queue

Add stubs for a custom circular queue implementation for the historical data in the parking repo
This commit is contained in:
2025-07-01 22:01:07 -04:00
parent 4758d566da
commit 18be03bfa6

View File

@@ -0,0 +1,27 @@
export class CircularQueue<T> {
private startIndex: number;
private endIndex: number;
private _data: T[];
constructor(
size: number,
) {
// See the Mozilla documentation on sparse arrays (*not* undefined values)
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Indexed_collections#sparse_arrays
this._data = new Array<T>(size);
this.startIndex = 0;
this.endIndex = size - 1;
}
appendWithSorting = (
data: T,
sortingCallback: ((a: T, b: T) => number) | undefined
) => {
// In case something is added that's not sorted, the sortingCallback
// will be used to sort
}
popFront = (data: T) => {
}
}