Bump packages to fix linter
This commit is contained in:
parent
ed9506bbaf
commit
0a11e3fdd9
6063 changed files with 378752 additions and 306784 deletions
7
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.d.ts
generated
vendored
Normal file
7
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { ContainerIterator } from "../../ContainerBase";
|
||||
export declare abstract class RandomIterator<T> extends ContainerIterator<T> {
|
||||
get pointer(): T;
|
||||
set pointer(newValue: T);
|
||||
pre(): this;
|
||||
next(): this;
|
||||
}
|
||||
67
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js
generated
vendored
Normal file
67
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.RandomIterator = void 0;
|
||||
|
||||
var _ContainerBase = require("../../ContainerBase");
|
||||
|
||||
var _throwError = require("../../../utils/throwError");
|
||||
|
||||
class RandomIterator extends _ContainerBase.ContainerIterator {
|
||||
constructor(t, r, i, s, h) {
|
||||
super(h);
|
||||
this.o = t;
|
||||
this.D = r;
|
||||
this.R = i;
|
||||
this.N = s;
|
||||
if (this.iteratorType === 0) {
|
||||
this.pre = function() {
|
||||
if (this.o === 0) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o -= 1;
|
||||
return this;
|
||||
};
|
||||
this.next = function() {
|
||||
if (this.o === this.D()) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o += 1;
|
||||
return this;
|
||||
};
|
||||
} else {
|
||||
this.pre = function() {
|
||||
if (this.o === this.D() - 1) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o += 1;
|
||||
return this;
|
||||
};
|
||||
this.next = function() {
|
||||
if (this.o === -1) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o -= 1;
|
||||
return this;
|
||||
};
|
||||
}
|
||||
}
|
||||
get pointer() {
|
||||
if (this.o < 0 || this.o > this.D() - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
return this.R(this.o);
|
||||
}
|
||||
set pointer(t) {
|
||||
if (this.o < 0 || this.o > this.D() - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
this.N(this.o, t);
|
||||
}
|
||||
}
|
||||
|
||||
exports.RandomIterator = RandomIterator;
|
||||
//# sourceMappingURL=RandomIterator.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
67
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.d.ts
generated
vendored
Normal file
67
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import { Container } from "../../ContainerBase";
|
||||
declare abstract class SequentialContainer<T> extends Container<T> {
|
||||
/**
|
||||
* @description Push the element to the back.
|
||||
* @param element - The element you want to push.
|
||||
* @returns The size of container after pushing.
|
||||
*/
|
||||
abstract pushBack(element: T): number;
|
||||
/**
|
||||
* @description Removes the last element.
|
||||
* @returns The element you popped.
|
||||
*/
|
||||
abstract popBack(): T | undefined;
|
||||
/**
|
||||
* @description Sets element by position.
|
||||
* @param pos - The position you want to change.
|
||||
* @param element - The element's value you want to update.
|
||||
* @example
|
||||
* container.setElementByPos(-1, 1); // throw a RangeError
|
||||
*/
|
||||
abstract setElementByPos(pos: number, element: T): void;
|
||||
/**
|
||||
* @description Removes the elements of the specified value.
|
||||
* @param value - The value you want to remove.
|
||||
* @returns The size of container after erasing.
|
||||
* @example
|
||||
* container.eraseElementByValue(-1);
|
||||
*/
|
||||
abstract eraseElementByValue(value: T): number;
|
||||
/**
|
||||
* @description Insert several elements after the specified position.
|
||||
* @param pos - The position you want to insert.
|
||||
* @param element - The element you want to insert.
|
||||
* @param num - The number of elements you want to insert (default 1).
|
||||
* @returns The size of container after inserting.
|
||||
* @example
|
||||
* const container = new Vector([1, 2, 3]);
|
||||
* container.insert(1, 4); // [1, 4, 2, 3]
|
||||
* container.insert(1, 5, 3); // [1, 5, 5, 5, 4, 2, 3]
|
||||
*/
|
||||
abstract insert(pos: number, element: T, num?: number): number;
|
||||
/**
|
||||
* @description Reverses the container.
|
||||
* @example
|
||||
* const container = new Vector([1, 2, 3]);
|
||||
* container.reverse(); // [3, 2, 1]
|
||||
*/
|
||||
abstract reverse(): void;
|
||||
/**
|
||||
* @description Removes the duplication of elements in the container.
|
||||
* @returns The size of container after inserting.
|
||||
* @example
|
||||
* const container = new Vector([1, 1, 3, 2, 2, 5, 5, 2]);
|
||||
* container.unique(); // [1, 3, 2, 5, 2]
|
||||
*/
|
||||
abstract unique(): number;
|
||||
/**
|
||||
* @description Sort the container.
|
||||
* @param cmp - Comparison function to sort.
|
||||
* @example
|
||||
* const container = new Vector([3, 1, 10]);
|
||||
* container.sort(); // [1, 10, 3]
|
||||
* container.sort((x, y) => x - y); // [1, 3, 10]
|
||||
*/
|
||||
abstract sort(cmp?: (x: T, y: T) => number): void;
|
||||
}
|
||||
export default SequentialContainer;
|
||||
16
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.js
generated
vendored
Normal file
16
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _ContainerBase = require("../../ContainerBase");
|
||||
|
||||
class SequentialContainer extends _ContainerBase.Container {}
|
||||
|
||||
var _default = SequentialContainer;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["container/SequentialContainer/Base/index.js","../../src/container/SequentialContainer/Base/index.ts"],"names":["Object","defineProperty","exports","value","default","_ContainerBase","require","SequentialContainer","Container","_default"],"mappings":"AAAA;;AAEAA,OAAOC,eAAeC,SAAS,KAAc;IAC3CC,OAAO;;;AAETD,QAAQE,eAAe;;ACLvB,IAAAC,iBAAAC,QAAA;;AAEA,MAAeC,4BAA+BC,eAAAA;;AAgE7C,IAAAC,WAEcF;;AAAmBL,QAAAE,UAAAK","file":"index.js","sourcesContent":[null,"import { Container } from '@/container/ContainerBase';\n\nabstract class SequentialContainer<T> extends Container<T> {\n /**\n * @description Push the element to the back.\n * @param element - The element you want to push.\n * @returns The size of container after pushing.\n */\n abstract pushBack(element: T): number;\n /**\n * @description Removes the last element.\n * @returns The element you popped.\n */\n abstract popBack(): T | undefined;\n /**\n * @description Sets element by position.\n * @param pos - The position you want to change.\n * @param element - The element's value you want to update.\n * @example\n * container.setElementByPos(-1, 1); // throw a RangeError\n */\n abstract setElementByPos(pos: number, element: T): void;\n /**\n * @description Removes the elements of the specified value.\n * @param value - The value you want to remove.\n * @returns The size of container after erasing.\n * @example\n * container.eraseElementByValue(-1);\n */\n abstract eraseElementByValue(value: T): number;\n /**\n * @description Insert several elements after the specified position.\n * @param pos - The position you want to insert.\n * @param element - The element you want to insert.\n * @param num - The number of elements you want to insert (default 1).\n * @returns The size of container after inserting.\n * @example\n * const container = new Vector([1, 2, 3]);\n * container.insert(1, 4); // [1, 4, 2, 3]\n * container.insert(1, 5, 3); // [1, 5, 5, 5, 4, 2, 3]\n */\n abstract insert(pos: number, element: T, num?: number): number;\n /**\n * @description Reverses the container.\n * @example\n * const container = new Vector([1, 2, 3]);\n * container.reverse(); // [3, 2, 1]\n */\n abstract reverse(): void;\n /**\n * @description Removes the duplication of elements in the container.\n * @returns The size of container after inserting.\n * @example\n * const container = new Vector([1, 1, 3, 2, 2, 5, 5, 2]);\n * container.unique(); // [1, 3, 2, 5, 2]\n */\n abstract unique(): number;\n /**\n * @description Sort the container.\n * @param cmp - Comparison function to sort.\n * @example\n * const container = new Vector([3, 1, 10]);\n * container.sort(); // [1, 10, 3]\n * container.sort((x, y) => x - y); // [1, 3, 10]\n */\n abstract sort(cmp?: (x: T, y: T) => number): void;\n}\n\nexport default SequentialContainer;\n"]}
|
||||
56
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.d.ts
generated
vendored
Normal file
56
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import SequentialContainer from './Base';
|
||||
import { initContainer } from "../ContainerBase";
|
||||
import { RandomIterator } from "./Base/RandomIterator";
|
||||
declare class DequeIterator<T> extends RandomIterator<T> {
|
||||
copy(): DequeIterator<T>;
|
||||
equals(iter: DequeIterator<T>): boolean;
|
||||
}
|
||||
export type { DequeIterator };
|
||||
declare class Deque<T> extends SequentialContainer<T> {
|
||||
constructor(container?: initContainer<T>, _bucketSize?: number);
|
||||
clear(): void;
|
||||
begin(): DequeIterator<T>;
|
||||
end(): DequeIterator<T>;
|
||||
rBegin(): DequeIterator<T>;
|
||||
rEnd(): DequeIterator<T>;
|
||||
front(): T | undefined;
|
||||
back(): T | undefined;
|
||||
pushBack(element: T): number;
|
||||
popBack(): T | undefined;
|
||||
/**
|
||||
* @description Push the element to the front.
|
||||
* @param element - The element you want to push.
|
||||
* @returns The size of queue after pushing.
|
||||
*/
|
||||
pushFront(element: T): number;
|
||||
/**
|
||||
* @description Remove the _first element.
|
||||
* @returns The element you popped.
|
||||
*/
|
||||
popFront(): T | undefined;
|
||||
getElementByPos(pos: number): T;
|
||||
setElementByPos(pos: number, element: T): void;
|
||||
insert(pos: number, element: T, num?: number): number;
|
||||
/**
|
||||
* @description Remove all elements after the specified position (excluding the specified position).
|
||||
* @param pos - The previous position of the first removed element.
|
||||
* @returns The size of the container after cutting.
|
||||
* @example
|
||||
* deque.cut(1); // Then deque's size will be 2. deque -> [0, 1]
|
||||
*/
|
||||
cut(pos: number): number;
|
||||
eraseElementByPos(pos: number): number;
|
||||
eraseElementByValue(value: T): number;
|
||||
eraseElementByIterator(iter: DequeIterator<T>): DequeIterator<T>;
|
||||
find(element: T): DequeIterator<T>;
|
||||
reverse(): void;
|
||||
unique(): number;
|
||||
sort(cmp?: (x: T, y: T) => number): void;
|
||||
/**
|
||||
* @description Remove as much useless space as possible.
|
||||
*/
|
||||
shrinkToFit(): void;
|
||||
forEach(callback: (element: T, index: number, deque: Deque<T>) => void): void;
|
||||
[Symbol.iterator](): Generator<T, void, unknown>;
|
||||
}
|
||||
export default Deque;
|
||||
343
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.js
generated
vendored
Normal file
343
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.js
generated
vendored
Normal file
|
|
@ -0,0 +1,343 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _Base = _interopRequireDefault(require("./Base"));
|
||||
|
||||
var _RandomIterator = require("./Base/RandomIterator");
|
||||
|
||||
function _interopRequireDefault(t) {
|
||||
return t && t.t ? t : {
|
||||
default: t
|
||||
};
|
||||
}
|
||||
|
||||
class DequeIterator extends _RandomIterator.RandomIterator {
|
||||
copy() {
|
||||
return new DequeIterator(this.o, this.D, this.R, this.N, this.iteratorType);
|
||||
}
|
||||
}
|
||||
|
||||
class Deque extends _Base.default {
|
||||
constructor(t = [], s = 1 << 12) {
|
||||
super();
|
||||
this.P = 0;
|
||||
this.A = 0;
|
||||
this.F = 0;
|
||||
this.j = 0;
|
||||
this.O = 0;
|
||||
this.T = [];
|
||||
let i;
|
||||
if ("size" in t) {
|
||||
if (typeof t.size === "number") {
|
||||
i = t.size;
|
||||
} else {
|
||||
i = t.size();
|
||||
}
|
||||
} else if ("length" in t) {
|
||||
i = t.length;
|
||||
} else {
|
||||
throw new RangeError("Can't get container's size!");
|
||||
}
|
||||
this.V = s;
|
||||
this.O = Math.max(Math.ceil(i / this.V), 1);
|
||||
for (let t = 0; t < this.O; ++t) {
|
||||
this.T.push(new Array(this.V));
|
||||
}
|
||||
const h = Math.ceil(i / this.V);
|
||||
this.P = this.F = (this.O >> 1) - (h >> 1);
|
||||
this.A = this.j = this.V - i % this.V >> 1;
|
||||
const e = this;
|
||||
t.forEach((function(t) {
|
||||
e.pushBack(t);
|
||||
}));
|
||||
this.size = this.size.bind(this);
|
||||
this.getElementByPos = this.getElementByPos.bind(this);
|
||||
this.setElementByPos = this.setElementByPos.bind(this);
|
||||
}
|
||||
G() {
|
||||
const t = [];
|
||||
const s = Math.max(this.O >> 1, 1);
|
||||
for (let i = 0; i < s; ++i) {
|
||||
t[i] = new Array(this.V);
|
||||
}
|
||||
for (let s = this.P; s < this.O; ++s) {
|
||||
t[t.length] = this.T[s];
|
||||
}
|
||||
for (let s = 0; s < this.F; ++s) {
|
||||
t[t.length] = this.T[s];
|
||||
}
|
||||
t[t.length] = [ ...this.T[this.F] ];
|
||||
this.P = s;
|
||||
this.F = t.length - 1;
|
||||
for (let i = 0; i < s; ++i) {
|
||||
t[t.length] = new Array(this.V);
|
||||
}
|
||||
this.T = t;
|
||||
this.O = t.length;
|
||||
}
|
||||
J(t) {
|
||||
const s = this.A + t + 1;
|
||||
const i = s % this.V;
|
||||
let h = i - 1;
|
||||
let e = this.P + (s - i) / this.V;
|
||||
if (i === 0) e -= 1;
|
||||
e %= this.O;
|
||||
if (h < 0) h += this.V;
|
||||
return {
|
||||
curNodeBucketIndex: e,
|
||||
curNodePointerIndex: h
|
||||
};
|
||||
}
|
||||
clear() {
|
||||
this.T = [ [] ];
|
||||
this.O = 1;
|
||||
this.P = this.F = this.i = 0;
|
||||
this.A = this.j = this.V >> 1;
|
||||
}
|
||||
begin() {
|
||||
return new DequeIterator(0, this.size, this.getElementByPos, this.setElementByPos);
|
||||
}
|
||||
end() {
|
||||
return new DequeIterator(this.i, this.size, this.getElementByPos, this.setElementByPos);
|
||||
}
|
||||
rBegin() {
|
||||
return new DequeIterator(this.i - 1, this.size, this.getElementByPos, this.setElementByPos, 1);
|
||||
}
|
||||
rEnd() {
|
||||
return new DequeIterator(-1, this.size, this.getElementByPos, this.setElementByPos, 1);
|
||||
}
|
||||
front() {
|
||||
return this.T[this.P][this.A];
|
||||
}
|
||||
back() {
|
||||
return this.T[this.F][this.j];
|
||||
}
|
||||
pushBack(t) {
|
||||
if (this.i) {
|
||||
if (this.j < this.V - 1) {
|
||||
this.j += 1;
|
||||
} else if (this.F < this.O - 1) {
|
||||
this.F += 1;
|
||||
this.j = 0;
|
||||
} else {
|
||||
this.F = 0;
|
||||
this.j = 0;
|
||||
}
|
||||
if (this.F === this.P && this.j === this.A) this.G();
|
||||
}
|
||||
this.i += 1;
|
||||
this.T[this.F][this.j] = t;
|
||||
return this.i;
|
||||
}
|
||||
popBack() {
|
||||
if (this.i === 0) return;
|
||||
const t = this.T[this.F][this.j];
|
||||
delete this.T[this.F][this.j];
|
||||
if (this.i !== 1) {
|
||||
if (this.j > 0) {
|
||||
this.j -= 1;
|
||||
} else if (this.F > 0) {
|
||||
this.F -= 1;
|
||||
this.j = this.V - 1;
|
||||
} else {
|
||||
this.F = this.O - 1;
|
||||
this.j = this.V - 1;
|
||||
}
|
||||
}
|
||||
this.i -= 1;
|
||||
return t;
|
||||
}
|
||||
pushFront(t) {
|
||||
if (this.i) {
|
||||
if (this.A > 0) {
|
||||
this.A -= 1;
|
||||
} else if (this.P > 0) {
|
||||
this.P -= 1;
|
||||
this.A = this.V - 1;
|
||||
} else {
|
||||
this.P = this.O - 1;
|
||||
this.A = this.V - 1;
|
||||
}
|
||||
if (this.P === this.F && this.A === this.j) this.G();
|
||||
}
|
||||
this.i += 1;
|
||||
this.T[this.P][this.A] = t;
|
||||
return this.i;
|
||||
}
|
||||
popFront() {
|
||||
if (this.i === 0) return;
|
||||
const t = this.T[this.P][this.A];
|
||||
delete this.T[this.P][this.A];
|
||||
if (this.i !== 1) {
|
||||
if (this.A < this.V - 1) {
|
||||
this.A += 1;
|
||||
} else if (this.P < this.O - 1) {
|
||||
this.P += 1;
|
||||
this.A = 0;
|
||||
} else {
|
||||
this.P = 0;
|
||||
this.A = 0;
|
||||
}
|
||||
}
|
||||
this.i -= 1;
|
||||
return t;
|
||||
}
|
||||
getElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
const {curNodeBucketIndex: s, curNodePointerIndex: i} = this.J(t);
|
||||
return this.T[s][i];
|
||||
}
|
||||
setElementByPos(t, s) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
const {curNodeBucketIndex: i, curNodePointerIndex: h} = this.J(t);
|
||||
this.T[i][h] = s;
|
||||
}
|
||||
insert(t, s, i = 1) {
|
||||
if (t < 0 || t > this.i) {
|
||||
throw new RangeError;
|
||||
}
|
||||
if (t === 0) {
|
||||
while (i--) this.pushFront(s);
|
||||
} else if (t === this.i) {
|
||||
while (i--) this.pushBack(s);
|
||||
} else {
|
||||
const h = [];
|
||||
for (let s = t; s < this.i; ++s) {
|
||||
h.push(this.getElementByPos(s));
|
||||
}
|
||||
this.cut(t - 1);
|
||||
for (let t = 0; t < i; ++t) this.pushBack(s);
|
||||
for (let t = 0; t < h.length; ++t) this.pushBack(h[t]);
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
cut(t) {
|
||||
if (t < 0) {
|
||||
this.clear();
|
||||
return 0;
|
||||
}
|
||||
const {curNodeBucketIndex: s, curNodePointerIndex: i} = this.J(t);
|
||||
this.F = s;
|
||||
this.j = i;
|
||||
this.i = t + 1;
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
if (t === 0) this.popFront(); else if (t === this.i - 1) this.popBack(); else {
|
||||
const s = [];
|
||||
for (let i = t + 1; i < this.i; ++i) {
|
||||
s.push(this.getElementByPos(i));
|
||||
}
|
||||
this.cut(t);
|
||||
this.popBack();
|
||||
const i = this;
|
||||
s.forEach((function(t) {
|
||||
i.pushBack(t);
|
||||
}));
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByValue(t) {
|
||||
if (this.i === 0) return 0;
|
||||
const s = [];
|
||||
for (let i = 0; i < this.i; ++i) {
|
||||
const h = this.getElementByPos(i);
|
||||
if (h !== t) s.push(h);
|
||||
}
|
||||
const i = s.length;
|
||||
for (let t = 0; t < i; ++t) this.setElementByPos(t, s[t]);
|
||||
return this.cut(i - 1);
|
||||
}
|
||||
eraseElementByIterator(t) {
|
||||
const s = t.o;
|
||||
this.eraseElementByPos(s);
|
||||
t = t.next();
|
||||
return t;
|
||||
}
|
||||
find(t) {
|
||||
for (let s = 0; s < this.i; ++s) {
|
||||
if (this.getElementByPos(s) === t) {
|
||||
return new DequeIterator(s, this.size, this.getElementByPos, this.setElementByPos);
|
||||
}
|
||||
}
|
||||
return this.end();
|
||||
}
|
||||
reverse() {
|
||||
let t = 0;
|
||||
let s = this.i - 1;
|
||||
while (t < s) {
|
||||
const i = this.getElementByPos(t);
|
||||
this.setElementByPos(t, this.getElementByPos(s));
|
||||
this.setElementByPos(s, i);
|
||||
t += 1;
|
||||
s -= 1;
|
||||
}
|
||||
}
|
||||
unique() {
|
||||
if (this.i <= 1) {
|
||||
return this.i;
|
||||
}
|
||||
let t = 1;
|
||||
let s = this.getElementByPos(0);
|
||||
for (let i = 1; i < this.i; ++i) {
|
||||
const h = this.getElementByPos(i);
|
||||
if (h !== s) {
|
||||
s = h;
|
||||
this.setElementByPos(t++, h);
|
||||
}
|
||||
}
|
||||
while (this.i > t) this.popBack();
|
||||
return this.i;
|
||||
}
|
||||
sort(t) {
|
||||
const s = [];
|
||||
for (let t = 0; t < this.i; ++t) {
|
||||
s.push(this.getElementByPos(t));
|
||||
}
|
||||
s.sort(t);
|
||||
for (let t = 0; t < this.i; ++t) this.setElementByPos(t, s[t]);
|
||||
}
|
||||
shrinkToFit() {
|
||||
if (this.i === 0) return;
|
||||
const t = [];
|
||||
this.forEach((function(s) {
|
||||
t.push(s);
|
||||
}));
|
||||
this.O = Math.max(Math.ceil(this.i / this.V), 1);
|
||||
this.i = this.P = this.F = this.A = this.j = 0;
|
||||
this.T = [];
|
||||
for (let t = 0; t < this.O; ++t) {
|
||||
this.T.push(new Array(this.V));
|
||||
}
|
||||
for (let s = 0; s < t.length; ++s) this.pushBack(t[s]);
|
||||
}
|
||||
forEach(t) {
|
||||
for (let s = 0; s < this.i; ++s) {
|
||||
t(this.getElementByPos(s), s, this);
|
||||
}
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return function*() {
|
||||
for (let t = 0; t < this.i; ++t) {
|
||||
yield this.getElementByPos(t);
|
||||
}
|
||||
}.bind(this)();
|
||||
}
|
||||
}
|
||||
|
||||
var _default = Deque;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=Deque.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
57
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.d.ts
generated
vendored
Normal file
57
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import SequentialContainer from './Base';
|
||||
import { ContainerIterator, initContainer } from "../ContainerBase";
|
||||
declare class LinkListIterator<T> extends ContainerIterator<T> {
|
||||
get pointer(): T;
|
||||
set pointer(newValue: T);
|
||||
copy(): LinkListIterator<T>;
|
||||
equals(iter: LinkListIterator<T>): boolean;
|
||||
pre(): this;
|
||||
next(): this;
|
||||
}
|
||||
export type { LinkListIterator };
|
||||
declare class LinkList<T> extends SequentialContainer<T> {
|
||||
constructor(container?: initContainer<T>);
|
||||
clear(): void;
|
||||
begin(): LinkListIterator<T>;
|
||||
end(): LinkListIterator<T>;
|
||||
rBegin(): LinkListIterator<T>;
|
||||
rEnd(): LinkListIterator<T>;
|
||||
front(): T | undefined;
|
||||
back(): T | undefined;
|
||||
getElementByPos(pos: number): T;
|
||||
eraseElementByPos(pos: number): number;
|
||||
eraseElementByValue(_value: T): number;
|
||||
eraseElementByIterator(iter: LinkListIterator<T>): LinkListIterator<T>;
|
||||
pushBack(element: T): number;
|
||||
popBack(): T | undefined;
|
||||
/**
|
||||
* @description Push an element to the front.
|
||||
* @param element - The element you want to push.
|
||||
* @returns The size of queue after pushing.
|
||||
*/
|
||||
pushFront(element: T): number;
|
||||
/**
|
||||
* @description Removes the first element.
|
||||
* @returns The element you popped.
|
||||
*/
|
||||
popFront(): T | undefined;
|
||||
setElementByPos(pos: number, element: T): void;
|
||||
insert(pos: number, element: T, num?: number): number;
|
||||
find(element: T): LinkListIterator<T>;
|
||||
reverse(): void;
|
||||
unique(): number;
|
||||
sort(cmp?: (x: T, y: T) => number): void;
|
||||
/**
|
||||
* @description Merges two sorted lists.
|
||||
* @param list - The other list you want to merge (must be sorted).
|
||||
* @returns The size of list after merging.
|
||||
* @example
|
||||
* const linkA = new LinkList([1, 3, 5]);
|
||||
* const linkB = new LinkList([2, 4, 6]);
|
||||
* linkA.merge(linkB); // [1, 2, 3, 4, 5];
|
||||
*/
|
||||
merge(list: LinkList<T>): number;
|
||||
forEach(callback: (element: T, index: number, list: LinkList<T>) => void): void;
|
||||
[Symbol.iterator](): Generator<T, void, unknown>;
|
||||
}
|
||||
export default LinkList;
|
||||
329
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.js
generated
vendored
Normal file
329
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.js
generated
vendored
Normal file
|
|
@ -0,0 +1,329 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _Base = _interopRequireDefault(require("./Base"));
|
||||
|
||||
var _ContainerBase = require("../ContainerBase");
|
||||
|
||||
var _throwError = require("../../utils/throwError");
|
||||
|
||||
function _interopRequireDefault(t) {
|
||||
return t && t.t ? t : {
|
||||
default: t
|
||||
};
|
||||
}
|
||||
|
||||
class LinkListIterator extends _ContainerBase.ContainerIterator {
|
||||
constructor(t, i, s) {
|
||||
super(s);
|
||||
this.o = t;
|
||||
this.h = i;
|
||||
if (this.iteratorType === 0) {
|
||||
this.pre = function() {
|
||||
if (this.o.L === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o = this.o.L;
|
||||
return this;
|
||||
};
|
||||
this.next = function() {
|
||||
if (this.o === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o = this.o.B;
|
||||
return this;
|
||||
};
|
||||
} else {
|
||||
this.pre = function() {
|
||||
if (this.o.B === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o = this.o.B;
|
||||
return this;
|
||||
};
|
||||
this.next = function() {
|
||||
if (this.o === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o = this.o.L;
|
||||
return this;
|
||||
};
|
||||
}
|
||||
}
|
||||
get pointer() {
|
||||
if (this.o === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
return this.o.l;
|
||||
}
|
||||
set pointer(t) {
|
||||
if (this.o === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o.l = t;
|
||||
}
|
||||
copy() {
|
||||
return new LinkListIterator(this.o, this.h, this.iteratorType);
|
||||
}
|
||||
}
|
||||
|
||||
class LinkList extends _Base.default {
|
||||
constructor(t = []) {
|
||||
super();
|
||||
this.h = {};
|
||||
this.p = this._ = this.h.L = this.h.B = this.h;
|
||||
const i = this;
|
||||
t.forEach((function(t) {
|
||||
i.pushBack(t);
|
||||
}));
|
||||
}
|
||||
K(t) {
|
||||
const {L: i, B: s} = t;
|
||||
i.B = s;
|
||||
s.L = i;
|
||||
if (t === this.p) {
|
||||
this.p = s;
|
||||
}
|
||||
if (t === this._) {
|
||||
this._ = i;
|
||||
}
|
||||
this.i -= 1;
|
||||
}
|
||||
U(t, i) {
|
||||
const s = i.B;
|
||||
const r = {
|
||||
l: t,
|
||||
L: i,
|
||||
B: s
|
||||
};
|
||||
i.B = r;
|
||||
s.L = r;
|
||||
if (i === this.h) {
|
||||
this.p = r;
|
||||
}
|
||||
if (s === this.h) {
|
||||
this._ = r;
|
||||
}
|
||||
this.i += 1;
|
||||
}
|
||||
clear() {
|
||||
this.i = 0;
|
||||
this.p = this._ = this.h.L = this.h.B = this.h;
|
||||
}
|
||||
begin() {
|
||||
return new LinkListIterator(this.p, this.h);
|
||||
}
|
||||
end() {
|
||||
return new LinkListIterator(this.h, this.h);
|
||||
}
|
||||
rBegin() {
|
||||
return new LinkListIterator(this._, this.h, 1);
|
||||
}
|
||||
rEnd() {
|
||||
return new LinkListIterator(this.h, this.h, 1);
|
||||
}
|
||||
front() {
|
||||
return this.p.l;
|
||||
}
|
||||
back() {
|
||||
return this._.l;
|
||||
}
|
||||
getElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
let i = this.p;
|
||||
while (t--) {
|
||||
i = i.B;
|
||||
}
|
||||
return i.l;
|
||||
}
|
||||
eraseElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
let i = this.p;
|
||||
while (t--) {
|
||||
i = i.B;
|
||||
}
|
||||
this.K(i);
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByValue(t) {
|
||||
let i = this.p;
|
||||
while (i !== this.h) {
|
||||
if (i.l === t) {
|
||||
this.K(i);
|
||||
}
|
||||
i = i.B;
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByIterator(t) {
|
||||
const i = t.o;
|
||||
if (i === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
t = t.next();
|
||||
this.K(i);
|
||||
return t;
|
||||
}
|
||||
pushBack(t) {
|
||||
this.U(t, this._);
|
||||
return this.i;
|
||||
}
|
||||
popBack() {
|
||||
if (this.i === 0) return;
|
||||
const t = this._.l;
|
||||
this.K(this._);
|
||||
return t;
|
||||
}
|
||||
pushFront(t) {
|
||||
this.U(t, this.h);
|
||||
return this.i;
|
||||
}
|
||||
popFront() {
|
||||
if (this.i === 0) return;
|
||||
const t = this.p.l;
|
||||
this.K(this.p);
|
||||
return t;
|
||||
}
|
||||
setElementByPos(t, i) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
let s = this.p;
|
||||
while (t--) {
|
||||
s = s.B;
|
||||
}
|
||||
s.l = i;
|
||||
}
|
||||
insert(t, i, s = 1) {
|
||||
if (t < 0 || t > this.i) {
|
||||
throw new RangeError;
|
||||
}
|
||||
if (s <= 0) return this.i;
|
||||
if (t === 0) {
|
||||
while (s--) this.pushFront(i);
|
||||
} else if (t === this.i) {
|
||||
while (s--) this.pushBack(i);
|
||||
} else {
|
||||
let r = this.p;
|
||||
for (let i = 1; i < t; ++i) {
|
||||
r = r.B;
|
||||
}
|
||||
const e = r.B;
|
||||
this.i += s;
|
||||
while (s--) {
|
||||
r.B = {
|
||||
l: i,
|
||||
L: r
|
||||
};
|
||||
r.B.L = r;
|
||||
r = r.B;
|
||||
}
|
||||
r.B = e;
|
||||
e.L = r;
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
find(t) {
|
||||
let i = this.p;
|
||||
while (i !== this.h) {
|
||||
if (i.l === t) {
|
||||
return new LinkListIterator(i, this.h);
|
||||
}
|
||||
i = i.B;
|
||||
}
|
||||
return this.end();
|
||||
}
|
||||
reverse() {
|
||||
if (this.i <= 1) return;
|
||||
let t = this.p;
|
||||
let i = this._;
|
||||
let s = 0;
|
||||
while (s << 1 < this.i) {
|
||||
const r = t.l;
|
||||
t.l = i.l;
|
||||
i.l = r;
|
||||
t = t.B;
|
||||
i = i.L;
|
||||
s += 1;
|
||||
}
|
||||
}
|
||||
unique() {
|
||||
if (this.i <= 1) {
|
||||
return this.i;
|
||||
}
|
||||
let t = this.p;
|
||||
while (t !== this.h) {
|
||||
let i = t;
|
||||
while (i.B !== this.h && i.l === i.B.l) {
|
||||
i = i.B;
|
||||
this.i -= 1;
|
||||
}
|
||||
t.B = i.B;
|
||||
t.B.L = t;
|
||||
t = t.B;
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
sort(t) {
|
||||
if (this.i <= 1) return;
|
||||
const i = [];
|
||||
this.forEach((function(t) {
|
||||
i.push(t);
|
||||
}));
|
||||
i.sort(t);
|
||||
let s = this.p;
|
||||
i.forEach((function(t) {
|
||||
s.l = t;
|
||||
s = s.B;
|
||||
}));
|
||||
}
|
||||
merge(t) {
|
||||
const i = this;
|
||||
if (this.i === 0) {
|
||||
t.forEach((function(t) {
|
||||
i.pushBack(t);
|
||||
}));
|
||||
} else {
|
||||
let s = this.p;
|
||||
t.forEach((function(t) {
|
||||
while (s !== i.h && s.l <= t) {
|
||||
s = s.B;
|
||||
}
|
||||
i.U(t, s.L);
|
||||
}));
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
forEach(t) {
|
||||
let i = this.p;
|
||||
let s = 0;
|
||||
while (i !== this.h) {
|
||||
t(i.l, s++, this);
|
||||
i = i.B;
|
||||
}
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return function*() {
|
||||
if (this.i === 0) return;
|
||||
let t = this.p;
|
||||
while (t !== this.h) {
|
||||
yield t.l;
|
||||
t = t.B;
|
||||
}
|
||||
}.bind(this)();
|
||||
}
|
||||
}
|
||||
|
||||
var _default = LinkList;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=LinkList.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
38
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.d.ts
generated
vendored
Normal file
38
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import SequentialContainer from './Base';
|
||||
import { initContainer } from "../ContainerBase";
|
||||
import { RandomIterator } from "./Base/RandomIterator";
|
||||
declare class VectorIterator<T> extends RandomIterator<T> {
|
||||
copy(): VectorIterator<T>;
|
||||
equals(iter: VectorIterator<T>): boolean;
|
||||
}
|
||||
export type { VectorIterator };
|
||||
declare class Vector<T> extends SequentialContainer<T> {
|
||||
/**
|
||||
* @param container - Initialize container, must have a forEach function.
|
||||
* @param copy - When the container is an array, you can choose to directly operate on the original object of
|
||||
* the array or perform a shallow copy. The default is shallow copy.
|
||||
*/
|
||||
constructor(container?: initContainer<T>, copy?: boolean);
|
||||
clear(): void;
|
||||
begin(): VectorIterator<T>;
|
||||
end(): VectorIterator<T>;
|
||||
rBegin(): VectorIterator<T>;
|
||||
rEnd(): VectorIterator<T>;
|
||||
front(): T | undefined;
|
||||
back(): T | undefined;
|
||||
getElementByPos(pos: number): T;
|
||||
eraseElementByPos(pos: number): number;
|
||||
eraseElementByValue(value: T): number;
|
||||
eraseElementByIterator(iter: VectorIterator<T>): VectorIterator<T>;
|
||||
pushBack(element: T): number;
|
||||
popBack(): T | undefined;
|
||||
setElementByPos(pos: number, element: T): void;
|
||||
insert(pos: number, element: T, num?: number): number;
|
||||
find(element: T): VectorIterator<T>;
|
||||
reverse(): void;
|
||||
unique(): number;
|
||||
sort(cmp?: (x: T, y: T) => number): void;
|
||||
forEach(callback: (element: T, index: number, vector: Vector<T>) => void): void;
|
||||
[Symbol.iterator](): Generator<T, void, undefined>;
|
||||
}
|
||||
export default Vector;
|
||||
157
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.js
generated
vendored
Normal file
157
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.js
generated
vendored
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _Base = _interopRequireDefault(require("./Base"));
|
||||
|
||||
var _RandomIterator = require("./Base/RandomIterator");
|
||||
|
||||
function _interopRequireDefault(t) {
|
||||
return t && t.t ? t : {
|
||||
default: t
|
||||
};
|
||||
}
|
||||
|
||||
class VectorIterator extends _RandomIterator.RandomIterator {
|
||||
copy() {
|
||||
return new VectorIterator(this.o, this.D, this.R, this.N, this.iteratorType);
|
||||
}
|
||||
}
|
||||
|
||||
class Vector extends _Base.default {
|
||||
constructor(t = [], r = true) {
|
||||
super();
|
||||
if (Array.isArray(t)) {
|
||||
this.W = r ? [ ...t ] : t;
|
||||
this.i = t.length;
|
||||
} else {
|
||||
this.W = [];
|
||||
const r = this;
|
||||
t.forEach((function(t) {
|
||||
r.pushBack(t);
|
||||
}));
|
||||
}
|
||||
this.size = this.size.bind(this);
|
||||
this.getElementByPos = this.getElementByPos.bind(this);
|
||||
this.setElementByPos = this.setElementByPos.bind(this);
|
||||
}
|
||||
clear() {
|
||||
this.i = 0;
|
||||
this.W.length = 0;
|
||||
}
|
||||
begin() {
|
||||
return new VectorIterator(0, this.size, this.getElementByPos, this.setElementByPos);
|
||||
}
|
||||
end() {
|
||||
return new VectorIterator(this.i, this.size, this.getElementByPos, this.setElementByPos);
|
||||
}
|
||||
rBegin() {
|
||||
return new VectorIterator(this.i - 1, this.size, this.getElementByPos, this.setElementByPos, 1);
|
||||
}
|
||||
rEnd() {
|
||||
return new VectorIterator(-1, this.size, this.getElementByPos, this.setElementByPos, 1);
|
||||
}
|
||||
front() {
|
||||
return this.W[0];
|
||||
}
|
||||
back() {
|
||||
return this.W[this.i - 1];
|
||||
}
|
||||
getElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
return this.W[t];
|
||||
}
|
||||
eraseElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
this.W.splice(t, 1);
|
||||
this.i -= 1;
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByValue(t) {
|
||||
let r = 0;
|
||||
for (let e = 0; e < this.i; ++e) {
|
||||
if (this.W[e] !== t) {
|
||||
this.W[r++] = this.W[e];
|
||||
}
|
||||
}
|
||||
this.i = this.W.length = r;
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByIterator(t) {
|
||||
const r = t.o;
|
||||
t = t.next();
|
||||
this.eraseElementByPos(r);
|
||||
return t;
|
||||
}
|
||||
pushBack(t) {
|
||||
this.W.push(t);
|
||||
this.i += 1;
|
||||
return this.i;
|
||||
}
|
||||
popBack() {
|
||||
if (this.i === 0) return;
|
||||
this.i -= 1;
|
||||
return this.W.pop();
|
||||
}
|
||||
setElementByPos(t, r) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
this.W[t] = r;
|
||||
}
|
||||
insert(t, r, e = 1) {
|
||||
if (t < 0 || t > this.i) {
|
||||
throw new RangeError;
|
||||
}
|
||||
this.W.splice(t, 0, ...new Array(e).fill(r));
|
||||
this.i += e;
|
||||
return this.i;
|
||||
}
|
||||
find(t) {
|
||||
for (let r = 0; r < this.i; ++r) {
|
||||
if (this.W[r] === t) {
|
||||
return new VectorIterator(r, this.size, this.getElementByPos, this.getElementByPos);
|
||||
}
|
||||
}
|
||||
return this.end();
|
||||
}
|
||||
reverse() {
|
||||
this.W.reverse();
|
||||
}
|
||||
unique() {
|
||||
let t = 1;
|
||||
for (let r = 1; r < this.i; ++r) {
|
||||
if (this.W[r] !== this.W[r - 1]) {
|
||||
this.W[t++] = this.W[r];
|
||||
}
|
||||
}
|
||||
this.i = this.W.length = t;
|
||||
return this.i;
|
||||
}
|
||||
sort(t) {
|
||||
this.W.sort(t);
|
||||
}
|
||||
forEach(t) {
|
||||
for (let r = 0; r < this.i; ++r) {
|
||||
t(this.W[r], r, this);
|
||||
}
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return function*() {
|
||||
yield* this.W;
|
||||
}.bind(this)();
|
||||
}
|
||||
}
|
||||
|
||||
var _default = Vector;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=Vector.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue