Tracking de l'application VApp (IHM du jeu)
This commit is contained in:
9
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/RandomIterator.d.ts
generated
vendored
Normal file
9
VApp/node_modules/js-sdsl/dist/esm/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;
|
||||
}
|
78
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/RandomIterator.js
generated
vendored
Normal file
78
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/RandomIterator.js
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
var __extends = this && this.t || function() {
|
||||
var extendStatics = function(t, r) {
|
||||
extendStatics = Object.setPrototypeOf || {
|
||||
__proto__: []
|
||||
} instanceof Array && function(t, r) {
|
||||
t.__proto__ = r;
|
||||
} || function(t, r) {
|
||||
for (var n in r) if (Object.prototype.hasOwnProperty.call(r, n)) t[n] = r[n];
|
||||
};
|
||||
return extendStatics(t, r);
|
||||
};
|
||||
return function(t, r) {
|
||||
if (typeof r !== "function" && r !== null) throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
|
||||
extendStatics(t, r);
|
||||
function __() {
|
||||
this.constructor = t;
|
||||
}
|
||||
t.prototype = r === null ? Object.create(r) : (__.prototype = r.prototype, new __);
|
||||
};
|
||||
}();
|
||||
|
||||
import { ContainerIterator } from "../../ContainerBase";
|
||||
|
||||
import { throwIteratorAccessError } from "../../../utils/throwError";
|
||||
|
||||
var RandomIterator = function(t) {
|
||||
__extends(RandomIterator, t);
|
||||
function RandomIterator(r, n) {
|
||||
var o = t.call(this, n) || this;
|
||||
o.o = r;
|
||||
if (o.iteratorType === 0) {
|
||||
o.pre = function() {
|
||||
if (this.o === 0) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
this.o -= 1;
|
||||
return this;
|
||||
};
|
||||
o.next = function() {
|
||||
if (this.o === this.container.size()) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
this.o += 1;
|
||||
return this;
|
||||
};
|
||||
} else {
|
||||
o.pre = function() {
|
||||
if (this.o === this.container.size() - 1) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
this.o += 1;
|
||||
return this;
|
||||
};
|
||||
o.next = function() {
|
||||
if (this.o === -1) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
this.o -= 1;
|
||||
return this;
|
||||
};
|
||||
}
|
||||
return o;
|
||||
}
|
||||
Object.defineProperty(RandomIterator.prototype, "pointer", {
|
||||
get: function() {
|
||||
return this.container.getElementByPos(this.o);
|
||||
},
|
||||
set: function(t) {
|
||||
this.container.setElementByPos(this.o, t);
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return RandomIterator;
|
||||
}(ContainerIterator);
|
||||
|
||||
export { RandomIterator };
|
||||
//# sourceMappingURL=RandomIterator.js.map
|
1
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/RandomIterator.js.map
generated
vendored
Normal file
1
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/RandomIterator.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
67
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/index.d.ts
generated
vendored
Normal file
67
VApp/node_modules/js-sdsl/dist/esm/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;
|
33
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/index.js
generated
vendored
Normal file
33
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/index.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
var __extends = this && this.t || function() {
|
||||
var extendStatics = function(n, t) {
|
||||
extendStatics = Object.setPrototypeOf || {
|
||||
__proto__: []
|
||||
} instanceof Array && function(n, t) {
|
||||
n.__proto__ = t;
|
||||
} || function(n, t) {
|
||||
for (var e in t) if (Object.prototype.hasOwnProperty.call(t, e)) n[e] = t[e];
|
||||
};
|
||||
return extendStatics(n, t);
|
||||
};
|
||||
return function(n, t) {
|
||||
if (typeof t !== "function" && t !== null) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
||||
extendStatics(n, t);
|
||||
function __() {
|
||||
this.constructor = n;
|
||||
}
|
||||
n.prototype = t === null ? Object.create(t) : (__.prototype = t.prototype, new __);
|
||||
};
|
||||
}();
|
||||
|
||||
import { Container } from "../../ContainerBase";
|
||||
|
||||
var SequentialContainer = function(n) {
|
||||
__extends(SequentialContainer, n);
|
||||
function SequentialContainer() {
|
||||
return n !== null && n.apply(this, arguments) || this;
|
||||
}
|
||||
return SequentialContainer;
|
||||
}(Container);
|
||||
|
||||
export default SequentialContainer;
|
||||
//# sourceMappingURL=index.js.map
|
1
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Base/index.js.map
generated
vendored
Normal file
1
VApp/node_modules/js-sdsl/dist/esm/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":["__extends","this","extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","TypeError","String","__","constructor","create","Container","SequentialContainer","_super","apply","arguments"],"mappings":"AAAA,IAAIA,YAAaC,QAAQA,KAAKD,KAAe;IACzC,IAAIE,gBAAgB,SAAUC,GAAGC;QAC7BF,gBAAgBG,OAAOC,kBAClB;YAAEC,WAAW;qBAAgBC,SAAS,SAAUL,GAAGC;YAAKD,EAAEI,YAAYH;AAAG,aAC1E,SAAUD,GAAGC;YAAK,KAAK,IAAIK,KAAKL,GAAG,IAAIC,OAAOK,UAAUC,eAAeC,KAAKR,GAAGK,IAAIN,EAAEM,KAAKL,EAAEK;AAAI;QACpG,OAAOP,cAAcC,GAAGC;AAC5B;IACA,OAAO,SAAUD,GAAGC;QAChB,WAAWA,MAAM,cAAcA,MAAM,MACjC,MAAM,IAAIS,UAAU,yBAAyBC,OAAOV,KAAK;QAC7DF,cAAcC,GAAGC;QACjB,SAASW;YAAOd,KAAKe,cAAcb;AAAG;QACtCA,EAAEO,YAAYN,MAAM,OAAOC,OAAOY,OAAOb,MAAMW,GAAGL,YAAYN,EAAEM,WAAW,IAAIK;AACnF;AACJ,CAd6C;;SCApCG,iBAAW;;AAEpB,IAAAC,sBAAA,SAAAC;IAA8CpB,UAAAmB,qBAAAC;IAA9C,SAAAD;QDiBQ,OAAOC,MAAW,QAAQA,EAAOC,MAAMpB,MAAMqB,cAAcrB;AC+CnE;IAAA,OAAAkB;AAAA,CAhEA,CAA8CD;;eAkE/BC","file":"index.js","sourcesContent":["var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport { Container } from \"../../ContainerBase\";\nvar SequentialContainer = /** @class */ (function (_super) {\n __extends(SequentialContainer, _super);\n function SequentialContainer() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return SequentialContainer;\n}(Container));\nexport default SequentialContainer;\n","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/esm/container/SequentialContainer/Deque.d.ts
generated
vendored
Normal file
58
VApp/node_modules/js-sdsl/dist/esm/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;
|
498
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Deque.js
generated
vendored
Normal file
498
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Deque.js
generated
vendored
Normal file
@ -0,0 +1,498 @@
|
||||
var __extends = this && this.t || function() {
|
||||
var extendStatics = function(t, i) {
|
||||
extendStatics = Object.setPrototypeOf || {
|
||||
__proto__: []
|
||||
} instanceof Array && function(t, i) {
|
||||
t.__proto__ = i;
|
||||
} || function(t, i) {
|
||||
for (var r in i) if (Object.prototype.hasOwnProperty.call(i, r)) t[r] = i[r];
|
||||
};
|
||||
return extendStatics(t, i);
|
||||
};
|
||||
return function(t, i) {
|
||||
if (typeof i !== "function" && i !== null) throw new TypeError("Class extends value " + String(i) + " is not a constructor or null");
|
||||
extendStatics(t, i);
|
||||
function __() {
|
||||
this.constructor = t;
|
||||
}
|
||||
t.prototype = i === null ? Object.create(i) : (__.prototype = i.prototype, new __);
|
||||
};
|
||||
}();
|
||||
|
||||
var __generator = this && this.i || function(t, i) {
|
||||
var r = {
|
||||
label: 0,
|
||||
sent: function() {
|
||||
if (h[0] & 1) throw h[1];
|
||||
return h[1];
|
||||
},
|
||||
trys: [],
|
||||
ops: []
|
||||
}, e, s, h, n;
|
||||
return n = {
|
||||
next: verb(0),
|
||||
throw: verb(1),
|
||||
return: verb(2)
|
||||
}, typeof Symbol === "function" && (n[Symbol.iterator] = function() {
|
||||
return this;
|
||||
}), n;
|
||||
function verb(t) {
|
||||
return function(i) {
|
||||
return step([ t, i ]);
|
||||
};
|
||||
}
|
||||
function step(n) {
|
||||
if (e) throw new TypeError("Generator is already executing.");
|
||||
while (r) try {
|
||||
if (e = 1, s && (h = n[0] & 2 ? s["return"] : n[0] ? s["throw"] || ((h = s["return"]) && h.call(s),
|
||||
0) : s.next) && !(h = h.call(s, n[1])).done) return h;
|
||||
if (s = 0, h) n = [ n[0] & 2, h.value ];
|
||||
switch (n[0]) {
|
||||
case 0:
|
||||
case 1:
|
||||
h = n;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
r.label++;
|
||||
return {
|
||||
value: n[1],
|
||||
done: false
|
||||
};
|
||||
|
||||
case 5:
|
||||
r.label++;
|
||||
s = n[1];
|
||||
n = [ 0 ];
|
||||
continue;
|
||||
|
||||
case 7:
|
||||
n = r.ops.pop();
|
||||
r.trys.pop();
|
||||
continue;
|
||||
|
||||
default:
|
||||
if (!(h = r.trys, h = h.length > 0 && h[h.length - 1]) && (n[0] === 6 || n[0] === 2)) {
|
||||
r = 0;
|
||||
continue;
|
||||
}
|
||||
if (n[0] === 3 && (!h || n[1] > h[0] && n[1] < h[3])) {
|
||||
r.label = n[1];
|
||||
break;
|
||||
}
|
||||
if (n[0] === 6 && r.label < h[1]) {
|
||||
r.label = h[1];
|
||||
h = n;
|
||||
break;
|
||||
}
|
||||
if (h && r.label < h[2]) {
|
||||
r.label = h[2];
|
||||
r.ops.push(n);
|
||||
break;
|
||||
}
|
||||
if (h[2]) r.ops.pop();
|
||||
r.trys.pop();
|
||||
continue;
|
||||
}
|
||||
n = i.call(t, r);
|
||||
} catch (t) {
|
||||
n = [ 6, t ];
|
||||
s = 0;
|
||||
} finally {
|
||||
e = h = 0;
|
||||
}
|
||||
if (n[0] & 5) throw n[1];
|
||||
return {
|
||||
value: n[0] ? n[1] : void 0,
|
||||
done: true
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
var __read = this && this.q || function(t, i) {
|
||||
var r = typeof Symbol === "function" && t[Symbol.iterator];
|
||||
if (!r) return t;
|
||||
var e = r.call(t), s, h = [], n;
|
||||
try {
|
||||
while ((i === void 0 || i-- > 0) && !(s = e.next()).done) h.push(s.value);
|
||||
} catch (t) {
|
||||
n = {
|
||||
error: t
|
||||
};
|
||||
} finally {
|
||||
try {
|
||||
if (s && !s.done && (r = e["return"])) r.call(e);
|
||||
} finally {
|
||||
if (n) throw n.error;
|
||||
}
|
||||
}
|
||||
return h;
|
||||
};
|
||||
|
||||
var __spreadArray = this && this.D || function(t, i, r) {
|
||||
if (r || arguments.length === 2) for (var e = 0, s = i.length, h; e < s; e++) {
|
||||
if (h || !(e in i)) {
|
||||
if (!h) h = Array.prototype.slice.call(i, 0, e);
|
||||
h[e] = i[e];
|
||||
}
|
||||
}
|
||||
return t.concat(h || Array.prototype.slice.call(i));
|
||||
};
|
||||
|
||||
import SequentialContainer from "./Base";
|
||||
|
||||
import { RandomIterator } from "./Base/RandomIterator";
|
||||
|
||||
var DequeIterator = function(t) {
|
||||
__extends(DequeIterator, t);
|
||||
function DequeIterator(i, r, e) {
|
||||
var s = t.call(this, i, e) || this;
|
||||
s.container = r;
|
||||
return s;
|
||||
}
|
||||
DequeIterator.prototype.copy = function() {
|
||||
return new DequeIterator(this.o, this.container, this.iteratorType);
|
||||
};
|
||||
return DequeIterator;
|
||||
}(RandomIterator);
|
||||
|
||||
var Deque = function(t) {
|
||||
__extends(Deque, t);
|
||||
function Deque(i, r) {
|
||||
if (i === void 0) {
|
||||
i = [];
|
||||
}
|
||||
if (r === void 0) {
|
||||
r = 1 << 12;
|
||||
}
|
||||
var e = t.call(this) || this;
|
||||
e.A = 0;
|
||||
e.S = 0;
|
||||
e.R = 0;
|
||||
e.k = 0;
|
||||
e.C = 0;
|
||||
e.j = [];
|
||||
var s = function() {
|
||||
if (typeof i.length === "number") return i.length;
|
||||
if (typeof i.size === "number") return i.size;
|
||||
if (typeof i.size === "function") return i.size();
|
||||
throw new TypeError("Cannot get the length or size of the container");
|
||||
}();
|
||||
e.B = r;
|
||||
e.C = Math.max(Math.ceil(s / e.B), 1);
|
||||
for (var h = 0; h < e.C; ++h) {
|
||||
e.j.push(new Array(e.B));
|
||||
}
|
||||
var n = Math.ceil(s / e.B);
|
||||
e.A = e.R = (e.C >> 1) - (n >> 1);
|
||||
e.S = e.k = e.B - s % e.B >> 1;
|
||||
var u = e;
|
||||
i.forEach((function(t) {
|
||||
u.pushBack(t);
|
||||
}));
|
||||
return e;
|
||||
}
|
||||
Deque.prototype.O = function() {
|
||||
var t = [];
|
||||
var i = Math.max(this.C >> 1, 1);
|
||||
for (var r = 0; r < i; ++r) {
|
||||
t[r] = new Array(this.B);
|
||||
}
|
||||
for (var r = this.A; r < this.C; ++r) {
|
||||
t[t.length] = this.j[r];
|
||||
}
|
||||
for (var r = 0; r < this.R; ++r) {
|
||||
t[t.length] = this.j[r];
|
||||
}
|
||||
t[t.length] = __spreadArray([], __read(this.j[this.R]), false);
|
||||
this.A = i;
|
||||
this.R = t.length - 1;
|
||||
for (var r = 0; r < i; ++r) {
|
||||
t[t.length] = new Array(this.B);
|
||||
}
|
||||
this.j = t;
|
||||
this.C = t.length;
|
||||
};
|
||||
Deque.prototype.T = function(t) {
|
||||
var i = this.S + t + 1;
|
||||
var r = i % this.B;
|
||||
var e = r - 1;
|
||||
var s = this.A + (i - r) / this.B;
|
||||
if (r === 0) s -= 1;
|
||||
s %= this.C;
|
||||
if (e < 0) e += this.B;
|
||||
return {
|
||||
curNodeBucketIndex: s,
|
||||
curNodePointerIndex: e
|
||||
};
|
||||
};
|
||||
Deque.prototype.clear = function() {
|
||||
this.j = [ new Array(this.B) ];
|
||||
this.C = 1;
|
||||
this.A = this.R = this.M = 0;
|
||||
this.S = this.k = this.B >> 1;
|
||||
};
|
||||
Deque.prototype.begin = function() {
|
||||
return new DequeIterator(0, this);
|
||||
};
|
||||
Deque.prototype.end = function() {
|
||||
return new DequeIterator(this.M, this);
|
||||
};
|
||||
Deque.prototype.rBegin = function() {
|
||||
return new DequeIterator(this.M - 1, this, 1);
|
||||
};
|
||||
Deque.prototype.rEnd = function() {
|
||||
return new DequeIterator(-1, this, 1);
|
||||
};
|
||||
Deque.prototype.front = function() {
|
||||
if (this.M === 0) return;
|
||||
return this.j[this.A][this.S];
|
||||
};
|
||||
Deque.prototype.back = function() {
|
||||
if (this.M === 0) return;
|
||||
return this.j[this.R][this.k];
|
||||
};
|
||||
Deque.prototype.pushBack = function(t) {
|
||||
if (this.M) {
|
||||
if (this.k < this.B - 1) {
|
||||
this.k += 1;
|
||||
} else if (this.R < this.C - 1) {
|
||||
this.R += 1;
|
||||
this.k = 0;
|
||||
} else {
|
||||
this.R = 0;
|
||||
this.k = 0;
|
||||
}
|
||||
if (this.R === this.A && this.k === this.S) this.O();
|
||||
}
|
||||
this.M += 1;
|
||||
this.j[this.R][this.k] = t;
|
||||
return this.M;
|
||||
};
|
||||
Deque.prototype.popBack = function() {
|
||||
if (this.M === 0) return;
|
||||
var t = this.j[this.R][this.k];
|
||||
if (this.M !== 1) {
|
||||
if (this.k > 0) {
|
||||
this.k -= 1;
|
||||
} else if (this.R > 0) {
|
||||
this.R -= 1;
|
||||
this.k = this.B - 1;
|
||||
} else {
|
||||
this.R = this.C - 1;
|
||||
this.k = this.B - 1;
|
||||
}
|
||||
}
|
||||
this.M -= 1;
|
||||
return t;
|
||||
};
|
||||
Deque.prototype.pushFront = function(t) {
|
||||
if (this.M) {
|
||||
if (this.S > 0) {
|
||||
this.S -= 1;
|
||||
} else if (this.A > 0) {
|
||||
this.A -= 1;
|
||||
this.S = this.B - 1;
|
||||
} else {
|
||||
this.A = this.C - 1;
|
||||
this.S = this.B - 1;
|
||||
}
|
||||
if (this.A === this.R && this.S === this.k) this.O();
|
||||
}
|
||||
this.M += 1;
|
||||
this.j[this.A][this.S] = t;
|
||||
return this.M;
|
||||
};
|
||||
Deque.prototype.popFront = function() {
|
||||
if (this.M === 0) return;
|
||||
var t = this.j[this.A][this.S];
|
||||
if (this.M !== 1) {
|
||||
if (this.S < this.B - 1) {
|
||||
this.S += 1;
|
||||
} else if (this.A < this.C - 1) {
|
||||
this.A += 1;
|
||||
this.S = 0;
|
||||
} else {
|
||||
this.A = 0;
|
||||
this.S = 0;
|
||||
}
|
||||
}
|
||||
this.M -= 1;
|
||||
return t;
|
||||
};
|
||||
Deque.prototype.getElementByPos = function(t) {
|
||||
if (t < 0 || t > this.M - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
var i = this.T(t), r = i.curNodeBucketIndex, e = i.curNodePointerIndex;
|
||||
return this.j[r][e];
|
||||
};
|
||||
Deque.prototype.setElementByPos = function(t, i) {
|
||||
if (t < 0 || t > this.M - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
var r = this.T(t), e = r.curNodeBucketIndex, s = r.curNodePointerIndex;
|
||||
this.j[e][s] = i;
|
||||
};
|
||||
Deque.prototype.insert = function(t, i, r) {
|
||||
if (r === void 0) {
|
||||
r = 1;
|
||||
}
|
||||
if (t < 0 || t > this.M) {
|
||||
throw new RangeError;
|
||||
}
|
||||
if (t === 0) {
|
||||
while (r--) this.pushFront(i);
|
||||
} else if (t === this.M) {
|
||||
while (r--) this.pushBack(i);
|
||||
} else {
|
||||
var e = [];
|
||||
for (var s = t; s < this.M; ++s) {
|
||||
e.push(this.getElementByPos(s));
|
||||
}
|
||||
this.cut(t - 1);
|
||||
for (var s = 0; s < r; ++s) this.pushBack(i);
|
||||
for (var s = 0; s < e.length; ++s) this.pushBack(e[s]);
|
||||
}
|
||||
return this.M;
|
||||
};
|
||||
Deque.prototype.cut = function(t) {
|
||||
if (t < 0) {
|
||||
this.clear();
|
||||
return 0;
|
||||
}
|
||||
var i = this.T(t), r = i.curNodeBucketIndex, e = i.curNodePointerIndex;
|
||||
this.R = r;
|
||||
this.k = e;
|
||||
this.M = t + 1;
|
||||
return this.M;
|
||||
};
|
||||
Deque.prototype.eraseElementByPos = function(t) {
|
||||
if (t < 0 || t > this.M - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
if (t === 0) this.popFront(); else if (t === this.M - 1) this.popBack(); else {
|
||||
var i = [];
|
||||
for (var r = t + 1; r < this.M; ++r) {
|
||||
i.push(this.getElementByPos(r));
|
||||
}
|
||||
this.cut(t);
|
||||
this.popBack();
|
||||
var e = this;
|
||||
i.forEach((function(t) {
|
||||
e.pushBack(t);
|
||||
}));
|
||||
}
|
||||
return this.M;
|
||||
};
|
||||
Deque.prototype.eraseElementByValue = function(t) {
|
||||
if (this.M === 0) return 0;
|
||||
var i = [];
|
||||
for (var r = 0; r < this.M; ++r) {
|
||||
var e = this.getElementByPos(r);
|
||||
if (e !== t) i.push(e);
|
||||
}
|
||||
var s = i.length;
|
||||
for (var r = 0; r < s; ++r) this.setElementByPos(r, i[r]);
|
||||
return this.cut(s - 1);
|
||||
};
|
||||
Deque.prototype.eraseElementByIterator = function(t) {
|
||||
var i = t.o;
|
||||
this.eraseElementByPos(i);
|
||||
t = t.next();
|
||||
return t;
|
||||
};
|
||||
Deque.prototype.find = function(t) {
|
||||
for (var i = 0; i < this.M; ++i) {
|
||||
if (this.getElementByPos(i) === t) {
|
||||
return new DequeIterator(i, this);
|
||||
}
|
||||
}
|
||||
return this.end();
|
||||
};
|
||||
Deque.prototype.reverse = function() {
|
||||
var t = 0;
|
||||
var i = this.M - 1;
|
||||
while (t < i) {
|
||||
var r = this.getElementByPos(t);
|
||||
this.setElementByPos(t, this.getElementByPos(i));
|
||||
this.setElementByPos(i, r);
|
||||
t += 1;
|
||||
i -= 1;
|
||||
}
|
||||
};
|
||||
Deque.prototype.unique = function() {
|
||||
if (this.M <= 1) {
|
||||
return this.M;
|
||||
}
|
||||
var t = 1;
|
||||
var i = this.getElementByPos(0);
|
||||
for (var r = 1; r < this.M; ++r) {
|
||||
var e = this.getElementByPos(r);
|
||||
if (e !== i) {
|
||||
i = e;
|
||||
this.setElementByPos(t++, e);
|
||||
}
|
||||
}
|
||||
while (this.M > t) this.popBack();
|
||||
return this.M;
|
||||
};
|
||||
Deque.prototype.sort = function(t) {
|
||||
var i = [];
|
||||
for (var r = 0; r < this.M; ++r) {
|
||||
i.push(this.getElementByPos(r));
|
||||
}
|
||||
i.sort(t);
|
||||
for (var r = 0; r < this.M; ++r) this.setElementByPos(r, i[r]);
|
||||
};
|
||||
Deque.prototype.shrinkToFit = function() {
|
||||
if (this.M === 0) return;
|
||||
var t = [];
|
||||
this.forEach((function(i) {
|
||||
t.push(i);
|
||||
}));
|
||||
this.C = Math.max(Math.ceil(this.M / this.B), 1);
|
||||
this.M = this.A = this.R = this.S = this.k = 0;
|
||||
this.j = [];
|
||||
for (var i = 0; i < this.C; ++i) {
|
||||
this.j.push(new Array(this.B));
|
||||
}
|
||||
for (var i = 0; i < t.length; ++i) this.pushBack(t[i]);
|
||||
};
|
||||
Deque.prototype.forEach = function(t) {
|
||||
for (var i = 0; i < this.M; ++i) {
|
||||
t(this.getElementByPos(i), i, this);
|
||||
}
|
||||
};
|
||||
Deque.prototype[Symbol.iterator] = function() {
|
||||
return function() {
|
||||
var t;
|
||||
return __generator(this, (function(i) {
|
||||
switch (i.label) {
|
||||
case 0:
|
||||
t = 0;
|
||||
i.label = 1;
|
||||
|
||||
case 1:
|
||||
if (!(t < this.M)) return [ 3, 4 ];
|
||||
return [ 4, this.getElementByPos(t) ];
|
||||
|
||||
case 2:
|
||||
i.sent();
|
||||
i.label = 3;
|
||||
|
||||
case 3:
|
||||
++t;
|
||||
return [ 3, 1 ];
|
||||
|
||||
case 4:
|
||||
return [ 2 ];
|
||||
}
|
||||
}));
|
||||
}.bind(this)();
|
||||
};
|
||||
return Deque;
|
||||
}(SequentialContainer);
|
||||
|
||||
export default Deque;
|
||||
//# sourceMappingURL=Deque.js.map
|
1
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Deque.js.map
generated
vendored
Normal file
1
VApp/node_modules/js-sdsl/dist/esm/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/esm/container/SequentialContainer/LinkList.d.ts
generated
vendored
Normal file
58
VApp/node_modules/js-sdsl/dist/esm/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;
|
456
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/LinkList.js
generated
vendored
Normal file
456
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/LinkList.js
generated
vendored
Normal file
@ -0,0 +1,456 @@
|
||||
var __extends = this && this.t || function() {
|
||||
var extendStatics = function(t, i) {
|
||||
extendStatics = Object.setPrototypeOf || {
|
||||
__proto__: []
|
||||
} instanceof Array && function(t, i) {
|
||||
t.__proto__ = i;
|
||||
} || function(t, i) {
|
||||
for (var r in i) if (Object.prototype.hasOwnProperty.call(i, r)) t[r] = i[r];
|
||||
};
|
||||
return extendStatics(t, i);
|
||||
};
|
||||
return function(t, i) {
|
||||
if (typeof i !== "function" && i !== null) throw new TypeError("Class extends value " + String(i) + " is not a constructor or null");
|
||||
extendStatics(t, i);
|
||||
function __() {
|
||||
this.constructor = t;
|
||||
}
|
||||
t.prototype = i === null ? Object.create(i) : (__.prototype = i.prototype, new __);
|
||||
};
|
||||
}();
|
||||
|
||||
var __generator = this && this.i || function(t, i) {
|
||||
var r = {
|
||||
label: 0,
|
||||
sent: function() {
|
||||
if (e[0] & 1) throw e[1];
|
||||
return e[1];
|
||||
},
|
||||
trys: [],
|
||||
ops: []
|
||||
}, n, s, e, h;
|
||||
return h = {
|
||||
next: verb(0),
|
||||
throw: verb(1),
|
||||
return: verb(2)
|
||||
}, typeof Symbol === "function" && (h[Symbol.iterator] = function() {
|
||||
return this;
|
||||
}), h;
|
||||
function verb(t) {
|
||||
return function(i) {
|
||||
return step([ t, i ]);
|
||||
};
|
||||
}
|
||||
function step(h) {
|
||||
if (n) throw new TypeError("Generator is already executing.");
|
||||
while (r) try {
|
||||
if (n = 1, s && (e = h[0] & 2 ? s["return"] : h[0] ? s["throw"] || ((e = s["return"]) && e.call(s),
|
||||
0) : s.next) && !(e = e.call(s, h[1])).done) return e;
|
||||
if (s = 0, e) h = [ h[0] & 2, e.value ];
|
||||
switch (h[0]) {
|
||||
case 0:
|
||||
case 1:
|
||||
e = h;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
r.label++;
|
||||
return {
|
||||
value: h[1],
|
||||
done: false
|
||||
};
|
||||
|
||||
case 5:
|
||||
r.label++;
|
||||
s = h[1];
|
||||
h = [ 0 ];
|
||||
continue;
|
||||
|
||||
case 7:
|
||||
h = r.ops.pop();
|
||||
r.trys.pop();
|
||||
continue;
|
||||
|
||||
default:
|
||||
if (!(e = r.trys, e = e.length > 0 && e[e.length - 1]) && (h[0] === 6 || h[0] === 2)) {
|
||||
r = 0;
|
||||
continue;
|
||||
}
|
||||
if (h[0] === 3 && (!e || h[1] > e[0] && h[1] < e[3])) {
|
||||
r.label = h[1];
|
||||
break;
|
||||
}
|
||||
if (h[0] === 6 && r.label < e[1]) {
|
||||
r.label = e[1];
|
||||
e = h;
|
||||
break;
|
||||
}
|
||||
if (e && r.label < e[2]) {
|
||||
r.label = e[2];
|
||||
r.ops.push(h);
|
||||
break;
|
||||
}
|
||||
if (e[2]) r.ops.pop();
|
||||
r.trys.pop();
|
||||
continue;
|
||||
}
|
||||
h = i.call(t, r);
|
||||
} catch (t) {
|
||||
h = [ 6, t ];
|
||||
s = 0;
|
||||
} finally {
|
||||
n = e = 0;
|
||||
}
|
||||
if (h[0] & 5) throw h[1];
|
||||
return {
|
||||
value: h[0] ? h[1] : void 0,
|
||||
done: true
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
import SequentialContainer from "./Base";
|
||||
|
||||
import { ContainerIterator } from "../ContainerBase";
|
||||
|
||||
import { throwIteratorAccessError } from "../../utils/throwError";
|
||||
|
||||
var LinkListIterator = function(t) {
|
||||
__extends(LinkListIterator, t);
|
||||
function LinkListIterator(i, r, n, s) {
|
||||
var e = t.call(this, s) || this;
|
||||
e.o = i;
|
||||
e.h = r;
|
||||
e.container = n;
|
||||
if (e.iteratorType === 0) {
|
||||
e.pre = function() {
|
||||
if (this.o.L === this.h) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
this.o = this.o.L;
|
||||
return this;
|
||||
};
|
||||
e.next = function() {
|
||||
if (this.o === this.h) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
this.o = this.o.m;
|
||||
return this;
|
||||
};
|
||||
} else {
|
||||
e.pre = function() {
|
||||
if (this.o.m === this.h) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
this.o = this.o.m;
|
||||
return this;
|
||||
};
|
||||
e.next = function() {
|
||||
if (this.o === this.h) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
this.o = this.o.L;
|
||||
return this;
|
||||
};
|
||||
}
|
||||
return e;
|
||||
}
|
||||
Object.defineProperty(LinkListIterator.prototype, "pointer", {
|
||||
get: function() {
|
||||
if (this.o === this.h) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
return this.o.p;
|
||||
},
|
||||
set: function(t) {
|
||||
if (this.o === this.h) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
this.o.p = t;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
LinkListIterator.prototype.copy = function() {
|
||||
return new LinkListIterator(this.o, this.h, this.container, this.iteratorType);
|
||||
};
|
||||
return LinkListIterator;
|
||||
}(ContainerIterator);
|
||||
|
||||
var LinkList = function(t) {
|
||||
__extends(LinkList, t);
|
||||
function LinkList(i) {
|
||||
if (i === void 0) {
|
||||
i = [];
|
||||
}
|
||||
var r = t.call(this) || this;
|
||||
r.h = {};
|
||||
r.H = r.l = r.h.L = r.h.m = r.h;
|
||||
var n = r;
|
||||
i.forEach((function(t) {
|
||||
n.pushBack(t);
|
||||
}));
|
||||
return r;
|
||||
}
|
||||
LinkList.prototype.G = function(t) {
|
||||
var i = t.L, r = t.m;
|
||||
i.m = r;
|
||||
r.L = i;
|
||||
if (t === this.H) {
|
||||
this.H = r;
|
||||
}
|
||||
if (t === this.l) {
|
||||
this.l = i;
|
||||
}
|
||||
this.M -= 1;
|
||||
};
|
||||
LinkList.prototype.F = function(t, i) {
|
||||
var r = i.m;
|
||||
var n = {
|
||||
p: t,
|
||||
L: i,
|
||||
m: r
|
||||
};
|
||||
i.m = n;
|
||||
r.L = n;
|
||||
if (i === this.h) {
|
||||
this.H = n;
|
||||
}
|
||||
if (r === this.h) {
|
||||
this.l = n;
|
||||
}
|
||||
this.M += 1;
|
||||
};
|
||||
LinkList.prototype.clear = function() {
|
||||
this.M = 0;
|
||||
this.H = this.l = this.h.L = this.h.m = this.h;
|
||||
};
|
||||
LinkList.prototype.begin = function() {
|
||||
return new LinkListIterator(this.H, this.h, this);
|
||||
};
|
||||
LinkList.prototype.end = function() {
|
||||
return new LinkListIterator(this.h, this.h, this);
|
||||
};
|
||||
LinkList.prototype.rBegin = function() {
|
||||
return new LinkListIterator(this.l, this.h, this, 1);
|
||||
};
|
||||
LinkList.prototype.rEnd = function() {
|
||||
return new LinkListIterator(this.h, this.h, this, 1);
|
||||
};
|
||||
LinkList.prototype.front = function() {
|
||||
return this.H.p;
|
||||
};
|
||||
LinkList.prototype.back = function() {
|
||||
return this.l.p;
|
||||
};
|
||||
LinkList.prototype.getElementByPos = function(t) {
|
||||
if (t < 0 || t > this.M - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
var i = this.H;
|
||||
while (t--) {
|
||||
i = i.m;
|
||||
}
|
||||
return i.p;
|
||||
};
|
||||
LinkList.prototype.eraseElementByPos = function(t) {
|
||||
if (t < 0 || t > this.M - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
var i = this.H;
|
||||
while (t--) {
|
||||
i = i.m;
|
||||
}
|
||||
this.G(i);
|
||||
return this.M;
|
||||
};
|
||||
LinkList.prototype.eraseElementByValue = function(t) {
|
||||
var i = this.H;
|
||||
while (i !== this.h) {
|
||||
if (i.p === t) {
|
||||
this.G(i);
|
||||
}
|
||||
i = i.m;
|
||||
}
|
||||
return this.M;
|
||||
};
|
||||
LinkList.prototype.eraseElementByIterator = function(t) {
|
||||
var i = t.o;
|
||||
if (i === this.h) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
t = t.next();
|
||||
this.G(i);
|
||||
return t;
|
||||
};
|
||||
LinkList.prototype.pushBack = function(t) {
|
||||
this.F(t, this.l);
|
||||
return this.M;
|
||||
};
|
||||
LinkList.prototype.popBack = function() {
|
||||
if (this.M === 0) return;
|
||||
var t = this.l.p;
|
||||
this.G(this.l);
|
||||
return t;
|
||||
};
|
||||
LinkList.prototype.pushFront = function(t) {
|
||||
this.F(t, this.h);
|
||||
return this.M;
|
||||
};
|
||||
LinkList.prototype.popFront = function() {
|
||||
if (this.M === 0) return;
|
||||
var t = this.H.p;
|
||||
this.G(this.H);
|
||||
return t;
|
||||
};
|
||||
LinkList.prototype.setElementByPos = function(t, i) {
|
||||
if (t < 0 || t > this.M - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
var r = this.H;
|
||||
while (t--) {
|
||||
r = r.m;
|
||||
}
|
||||
r.p = i;
|
||||
};
|
||||
LinkList.prototype.insert = function(t, i, r) {
|
||||
if (r === void 0) {
|
||||
r = 1;
|
||||
}
|
||||
if (t < 0 || t > this.M) {
|
||||
throw new RangeError;
|
||||
}
|
||||
if (r <= 0) return this.M;
|
||||
if (t === 0) {
|
||||
while (r--) this.pushFront(i);
|
||||
} else if (t === this.M) {
|
||||
while (r--) this.pushBack(i);
|
||||
} else {
|
||||
var n = this.H;
|
||||
for (var s = 1; s < t; ++s) {
|
||||
n = n.m;
|
||||
}
|
||||
var e = n.m;
|
||||
this.M += r;
|
||||
while (r--) {
|
||||
n.m = {
|
||||
p: i,
|
||||
L: n
|
||||
};
|
||||
n.m.L = n;
|
||||
n = n.m;
|
||||
}
|
||||
n.m = e;
|
||||
e.L = n;
|
||||
}
|
||||
return this.M;
|
||||
};
|
||||
LinkList.prototype.find = function(t) {
|
||||
var i = this.H;
|
||||
while (i !== this.h) {
|
||||
if (i.p === t) {
|
||||
return new LinkListIterator(i, this.h, this);
|
||||
}
|
||||
i = i.m;
|
||||
}
|
||||
return this.end();
|
||||
};
|
||||
LinkList.prototype.reverse = function() {
|
||||
if (this.M <= 1) return;
|
||||
var t = this.H;
|
||||
var i = this.l;
|
||||
var r = 0;
|
||||
while (r << 1 < this.M) {
|
||||
var n = t.p;
|
||||
t.p = i.p;
|
||||
i.p = n;
|
||||
t = t.m;
|
||||
i = i.L;
|
||||
r += 1;
|
||||
}
|
||||
};
|
||||
LinkList.prototype.unique = function() {
|
||||
if (this.M <= 1) {
|
||||
return this.M;
|
||||
}
|
||||
var t = this.H;
|
||||
while (t !== this.h) {
|
||||
var i = t;
|
||||
while (i.m !== this.h && i.p === i.m.p) {
|
||||
i = i.m;
|
||||
this.M -= 1;
|
||||
}
|
||||
t.m = i.m;
|
||||
t.m.L = t;
|
||||
t = t.m;
|
||||
}
|
||||
return this.M;
|
||||
};
|
||||
LinkList.prototype.sort = function(t) {
|
||||
if (this.M <= 1) return;
|
||||
var i = [];
|
||||
this.forEach((function(t) {
|
||||
i.push(t);
|
||||
}));
|
||||
i.sort(t);
|
||||
var r = this.H;
|
||||
i.forEach((function(t) {
|
||||
r.p = t;
|
||||
r = r.m;
|
||||
}));
|
||||
};
|
||||
LinkList.prototype.merge = function(t) {
|
||||
var i = this;
|
||||
if (this.M === 0) {
|
||||
t.forEach((function(t) {
|
||||
i.pushBack(t);
|
||||
}));
|
||||
} else {
|
||||
var r = this.H;
|
||||
t.forEach((function(t) {
|
||||
while (r !== i.h && r.p <= t) {
|
||||
r = r.m;
|
||||
}
|
||||
i.F(t, r.L);
|
||||
}));
|
||||
}
|
||||
return this.M;
|
||||
};
|
||||
LinkList.prototype.forEach = function(t) {
|
||||
var i = this.H;
|
||||
var r = 0;
|
||||
while (i !== this.h) {
|
||||
t(i.p, r++, this);
|
||||
i = i.m;
|
||||
}
|
||||
};
|
||||
LinkList.prototype[Symbol.iterator] = function() {
|
||||
return function() {
|
||||
var t;
|
||||
return __generator(this, (function(i) {
|
||||
switch (i.label) {
|
||||
case 0:
|
||||
if (this.M === 0) return [ 2 ];
|
||||
t = this.H;
|
||||
i.label = 1;
|
||||
|
||||
case 1:
|
||||
if (!(t !== this.h)) return [ 3, 3 ];
|
||||
return [ 4, t.p ];
|
||||
|
||||
case 2:
|
||||
i.sent();
|
||||
t = t.m;
|
||||
return [ 3, 1 ];
|
||||
|
||||
case 3:
|
||||
return [ 2 ];
|
||||
}
|
||||
}));
|
||||
}.bind(this)();
|
||||
};
|
||||
return LinkList;
|
||||
}(SequentialContainer);
|
||||
|
||||
export default LinkList;
|
||||
//# sourceMappingURL=LinkList.js.map
|
1
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/LinkList.js.map
generated
vendored
Normal file
1
VApp/node_modules/js-sdsl/dist/esm/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/esm/container/SequentialContainer/Vector.d.ts
generated
vendored
Normal file
40
VApp/node_modules/js-sdsl/dist/esm/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;
|
323
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Vector.js
generated
vendored
Normal file
323
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Vector.js
generated
vendored
Normal file
@ -0,0 +1,323 @@
|
||||
var __extends = this && this.t || function() {
|
||||
var extendStatics = function(t, r) {
|
||||
extendStatics = Object.setPrototypeOf || {
|
||||
__proto__: []
|
||||
} instanceof Array && function(t, r) {
|
||||
t.__proto__ = r;
|
||||
} || function(t, r) {
|
||||
for (var e in r) if (Object.prototype.hasOwnProperty.call(r, e)) t[e] = r[e];
|
||||
};
|
||||
return extendStatics(t, r);
|
||||
};
|
||||
return function(t, r) {
|
||||
if (typeof r !== "function" && r !== null) throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
|
||||
extendStatics(t, r);
|
||||
function __() {
|
||||
this.constructor = t;
|
||||
}
|
||||
t.prototype = r === null ? Object.create(r) : (__.prototype = r.prototype, new __);
|
||||
};
|
||||
}();
|
||||
|
||||
var __generator = this && this.i || function(t, r) {
|
||||
var e = {
|
||||
label: 0,
|
||||
sent: function() {
|
||||
if (o[0] & 1) throw o[1];
|
||||
return o[1];
|
||||
},
|
||||
trys: [],
|
||||
ops: []
|
||||
}, n, i, o, u;
|
||||
return u = {
|
||||
next: verb(0),
|
||||
throw: verb(1),
|
||||
return: verb(2)
|
||||
}, typeof Symbol === "function" && (u[Symbol.iterator] = function() {
|
||||
return this;
|
||||
}), u;
|
||||
function verb(t) {
|
||||
return function(r) {
|
||||
return step([ t, r ]);
|
||||
};
|
||||
}
|
||||
function step(u) {
|
||||
if (n) throw new TypeError("Generator is already executing.");
|
||||
while (e) try {
|
||||
if (n = 1, i && (o = u[0] & 2 ? i["return"] : u[0] ? i["throw"] || ((o = i["return"]) && o.call(i),
|
||||
0) : i.next) && !(o = o.call(i, u[1])).done) return o;
|
||||
if (i = 0, o) u = [ u[0] & 2, o.value ];
|
||||
switch (u[0]) {
|
||||
case 0:
|
||||
case 1:
|
||||
o = u;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
e.label++;
|
||||
return {
|
||||
value: u[1],
|
||||
done: false
|
||||
};
|
||||
|
||||
case 5:
|
||||
e.label++;
|
||||
i = u[1];
|
||||
u = [ 0 ];
|
||||
continue;
|
||||
|
||||
case 7:
|
||||
u = e.ops.pop();
|
||||
e.trys.pop();
|
||||
continue;
|
||||
|
||||
default:
|
||||
if (!(o = e.trys, o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
|
||||
e = 0;
|
||||
continue;
|
||||
}
|
||||
if (u[0] === 3 && (!o || u[1] > o[0] && u[1] < o[3])) {
|
||||
e.label = u[1];
|
||||
break;
|
||||
}
|
||||
if (u[0] === 6 && e.label < o[1]) {
|
||||
e.label = o[1];
|
||||
o = u;
|
||||
break;
|
||||
}
|
||||
if (o && e.label < o[2]) {
|
||||
e.label = o[2];
|
||||
e.ops.push(u);
|
||||
break;
|
||||
}
|
||||
if (o[2]) e.ops.pop();
|
||||
e.trys.pop();
|
||||
continue;
|
||||
}
|
||||
u = r.call(t, e);
|
||||
} catch (t) {
|
||||
u = [ 6, t ];
|
||||
i = 0;
|
||||
} finally {
|
||||
n = o = 0;
|
||||
}
|
||||
if (u[0] & 5) throw u[1];
|
||||
return {
|
||||
value: u[0] ? u[1] : void 0,
|
||||
done: true
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
var __read = this && this.q || function(t, r) {
|
||||
var e = typeof Symbol === "function" && t[Symbol.iterator];
|
||||
if (!e) return t;
|
||||
var n = e.call(t), i, o = [], u;
|
||||
try {
|
||||
while ((r === void 0 || r-- > 0) && !(i = n.next()).done) o.push(i.value);
|
||||
} catch (t) {
|
||||
u = {
|
||||
error: t
|
||||
};
|
||||
} finally {
|
||||
try {
|
||||
if (i && !i.done && (e = n["return"])) e.call(n);
|
||||
} finally {
|
||||
if (u) throw u.error;
|
||||
}
|
||||
}
|
||||
return o;
|
||||
};
|
||||
|
||||
var __spreadArray = this && this.D || function(t, r, e) {
|
||||
if (e || arguments.length === 2) for (var n = 0, i = r.length, o; n < i; n++) {
|
||||
if (o || !(n in r)) {
|
||||
if (!o) o = Array.prototype.slice.call(r, 0, n);
|
||||
o[n] = r[n];
|
||||
}
|
||||
}
|
||||
return t.concat(o || Array.prototype.slice.call(r));
|
||||
};
|
||||
|
||||
var __values = this && this.V || function(t) {
|
||||
var r = typeof Symbol === "function" && Symbol.iterator, e = r && t[r], n = 0;
|
||||
if (e) return e.call(t);
|
||||
if (t && typeof t.length === "number") return {
|
||||
next: function() {
|
||||
if (t && n >= t.length) t = void 0;
|
||||
return {
|
||||
value: t && t[n++],
|
||||
done: !t
|
||||
};
|
||||
}
|
||||
};
|
||||
throw new TypeError(r ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
|
||||
import SequentialContainer from "./Base";
|
||||
|
||||
import { RandomIterator } from "./Base/RandomIterator";
|
||||
|
||||
var VectorIterator = function(t) {
|
||||
__extends(VectorIterator, t);
|
||||
function VectorIterator(r, e, n) {
|
||||
var i = t.call(this, r, n) || this;
|
||||
i.container = e;
|
||||
return i;
|
||||
}
|
||||
VectorIterator.prototype.copy = function() {
|
||||
return new VectorIterator(this.o, this.container, this.iteratorType);
|
||||
};
|
||||
return VectorIterator;
|
||||
}(RandomIterator);
|
||||
|
||||
var Vector = function(t) {
|
||||
__extends(Vector, t);
|
||||
function Vector(r, e) {
|
||||
if (r === void 0) {
|
||||
r = [];
|
||||
}
|
||||
if (e === void 0) {
|
||||
e = true;
|
||||
}
|
||||
var n = t.call(this) || this;
|
||||
if (Array.isArray(r)) {
|
||||
n.J = e ? __spreadArray([], __read(r), false) : r;
|
||||
n.M = r.length;
|
||||
} else {
|
||||
n.J = [];
|
||||
var i = n;
|
||||
r.forEach((function(t) {
|
||||
i.pushBack(t);
|
||||
}));
|
||||
}
|
||||
return n;
|
||||
}
|
||||
Vector.prototype.clear = function() {
|
||||
this.M = 0;
|
||||
this.J.length = 0;
|
||||
};
|
||||
Vector.prototype.begin = function() {
|
||||
return new VectorIterator(0, this);
|
||||
};
|
||||
Vector.prototype.end = function() {
|
||||
return new VectorIterator(this.M, this);
|
||||
};
|
||||
Vector.prototype.rBegin = function() {
|
||||
return new VectorIterator(this.M - 1, this, 1);
|
||||
};
|
||||
Vector.prototype.rEnd = function() {
|
||||
return new VectorIterator(-1, this, 1);
|
||||
};
|
||||
Vector.prototype.front = function() {
|
||||
return this.J[0];
|
||||
};
|
||||
Vector.prototype.back = function() {
|
||||
return this.J[this.M - 1];
|
||||
};
|
||||
Vector.prototype.getElementByPos = function(t) {
|
||||
if (t < 0 || t > this.M - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
return this.J[t];
|
||||
};
|
||||
Vector.prototype.eraseElementByPos = function(t) {
|
||||
if (t < 0 || t > this.M - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
this.J.splice(t, 1);
|
||||
this.M -= 1;
|
||||
return this.M;
|
||||
};
|
||||
Vector.prototype.eraseElementByValue = function(t) {
|
||||
var r = 0;
|
||||
for (var e = 0; e < this.M; ++e) {
|
||||
if (this.J[e] !== t) {
|
||||
this.J[r++] = this.J[e];
|
||||
}
|
||||
}
|
||||
this.M = this.J.length = r;
|
||||
return this.M;
|
||||
};
|
||||
Vector.prototype.eraseElementByIterator = function(t) {
|
||||
var r = t.o;
|
||||
t = t.next();
|
||||
this.eraseElementByPos(r);
|
||||
return t;
|
||||
};
|
||||
Vector.prototype.pushBack = function(t) {
|
||||
this.J.push(t);
|
||||
this.M += 1;
|
||||
return this.M;
|
||||
};
|
||||
Vector.prototype.popBack = function() {
|
||||
if (this.M === 0) return;
|
||||
this.M -= 1;
|
||||
return this.J.pop();
|
||||
};
|
||||
Vector.prototype.setElementByPos = function(t, r) {
|
||||
if (t < 0 || t > this.M - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
this.J[t] = r;
|
||||
};
|
||||
Vector.prototype.insert = function(t, r, e) {
|
||||
var n;
|
||||
if (e === void 0) {
|
||||
e = 1;
|
||||
}
|
||||
if (t < 0 || t > this.M) {
|
||||
throw new RangeError;
|
||||
}
|
||||
(n = this.J).splice.apply(n, __spreadArray([ t, 0 ], __read(new Array(e).fill(r)), false));
|
||||
this.M += e;
|
||||
return this.M;
|
||||
};
|
||||
Vector.prototype.find = function(t) {
|
||||
for (var r = 0; r < this.M; ++r) {
|
||||
if (this.J[r] === t) {
|
||||
return new VectorIterator(r, this);
|
||||
}
|
||||
}
|
||||
return this.end();
|
||||
};
|
||||
Vector.prototype.reverse = function() {
|
||||
this.J.reverse();
|
||||
};
|
||||
Vector.prototype.unique = function() {
|
||||
var t = 1;
|
||||
for (var r = 1; r < this.M; ++r) {
|
||||
if (this.J[r] !== this.J[r - 1]) {
|
||||
this.J[t++] = this.J[r];
|
||||
}
|
||||
}
|
||||
this.M = this.J.length = t;
|
||||
return this.M;
|
||||
};
|
||||
Vector.prototype.sort = function(t) {
|
||||
this.J.sort(t);
|
||||
};
|
||||
Vector.prototype.forEach = function(t) {
|
||||
for (var r = 0; r < this.M; ++r) {
|
||||
t(this.J[r], r, this);
|
||||
}
|
||||
};
|
||||
Vector.prototype[Symbol.iterator] = function() {
|
||||
return function() {
|
||||
return __generator(this, (function(t) {
|
||||
switch (t.label) {
|
||||
case 0:
|
||||
return [ 5, __values(this.J) ];
|
||||
|
||||
case 1:
|
||||
t.sent();
|
||||
return [ 2 ];
|
||||
}
|
||||
}));
|
||||
}.bind(this)();
|
||||
};
|
||||
return Vector;
|
||||
}(SequentialContainer);
|
||||
|
||||
export default Vector;
|
||||
//# sourceMappingURL=Vector.js.map
|
1
VApp/node_modules/js-sdsl/dist/esm/container/SequentialContainer/Vector.js.map
generated
vendored
Normal file
1
VApp/node_modules/js-sdsl/dist/esm/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