Tracking de l'application VApp (IHM du jeu)
This commit is contained in:
9
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.d.ts
generated
vendored
Normal file
9
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import { ContainerIterator } from "../../ContainerBase";
|
||||
import SequentialContainer from "./index";
|
||||
export declare abstract class RandomIterator<T> extends ContainerIterator<T> {
|
||||
abstract readonly container: SequentialContainer<T>;
|
||||
get pointer(): T;
|
||||
set pointer(newValue: T);
|
||||
pre(): this;
|
||||
next(): this;
|
||||
}
|
58
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js
generated
vendored
Normal file
58
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
"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) {
|
||||
super(r);
|
||||
this.o = t;
|
||||
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.container.size()) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o += 1;
|
||||
return this;
|
||||
};
|
||||
} else {
|
||||
this.pre = function() {
|
||||
if (this.o === this.container.size() - 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() {
|
||||
return this.container.getElementByPos(this.o);
|
||||
}
|
||||
set pointer(t) {
|
||||
this.container.setElementByPos(this.o, t);
|
||||
}
|
||||
}
|
||||
|
||||
exports.RandomIterator = RandomIterator;
|
||||
//# sourceMappingURL=RandomIterator.js.map
|
1
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js.map
generated
vendored
Normal file
1
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["container/SequentialContainer/Base/RandomIterator.js","../../src/container/SequentialContainer/Base/RandomIterator.ts"],"names":["Object","defineProperty","exports","value","RandomIterator","_ContainerBase","require","_throwError","ContainerIterator","constructor","index","iteratorType","super","this","_node","pre","throwIteratorAccessError","next","container","size","pointer","getElementByPos","newValue","setElementByPos"],"mappings":"AAAA;;AAEAA,OAAOC,eAAeC,SAAS,KAAc;IAC3CC,OAAO;;;AAETD,QAAQE,sBAAsB;;ACL9B,IAAAC,iBAAAC,QAAA;;AAEA,IAAAC,cAAAD,QAAA;;AAEM,MAAgBF,uBAA0BI,eAAAA;IAS9CC,YACEC,GACAC;QAEAC,MAAMD;QACNE,KAAKC,IAAQJ;QACb,IAAIG,KAAKF,iBAAY,GAA0B;YAC7CE,KAAKE,MAAM;gBACT,IAAIF,KAAKC,MAAU,GAAG;qBACpB,GAAAE,YAAAA;ADTM;gBCWRH,KAAKC,KAAS;gBACd,OAAOD;ADTH;YCWNA,KAAKI,OAAO;gBACV,IAAIJ,KAAKC,MAAUD,KAAKK,UAAUC,QAAQ;qBACxC,GAAAH,YAAAA;ADTM;gBCWRH,KAAKC,KAAS;gBACd,OAAOD;ADTH;AACJ,eCUG;YACLA,KAAKE,MAAM;gBACT,IAAIF,KAAKC,MAAUD,KAAKK,UAAUC,SAAS,GAAG;qBAC5C,GAAAH,YAAAA;ADRM;gBCURH,KAAKC,KAAS;gBACd,OAAOD;ADRH;YCUNA,KAAKI,OAAO;gBACV,IAAIJ,KAAKC,OAAW,GAAG;qBACrB,GAAAE,YAAAA;ADRM;gBCURH,KAAKC,KAAS;gBACd,OAAOD;ADRH;AACJ;AACJ;ICUEO;QACF,OAAOP,KAAKK,UAAUG,gBAAgBR,KAAKC;ADR3C;ICUEM,YAAQE;QACVT,KAAKK,UAAUK,gBAAgBV,KAAKC,GAAOQ;ADR3C;;;ACcHpB,QAAAE,iBAAAA","file":"RandomIterator.js","sourcesContent":["import { ContainerIterator } from \"../../ContainerBase\";\nimport { throwIteratorAccessError } from \"../../../utils/throwError\";\nexport class RandomIterator extends ContainerIterator {\n /**\n * @internal\n */\n constructor(index, iteratorType) {\n super(iteratorType);\n this._node = index;\n if (this.iteratorType === 0 /* IteratorType.NORMAL */) {\n this.pre = function () {\n if (this._node === 0) {\n throwIteratorAccessError();\n }\n this._node -= 1;\n return this;\n };\n this.next = function () {\n if (this._node === this.container.size()) {\n throwIteratorAccessError();\n }\n this._node += 1;\n return this;\n };\n }\n else {\n this.pre = function () {\n if (this._node === this.container.size() - 1) {\n throwIteratorAccessError();\n }\n this._node += 1;\n return this;\n };\n this.next = function () {\n if (this._node === -1) {\n throwIteratorAccessError();\n }\n this._node -= 1;\n return this;\n };\n }\n }\n get pointer() {\n return this.container.getElementByPos(this._node);\n }\n set pointer(newValue) {\n this.container.setElementByPos(this._node, newValue);\n }\n}\n","import { ContainerIterator, IteratorType } from '@/container/ContainerBase';\nimport SequentialContainer from '@/container/SequentialContainer/Base/index';\nimport { throwIteratorAccessError } from '@/utils/throwError';\n\nexport abstract class RandomIterator<T> extends ContainerIterator<T> {\n abstract readonly container: SequentialContainer<T>;\n /**\n * @internal\n */\n _node: number;\n /**\n * @internal\n */\n protected constructor(\n index: number,\n iteratorType?: IteratorType\n ) {\n super(iteratorType);\n this._node = index;\n if (this.iteratorType === IteratorType.NORMAL) {\n this.pre = function () {\n if (this._node === 0) {\n throwIteratorAccessError();\n }\n this._node -= 1;\n return this;\n };\n this.next = function () {\n if (this._node === this.container.size()) {\n throwIteratorAccessError();\n }\n this._node += 1;\n return this;\n };\n } else {\n this.pre = function () {\n if (this._node === this.container.size() - 1) {\n throwIteratorAccessError();\n }\n this._node += 1;\n return this;\n };\n this.next = function () {\n if (this._node === -1) {\n throwIteratorAccessError();\n }\n this._node -= 1;\n return this;\n };\n }\n }\n get pointer() {\n return this.container.getElementByPos(this._node);\n }\n set pointer(newValue: T) {\n this.container.setElementByPos(this._node, newValue);\n }\n // @ts-ignore\n pre(): this;\n // @ts-ignore\n next(): this;\n}\n"]}
|
67
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.d.ts
generated
vendored
Normal file
67
VApp/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
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.js
generated
vendored
Normal file
16
VApp/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
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.js.map
generated
vendored
Normal file
1
VApp/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"]}
|
58
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.d.ts
generated
vendored
Normal file
58
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.d.ts
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
import SequentialContainer from './Base';
|
||||
import { IteratorType, initContainer } from "../ContainerBase";
|
||||
import { RandomIterator } from "./Base/RandomIterator";
|
||||
declare class DequeIterator<T> extends RandomIterator<T> {
|
||||
readonly container: Deque<T>;
|
||||
constructor(node: number, container: Deque<T>, iteratorType?: IteratorType);
|
||||
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;
|
338
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.js
generated
vendored
Normal file
338
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.js
generated
vendored
Normal file
@ -0,0 +1,338 @@
|
||||
"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 {
|
||||
constructor(t, i, s) {
|
||||
super(t, s);
|
||||
this.container = i;
|
||||
}
|
||||
copy() {
|
||||
return new DequeIterator(this.o, this.container, this.iteratorType);
|
||||
}
|
||||
}
|
||||
|
||||
class Deque extends _Base.default {
|
||||
constructor(t = [], i = 1 << 12) {
|
||||
super();
|
||||
this.j = 0;
|
||||
this.D = 0;
|
||||
this.R = 0;
|
||||
this.N = 0;
|
||||
this.P = 0;
|
||||
this.A = [];
|
||||
const s = (() => {
|
||||
if (typeof t.length === "number") return t.length;
|
||||
if (typeof t.size === "number") return t.size;
|
||||
if (typeof t.size === "function") return t.size();
|
||||
throw new TypeError("Cannot get the length or size of the container");
|
||||
})();
|
||||
this.F = i;
|
||||
this.P = Math.max(Math.ceil(s / this.F), 1);
|
||||
for (let t = 0; t < this.P; ++t) {
|
||||
this.A.push(new Array(this.F));
|
||||
}
|
||||
const h = Math.ceil(s / this.F);
|
||||
this.j = this.R = (this.P >> 1) - (h >> 1);
|
||||
this.D = this.N = this.F - s % this.F >> 1;
|
||||
const e = this;
|
||||
t.forEach((function(t) {
|
||||
e.pushBack(t);
|
||||
}));
|
||||
}
|
||||
T() {
|
||||
const t = [];
|
||||
const i = Math.max(this.P >> 1, 1);
|
||||
for (let s = 0; s < i; ++s) {
|
||||
t[s] = new Array(this.F);
|
||||
}
|
||||
for (let i = this.j; i < this.P; ++i) {
|
||||
t[t.length] = this.A[i];
|
||||
}
|
||||
for (let i = 0; i < this.R; ++i) {
|
||||
t[t.length] = this.A[i];
|
||||
}
|
||||
t[t.length] = [ ...this.A[this.R] ];
|
||||
this.j = i;
|
||||
this.R = t.length - 1;
|
||||
for (let s = 0; s < i; ++s) {
|
||||
t[t.length] = new Array(this.F);
|
||||
}
|
||||
this.A = t;
|
||||
this.P = t.length;
|
||||
}
|
||||
O(t) {
|
||||
const i = this.D + t + 1;
|
||||
const s = i % this.F;
|
||||
let h = s - 1;
|
||||
let e = this.j + (i - s) / this.F;
|
||||
if (s === 0) e -= 1;
|
||||
e %= this.P;
|
||||
if (h < 0) h += this.F;
|
||||
return {
|
||||
curNodeBucketIndex: e,
|
||||
curNodePointerIndex: h
|
||||
};
|
||||
}
|
||||
clear() {
|
||||
this.A = [ new Array(this.F) ];
|
||||
this.P = 1;
|
||||
this.j = this.R = this.i = 0;
|
||||
this.D = this.N = this.F >> 1;
|
||||
}
|
||||
begin() {
|
||||
return new DequeIterator(0, this);
|
||||
}
|
||||
end() {
|
||||
return new DequeIterator(this.i, this);
|
||||
}
|
||||
rBegin() {
|
||||
return new DequeIterator(this.i - 1, this, 1);
|
||||
}
|
||||
rEnd() {
|
||||
return new DequeIterator(-1, this, 1);
|
||||
}
|
||||
front() {
|
||||
if (this.i === 0) return;
|
||||
return this.A[this.j][this.D];
|
||||
}
|
||||
back() {
|
||||
if (this.i === 0) return;
|
||||
return this.A[this.R][this.N];
|
||||
}
|
||||
pushBack(t) {
|
||||
if (this.i) {
|
||||
if (this.N < this.F - 1) {
|
||||
this.N += 1;
|
||||
} else if (this.R < this.P - 1) {
|
||||
this.R += 1;
|
||||
this.N = 0;
|
||||
} else {
|
||||
this.R = 0;
|
||||
this.N = 0;
|
||||
}
|
||||
if (this.R === this.j && this.N === this.D) this.T();
|
||||
}
|
||||
this.i += 1;
|
||||
this.A[this.R][this.N] = t;
|
||||
return this.i;
|
||||
}
|
||||
popBack() {
|
||||
if (this.i === 0) return;
|
||||
const t = this.A[this.R][this.N];
|
||||
if (this.i !== 1) {
|
||||
if (this.N > 0) {
|
||||
this.N -= 1;
|
||||
} else if (this.R > 0) {
|
||||
this.R -= 1;
|
||||
this.N = this.F - 1;
|
||||
} else {
|
||||
this.R = this.P - 1;
|
||||
this.N = this.F - 1;
|
||||
}
|
||||
}
|
||||
this.i -= 1;
|
||||
return t;
|
||||
}
|
||||
pushFront(t) {
|
||||
if (this.i) {
|
||||
if (this.D > 0) {
|
||||
this.D -= 1;
|
||||
} else if (this.j > 0) {
|
||||
this.j -= 1;
|
||||
this.D = this.F - 1;
|
||||
} else {
|
||||
this.j = this.P - 1;
|
||||
this.D = this.F - 1;
|
||||
}
|
||||
if (this.j === this.R && this.D === this.N) this.T();
|
||||
}
|
||||
this.i += 1;
|
||||
this.A[this.j][this.D] = t;
|
||||
return this.i;
|
||||
}
|
||||
popFront() {
|
||||
if (this.i === 0) return;
|
||||
const t = this.A[this.j][this.D];
|
||||
if (this.i !== 1) {
|
||||
if (this.D < this.F - 1) {
|
||||
this.D += 1;
|
||||
} else if (this.j < this.P - 1) {
|
||||
this.j += 1;
|
||||
this.D = 0;
|
||||
} else {
|
||||
this.j = 0;
|
||||
this.D = 0;
|
||||
}
|
||||
}
|
||||
this.i -= 1;
|
||||
return t;
|
||||
}
|
||||
getElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
const {curNodeBucketIndex: i, curNodePointerIndex: s} = this.O(t);
|
||||
return this.A[i][s];
|
||||
}
|
||||
setElementByPos(t, i) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
const {curNodeBucketIndex: s, curNodePointerIndex: h} = this.O(t);
|
||||
this.A[s][h] = i;
|
||||
}
|
||||
insert(t, i, s = 1) {
|
||||
if (t < 0 || t > this.i) {
|
||||
throw new RangeError;
|
||||
}
|
||||
if (t === 0) {
|
||||
while (s--) this.pushFront(i);
|
||||
} else if (t === this.i) {
|
||||
while (s--) this.pushBack(i);
|
||||
} else {
|
||||
const h = [];
|
||||
for (let i = t; i < this.i; ++i) {
|
||||
h.push(this.getElementByPos(i));
|
||||
}
|
||||
this.cut(t - 1);
|
||||
for (let t = 0; t < s; ++t) this.pushBack(i);
|
||||
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: i, curNodePointerIndex: s} = this.O(t);
|
||||
this.R = i;
|
||||
this.N = s;
|
||||
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 i = [];
|
||||
for (let s = t + 1; s < this.i; ++s) {
|
||||
i.push(this.getElementByPos(s));
|
||||
}
|
||||
this.cut(t);
|
||||
this.popBack();
|
||||
const s = this;
|
||||
i.forEach((function(t) {
|
||||
s.pushBack(t);
|
||||
}));
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByValue(t) {
|
||||
if (this.i === 0) return 0;
|
||||
const i = [];
|
||||
for (let s = 0; s < this.i; ++s) {
|
||||
const h = this.getElementByPos(s);
|
||||
if (h !== t) i.push(h);
|
||||
}
|
||||
const s = i.length;
|
||||
for (let t = 0; t < s; ++t) this.setElementByPos(t, i[t]);
|
||||
return this.cut(s - 1);
|
||||
}
|
||||
eraseElementByIterator(t) {
|
||||
const i = t.o;
|
||||
this.eraseElementByPos(i);
|
||||
t = t.next();
|
||||
return t;
|
||||
}
|
||||
find(t) {
|
||||
for (let i = 0; i < this.i; ++i) {
|
||||
if (this.getElementByPos(i) === t) {
|
||||
return new DequeIterator(i, this);
|
||||
}
|
||||
}
|
||||
return this.end();
|
||||
}
|
||||
reverse() {
|
||||
let t = 0;
|
||||
let i = this.i - 1;
|
||||
while (t < i) {
|
||||
const s = this.getElementByPos(t);
|
||||
this.setElementByPos(t, this.getElementByPos(i));
|
||||
this.setElementByPos(i, s);
|
||||
t += 1;
|
||||
i -= 1;
|
||||
}
|
||||
}
|
||||
unique() {
|
||||
if (this.i <= 1) {
|
||||
return this.i;
|
||||
}
|
||||
let t = 1;
|
||||
let i = this.getElementByPos(0);
|
||||
for (let s = 1; s < this.i; ++s) {
|
||||
const h = this.getElementByPos(s);
|
||||
if (h !== i) {
|
||||
i = h;
|
||||
this.setElementByPos(t++, h);
|
||||
}
|
||||
}
|
||||
while (this.i > t) this.popBack();
|
||||
return this.i;
|
||||
}
|
||||
sort(t) {
|
||||
const i = [];
|
||||
for (let t = 0; t < this.i; ++t) {
|
||||
i.push(this.getElementByPos(t));
|
||||
}
|
||||
i.sort(t);
|
||||
for (let t = 0; t < this.i; ++t) this.setElementByPos(t, i[t]);
|
||||
}
|
||||
shrinkToFit() {
|
||||
if (this.i === 0) return;
|
||||
const t = [];
|
||||
this.forEach((function(i) {
|
||||
t.push(i);
|
||||
}));
|
||||
this.P = Math.max(Math.ceil(this.i / this.F), 1);
|
||||
this.i = this.j = this.R = this.D = this.N = 0;
|
||||
this.A = [];
|
||||
for (let t = 0; t < this.P; ++t) {
|
||||
this.A.push(new Array(this.F));
|
||||
}
|
||||
for (let i = 0; i < t.length; ++i) this.pushBack(t[i]);
|
||||
}
|
||||
forEach(t) {
|
||||
for (let i = 0; i < this.i; ++i) {
|
||||
t(this.getElementByPos(i), i, 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
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.js.map
generated
vendored
Normal file
1
VApp/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
58
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.d.ts
generated
vendored
Normal file
58
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.d.ts
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
import SequentialContainer from './Base';
|
||||
import { ContainerIterator, initContainer } from "../ContainerBase";
|
||||
declare class LinkListIterator<T> extends ContainerIterator<T> {
|
||||
readonly container: LinkList<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;
|
330
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.js
generated
vendored
Normal file
330
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.js
generated
vendored
Normal file
@ -0,0 +1,330 @@
|
||||
"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, r) {
|
||||
super(r);
|
||||
this.o = t;
|
||||
this.h = i;
|
||||
this.container = s;
|
||||
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.container, 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);
|
||||
}));
|
||||
}
|
||||
V(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;
|
||||
}
|
||||
G(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, this);
|
||||
}
|
||||
end() {
|
||||
return new LinkListIterator(this.h, this.h, this);
|
||||
}
|
||||
rBegin() {
|
||||
return new LinkListIterator(this._, this.h, this, 1);
|
||||
}
|
||||
rEnd() {
|
||||
return new LinkListIterator(this.h, this.h, this, 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.V(i);
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByValue(t) {
|
||||
let i = this.p;
|
||||
while (i !== this.h) {
|
||||
if (i.l === t) {
|
||||
this.V(i);
|
||||
}
|
||||
i = i.B;
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByIterator(t) {
|
||||
const i = t.o;
|
||||
if (i === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
t = t.next();
|
||||
this.V(i);
|
||||
return t;
|
||||
}
|
||||
pushBack(t) {
|
||||
this.G(t, this._);
|
||||
return this.i;
|
||||
}
|
||||
popBack() {
|
||||
if (this.i === 0) return;
|
||||
const t = this._.l;
|
||||
this.V(this._);
|
||||
return t;
|
||||
}
|
||||
pushFront(t) {
|
||||
this.G(t, this.h);
|
||||
return this.i;
|
||||
}
|
||||
popFront() {
|
||||
if (this.i === 0) return;
|
||||
const t = this.p.l;
|
||||
this.V(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, this);
|
||||
}
|
||||
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.G(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
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.js.map
generated
vendored
Normal file
1
VApp/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
40
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.d.ts
generated
vendored
Normal file
40
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.d.ts
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
import SequentialContainer from './Base';
|
||||
import { initContainer, IteratorType } from "../ContainerBase";
|
||||
import { RandomIterator } from "./Base/RandomIterator";
|
||||
declare class VectorIterator<T> extends RandomIterator<T> {
|
||||
container: Vector<T>;
|
||||
constructor(node: number, container: Vector<T>, iteratorType?: IteratorType);
|
||||
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;
|
158
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.js
generated
vendored
Normal file
158
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.js
generated
vendored
Normal file
@ -0,0 +1,158 @@
|
||||
"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 {
|
||||
constructor(t, r, e) {
|
||||
super(t, e);
|
||||
this.container = r;
|
||||
}
|
||||
copy() {
|
||||
return new VectorIterator(this.o, this.container, this.iteratorType);
|
||||
}
|
||||
}
|
||||
|
||||
class Vector extends _Base.default {
|
||||
constructor(t = [], r = true) {
|
||||
super();
|
||||
if (Array.isArray(t)) {
|
||||
this.J = r ? [ ...t ] : t;
|
||||
this.i = t.length;
|
||||
} else {
|
||||
this.J = [];
|
||||
const r = this;
|
||||
t.forEach((function(t) {
|
||||
r.pushBack(t);
|
||||
}));
|
||||
}
|
||||
}
|
||||
clear() {
|
||||
this.i = 0;
|
||||
this.J.length = 0;
|
||||
}
|
||||
begin() {
|
||||
return new VectorIterator(0, this);
|
||||
}
|
||||
end() {
|
||||
return new VectorIterator(this.i, this);
|
||||
}
|
||||
rBegin() {
|
||||
return new VectorIterator(this.i - 1, this, 1);
|
||||
}
|
||||
rEnd() {
|
||||
return new VectorIterator(-1, this, 1);
|
||||
}
|
||||
front() {
|
||||
return this.J[0];
|
||||
}
|
||||
back() {
|
||||
return this.J[this.i - 1];
|
||||
}
|
||||
getElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
return this.J[t];
|
||||
}
|
||||
eraseElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
this.J.splice(t, 1);
|
||||
this.i -= 1;
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByValue(t) {
|
||||
let r = 0;
|
||||
for (let e = 0; e < this.i; ++e) {
|
||||
if (this.J[e] !== t) {
|
||||
this.J[r++] = this.J[e];
|
||||
}
|
||||
}
|
||||
this.i = this.J.length = r;
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByIterator(t) {
|
||||
const r = t.o;
|
||||
t = t.next();
|
||||
this.eraseElementByPos(r);
|
||||
return t;
|
||||
}
|
||||
pushBack(t) {
|
||||
this.J.push(t);
|
||||
this.i += 1;
|
||||
return this.i;
|
||||
}
|
||||
popBack() {
|
||||
if (this.i === 0) return;
|
||||
this.i -= 1;
|
||||
return this.J.pop();
|
||||
}
|
||||
setElementByPos(t, r) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
this.J[t] = r;
|
||||
}
|
||||
insert(t, r, e = 1) {
|
||||
if (t < 0 || t > this.i) {
|
||||
throw new RangeError;
|
||||
}
|
||||
this.J.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.J[r] === t) {
|
||||
return new VectorIterator(r, this);
|
||||
}
|
||||
}
|
||||
return this.end();
|
||||
}
|
||||
reverse() {
|
||||
this.J.reverse();
|
||||
}
|
||||
unique() {
|
||||
let t = 1;
|
||||
for (let r = 1; r < this.i; ++r) {
|
||||
if (this.J[r] !== this.J[r - 1]) {
|
||||
this.J[t++] = this.J[r];
|
||||
}
|
||||
}
|
||||
this.i = this.J.length = t;
|
||||
return this.i;
|
||||
}
|
||||
sort(t) {
|
||||
this.J.sort(t);
|
||||
}
|
||||
forEach(t) {
|
||||
for (let r = 0; r < this.i; ++r) {
|
||||
t(this.J[r], r, this);
|
||||
}
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return function*() {
|
||||
yield* this.J;
|
||||
}.bind(this)();
|
||||
}
|
||||
}
|
||||
|
||||
var _default = Vector;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=Vector.js.map
|
1
VApp/node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.js.map
generated
vendored
Normal file
1
VApp/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
Reference in New Issue
Block a user