Bump packages to fix linter
This commit is contained in:
parent
ed9506bbaf
commit
0a11e3fdd9
6063 changed files with 378752 additions and 306784 deletions
206
node_modules/js-sdsl/dist/cjs/container/ContainerBase/index.d.ts
generated
vendored
Normal file
206
node_modules/js-sdsl/dist/cjs/container/ContainerBase/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
/**
|
||||
* @description The iterator type including `NORMAL` and `REVERSE`.
|
||||
*/
|
||||
export declare const enum IteratorType {
|
||||
NORMAL = 0,
|
||||
REVERSE = 1
|
||||
}
|
||||
export declare abstract class ContainerIterator<T> {
|
||||
/**
|
||||
* @description Iterator's type.
|
||||
* @example
|
||||
* console.log(container.end().iteratorType === IteratorType.NORMAL); // true
|
||||
*/
|
||||
readonly iteratorType: IteratorType;
|
||||
/**
|
||||
* @param iter - The other iterator you want to compare.
|
||||
* @returns Whether this equals to obj.
|
||||
* @example
|
||||
* container.find(1).equals(container.end());
|
||||
*/
|
||||
equals(iter: ContainerIterator<T>): boolean;
|
||||
/**
|
||||
* @description Pointers to element.
|
||||
* @returns The value of the pointer's element.
|
||||
* @example
|
||||
* const val = container.begin().pointer;
|
||||
*/
|
||||
abstract get pointer(): T;
|
||||
/**
|
||||
* @description Set pointer's value (some containers are unavailable).
|
||||
* @param newValue - The new value you want to set.
|
||||
* @example
|
||||
* (<LinkList<number>>container).begin().pointer = 1;
|
||||
*/
|
||||
abstract set pointer(newValue: T);
|
||||
/**
|
||||
* @description Move `this` iterator to pre.
|
||||
* @returns The iterator's self.
|
||||
* @example
|
||||
* const iter = container.find(1); // container = [0, 1]
|
||||
* const pre = iter.pre();
|
||||
* console.log(pre === iter); // true
|
||||
* console.log(pre.equals(iter)); // true
|
||||
* console.log(pre.pointer, iter.pointer); // 0, 0
|
||||
*/
|
||||
abstract pre(): this;
|
||||
/**
|
||||
* @description Move `this` iterator to next.
|
||||
* @returns The iterator's self.
|
||||
* @example
|
||||
* const iter = container.find(1); // container = [1, 2]
|
||||
* const next = iter.next();
|
||||
* console.log(next === iter); // true
|
||||
* console.log(next.equals(iter)); // true
|
||||
* console.log(next.pointer, iter.pointer); // 2, 2
|
||||
*/
|
||||
abstract next(): this;
|
||||
/**
|
||||
* @description Get a copy of itself.
|
||||
* @returns The copy of self.
|
||||
* @example
|
||||
* const iter = container.find(1); // container = [1, 2]
|
||||
* const next = iter.copy().next();
|
||||
* console.log(next === iter); // false
|
||||
* console.log(next.equals(iter)); // false
|
||||
* console.log(next.pointer, iter.pointer); // 2, 1
|
||||
*/
|
||||
abstract copy(): ContainerIterator<T>;
|
||||
}
|
||||
export declare abstract class Base {
|
||||
/**
|
||||
* @returns The size of the container.
|
||||
* @example
|
||||
* const container = new Vector([1, 2]);
|
||||
* console.log(container.length); // 2
|
||||
*/
|
||||
get length(): number;
|
||||
/**
|
||||
* @returns The size of the container.
|
||||
* @example
|
||||
* const container = new Vector([1, 2]);
|
||||
* console.log(container.size()); // 2
|
||||
*/
|
||||
size(): number;
|
||||
/**
|
||||
* @returns Whether the container is empty.
|
||||
* @example
|
||||
* container.clear();
|
||||
* console.log(container.empty()); // true
|
||||
*/
|
||||
empty(): boolean;
|
||||
/**
|
||||
* @description Clear the container.
|
||||
* @example
|
||||
* container.clear();
|
||||
* console.log(container.empty()); // true
|
||||
*/
|
||||
abstract clear(): void;
|
||||
}
|
||||
export declare abstract class Container<T> extends Base {
|
||||
/**
|
||||
* @returns Iterator pointing to the beginning element.
|
||||
* @example
|
||||
* const begin = container.begin();
|
||||
* const end = container.end();
|
||||
* for (const it = begin; !it.equals(end); it.next()) {
|
||||
* doSomething(it.pointer);
|
||||
* }
|
||||
*/
|
||||
abstract begin(): ContainerIterator<T>;
|
||||
/**
|
||||
* @returns Iterator pointing to the super end like c++.
|
||||
* @example
|
||||
* const begin = container.begin();
|
||||
* const end = container.end();
|
||||
* for (const it = begin; !it.equals(end); it.next()) {
|
||||
* doSomething(it.pointer);
|
||||
* }
|
||||
*/
|
||||
abstract end(): ContainerIterator<T>;
|
||||
/**
|
||||
* @returns Iterator pointing to the end element.
|
||||
* @example
|
||||
* const rBegin = container.rBegin();
|
||||
* const rEnd = container.rEnd();
|
||||
* for (const it = rBegin; !it.equals(rEnd); it.next()) {
|
||||
* doSomething(it.pointer);
|
||||
* }
|
||||
*/
|
||||
abstract rBegin(): ContainerIterator<T>;
|
||||
/**
|
||||
* @returns Iterator pointing to the super begin like c++.
|
||||
* @example
|
||||
* const rBegin = container.rBegin();
|
||||
* const rEnd = container.rEnd();
|
||||
* for (const it = rBegin; !it.equals(rEnd); it.next()) {
|
||||
* doSomething(it.pointer);
|
||||
* }
|
||||
*/
|
||||
abstract rEnd(): ContainerIterator<T>;
|
||||
/**
|
||||
* @returns The first element of the container.
|
||||
*/
|
||||
abstract front(): T | undefined;
|
||||
/**
|
||||
* @returns The last element of the container.
|
||||
*/
|
||||
abstract back(): T | undefined;
|
||||
/**
|
||||
* @param element - The element you want to find.
|
||||
* @returns An iterator pointing to the element if found, or super end if not found.
|
||||
* @example
|
||||
* container.find(1).equals(container.end());
|
||||
*/
|
||||
abstract find(element: T): ContainerIterator<T>;
|
||||
/**
|
||||
* @description Iterate over all elements in the container.
|
||||
* @param callback - Callback function like Array.forEach.
|
||||
* @example
|
||||
* container.forEach((element, index) => console.log(element, index));
|
||||
*/
|
||||
abstract forEach(callback: (element: T, index: number, container: Container<T>) => void): void;
|
||||
/**
|
||||
* @description Gets the value of the element at the specified position.
|
||||
* @example
|
||||
* const val = container.getElementByPos(-1); // throw a RangeError
|
||||
*/
|
||||
abstract getElementByPos(pos: number): T;
|
||||
/**
|
||||
* @description Removes the element at the specified position.
|
||||
* @param pos - The element's position you want to remove.
|
||||
* @returns The container length after erasing.
|
||||
* @example
|
||||
* container.eraseElementByPos(-1); // throw a RangeError
|
||||
*/
|
||||
abstract eraseElementByPos(pos: number): number;
|
||||
/**
|
||||
* @description Removes element by iterator and move `iter` to next.
|
||||
* @param iter - The iterator you want to erase.
|
||||
* @returns The next iterator.
|
||||
* @example
|
||||
* container.eraseElementByIterator(container.begin());
|
||||
* container.eraseElementByIterator(container.end()); // throw a RangeError
|
||||
*/
|
||||
abstract eraseElementByIterator(iter: ContainerIterator<T>): ContainerIterator<T>;
|
||||
/**
|
||||
* @description Using for `for...of` syntax like Array.
|
||||
* @example
|
||||
* for (const element of container) {
|
||||
* console.log(element);
|
||||
* }
|
||||
*/
|
||||
abstract [Symbol.iterator](): Generator<T, void>;
|
||||
}
|
||||
/**
|
||||
* @description The initial data type passed in when initializing the container.
|
||||
*/
|
||||
export declare type initContainer<T> = ({
|
||||
size: number;
|
||||
} | {
|
||||
length: number;
|
||||
} | {
|
||||
size(): number;
|
||||
}) & {
|
||||
forEach(callback: (element: T) => void): void;
|
||||
};
|
||||
40
node_modules/js-sdsl/dist/cjs/container/ContainerBase/index.js
generated
vendored
Normal file
40
node_modules/js-sdsl/dist/cjs/container/ContainerBase/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.ContainerIterator = exports.Container = exports.Base = void 0;
|
||||
|
||||
class ContainerIterator {
|
||||
constructor(t = 0) {
|
||||
this.iteratorType = t;
|
||||
}
|
||||
equals(t) {
|
||||
return this.o === t.o;
|
||||
}
|
||||
}
|
||||
|
||||
exports.ContainerIterator = ContainerIterator;
|
||||
|
||||
class Base {
|
||||
constructor() {
|
||||
this.i = 0;
|
||||
}
|
||||
get length() {
|
||||
return this.i;
|
||||
}
|
||||
size() {
|
||||
return this.i;
|
||||
}
|
||||
empty() {
|
||||
return this.i === 0;
|
||||
}
|
||||
}
|
||||
|
||||
exports.Base = Base;
|
||||
|
||||
class Container extends Base {}
|
||||
|
||||
exports.Container = Container;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/ContainerBase/index.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/ContainerBase/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
22
node_modules/js-sdsl/dist/cjs/container/HashContainer/Base/index.d.ts
generated
vendored
Normal file
22
node_modules/js-sdsl/dist/cjs/container/HashContainer/Base/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { Container, ContainerIterator } from "../../ContainerBase";
|
||||
export declare abstract class HashContainerIterator<K, V> extends ContainerIterator<K | [K, V]> {
|
||||
pre(): this;
|
||||
next(): this;
|
||||
}
|
||||
export declare abstract class HashContainer<K, V> extends Container<K | [K, V]> {
|
||||
/**
|
||||
* @description Unique symbol used to tag object.
|
||||
*/
|
||||
readonly HASH_TAG: symbol;
|
||||
clear(): void;
|
||||
/**
|
||||
* @description Remove the element of the specified key.
|
||||
* @param key - The key you want to remove.
|
||||
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
|
||||
* If a `undefined` value is passed in, the type will be automatically judged.
|
||||
* @returns Whether erase successfully.
|
||||
*/
|
||||
eraseElementByKey(key: K, isObject?: boolean): boolean;
|
||||
eraseElementByIterator(iter: HashContainerIterator<K, V>): HashContainerIterator<K, V>;
|
||||
eraseElementByPos(pos: number): number;
|
||||
}
|
||||
188
node_modules/js-sdsl/dist/cjs/container/HashContainer/Base/index.js
generated
vendored
Normal file
188
node_modules/js-sdsl/dist/cjs/container/HashContainer/Base/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.HashContainerIterator = exports.HashContainer = void 0;
|
||||
|
||||
var _ContainerBase = require("../../ContainerBase");
|
||||
|
||||
var _checkObject = _interopRequireDefault(require("../../../utils/checkObject"));
|
||||
|
||||
var _throwError = require("../../../utils/throwError");
|
||||
|
||||
function _interopRequireDefault(t) {
|
||||
return t && t.t ? t : {
|
||||
default: t
|
||||
};
|
||||
}
|
||||
|
||||
class HashContainerIterator extends _ContainerBase.ContainerIterator {
|
||||
constructor(t, e, i) {
|
||||
super(i);
|
||||
this.o = t;
|
||||
this.h = e;
|
||||
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;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.HashContainerIterator = HashContainerIterator;
|
||||
|
||||
class HashContainer extends _ContainerBase.Container {
|
||||
constructor() {
|
||||
super();
|
||||
this.H = [];
|
||||
this.g = {};
|
||||
this.HASH_TAG = Symbol("@@HASH_TAG");
|
||||
Object.setPrototypeOf(this.g, null);
|
||||
this.h = {};
|
||||
this.h.L = this.h.B = this.p = this._ = this.h;
|
||||
}
|
||||
K(t) {
|
||||
const {L: e, B: i} = t;
|
||||
e.B = i;
|
||||
i.L = e;
|
||||
if (t === this.p) {
|
||||
this.p = i;
|
||||
}
|
||||
if (t === this._) {
|
||||
this._ = e;
|
||||
}
|
||||
this.i -= 1;
|
||||
}
|
||||
M(t, e, i) {
|
||||
if (i === undefined) i = (0, _checkObject.default)(t);
|
||||
let s;
|
||||
if (i) {
|
||||
const i = t[this.HASH_TAG];
|
||||
if (i !== undefined) {
|
||||
this.H[i].l = e;
|
||||
return this.i;
|
||||
}
|
||||
Object.defineProperty(t, this.HASH_TAG, {
|
||||
value: this.H.length,
|
||||
configurable: true
|
||||
});
|
||||
s = {
|
||||
u: t,
|
||||
l: e,
|
||||
L: this._,
|
||||
B: this.h
|
||||
};
|
||||
this.H.push(s);
|
||||
} else {
|
||||
const i = this.g[t];
|
||||
if (i) {
|
||||
i.l = e;
|
||||
return this.i;
|
||||
}
|
||||
s = {
|
||||
u: t,
|
||||
l: e,
|
||||
L: this._,
|
||||
B: this.h
|
||||
};
|
||||
this.g[t] = s;
|
||||
}
|
||||
if (this.i === 0) {
|
||||
this.p = s;
|
||||
this.h.B = s;
|
||||
} else {
|
||||
this._.B = s;
|
||||
}
|
||||
this._ = s;
|
||||
this.h.L = s;
|
||||
return ++this.i;
|
||||
}
|
||||
I(t, e) {
|
||||
if (e === undefined) e = (0, _checkObject.default)(t);
|
||||
if (e) {
|
||||
const e = t[this.HASH_TAG];
|
||||
if (e === undefined) return this.h;
|
||||
return this.H[e];
|
||||
} else {
|
||||
return this.g[t] || this.h;
|
||||
}
|
||||
}
|
||||
clear() {
|
||||
const t = this.HASH_TAG;
|
||||
this.H.forEach((function(e) {
|
||||
delete e.u[t];
|
||||
}));
|
||||
this.H = [];
|
||||
this.g = {};
|
||||
Object.setPrototypeOf(this.g, null);
|
||||
this.i = 0;
|
||||
this.p = this._ = this.h.L = this.h.B = this.h;
|
||||
}
|
||||
eraseElementByKey(t, e) {
|
||||
let i;
|
||||
if (e === undefined) e = (0, _checkObject.default)(t);
|
||||
if (e) {
|
||||
const e = t[this.HASH_TAG];
|
||||
if (e === undefined) return false;
|
||||
delete t[this.HASH_TAG];
|
||||
i = this.H[e];
|
||||
delete this.H[e];
|
||||
} else {
|
||||
i = this.g[t];
|
||||
if (i === undefined) return false;
|
||||
delete this.g[t];
|
||||
}
|
||||
this.K(i);
|
||||
return true;
|
||||
}
|
||||
eraseElementByIterator(t) {
|
||||
const e = t.o;
|
||||
if (e === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.K(e);
|
||||
return t.next();
|
||||
}
|
||||
eraseElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
let e = this.p;
|
||||
while (t--) {
|
||||
e = e.B;
|
||||
}
|
||||
this.K(e);
|
||||
return this.i;
|
||||
}
|
||||
}
|
||||
|
||||
exports.HashContainer = HashContainer;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/HashContainer/Base/index.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/HashContainer/Base/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
47
node_modules/js-sdsl/dist/cjs/container/HashContainer/HashMap.d.ts
generated
vendored
Normal file
47
node_modules/js-sdsl/dist/cjs/container/HashContainer/HashMap.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { initContainer } from "../ContainerBase";
|
||||
import { HashContainer, HashContainerIterator } from "./Base";
|
||||
declare class HashMapIterator<K, V> extends HashContainerIterator<K, V> {
|
||||
get pointer(): [K, V];
|
||||
copy(): HashMapIterator<K, V>;
|
||||
equals(iter: HashMapIterator<K, V>): boolean;
|
||||
}
|
||||
export type { HashMapIterator };
|
||||
declare class HashMap<K, V> extends HashContainer<K, V> {
|
||||
constructor(container?: initContainer<[K, V]>);
|
||||
begin(): HashMapIterator<K, V>;
|
||||
end(): HashMapIterator<K, V>;
|
||||
rBegin(): HashMapIterator<K, V>;
|
||||
rEnd(): HashMapIterator<K, V>;
|
||||
front(): [K, V] | undefined;
|
||||
back(): [K, V] | undefined;
|
||||
/**
|
||||
* @description Insert a key-value pair or set value by the given key.
|
||||
* @param key - The key want to insert.
|
||||
* @param value - The value want to set.
|
||||
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
|
||||
* If a `undefined` value is passed in, the type will be automatically judged.
|
||||
* @returns The size of container after setting.
|
||||
*/
|
||||
setElement(key: K, value: V, isObject?: boolean): number;
|
||||
/**
|
||||
* @description Check key if exist in container.
|
||||
* @param key - The element you want to search.
|
||||
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
|
||||
* If a `undefined` value is passed in, the type will be automatically judged.
|
||||
* @returns An iterator pointing to the element if found, or super end if not found.
|
||||
*/
|
||||
/**
|
||||
* @description Get the value of the element of the specified key.
|
||||
* @param key - The key want to search.
|
||||
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
|
||||
* If a `undefined` value is passed in, the type will be automatically judged.
|
||||
* @example
|
||||
* const val = container.getElementByKey(1);
|
||||
*/
|
||||
getElementByKey(key: K, isObject?: boolean): V | undefined;
|
||||
getElementByPos(pos: number): [K, V];
|
||||
find(key: K, isObject?: boolean): HashMapIterator<K, V>;
|
||||
forEach(callback: (element: [K, V], index: number, hashMap: HashMap<K, V>) => void): void;
|
||||
[Symbol.iterator](): Generator<[K, V], void, unknown>;
|
||||
}
|
||||
export default HashMap;
|
||||
121
node_modules/js-sdsl/dist/cjs/container/HashContainer/HashMap.js
generated
vendored
Normal file
121
node_modules/js-sdsl/dist/cjs/container/HashContainer/HashMap.js
generated
vendored
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _Base = require("./Base");
|
||||
|
||||
var _checkObject = _interopRequireDefault(require("../../utils/checkObject"));
|
||||
|
||||
var _throwError = require("../../utils/throwError");
|
||||
|
||||
function _interopRequireDefault(t) {
|
||||
return t && t.t ? t : {
|
||||
default: t
|
||||
};
|
||||
}
|
||||
|
||||
class HashMapIterator extends _Base.HashContainerIterator {
|
||||
get pointer() {
|
||||
if (this.o === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
const t = this;
|
||||
return new Proxy([], {
|
||||
get(e, r) {
|
||||
if (r === "0") return t.o.u; else if (r === "1") return t.o.l;
|
||||
},
|
||||
set(e, r, s) {
|
||||
if (r !== "1") {
|
||||
throw new TypeError("props must be 1");
|
||||
}
|
||||
t.o.l = s;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
copy() {
|
||||
return new HashMapIterator(this.o, this.h, this.iteratorType);
|
||||
}
|
||||
}
|
||||
|
||||
class HashMap extends _Base.HashContainer {
|
||||
constructor(t = []) {
|
||||
super();
|
||||
const e = this;
|
||||
t.forEach((function(t) {
|
||||
e.setElement(t[0], t[1]);
|
||||
}));
|
||||
}
|
||||
begin() {
|
||||
return new HashMapIterator(this.p, this.h);
|
||||
}
|
||||
end() {
|
||||
return new HashMapIterator(this.h, this.h);
|
||||
}
|
||||
rBegin() {
|
||||
return new HashMapIterator(this._, this.h, 1);
|
||||
}
|
||||
rEnd() {
|
||||
return new HashMapIterator(this.h, this.h, 1);
|
||||
}
|
||||
front() {
|
||||
if (this.i === 0) return;
|
||||
return [ this.p.u, this.p.l ];
|
||||
}
|
||||
back() {
|
||||
if (this.i === 0) return;
|
||||
return [ this._.u, this._.l ];
|
||||
}
|
||||
setElement(t, e, r) {
|
||||
return this.M(t, e, r);
|
||||
}
|
||||
getElementByKey(t, e) {
|
||||
if (e === undefined) e = (0, _checkObject.default)(t);
|
||||
if (e) {
|
||||
const e = t[this.HASH_TAG];
|
||||
return e !== undefined ? this.H[e].l : undefined;
|
||||
}
|
||||
const r = this.g[t];
|
||||
return r ? r.l : undefined;
|
||||
}
|
||||
getElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
let e = this.p;
|
||||
while (t--) {
|
||||
e = e.B;
|
||||
}
|
||||
return [ e.u, e.l ];
|
||||
}
|
||||
find(t, e) {
|
||||
const r = this.I(t, e);
|
||||
return new HashMapIterator(r, this.h);
|
||||
}
|
||||
forEach(t) {
|
||||
let e = 0;
|
||||
let r = this.p;
|
||||
while (r !== this.h) {
|
||||
t([ r.u, r.l ], e++, this);
|
||||
r = r.B;
|
||||
}
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return function*() {
|
||||
let t = this.p;
|
||||
while (t !== this.h) {
|
||||
yield [ t.u, t.l ];
|
||||
t = t.B;
|
||||
}
|
||||
}.bind(this)();
|
||||
}
|
||||
}
|
||||
|
||||
var _default = HashMap;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=HashMap.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/HashContainer/HashMap.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/HashContainer/HashMap.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
37
node_modules/js-sdsl/dist/cjs/container/HashContainer/HashSet.d.ts
generated
vendored
Normal file
37
node_modules/js-sdsl/dist/cjs/container/HashContainer/HashSet.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import { initContainer } from "../ContainerBase";
|
||||
import { HashContainer, HashContainerIterator } from "./Base";
|
||||
declare class HashSetIterator<K, V> extends HashContainerIterator<K, V> {
|
||||
get pointer(): K;
|
||||
copy(): HashSetIterator<K, V>;
|
||||
equals(iter: HashSetIterator<K, V>): boolean;
|
||||
}
|
||||
export type { HashSetIterator };
|
||||
declare class HashSet<K> extends HashContainer<K, undefined> {
|
||||
constructor(container?: initContainer<K>);
|
||||
begin(): HashSetIterator<K, undefined>;
|
||||
end(): HashSetIterator<K, undefined>;
|
||||
rBegin(): HashSetIterator<K, undefined>;
|
||||
rEnd(): HashSetIterator<K, undefined>;
|
||||
front(): K | undefined;
|
||||
back(): K | undefined;
|
||||
/**
|
||||
* @description Insert element to set.
|
||||
* @param key - The key want to insert.
|
||||
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
|
||||
* If a `undefined` value is passed in, the type will be automatically judged.
|
||||
* @returns The size of container after inserting.
|
||||
*/
|
||||
insert(key: K, isObject?: boolean): number;
|
||||
getElementByPos(pos: number): K;
|
||||
/**
|
||||
* @description Check key if exist in container.
|
||||
* @param key - The element you want to search.
|
||||
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
|
||||
* If a `undefined` value is passed in, the type will be automatically judged.
|
||||
* @returns An iterator pointing to the element if found, or super end if not found.
|
||||
*/
|
||||
find(key: K, isObject?: boolean): HashSetIterator<K, undefined>;
|
||||
forEach(callback: (element: K, index: number, container: HashSet<K>) => void): void;
|
||||
[Symbol.iterator](): Generator<K, void, unknown>;
|
||||
}
|
||||
export default HashSet;
|
||||
90
node_modules/js-sdsl/dist/cjs/container/HashContainer/HashSet.js
generated
vendored
Normal file
90
node_modules/js-sdsl/dist/cjs/container/HashContainer/HashSet.js
generated
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _Base = require("./Base");
|
||||
|
||||
var _throwError = require("../../utils/throwError");
|
||||
|
||||
class HashSetIterator extends _Base.HashContainerIterator {
|
||||
get pointer() {
|
||||
if (this.o === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
return this.o.u;
|
||||
}
|
||||
copy() {
|
||||
return new HashSetIterator(this.o, this.h, this.iteratorType);
|
||||
}
|
||||
}
|
||||
|
||||
class HashSet extends _Base.HashContainer {
|
||||
constructor(t = []) {
|
||||
super();
|
||||
const e = this;
|
||||
t.forEach((function(t) {
|
||||
e.insert(t);
|
||||
}));
|
||||
}
|
||||
begin() {
|
||||
return new HashSetIterator(this.p, this.h);
|
||||
}
|
||||
end() {
|
||||
return new HashSetIterator(this.h, this.h);
|
||||
}
|
||||
rBegin() {
|
||||
return new HashSetIterator(this._, this.h, 1);
|
||||
}
|
||||
rEnd() {
|
||||
return new HashSetIterator(this.h, this.h, 1);
|
||||
}
|
||||
front() {
|
||||
return this.p.u;
|
||||
}
|
||||
back() {
|
||||
return this._.u;
|
||||
}
|
||||
insert(t, e) {
|
||||
return this.M(t, undefined, e);
|
||||
}
|
||||
getElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
let e = this.p;
|
||||
while (t--) {
|
||||
e = e.B;
|
||||
}
|
||||
return e.u;
|
||||
}
|
||||
find(t, e) {
|
||||
const r = this.I(t, e);
|
||||
return new HashSetIterator(r, this.h);
|
||||
}
|
||||
forEach(t) {
|
||||
let e = 0;
|
||||
let r = this.p;
|
||||
while (r !== this.h) {
|
||||
t(r.u, e++, this);
|
||||
r = r.B;
|
||||
}
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return function*() {
|
||||
let t = this.p;
|
||||
while (t !== this.h) {
|
||||
yield t.u;
|
||||
t = t.B;
|
||||
}
|
||||
}.bind(this)();
|
||||
}
|
||||
}
|
||||
|
||||
var _default = HashSet;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=HashSet.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/HashContainer/HashSet.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/HashContainer/HashSet.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
79
node_modules/js-sdsl/dist/cjs/container/OtherContainer/PriorityQueue.d.ts
generated
vendored
Normal file
79
node_modules/js-sdsl/dist/cjs/container/OtherContainer/PriorityQueue.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
import { Base, initContainer } from "../ContainerBase";
|
||||
declare class PriorityQueue<T> extends Base {
|
||||
/**
|
||||
* @description PriorityQueue's constructor.
|
||||
* @param container - Initialize container, must have a forEach function.
|
||||
* @param cmp - Compare 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.
|
||||
* @example
|
||||
* new PriorityQueue();
|
||||
* new PriorityQueue([1, 2, 3]);
|
||||
* new PriorityQueue([1, 2, 3], (x, y) => x - y);
|
||||
* new PriorityQueue([1, 2, 3], (x, y) => x - y, false);
|
||||
*/
|
||||
constructor(container?: initContainer<T>, cmp?: (x: T, y: T) => number, copy?: boolean);
|
||||
clear(): void;
|
||||
/**
|
||||
* @description Push element into a container in order.
|
||||
* @param item - The element you want to push.
|
||||
* @returns The size of heap after pushing.
|
||||
* @example
|
||||
* queue.push(1);
|
||||
*/
|
||||
push(item: T): void;
|
||||
/**
|
||||
* @description Removes the top element.
|
||||
* @returns The element you popped.
|
||||
* @example
|
||||
* queue.pop();
|
||||
*/
|
||||
pop(): T | undefined;
|
||||
/**
|
||||
* @description Accesses the top element.
|
||||
* @example
|
||||
* const top = queue.top();
|
||||
*/
|
||||
top(): T | undefined;
|
||||
/**
|
||||
* @description Check if element is in heap.
|
||||
* @param item - The item want to find.
|
||||
* @returns Whether element is in heap.
|
||||
* @example
|
||||
* const que = new PriorityQueue([], (x, y) => x.id - y.id);
|
||||
* const obj = { id: 1 };
|
||||
* que.push(obj);
|
||||
* console.log(que.find(obj)); // true
|
||||
*/
|
||||
find(item: T): boolean;
|
||||
/**
|
||||
* @description Remove specified item from heap.
|
||||
* @param item - The item want to remove.
|
||||
* @returns Whether remove success.
|
||||
* @example
|
||||
* const que = new PriorityQueue([], (x, y) => x.id - y.id);
|
||||
* const obj = { id: 1 };
|
||||
* que.push(obj);
|
||||
* que.remove(obj);
|
||||
*/
|
||||
remove(item: T): boolean;
|
||||
/**
|
||||
* @description Update item and it's pos in the heap.
|
||||
* @param item - The item want to update.
|
||||
* @returns Whether update success.
|
||||
* @example
|
||||
* const que = new PriorityQueue([], (x, y) => x.id - y.id);
|
||||
* const obj = { id: 1 };
|
||||
* que.push(obj);
|
||||
* obj.id = 2;
|
||||
* que.updateItem(obj);
|
||||
*/
|
||||
updateItem(item: T): boolean;
|
||||
/**
|
||||
* @returns Return a copy array of heap.
|
||||
* @example
|
||||
* const arr = queue.toArray();
|
||||
*/
|
||||
toArray(): T[];
|
||||
}
|
||||
export default PriorityQueue;
|
||||
118
node_modules/js-sdsl/dist/cjs/container/OtherContainer/PriorityQueue.js
generated
vendored
Normal file
118
node_modules/js-sdsl/dist/cjs/container/OtherContainer/PriorityQueue.js
generated
vendored
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _ContainerBase = require("../ContainerBase");
|
||||
|
||||
class PriorityQueue extends _ContainerBase.Base {
|
||||
constructor(t = [], s = function(t, s) {
|
||||
if (t > s) return -1;
|
||||
if (t < s) return 1;
|
||||
return 0;
|
||||
}, i = true) {
|
||||
super();
|
||||
this.v = s;
|
||||
if (Array.isArray(t)) {
|
||||
this.C = i ? [ ...t ] : t;
|
||||
} else {
|
||||
this.C = [];
|
||||
const s = this;
|
||||
t.forEach((function(t) {
|
||||
s.C.push(t);
|
||||
}));
|
||||
}
|
||||
this.i = this.C.length;
|
||||
const e = this.i >> 1;
|
||||
for (let t = this.i - 1 >> 1; t >= 0; --t) {
|
||||
this.k(t, e);
|
||||
}
|
||||
}
|
||||
m(t) {
|
||||
const s = this.C[t];
|
||||
while (t > 0) {
|
||||
const i = t - 1 >> 1;
|
||||
const e = this.C[i];
|
||||
if (this.v(e, s) <= 0) break;
|
||||
this.C[t] = e;
|
||||
t = i;
|
||||
}
|
||||
this.C[t] = s;
|
||||
}
|
||||
k(t, s) {
|
||||
const i = this.C[t];
|
||||
while (t < s) {
|
||||
let s = t << 1 | 1;
|
||||
const e = s + 1;
|
||||
let h = this.C[s];
|
||||
if (e < this.i && this.v(h, this.C[e]) > 0) {
|
||||
s = e;
|
||||
h = this.C[e];
|
||||
}
|
||||
if (this.v(h, i) >= 0) break;
|
||||
this.C[t] = h;
|
||||
t = s;
|
||||
}
|
||||
this.C[t] = i;
|
||||
}
|
||||
clear() {
|
||||
this.i = 0;
|
||||
this.C.length = 0;
|
||||
}
|
||||
push(t) {
|
||||
this.C.push(t);
|
||||
this.m(this.i);
|
||||
this.i += 1;
|
||||
}
|
||||
pop() {
|
||||
if (this.i === 0) return;
|
||||
const t = this.C[0];
|
||||
const s = this.C.pop();
|
||||
this.i -= 1;
|
||||
if (this.i) {
|
||||
this.C[0] = s;
|
||||
this.k(0, this.i >> 1);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
top() {
|
||||
return this.C[0];
|
||||
}
|
||||
find(t) {
|
||||
return this.C.indexOf(t) >= 0;
|
||||
}
|
||||
remove(t) {
|
||||
const s = this.C.indexOf(t);
|
||||
if (s < 0) return false;
|
||||
if (s === 0) {
|
||||
this.pop();
|
||||
} else if (s === this.i - 1) {
|
||||
this.C.pop();
|
||||
this.i -= 1;
|
||||
} else {
|
||||
this.C.splice(s, 1, this.C.pop());
|
||||
this.i -= 1;
|
||||
this.m(s);
|
||||
this.k(s, this.i >> 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
updateItem(t) {
|
||||
const s = this.C.indexOf(t);
|
||||
if (s < 0) return false;
|
||||
this.m(s);
|
||||
this.k(s, this.i >> 1);
|
||||
return true;
|
||||
}
|
||||
toArray() {
|
||||
return [ ...this.C ];
|
||||
}
|
||||
}
|
||||
|
||||
var _default = PriorityQueue;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=PriorityQueue.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/OtherContainer/PriorityQueue.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/OtherContainer/PriorityQueue.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
22
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Queue.d.ts
generated
vendored
Normal file
22
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Queue.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { Base, initContainer } from "../ContainerBase";
|
||||
declare class Queue<T> extends Base {
|
||||
constructor(container?: initContainer<T>);
|
||||
clear(): void;
|
||||
/**
|
||||
* @description Inserts element to queue's end.
|
||||
* @param element - The element you want to push to the front.
|
||||
* @returns The container length after pushing.
|
||||
*/
|
||||
push(element: T): number;
|
||||
/**
|
||||
* @description Removes the first element.
|
||||
* @returns The element you popped.
|
||||
*/
|
||||
pop(): T | undefined;
|
||||
/**
|
||||
* @description Access the first element.
|
||||
* @returns The first element.
|
||||
*/
|
||||
front(): T | undefined;
|
||||
}
|
||||
export default Queue;
|
||||
47
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Queue.js
generated
vendored
Normal file
47
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Queue.js
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _ContainerBase = require("../ContainerBase");
|
||||
|
||||
var _Deque = _interopRequireDefault(require("../SequentialContainer/Deque"));
|
||||
|
||||
function _interopRequireDefault(e) {
|
||||
return e && e.t ? e : {
|
||||
default: e
|
||||
};
|
||||
}
|
||||
|
||||
class Queue extends _ContainerBase.Base {
|
||||
constructor(e = []) {
|
||||
super();
|
||||
this.q = new _Deque.default(e);
|
||||
this.i = this.q.size();
|
||||
}
|
||||
clear() {
|
||||
this.q.clear();
|
||||
this.i = 0;
|
||||
}
|
||||
push(e) {
|
||||
this.q.pushBack(e);
|
||||
this.i += 1;
|
||||
return this.i;
|
||||
}
|
||||
pop() {
|
||||
if (this.i === 0) return;
|
||||
this.i -= 1;
|
||||
return this.q.popFront();
|
||||
}
|
||||
front() {
|
||||
return this.q.front();
|
||||
}
|
||||
}
|
||||
|
||||
var _default = Queue;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=Queue.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Queue.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Queue.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["container/OtherContainer/Queue.js","../../src/container/OtherContainer/Queue.ts"],"names":["Object","defineProperty","exports","value","default","_ContainerBase","require","_Deque","_interopRequireDefault","obj","__esModule","Queue","Base","constructor","container","super","this","_queue","Deque","_length","size","clear","push","element","pushBack","pop","popFront","front","_default"],"mappings":"AAAA;;AAEAA,OAAOC,eAAeC,SAAS,KAAc;IAC3CC,OAAO;;;AAETD,QAAQE,eAAe;;ACLvB,IAAAC,iBAAAC,QAAA;;AACA,IAAAC,SAAAC,uBAAAF,QAAA;;AAA0D,SAAAE,uBAAAC;IAAA,OAAAA,KAAAA,EAAAC,IAAAD,IAAA;QAAAL,SAAAK;;AAAA;;AAE1D,MAAME,cAAiBC,eAAAA;IAKrBC,YAAYC,IAA8B;QACxCC;QACAC,KAAKC,IAAS,IAAIC,OAAAA,QAAMJ;QACxBE,KAAKG,IAAUH,KAAKC,EAAOG;ADJ3B;ICMFC;QACEL,KAAKC,EAAOI;QACZL,KAAKG,IAAU;ADJf;ICWFG,KAAKC;QACHP,KAAKC,EAAOO,SAASD;QACrBP,KAAKG,KAAW;QAChB,OAAOH,KAAKG;ADJZ;ICUFM;QACE,IAAIT,KAAKG,MAAY,GAAG;QACxBH,KAAKG,KAAW;QAChB,OAAOH,KAAKC,EAAOS;ADHnB;ICSFC;QACE,OAAOX,KAAKC,EAAOU;ADHnB;;;ACKH,IAAAC,WAEcjB;;AAAKT,QAAAE,UAAAwB","file":"Queue.js","sourcesContent":["import { Base } from \"../ContainerBase\";\nimport Deque from \"../SequentialContainer/Deque\";\nclass Queue extends Base {\n constructor(container = []) {\n super();\n this._queue = new Deque(container);\n this._length = this._queue.size();\n }\n clear() {\n this._queue.clear();\n this._length = 0;\n }\n /**\n * @description Inserts element to queue's end.\n * @param element - The element you want to push to the front.\n * @returns The container length after pushing.\n */\n push(element) {\n this._queue.pushBack(element);\n this._length += 1;\n return this._length;\n }\n /**\n * @description Removes the first element.\n * @returns The element you popped.\n */\n pop() {\n if (this._length === 0)\n return;\n this._length -= 1;\n return this._queue.popFront();\n }\n /**\n * @description Access the first element.\n * @returns The first element.\n */\n front() {\n return this._queue.front();\n }\n}\nexport default Queue;\n","import { Base, initContainer } from '@/container/ContainerBase';\nimport Deque from '@/container/SequentialContainer/Deque';\n\nclass Queue<T> extends Base {\n /**\n * @internal\n */\n private _queue: Deque<T>;\n constructor(container: initContainer<T> = []) {\n super();\n this._queue = new Deque(container);\n this._length = this._queue.size();\n }\n clear() {\n this._queue.clear();\n this._length = 0;\n }\n /**\n * @description Inserts element to queue's end.\n * @param element - The element you want to push to the front.\n * @returns The container length after pushing.\n */\n push(element: T) {\n this._queue.pushBack(element);\n this._length += 1;\n return this._length;\n }\n /**\n * @description Removes the first element.\n * @returns The element you popped.\n */\n pop() {\n if (this._length === 0) return;\n this._length -= 1;\n return this._queue.popFront();\n }\n /**\n * @description Access the first element.\n * @returns The first element.\n */\n front() {\n return this._queue.front();\n }\n}\n\nexport default Queue;\n"]}
|
||||
22
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Stack.d.ts
generated
vendored
Normal file
22
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Stack.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { Base, initContainer } from "../ContainerBase";
|
||||
declare class Stack<T> extends Base {
|
||||
constructor(container?: initContainer<T>);
|
||||
clear(): void;
|
||||
/**
|
||||
* @description Insert element to stack's end.
|
||||
* @description The element you want to push to the back.
|
||||
* @returns The container length after erasing.
|
||||
*/
|
||||
push(element: T): number;
|
||||
/**
|
||||
* @description Removes the end element.
|
||||
* @returns The element you popped.
|
||||
*/
|
||||
pop(): T | undefined;
|
||||
/**
|
||||
* @description Accesses the end element.
|
||||
* @returns The last element.
|
||||
*/
|
||||
top(): T | undefined;
|
||||
}
|
||||
export default Stack;
|
||||
42
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Stack.js
generated
vendored
Normal file
42
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Stack.js
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _ContainerBase = require("../ContainerBase");
|
||||
|
||||
class Stack extends _ContainerBase.Base {
|
||||
constructor(t = []) {
|
||||
super();
|
||||
this.S = [];
|
||||
const s = this;
|
||||
t.forEach((function(t) {
|
||||
s.push(t);
|
||||
}));
|
||||
}
|
||||
clear() {
|
||||
this.i = 0;
|
||||
this.S = [];
|
||||
}
|
||||
push(t) {
|
||||
this.S.push(t);
|
||||
this.i += 1;
|
||||
return this.i;
|
||||
}
|
||||
pop() {
|
||||
if (this.i === 0) return;
|
||||
this.i -= 1;
|
||||
return this.S.pop();
|
||||
}
|
||||
top() {
|
||||
return this.S[this.i - 1];
|
||||
}
|
||||
}
|
||||
|
||||
var _default = Stack;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=Stack.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Stack.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/OtherContainer/Stack.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["container/OtherContainer/Stack.js","../../src/container/OtherContainer/Stack.ts"],"names":["Object","defineProperty","exports","value","default","_ContainerBase","require","Stack","Base","constructor","container","super","this","_stack","self","forEach","el","push","clear","_length","element","pop","top","_default"],"mappings":"AAAA;;AAEAA,OAAOC,eAAeC,SAAS,KAAc;IAC3CC,OAAO;;;AAETD,QAAQE,eAAe;;ACLvB,IAAAC,iBAAAC,QAAA;;AAEA,MAAMC,cAAiBC,eAAAA;IAKrBC,YAAYC,IAA8B;QACxCC;QAFMC,KAAAC,IAAc;QAGpB,MAAMC,IAAOF;QACbF,EAAUK,SAAQ,SAAUC;YAC1BF,EAAKG,KAAKD;ADAR;AACJ;ICEFE;QACEN,KAAKO,IAAU;QACfP,KAAKC,IAAS;ADAd;ICOFI,KAAKG;QACHR,KAAKC,EAAOI,KAAKG;QACjBR,KAAKO,KAAW;QAChB,OAAOP,KAAKO;ADAZ;ICMFE;QACE,IAAIT,KAAKO,MAAY,GAAG;QACxBP,KAAKO,KAAW;QAChB,OAAOP,KAAKC,EAAOQ;ADCnB;ICKFC;QACE,OAAOV,KAAKC,EAAOD,KAAKO,IAAU;ADClC;;;ACCH,IAAAI,WAEchB;;AAAKL,QAAAE,UAAAmB","file":"Stack.js","sourcesContent":["import { Base } from \"../ContainerBase\";\nclass Stack extends Base {\n constructor(container = []) {\n super();\n /**\n * @internal\n */\n this._stack = [];\n const self = this;\n container.forEach(function (el) {\n self.push(el);\n });\n }\n clear() {\n this._length = 0;\n this._stack = [];\n }\n /**\n * @description Insert element to stack's end.\n * @description The element you want to push to the back.\n * @returns The container length after erasing.\n */\n push(element) {\n this._stack.push(element);\n this._length += 1;\n return this._length;\n }\n /**\n * @description Removes the end element.\n * @returns The element you popped.\n */\n pop() {\n if (this._length === 0)\n return;\n this._length -= 1;\n return this._stack.pop();\n }\n /**\n * @description Accesses the end element.\n * @returns The last element.\n */\n top() {\n return this._stack[this._length - 1];\n }\n}\nexport default Stack;\n","import { Base, initContainer } from '@/container/ContainerBase';\n\nclass Stack<T> extends Base {\n /**\n * @internal\n */\n private _stack: T[] = [];\n constructor(container: initContainer<T> = []) {\n super();\n const self = this;\n container.forEach(function (el) {\n self.push(el);\n });\n }\n clear() {\n this._length = 0;\n this._stack = [];\n }\n /**\n * @description Insert element to stack's end.\n * @description The element you want to push to the back.\n * @returns The container length after erasing.\n */\n push(element: T) {\n this._stack.push(element);\n this._length += 1;\n return this._length;\n }\n /**\n * @description Removes the end element.\n * @returns The element you popped.\n */\n pop() {\n if (this._length === 0) return;\n this._length -= 1;\n return this._stack.pop();\n }\n /**\n * @description Accesses the end element.\n * @returns The last element.\n */\n top(): T | undefined {\n return this._stack[this._length - 1];\n }\n}\n\nexport default Stack;\n"]}
|
||||
7
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.d.ts
generated
vendored
Normal file
7
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { ContainerIterator } from "../../ContainerBase";
|
||||
export declare abstract class RandomIterator<T> extends ContainerIterator<T> {
|
||||
get pointer(): T;
|
||||
set pointer(newValue: T);
|
||||
pre(): this;
|
||||
next(): this;
|
||||
}
|
||||
67
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js
generated
vendored
Normal file
67
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.RandomIterator = void 0;
|
||||
|
||||
var _ContainerBase = require("../../ContainerBase");
|
||||
|
||||
var _throwError = require("../../../utils/throwError");
|
||||
|
||||
class RandomIterator extends _ContainerBase.ContainerIterator {
|
||||
constructor(t, r, i, s, h) {
|
||||
super(h);
|
||||
this.o = t;
|
||||
this.D = r;
|
||||
this.R = i;
|
||||
this.N = s;
|
||||
if (this.iteratorType === 0) {
|
||||
this.pre = function() {
|
||||
if (this.o === 0) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o -= 1;
|
||||
return this;
|
||||
};
|
||||
this.next = function() {
|
||||
if (this.o === this.D()) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o += 1;
|
||||
return this;
|
||||
};
|
||||
} else {
|
||||
this.pre = function() {
|
||||
if (this.o === this.D() - 1) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o += 1;
|
||||
return this;
|
||||
};
|
||||
this.next = function() {
|
||||
if (this.o === -1) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o -= 1;
|
||||
return this;
|
||||
};
|
||||
}
|
||||
}
|
||||
get pointer() {
|
||||
if (this.o < 0 || this.o > this.D() - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
return this.R(this.o);
|
||||
}
|
||||
set pointer(t) {
|
||||
if (this.o < 0 || this.o > this.D() - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
this.N(this.o, t);
|
||||
}
|
||||
}
|
||||
|
||||
exports.RandomIterator = RandomIterator;
|
||||
//# sourceMappingURL=RandomIterator.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/RandomIterator.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
67
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.d.ts
generated
vendored
Normal file
67
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import { Container } from "../../ContainerBase";
|
||||
declare abstract class SequentialContainer<T> extends Container<T> {
|
||||
/**
|
||||
* @description Push the element to the back.
|
||||
* @param element - The element you want to push.
|
||||
* @returns The size of container after pushing.
|
||||
*/
|
||||
abstract pushBack(element: T): number;
|
||||
/**
|
||||
* @description Removes the last element.
|
||||
* @returns The element you popped.
|
||||
*/
|
||||
abstract popBack(): T | undefined;
|
||||
/**
|
||||
* @description Sets element by position.
|
||||
* @param pos - The position you want to change.
|
||||
* @param element - The element's value you want to update.
|
||||
* @example
|
||||
* container.setElementByPos(-1, 1); // throw a RangeError
|
||||
*/
|
||||
abstract setElementByPos(pos: number, element: T): void;
|
||||
/**
|
||||
* @description Removes the elements of the specified value.
|
||||
* @param value - The value you want to remove.
|
||||
* @returns The size of container after erasing.
|
||||
* @example
|
||||
* container.eraseElementByValue(-1);
|
||||
*/
|
||||
abstract eraseElementByValue(value: T): number;
|
||||
/**
|
||||
* @description Insert several elements after the specified position.
|
||||
* @param pos - The position you want to insert.
|
||||
* @param element - The element you want to insert.
|
||||
* @param num - The number of elements you want to insert (default 1).
|
||||
* @returns The size of container after inserting.
|
||||
* @example
|
||||
* const container = new Vector([1, 2, 3]);
|
||||
* container.insert(1, 4); // [1, 4, 2, 3]
|
||||
* container.insert(1, 5, 3); // [1, 5, 5, 5, 4, 2, 3]
|
||||
*/
|
||||
abstract insert(pos: number, element: T, num?: number): number;
|
||||
/**
|
||||
* @description Reverses the container.
|
||||
* @example
|
||||
* const container = new Vector([1, 2, 3]);
|
||||
* container.reverse(); // [3, 2, 1]
|
||||
*/
|
||||
abstract reverse(): void;
|
||||
/**
|
||||
* @description Removes the duplication of elements in the container.
|
||||
* @returns The size of container after inserting.
|
||||
* @example
|
||||
* const container = new Vector([1, 1, 3, 2, 2, 5, 5, 2]);
|
||||
* container.unique(); // [1, 3, 2, 5, 2]
|
||||
*/
|
||||
abstract unique(): number;
|
||||
/**
|
||||
* @description Sort the container.
|
||||
* @param cmp - Comparison function to sort.
|
||||
* @example
|
||||
* const container = new Vector([3, 1, 10]);
|
||||
* container.sort(); // [1, 10, 3]
|
||||
* container.sort((x, y) => x - y); // [1, 3, 10]
|
||||
*/
|
||||
abstract sort(cmp?: (x: T, y: T) => number): void;
|
||||
}
|
||||
export default SequentialContainer;
|
||||
16
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.js
generated
vendored
Normal file
16
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _ContainerBase = require("../../ContainerBase");
|
||||
|
||||
class SequentialContainer extends _ContainerBase.Container {}
|
||||
|
||||
var _default = SequentialContainer;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Base/index.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["container/SequentialContainer/Base/index.js","../../src/container/SequentialContainer/Base/index.ts"],"names":["Object","defineProperty","exports","value","default","_ContainerBase","require","SequentialContainer","Container","_default"],"mappings":"AAAA;;AAEAA,OAAOC,eAAeC,SAAS,KAAc;IAC3CC,OAAO;;;AAETD,QAAQE,eAAe;;ACLvB,IAAAC,iBAAAC,QAAA;;AAEA,MAAeC,4BAA+BC,eAAAA;;AAgE7C,IAAAC,WAEcF;;AAAmBL,QAAAE,UAAAK","file":"index.js","sourcesContent":[null,"import { Container } from '@/container/ContainerBase';\n\nabstract class SequentialContainer<T> extends Container<T> {\n /**\n * @description Push the element to the back.\n * @param element - The element you want to push.\n * @returns The size of container after pushing.\n */\n abstract pushBack(element: T): number;\n /**\n * @description Removes the last element.\n * @returns The element you popped.\n */\n abstract popBack(): T | undefined;\n /**\n * @description Sets element by position.\n * @param pos - The position you want to change.\n * @param element - The element's value you want to update.\n * @example\n * container.setElementByPos(-1, 1); // throw a RangeError\n */\n abstract setElementByPos(pos: number, element: T): void;\n /**\n * @description Removes the elements of the specified value.\n * @param value - The value you want to remove.\n * @returns The size of container after erasing.\n * @example\n * container.eraseElementByValue(-1);\n */\n abstract eraseElementByValue(value: T): number;\n /**\n * @description Insert several elements after the specified position.\n * @param pos - The position you want to insert.\n * @param element - The element you want to insert.\n * @param num - The number of elements you want to insert (default 1).\n * @returns The size of container after inserting.\n * @example\n * const container = new Vector([1, 2, 3]);\n * container.insert(1, 4); // [1, 4, 2, 3]\n * container.insert(1, 5, 3); // [1, 5, 5, 5, 4, 2, 3]\n */\n abstract insert(pos: number, element: T, num?: number): number;\n /**\n * @description Reverses the container.\n * @example\n * const container = new Vector([1, 2, 3]);\n * container.reverse(); // [3, 2, 1]\n */\n abstract reverse(): void;\n /**\n * @description Removes the duplication of elements in the container.\n * @returns The size of container after inserting.\n * @example\n * const container = new Vector([1, 1, 3, 2, 2, 5, 5, 2]);\n * container.unique(); // [1, 3, 2, 5, 2]\n */\n abstract unique(): number;\n /**\n * @description Sort the container.\n * @param cmp - Comparison function to sort.\n * @example\n * const container = new Vector([3, 1, 10]);\n * container.sort(); // [1, 10, 3]\n * container.sort((x, y) => x - y); // [1, 3, 10]\n */\n abstract sort(cmp?: (x: T, y: T) => number): void;\n}\n\nexport default SequentialContainer;\n"]}
|
||||
56
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.d.ts
generated
vendored
Normal file
56
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import SequentialContainer from './Base';
|
||||
import { initContainer } from "../ContainerBase";
|
||||
import { RandomIterator } from "./Base/RandomIterator";
|
||||
declare class DequeIterator<T> extends RandomIterator<T> {
|
||||
copy(): DequeIterator<T>;
|
||||
equals(iter: DequeIterator<T>): boolean;
|
||||
}
|
||||
export type { DequeIterator };
|
||||
declare class Deque<T> extends SequentialContainer<T> {
|
||||
constructor(container?: initContainer<T>, _bucketSize?: number);
|
||||
clear(): void;
|
||||
begin(): DequeIterator<T>;
|
||||
end(): DequeIterator<T>;
|
||||
rBegin(): DequeIterator<T>;
|
||||
rEnd(): DequeIterator<T>;
|
||||
front(): T | undefined;
|
||||
back(): T | undefined;
|
||||
pushBack(element: T): number;
|
||||
popBack(): T | undefined;
|
||||
/**
|
||||
* @description Push the element to the front.
|
||||
* @param element - The element you want to push.
|
||||
* @returns The size of queue after pushing.
|
||||
*/
|
||||
pushFront(element: T): number;
|
||||
/**
|
||||
* @description Remove the _first element.
|
||||
* @returns The element you popped.
|
||||
*/
|
||||
popFront(): T | undefined;
|
||||
getElementByPos(pos: number): T;
|
||||
setElementByPos(pos: number, element: T): void;
|
||||
insert(pos: number, element: T, num?: number): number;
|
||||
/**
|
||||
* @description Remove all elements after the specified position (excluding the specified position).
|
||||
* @param pos - The previous position of the first removed element.
|
||||
* @returns The size of the container after cutting.
|
||||
* @example
|
||||
* deque.cut(1); // Then deque's size will be 2. deque -> [0, 1]
|
||||
*/
|
||||
cut(pos: number): number;
|
||||
eraseElementByPos(pos: number): number;
|
||||
eraseElementByValue(value: T): number;
|
||||
eraseElementByIterator(iter: DequeIterator<T>): DequeIterator<T>;
|
||||
find(element: T): DequeIterator<T>;
|
||||
reverse(): void;
|
||||
unique(): number;
|
||||
sort(cmp?: (x: T, y: T) => number): void;
|
||||
/**
|
||||
* @description Remove as much useless space as possible.
|
||||
*/
|
||||
shrinkToFit(): void;
|
||||
forEach(callback: (element: T, index: number, deque: Deque<T>) => void): void;
|
||||
[Symbol.iterator](): Generator<T, void, unknown>;
|
||||
}
|
||||
export default Deque;
|
||||
343
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.js
generated
vendored
Normal file
343
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.js
generated
vendored
Normal file
|
|
@ -0,0 +1,343 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _Base = _interopRequireDefault(require("./Base"));
|
||||
|
||||
var _RandomIterator = require("./Base/RandomIterator");
|
||||
|
||||
function _interopRequireDefault(t) {
|
||||
return t && t.t ? t : {
|
||||
default: t
|
||||
};
|
||||
}
|
||||
|
||||
class DequeIterator extends _RandomIterator.RandomIterator {
|
||||
copy() {
|
||||
return new DequeIterator(this.o, this.D, this.R, this.N, this.iteratorType);
|
||||
}
|
||||
}
|
||||
|
||||
class Deque extends _Base.default {
|
||||
constructor(t = [], s = 1 << 12) {
|
||||
super();
|
||||
this.P = 0;
|
||||
this.A = 0;
|
||||
this.F = 0;
|
||||
this.j = 0;
|
||||
this.O = 0;
|
||||
this.T = [];
|
||||
let i;
|
||||
if ("size" in t) {
|
||||
if (typeof t.size === "number") {
|
||||
i = t.size;
|
||||
} else {
|
||||
i = t.size();
|
||||
}
|
||||
} else if ("length" in t) {
|
||||
i = t.length;
|
||||
} else {
|
||||
throw new RangeError("Can't get container's size!");
|
||||
}
|
||||
this.V = s;
|
||||
this.O = Math.max(Math.ceil(i / this.V), 1);
|
||||
for (let t = 0; t < this.O; ++t) {
|
||||
this.T.push(new Array(this.V));
|
||||
}
|
||||
const h = Math.ceil(i / this.V);
|
||||
this.P = this.F = (this.O >> 1) - (h >> 1);
|
||||
this.A = this.j = this.V - i % this.V >> 1;
|
||||
const e = this;
|
||||
t.forEach((function(t) {
|
||||
e.pushBack(t);
|
||||
}));
|
||||
this.size = this.size.bind(this);
|
||||
this.getElementByPos = this.getElementByPos.bind(this);
|
||||
this.setElementByPos = this.setElementByPos.bind(this);
|
||||
}
|
||||
G() {
|
||||
const t = [];
|
||||
const s = Math.max(this.O >> 1, 1);
|
||||
for (let i = 0; i < s; ++i) {
|
||||
t[i] = new Array(this.V);
|
||||
}
|
||||
for (let s = this.P; s < this.O; ++s) {
|
||||
t[t.length] = this.T[s];
|
||||
}
|
||||
for (let s = 0; s < this.F; ++s) {
|
||||
t[t.length] = this.T[s];
|
||||
}
|
||||
t[t.length] = [ ...this.T[this.F] ];
|
||||
this.P = s;
|
||||
this.F = t.length - 1;
|
||||
for (let i = 0; i < s; ++i) {
|
||||
t[t.length] = new Array(this.V);
|
||||
}
|
||||
this.T = t;
|
||||
this.O = t.length;
|
||||
}
|
||||
J(t) {
|
||||
const s = this.A + t + 1;
|
||||
const i = s % this.V;
|
||||
let h = i - 1;
|
||||
let e = this.P + (s - i) / this.V;
|
||||
if (i === 0) e -= 1;
|
||||
e %= this.O;
|
||||
if (h < 0) h += this.V;
|
||||
return {
|
||||
curNodeBucketIndex: e,
|
||||
curNodePointerIndex: h
|
||||
};
|
||||
}
|
||||
clear() {
|
||||
this.T = [ [] ];
|
||||
this.O = 1;
|
||||
this.P = this.F = this.i = 0;
|
||||
this.A = this.j = this.V >> 1;
|
||||
}
|
||||
begin() {
|
||||
return new DequeIterator(0, this.size, this.getElementByPos, this.setElementByPos);
|
||||
}
|
||||
end() {
|
||||
return new DequeIterator(this.i, this.size, this.getElementByPos, this.setElementByPos);
|
||||
}
|
||||
rBegin() {
|
||||
return new DequeIterator(this.i - 1, this.size, this.getElementByPos, this.setElementByPos, 1);
|
||||
}
|
||||
rEnd() {
|
||||
return new DequeIterator(-1, this.size, this.getElementByPos, this.setElementByPos, 1);
|
||||
}
|
||||
front() {
|
||||
return this.T[this.P][this.A];
|
||||
}
|
||||
back() {
|
||||
return this.T[this.F][this.j];
|
||||
}
|
||||
pushBack(t) {
|
||||
if (this.i) {
|
||||
if (this.j < this.V - 1) {
|
||||
this.j += 1;
|
||||
} else if (this.F < this.O - 1) {
|
||||
this.F += 1;
|
||||
this.j = 0;
|
||||
} else {
|
||||
this.F = 0;
|
||||
this.j = 0;
|
||||
}
|
||||
if (this.F === this.P && this.j === this.A) this.G();
|
||||
}
|
||||
this.i += 1;
|
||||
this.T[this.F][this.j] = t;
|
||||
return this.i;
|
||||
}
|
||||
popBack() {
|
||||
if (this.i === 0) return;
|
||||
const t = this.T[this.F][this.j];
|
||||
delete this.T[this.F][this.j];
|
||||
if (this.i !== 1) {
|
||||
if (this.j > 0) {
|
||||
this.j -= 1;
|
||||
} else if (this.F > 0) {
|
||||
this.F -= 1;
|
||||
this.j = this.V - 1;
|
||||
} else {
|
||||
this.F = this.O - 1;
|
||||
this.j = this.V - 1;
|
||||
}
|
||||
}
|
||||
this.i -= 1;
|
||||
return t;
|
||||
}
|
||||
pushFront(t) {
|
||||
if (this.i) {
|
||||
if (this.A > 0) {
|
||||
this.A -= 1;
|
||||
} else if (this.P > 0) {
|
||||
this.P -= 1;
|
||||
this.A = this.V - 1;
|
||||
} else {
|
||||
this.P = this.O - 1;
|
||||
this.A = this.V - 1;
|
||||
}
|
||||
if (this.P === this.F && this.A === this.j) this.G();
|
||||
}
|
||||
this.i += 1;
|
||||
this.T[this.P][this.A] = t;
|
||||
return this.i;
|
||||
}
|
||||
popFront() {
|
||||
if (this.i === 0) return;
|
||||
const t = this.T[this.P][this.A];
|
||||
delete this.T[this.P][this.A];
|
||||
if (this.i !== 1) {
|
||||
if (this.A < this.V - 1) {
|
||||
this.A += 1;
|
||||
} else if (this.P < this.O - 1) {
|
||||
this.P += 1;
|
||||
this.A = 0;
|
||||
} else {
|
||||
this.P = 0;
|
||||
this.A = 0;
|
||||
}
|
||||
}
|
||||
this.i -= 1;
|
||||
return t;
|
||||
}
|
||||
getElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
const {curNodeBucketIndex: s, curNodePointerIndex: i} = this.J(t);
|
||||
return this.T[s][i];
|
||||
}
|
||||
setElementByPos(t, s) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
const {curNodeBucketIndex: i, curNodePointerIndex: h} = this.J(t);
|
||||
this.T[i][h] = s;
|
||||
}
|
||||
insert(t, s, i = 1) {
|
||||
if (t < 0 || t > this.i) {
|
||||
throw new RangeError;
|
||||
}
|
||||
if (t === 0) {
|
||||
while (i--) this.pushFront(s);
|
||||
} else if (t === this.i) {
|
||||
while (i--) this.pushBack(s);
|
||||
} else {
|
||||
const h = [];
|
||||
for (let s = t; s < this.i; ++s) {
|
||||
h.push(this.getElementByPos(s));
|
||||
}
|
||||
this.cut(t - 1);
|
||||
for (let t = 0; t < i; ++t) this.pushBack(s);
|
||||
for (let t = 0; t < h.length; ++t) this.pushBack(h[t]);
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
cut(t) {
|
||||
if (t < 0) {
|
||||
this.clear();
|
||||
return 0;
|
||||
}
|
||||
const {curNodeBucketIndex: s, curNodePointerIndex: i} = this.J(t);
|
||||
this.F = s;
|
||||
this.j = i;
|
||||
this.i = t + 1;
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
if (t === 0) this.popFront(); else if (t === this.i - 1) this.popBack(); else {
|
||||
const s = [];
|
||||
for (let i = t + 1; i < this.i; ++i) {
|
||||
s.push(this.getElementByPos(i));
|
||||
}
|
||||
this.cut(t);
|
||||
this.popBack();
|
||||
const i = this;
|
||||
s.forEach((function(t) {
|
||||
i.pushBack(t);
|
||||
}));
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByValue(t) {
|
||||
if (this.i === 0) return 0;
|
||||
const s = [];
|
||||
for (let i = 0; i < this.i; ++i) {
|
||||
const h = this.getElementByPos(i);
|
||||
if (h !== t) s.push(h);
|
||||
}
|
||||
const i = s.length;
|
||||
for (let t = 0; t < i; ++t) this.setElementByPos(t, s[t]);
|
||||
return this.cut(i - 1);
|
||||
}
|
||||
eraseElementByIterator(t) {
|
||||
const s = t.o;
|
||||
this.eraseElementByPos(s);
|
||||
t = t.next();
|
||||
return t;
|
||||
}
|
||||
find(t) {
|
||||
for (let s = 0; s < this.i; ++s) {
|
||||
if (this.getElementByPos(s) === t) {
|
||||
return new DequeIterator(s, this.size, this.getElementByPos, this.setElementByPos);
|
||||
}
|
||||
}
|
||||
return this.end();
|
||||
}
|
||||
reverse() {
|
||||
let t = 0;
|
||||
let s = this.i - 1;
|
||||
while (t < s) {
|
||||
const i = this.getElementByPos(t);
|
||||
this.setElementByPos(t, this.getElementByPos(s));
|
||||
this.setElementByPos(s, i);
|
||||
t += 1;
|
||||
s -= 1;
|
||||
}
|
||||
}
|
||||
unique() {
|
||||
if (this.i <= 1) {
|
||||
return this.i;
|
||||
}
|
||||
let t = 1;
|
||||
let s = this.getElementByPos(0);
|
||||
for (let i = 1; i < this.i; ++i) {
|
||||
const h = this.getElementByPos(i);
|
||||
if (h !== s) {
|
||||
s = h;
|
||||
this.setElementByPos(t++, h);
|
||||
}
|
||||
}
|
||||
while (this.i > t) this.popBack();
|
||||
return this.i;
|
||||
}
|
||||
sort(t) {
|
||||
const s = [];
|
||||
for (let t = 0; t < this.i; ++t) {
|
||||
s.push(this.getElementByPos(t));
|
||||
}
|
||||
s.sort(t);
|
||||
for (let t = 0; t < this.i; ++t) this.setElementByPos(t, s[t]);
|
||||
}
|
||||
shrinkToFit() {
|
||||
if (this.i === 0) return;
|
||||
const t = [];
|
||||
this.forEach((function(s) {
|
||||
t.push(s);
|
||||
}));
|
||||
this.O = Math.max(Math.ceil(this.i / this.V), 1);
|
||||
this.i = this.P = this.F = this.A = this.j = 0;
|
||||
this.T = [];
|
||||
for (let t = 0; t < this.O; ++t) {
|
||||
this.T.push(new Array(this.V));
|
||||
}
|
||||
for (let s = 0; s < t.length; ++s) this.pushBack(t[s]);
|
||||
}
|
||||
forEach(t) {
|
||||
for (let s = 0; s < this.i; ++s) {
|
||||
t(this.getElementByPos(s), s, this);
|
||||
}
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return function*() {
|
||||
for (let t = 0; t < this.i; ++t) {
|
||||
yield this.getElementByPos(t);
|
||||
}
|
||||
}.bind(this)();
|
||||
}
|
||||
}
|
||||
|
||||
var _default = Deque;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=Deque.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Deque.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
57
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.d.ts
generated
vendored
Normal file
57
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import SequentialContainer from './Base';
|
||||
import { ContainerIterator, initContainer } from "../ContainerBase";
|
||||
declare class LinkListIterator<T> extends ContainerIterator<T> {
|
||||
get pointer(): T;
|
||||
set pointer(newValue: T);
|
||||
copy(): LinkListIterator<T>;
|
||||
equals(iter: LinkListIterator<T>): boolean;
|
||||
pre(): this;
|
||||
next(): this;
|
||||
}
|
||||
export type { LinkListIterator };
|
||||
declare class LinkList<T> extends SequentialContainer<T> {
|
||||
constructor(container?: initContainer<T>);
|
||||
clear(): void;
|
||||
begin(): LinkListIterator<T>;
|
||||
end(): LinkListIterator<T>;
|
||||
rBegin(): LinkListIterator<T>;
|
||||
rEnd(): LinkListIterator<T>;
|
||||
front(): T | undefined;
|
||||
back(): T | undefined;
|
||||
getElementByPos(pos: number): T;
|
||||
eraseElementByPos(pos: number): number;
|
||||
eraseElementByValue(_value: T): number;
|
||||
eraseElementByIterator(iter: LinkListIterator<T>): LinkListIterator<T>;
|
||||
pushBack(element: T): number;
|
||||
popBack(): T | undefined;
|
||||
/**
|
||||
* @description Push an element to the front.
|
||||
* @param element - The element you want to push.
|
||||
* @returns The size of queue after pushing.
|
||||
*/
|
||||
pushFront(element: T): number;
|
||||
/**
|
||||
* @description Removes the first element.
|
||||
* @returns The element you popped.
|
||||
*/
|
||||
popFront(): T | undefined;
|
||||
setElementByPos(pos: number, element: T): void;
|
||||
insert(pos: number, element: T, num?: number): number;
|
||||
find(element: T): LinkListIterator<T>;
|
||||
reverse(): void;
|
||||
unique(): number;
|
||||
sort(cmp?: (x: T, y: T) => number): void;
|
||||
/**
|
||||
* @description Merges two sorted lists.
|
||||
* @param list - The other list you want to merge (must be sorted).
|
||||
* @returns The size of list after merging.
|
||||
* @example
|
||||
* const linkA = new LinkList([1, 3, 5]);
|
||||
* const linkB = new LinkList([2, 4, 6]);
|
||||
* linkA.merge(linkB); // [1, 2, 3, 4, 5];
|
||||
*/
|
||||
merge(list: LinkList<T>): number;
|
||||
forEach(callback: (element: T, index: number, list: LinkList<T>) => void): void;
|
||||
[Symbol.iterator](): Generator<T, void, unknown>;
|
||||
}
|
||||
export default LinkList;
|
||||
329
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.js
generated
vendored
Normal file
329
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.js
generated
vendored
Normal file
|
|
@ -0,0 +1,329 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _Base = _interopRequireDefault(require("./Base"));
|
||||
|
||||
var _ContainerBase = require("../ContainerBase");
|
||||
|
||||
var _throwError = require("../../utils/throwError");
|
||||
|
||||
function _interopRequireDefault(t) {
|
||||
return t && t.t ? t : {
|
||||
default: t
|
||||
};
|
||||
}
|
||||
|
||||
class LinkListIterator extends _ContainerBase.ContainerIterator {
|
||||
constructor(t, i, s) {
|
||||
super(s);
|
||||
this.o = t;
|
||||
this.h = i;
|
||||
if (this.iteratorType === 0) {
|
||||
this.pre = function() {
|
||||
if (this.o.L === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o = this.o.L;
|
||||
return this;
|
||||
};
|
||||
this.next = function() {
|
||||
if (this.o === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o = this.o.B;
|
||||
return this;
|
||||
};
|
||||
} else {
|
||||
this.pre = function() {
|
||||
if (this.o.B === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o = this.o.B;
|
||||
return this;
|
||||
};
|
||||
this.next = function() {
|
||||
if (this.o === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o = this.o.L;
|
||||
return this;
|
||||
};
|
||||
}
|
||||
}
|
||||
get pointer() {
|
||||
if (this.o === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
return this.o.l;
|
||||
}
|
||||
set pointer(t) {
|
||||
if (this.o === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
this.o.l = t;
|
||||
}
|
||||
copy() {
|
||||
return new LinkListIterator(this.o, this.h, this.iteratorType);
|
||||
}
|
||||
}
|
||||
|
||||
class LinkList extends _Base.default {
|
||||
constructor(t = []) {
|
||||
super();
|
||||
this.h = {};
|
||||
this.p = this._ = this.h.L = this.h.B = this.h;
|
||||
const i = this;
|
||||
t.forEach((function(t) {
|
||||
i.pushBack(t);
|
||||
}));
|
||||
}
|
||||
K(t) {
|
||||
const {L: i, B: s} = t;
|
||||
i.B = s;
|
||||
s.L = i;
|
||||
if (t === this.p) {
|
||||
this.p = s;
|
||||
}
|
||||
if (t === this._) {
|
||||
this._ = i;
|
||||
}
|
||||
this.i -= 1;
|
||||
}
|
||||
U(t, i) {
|
||||
const s = i.B;
|
||||
const r = {
|
||||
l: t,
|
||||
L: i,
|
||||
B: s
|
||||
};
|
||||
i.B = r;
|
||||
s.L = r;
|
||||
if (i === this.h) {
|
||||
this.p = r;
|
||||
}
|
||||
if (s === this.h) {
|
||||
this._ = r;
|
||||
}
|
||||
this.i += 1;
|
||||
}
|
||||
clear() {
|
||||
this.i = 0;
|
||||
this.p = this._ = this.h.L = this.h.B = this.h;
|
||||
}
|
||||
begin() {
|
||||
return new LinkListIterator(this.p, this.h);
|
||||
}
|
||||
end() {
|
||||
return new LinkListIterator(this.h, this.h);
|
||||
}
|
||||
rBegin() {
|
||||
return new LinkListIterator(this._, this.h, 1);
|
||||
}
|
||||
rEnd() {
|
||||
return new LinkListIterator(this.h, this.h, 1);
|
||||
}
|
||||
front() {
|
||||
return this.p.l;
|
||||
}
|
||||
back() {
|
||||
return this._.l;
|
||||
}
|
||||
getElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
let i = this.p;
|
||||
while (t--) {
|
||||
i = i.B;
|
||||
}
|
||||
return i.l;
|
||||
}
|
||||
eraseElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
let i = this.p;
|
||||
while (t--) {
|
||||
i = i.B;
|
||||
}
|
||||
this.K(i);
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByValue(t) {
|
||||
let i = this.p;
|
||||
while (i !== this.h) {
|
||||
if (i.l === t) {
|
||||
this.K(i);
|
||||
}
|
||||
i = i.B;
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByIterator(t) {
|
||||
const i = t.o;
|
||||
if (i === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
t = t.next();
|
||||
this.K(i);
|
||||
return t;
|
||||
}
|
||||
pushBack(t) {
|
||||
this.U(t, this._);
|
||||
return this.i;
|
||||
}
|
||||
popBack() {
|
||||
if (this.i === 0) return;
|
||||
const t = this._.l;
|
||||
this.K(this._);
|
||||
return t;
|
||||
}
|
||||
pushFront(t) {
|
||||
this.U(t, this.h);
|
||||
return this.i;
|
||||
}
|
||||
popFront() {
|
||||
if (this.i === 0) return;
|
||||
const t = this.p.l;
|
||||
this.K(this.p);
|
||||
return t;
|
||||
}
|
||||
setElementByPos(t, i) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
let s = this.p;
|
||||
while (t--) {
|
||||
s = s.B;
|
||||
}
|
||||
s.l = i;
|
||||
}
|
||||
insert(t, i, s = 1) {
|
||||
if (t < 0 || t > this.i) {
|
||||
throw new RangeError;
|
||||
}
|
||||
if (s <= 0) return this.i;
|
||||
if (t === 0) {
|
||||
while (s--) this.pushFront(i);
|
||||
} else if (t === this.i) {
|
||||
while (s--) this.pushBack(i);
|
||||
} else {
|
||||
let r = this.p;
|
||||
for (let i = 1; i < t; ++i) {
|
||||
r = r.B;
|
||||
}
|
||||
const e = r.B;
|
||||
this.i += s;
|
||||
while (s--) {
|
||||
r.B = {
|
||||
l: i,
|
||||
L: r
|
||||
};
|
||||
r.B.L = r;
|
||||
r = r.B;
|
||||
}
|
||||
r.B = e;
|
||||
e.L = r;
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
find(t) {
|
||||
let i = this.p;
|
||||
while (i !== this.h) {
|
||||
if (i.l === t) {
|
||||
return new LinkListIterator(i, this.h);
|
||||
}
|
||||
i = i.B;
|
||||
}
|
||||
return this.end();
|
||||
}
|
||||
reverse() {
|
||||
if (this.i <= 1) return;
|
||||
let t = this.p;
|
||||
let i = this._;
|
||||
let s = 0;
|
||||
while (s << 1 < this.i) {
|
||||
const r = t.l;
|
||||
t.l = i.l;
|
||||
i.l = r;
|
||||
t = t.B;
|
||||
i = i.L;
|
||||
s += 1;
|
||||
}
|
||||
}
|
||||
unique() {
|
||||
if (this.i <= 1) {
|
||||
return this.i;
|
||||
}
|
||||
let t = this.p;
|
||||
while (t !== this.h) {
|
||||
let i = t;
|
||||
while (i.B !== this.h && i.l === i.B.l) {
|
||||
i = i.B;
|
||||
this.i -= 1;
|
||||
}
|
||||
t.B = i.B;
|
||||
t.B.L = t;
|
||||
t = t.B;
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
sort(t) {
|
||||
if (this.i <= 1) return;
|
||||
const i = [];
|
||||
this.forEach((function(t) {
|
||||
i.push(t);
|
||||
}));
|
||||
i.sort(t);
|
||||
let s = this.p;
|
||||
i.forEach((function(t) {
|
||||
s.l = t;
|
||||
s = s.B;
|
||||
}));
|
||||
}
|
||||
merge(t) {
|
||||
const i = this;
|
||||
if (this.i === 0) {
|
||||
t.forEach((function(t) {
|
||||
i.pushBack(t);
|
||||
}));
|
||||
} else {
|
||||
let s = this.p;
|
||||
t.forEach((function(t) {
|
||||
while (s !== i.h && s.l <= t) {
|
||||
s = s.B;
|
||||
}
|
||||
i.U(t, s.L);
|
||||
}));
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
forEach(t) {
|
||||
let i = this.p;
|
||||
let s = 0;
|
||||
while (i !== this.h) {
|
||||
t(i.l, s++, this);
|
||||
i = i.B;
|
||||
}
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return function*() {
|
||||
if (this.i === 0) return;
|
||||
let t = this.p;
|
||||
while (t !== this.h) {
|
||||
yield t.l;
|
||||
t = t.B;
|
||||
}
|
||||
}.bind(this)();
|
||||
}
|
||||
}
|
||||
|
||||
var _default = LinkList;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=LinkList.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/LinkList.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
38
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.d.ts
generated
vendored
Normal file
38
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import SequentialContainer from './Base';
|
||||
import { initContainer } from "../ContainerBase";
|
||||
import { RandomIterator } from "./Base/RandomIterator";
|
||||
declare class VectorIterator<T> extends RandomIterator<T> {
|
||||
copy(): VectorIterator<T>;
|
||||
equals(iter: VectorIterator<T>): boolean;
|
||||
}
|
||||
export type { VectorIterator };
|
||||
declare class Vector<T> extends SequentialContainer<T> {
|
||||
/**
|
||||
* @param container - Initialize container, must have a forEach function.
|
||||
* @param copy - When the container is an array, you can choose to directly operate on the original object of
|
||||
* the array or perform a shallow copy. The default is shallow copy.
|
||||
*/
|
||||
constructor(container?: initContainer<T>, copy?: boolean);
|
||||
clear(): void;
|
||||
begin(): VectorIterator<T>;
|
||||
end(): VectorIterator<T>;
|
||||
rBegin(): VectorIterator<T>;
|
||||
rEnd(): VectorIterator<T>;
|
||||
front(): T | undefined;
|
||||
back(): T | undefined;
|
||||
getElementByPos(pos: number): T;
|
||||
eraseElementByPos(pos: number): number;
|
||||
eraseElementByValue(value: T): number;
|
||||
eraseElementByIterator(iter: VectorIterator<T>): VectorIterator<T>;
|
||||
pushBack(element: T): number;
|
||||
popBack(): T | undefined;
|
||||
setElementByPos(pos: number, element: T): void;
|
||||
insert(pos: number, element: T, num?: number): number;
|
||||
find(element: T): VectorIterator<T>;
|
||||
reverse(): void;
|
||||
unique(): number;
|
||||
sort(cmp?: (x: T, y: T) => number): void;
|
||||
forEach(callback: (element: T, index: number, vector: Vector<T>) => void): void;
|
||||
[Symbol.iterator](): Generator<T, void, undefined>;
|
||||
}
|
||||
export default Vector;
|
||||
157
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.js
generated
vendored
Normal file
157
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.js
generated
vendored
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _Base = _interopRequireDefault(require("./Base"));
|
||||
|
||||
var _RandomIterator = require("./Base/RandomIterator");
|
||||
|
||||
function _interopRequireDefault(t) {
|
||||
return t && t.t ? t : {
|
||||
default: t
|
||||
};
|
||||
}
|
||||
|
||||
class VectorIterator extends _RandomIterator.RandomIterator {
|
||||
copy() {
|
||||
return new VectorIterator(this.o, this.D, this.R, this.N, this.iteratorType);
|
||||
}
|
||||
}
|
||||
|
||||
class Vector extends _Base.default {
|
||||
constructor(t = [], r = true) {
|
||||
super();
|
||||
if (Array.isArray(t)) {
|
||||
this.W = r ? [ ...t ] : t;
|
||||
this.i = t.length;
|
||||
} else {
|
||||
this.W = [];
|
||||
const r = this;
|
||||
t.forEach((function(t) {
|
||||
r.pushBack(t);
|
||||
}));
|
||||
}
|
||||
this.size = this.size.bind(this);
|
||||
this.getElementByPos = this.getElementByPos.bind(this);
|
||||
this.setElementByPos = this.setElementByPos.bind(this);
|
||||
}
|
||||
clear() {
|
||||
this.i = 0;
|
||||
this.W.length = 0;
|
||||
}
|
||||
begin() {
|
||||
return new VectorIterator(0, this.size, this.getElementByPos, this.setElementByPos);
|
||||
}
|
||||
end() {
|
||||
return new VectorIterator(this.i, this.size, this.getElementByPos, this.setElementByPos);
|
||||
}
|
||||
rBegin() {
|
||||
return new VectorIterator(this.i - 1, this.size, this.getElementByPos, this.setElementByPos, 1);
|
||||
}
|
||||
rEnd() {
|
||||
return new VectorIterator(-1, this.size, this.getElementByPos, this.setElementByPos, 1);
|
||||
}
|
||||
front() {
|
||||
return this.W[0];
|
||||
}
|
||||
back() {
|
||||
return this.W[this.i - 1];
|
||||
}
|
||||
getElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
return this.W[t];
|
||||
}
|
||||
eraseElementByPos(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
this.W.splice(t, 1);
|
||||
this.i -= 1;
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByValue(t) {
|
||||
let r = 0;
|
||||
for (let e = 0; e < this.i; ++e) {
|
||||
if (this.W[e] !== t) {
|
||||
this.W[r++] = this.W[e];
|
||||
}
|
||||
}
|
||||
this.i = this.W.length = r;
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByIterator(t) {
|
||||
const r = t.o;
|
||||
t = t.next();
|
||||
this.eraseElementByPos(r);
|
||||
return t;
|
||||
}
|
||||
pushBack(t) {
|
||||
this.W.push(t);
|
||||
this.i += 1;
|
||||
return this.i;
|
||||
}
|
||||
popBack() {
|
||||
if (this.i === 0) return;
|
||||
this.i -= 1;
|
||||
return this.W.pop();
|
||||
}
|
||||
setElementByPos(t, r) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
this.W[t] = r;
|
||||
}
|
||||
insert(t, r, e = 1) {
|
||||
if (t < 0 || t > this.i) {
|
||||
throw new RangeError;
|
||||
}
|
||||
this.W.splice(t, 0, ...new Array(e).fill(r));
|
||||
this.i += e;
|
||||
return this.i;
|
||||
}
|
||||
find(t) {
|
||||
for (let r = 0; r < this.i; ++r) {
|
||||
if (this.W[r] === t) {
|
||||
return new VectorIterator(r, this.size, this.getElementByPos, this.getElementByPos);
|
||||
}
|
||||
}
|
||||
return this.end();
|
||||
}
|
||||
reverse() {
|
||||
this.W.reverse();
|
||||
}
|
||||
unique() {
|
||||
let t = 1;
|
||||
for (let r = 1; r < this.i; ++r) {
|
||||
if (this.W[r] !== this.W[r - 1]) {
|
||||
this.W[t++] = this.W[r];
|
||||
}
|
||||
}
|
||||
this.i = this.W.length = t;
|
||||
return this.i;
|
||||
}
|
||||
sort(t) {
|
||||
this.W.sort(t);
|
||||
}
|
||||
forEach(t) {
|
||||
for (let r = 0; r < this.i; ++r) {
|
||||
t(this.W[r], r, this);
|
||||
}
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return function*() {
|
||||
yield* this.W;
|
||||
}.bind(this)();
|
||||
}
|
||||
}
|
||||
|
||||
var _default = Vector;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=Vector.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/SequentialContainer/Vector.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
16
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeIterator.d.ts
generated
vendored
Normal file
16
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeIterator.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { ContainerIterator } from "../../ContainerBase";
|
||||
declare abstract class TreeIterator<K, V> extends ContainerIterator<K | [K, V]> {
|
||||
/**
|
||||
* @description Get the sequential index of the iterator in the tree container.<br/>
|
||||
* <strong>Note:</strong>
|
||||
* This function only takes effect when the specified tree container `enableIndex = true`.
|
||||
* @returns The index subscript of the node in the tree.
|
||||
* @example
|
||||
* const st = new OrderedSet([1, 2, 3], true);
|
||||
* console.log(st.begin().next().index); // 1
|
||||
*/
|
||||
get index(): number;
|
||||
pre(): this;
|
||||
next(): this;
|
||||
}
|
||||
export default TreeIterator;
|
||||
80
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeIterator.js
generated
vendored
Normal file
80
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeIterator.js
generated
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _ContainerBase = require("../../ContainerBase");
|
||||
|
||||
var _throwError = require("../../../utils/throwError");
|
||||
|
||||
class TreeIterator extends _ContainerBase.ContainerIterator {
|
||||
constructor(t, r, i) {
|
||||
super(i);
|
||||
this.o = t;
|
||||
this.h = r;
|
||||
if (this.iteratorType === 0) {
|
||||
this.pre = function() {
|
||||
if (this.o === this.h.Y) {
|
||||
(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 === this.h.Z) {
|
||||
(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 index() {
|
||||
let t = this.o;
|
||||
const r = this.h.tt;
|
||||
if (t === this.h) {
|
||||
if (r) {
|
||||
return r.rt - 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
let i = 0;
|
||||
if (t.Y) {
|
||||
i += t.Y.rt;
|
||||
}
|
||||
while (t !== r) {
|
||||
const r = t.tt;
|
||||
if (t === r.Z) {
|
||||
i += 1;
|
||||
if (r.Y) {
|
||||
i += r.Y.rt;
|
||||
}
|
||||
}
|
||||
t = r;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
var _default = TreeIterator;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=TreeIterator.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeIterator.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeIterator.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeNode.d.ts
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeNode.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
115
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeNode.js
generated
vendored
Normal file
115
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeNode.js
generated
vendored
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.TreeNodeEnableIndex = exports.TreeNode = void 0;
|
||||
|
||||
class TreeNode {
|
||||
constructor(e, t) {
|
||||
this.ee = 1;
|
||||
this.u = undefined;
|
||||
this.l = undefined;
|
||||
this.Y = undefined;
|
||||
this.Z = undefined;
|
||||
this.tt = undefined;
|
||||
this.u = e;
|
||||
this.l = t;
|
||||
}
|
||||
L() {
|
||||
let e = this;
|
||||
if (e.ee === 1 && e.tt.tt === e) {
|
||||
e = e.Z;
|
||||
} else if (e.Y) {
|
||||
e = e.Y;
|
||||
while (e.Z) {
|
||||
e = e.Z;
|
||||
}
|
||||
} else {
|
||||
let t = e.tt;
|
||||
while (t.Y === e) {
|
||||
e = t;
|
||||
t = e.tt;
|
||||
}
|
||||
e = t;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
B() {
|
||||
let e = this;
|
||||
if (e.Z) {
|
||||
e = e.Z;
|
||||
while (e.Y) {
|
||||
e = e.Y;
|
||||
}
|
||||
return e;
|
||||
} else {
|
||||
let t = e.tt;
|
||||
while (t.Z === e) {
|
||||
e = t;
|
||||
t = e.tt;
|
||||
}
|
||||
if (e.Z !== t) {
|
||||
return t;
|
||||
} else return e;
|
||||
}
|
||||
}
|
||||
te() {
|
||||
const e = this.tt;
|
||||
const t = this.Z;
|
||||
const s = t.Y;
|
||||
if (e.tt === this) e.tt = t; else if (e.Y === this) e.Y = t; else e.Z = t;
|
||||
t.tt = e;
|
||||
t.Y = this;
|
||||
this.tt = t;
|
||||
this.Z = s;
|
||||
if (s) s.tt = this;
|
||||
return t;
|
||||
}
|
||||
se() {
|
||||
const e = this.tt;
|
||||
const t = this.Y;
|
||||
const s = t.Z;
|
||||
if (e.tt === this) e.tt = t; else if (e.Y === this) e.Y = t; else e.Z = t;
|
||||
t.tt = e;
|
||||
t.Z = this;
|
||||
this.tt = t;
|
||||
this.Y = s;
|
||||
if (s) s.tt = this;
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
exports.TreeNode = TreeNode;
|
||||
|
||||
class TreeNodeEnableIndex extends TreeNode {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.rt = 1;
|
||||
}
|
||||
te() {
|
||||
const e = super.te();
|
||||
this.ie();
|
||||
e.ie();
|
||||
return e;
|
||||
}
|
||||
se() {
|
||||
const e = super.se();
|
||||
this.ie();
|
||||
e.ie();
|
||||
return e;
|
||||
}
|
||||
ie() {
|
||||
this.rt = 1;
|
||||
if (this.Y) {
|
||||
this.rt += this.Y.rt;
|
||||
}
|
||||
if (this.Z) {
|
||||
this.rt += this.Z.rt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.TreeNodeEnableIndex = TreeNodeEnableIndex;
|
||||
//# sourceMappingURL=TreeNode.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeNode.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeNode.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
58
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/index.d.ts
generated
vendored
Normal file
58
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
import type TreeIterator from './TreeIterator';
|
||||
import { Container } from "../../ContainerBase";
|
||||
declare abstract class TreeContainer<K, V> extends Container<K | [K, V]> {
|
||||
clear(): void;
|
||||
/**
|
||||
* @description Update node's key by iterator.
|
||||
* @param iter - The iterator you want to change.
|
||||
* @param key - The key you want to update.
|
||||
* @returns Whether the modification is successful.
|
||||
* @example
|
||||
* const st = new orderedSet([1, 2, 5]);
|
||||
* const iter = st.find(2);
|
||||
* st.updateKeyByIterator(iter, 3); // then st will become [1, 3, 5]
|
||||
*/
|
||||
updateKeyByIterator(iter: TreeIterator<K, V>, key: K): boolean;
|
||||
eraseElementByPos(pos: number): number;
|
||||
/**
|
||||
* @description Remove the element of the specified key.
|
||||
* @param key - The key you want to remove.
|
||||
* @returns Whether erase successfully.
|
||||
*/
|
||||
eraseElementByKey(key: K): boolean;
|
||||
eraseElementByIterator(iter: TreeIterator<K, V>): TreeIterator<K, V>;
|
||||
forEach(callback: (element: K | [K, V], index: number, tree: TreeContainer<K, V>) => void): void;
|
||||
getElementByPos(pos: number): K | [K, V];
|
||||
/**
|
||||
* @description Get the height of the tree.
|
||||
* @returns Number about the height of the RB-tree.
|
||||
*/
|
||||
getHeight(): number;
|
||||
/**
|
||||
* @param key - The given key you want to compare.
|
||||
* @returns An iterator to the first element less than the given key.
|
||||
*/
|
||||
abstract reverseUpperBound(key: K): TreeIterator<K, V>;
|
||||
/**
|
||||
* @description Union the other tree to self.
|
||||
* @param other - The other tree container you want to merge.
|
||||
* @returns The size of the tree after union.
|
||||
*/
|
||||
abstract union(other: TreeContainer<K, V>): number;
|
||||
/**
|
||||
* @param key - The given key you want to compare.
|
||||
* @returns An iterator to the first element not greater than the given key.
|
||||
*/
|
||||
abstract reverseLowerBound(key: K): TreeIterator<K, V>;
|
||||
/**
|
||||
* @param key - The given key you want to compare.
|
||||
* @returns An iterator to the first element not less than the given key.
|
||||
*/
|
||||
abstract lowerBound(key: K): TreeIterator<K, V>;
|
||||
/**
|
||||
* @param key - The given key you want to compare.
|
||||
* @returns An iterator to the first element greater than the given key.
|
||||
*/
|
||||
abstract upperBound(key: K): TreeIterator<K, V>;
|
||||
}
|
||||
export default TreeContainer;
|
||||
514
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/index.js
generated
vendored
Normal file
514
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,514 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _TreeNode = require("./TreeNode");
|
||||
|
||||
var _ContainerBase = require("../../ContainerBase");
|
||||
|
||||
var _throwError = require("../../../utils/throwError");
|
||||
|
||||
class TreeContainer extends _ContainerBase.Container {
|
||||
constructor(e = function(e, t) {
|
||||
if (e < t) return -1;
|
||||
if (e > t) return 1;
|
||||
return 0;
|
||||
}, t = false) {
|
||||
super();
|
||||
this.rr = undefined;
|
||||
this.v = e;
|
||||
if (t) {
|
||||
this.re = _TreeNode.TreeNodeEnableIndex;
|
||||
this.M = function(e, t, i) {
|
||||
const s = this.ne(e, t, i);
|
||||
if (s) {
|
||||
let e = s.tt;
|
||||
while (e !== this.h) {
|
||||
e.rt += 1;
|
||||
e = e.tt;
|
||||
}
|
||||
const t = this.he(s);
|
||||
if (t) {
|
||||
const {parentNode: e, grandParent: i, curNode: s} = t;
|
||||
e.ie();
|
||||
i.ie();
|
||||
s.ie();
|
||||
}
|
||||
}
|
||||
return this.i;
|
||||
};
|
||||
this.K = function(e) {
|
||||
let t = this.fe(e);
|
||||
while (t !== this.h) {
|
||||
t.rt -= 1;
|
||||
t = t.tt;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
this.re = _TreeNode.TreeNode;
|
||||
this.M = function(e, t, i) {
|
||||
const s = this.ne(e, t, i);
|
||||
if (s) this.he(s);
|
||||
return this.i;
|
||||
};
|
||||
this.K = this.fe;
|
||||
}
|
||||
this.h = new this.re;
|
||||
}
|
||||
$(e, t) {
|
||||
let i = this.h;
|
||||
while (e) {
|
||||
const s = this.v(e.u, t);
|
||||
if (s < 0) {
|
||||
e = e.Z;
|
||||
} else if (s > 0) {
|
||||
i = e;
|
||||
e = e.Y;
|
||||
} else return e;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
er(e, t) {
|
||||
let i = this.h;
|
||||
while (e) {
|
||||
const s = this.v(e.u, t);
|
||||
if (s <= 0) {
|
||||
e = e.Z;
|
||||
} else {
|
||||
i = e;
|
||||
e = e.Y;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
tr(e, t) {
|
||||
let i = this.h;
|
||||
while (e) {
|
||||
const s = this.v(e.u, t);
|
||||
if (s < 0) {
|
||||
i = e;
|
||||
e = e.Z;
|
||||
} else if (s > 0) {
|
||||
e = e.Y;
|
||||
} else return e;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
sr(e, t) {
|
||||
let i = this.h;
|
||||
while (e) {
|
||||
const s = this.v(e.u, t);
|
||||
if (s < 0) {
|
||||
i = e;
|
||||
e = e.Z;
|
||||
} else {
|
||||
e = e.Y;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
ue(e) {
|
||||
while (true) {
|
||||
const t = e.tt;
|
||||
if (t === this.h) return;
|
||||
if (e.ee === 1) {
|
||||
e.ee = 0;
|
||||
return;
|
||||
}
|
||||
if (e === t.Y) {
|
||||
const i = t.Z;
|
||||
if (i.ee === 1) {
|
||||
i.ee = 0;
|
||||
t.ee = 1;
|
||||
if (t === this.rr) {
|
||||
this.rr = t.te();
|
||||
} else t.te();
|
||||
} else {
|
||||
if (i.Z && i.Z.ee === 1) {
|
||||
i.ee = t.ee;
|
||||
t.ee = 0;
|
||||
i.Z.ee = 0;
|
||||
if (t === this.rr) {
|
||||
this.rr = t.te();
|
||||
} else t.te();
|
||||
return;
|
||||
} else if (i.Y && i.Y.ee === 1) {
|
||||
i.ee = 1;
|
||||
i.Y.ee = 0;
|
||||
i.se();
|
||||
} else {
|
||||
i.ee = 1;
|
||||
e = t;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const i = t.Y;
|
||||
if (i.ee === 1) {
|
||||
i.ee = 0;
|
||||
t.ee = 1;
|
||||
if (t === this.rr) {
|
||||
this.rr = t.se();
|
||||
} else t.se();
|
||||
} else {
|
||||
if (i.Y && i.Y.ee === 1) {
|
||||
i.ee = t.ee;
|
||||
t.ee = 0;
|
||||
i.Y.ee = 0;
|
||||
if (t === this.rr) {
|
||||
this.rr = t.se();
|
||||
} else t.se();
|
||||
return;
|
||||
} else if (i.Z && i.Z.ee === 1) {
|
||||
i.ee = 1;
|
||||
i.Z.ee = 0;
|
||||
i.te();
|
||||
} else {
|
||||
i.ee = 1;
|
||||
e = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fe(e) {
|
||||
if (this.i === 1) {
|
||||
this.clear();
|
||||
return this.h;
|
||||
}
|
||||
let t = e;
|
||||
while (t.Y || t.Z) {
|
||||
if (t.Z) {
|
||||
t = t.Z;
|
||||
while (t.Y) t = t.Y;
|
||||
} else {
|
||||
t = t.Y;
|
||||
}
|
||||
[e.u, t.u] = [ t.u, e.u ];
|
||||
[e.l, t.l] = [ t.l, e.l ];
|
||||
e = t;
|
||||
}
|
||||
if (this.h.Y === t) {
|
||||
this.h.Y = t.tt;
|
||||
} else if (this.h.Z === t) {
|
||||
this.h.Z = t.tt;
|
||||
}
|
||||
this.ue(t);
|
||||
const i = t.tt;
|
||||
if (t === i.Y) {
|
||||
i.Y = undefined;
|
||||
} else i.Z = undefined;
|
||||
this.i -= 1;
|
||||
this.rr.ee = 0;
|
||||
return i;
|
||||
}
|
||||
oe(e, t) {
|
||||
if (e === undefined) return false;
|
||||
const i = this.oe(e.Y, t);
|
||||
if (i) return true;
|
||||
if (t(e)) return true;
|
||||
return this.oe(e.Z, t);
|
||||
}
|
||||
he(e) {
|
||||
while (true) {
|
||||
const t = e.tt;
|
||||
if (t.ee === 0) return;
|
||||
const i = t.tt;
|
||||
if (t === i.Y) {
|
||||
const s = i.Z;
|
||||
if (s && s.ee === 1) {
|
||||
s.ee = t.ee = 0;
|
||||
if (i === this.rr) return;
|
||||
i.ee = 1;
|
||||
e = i;
|
||||
continue;
|
||||
} else if (e === t.Z) {
|
||||
e.ee = 0;
|
||||
if (e.Y) e.Y.tt = t;
|
||||
if (e.Z) e.Z.tt = i;
|
||||
t.Z = e.Y;
|
||||
i.Y = e.Z;
|
||||
e.Y = t;
|
||||
e.Z = i;
|
||||
if (i === this.rr) {
|
||||
this.rr = e;
|
||||
this.h.tt = e;
|
||||
} else {
|
||||
const t = i.tt;
|
||||
if (t.Y === i) {
|
||||
t.Y = e;
|
||||
} else t.Z = e;
|
||||
}
|
||||
e.tt = i.tt;
|
||||
t.tt = e;
|
||||
i.tt = e;
|
||||
i.ee = 1;
|
||||
return {
|
||||
parentNode: t,
|
||||
grandParent: i,
|
||||
curNode: e
|
||||
};
|
||||
} else {
|
||||
t.ee = 0;
|
||||
if (i === this.rr) {
|
||||
this.rr = i.se();
|
||||
} else i.se();
|
||||
i.ee = 1;
|
||||
}
|
||||
} else {
|
||||
const s = i.Y;
|
||||
if (s && s.ee === 1) {
|
||||
s.ee = t.ee = 0;
|
||||
if (i === this.rr) return;
|
||||
i.ee = 1;
|
||||
e = i;
|
||||
continue;
|
||||
} else if (e === t.Y) {
|
||||
e.ee = 0;
|
||||
if (e.Y) e.Y.tt = i;
|
||||
if (e.Z) e.Z.tt = t;
|
||||
i.Z = e.Y;
|
||||
t.Y = e.Z;
|
||||
e.Y = i;
|
||||
e.Z = t;
|
||||
if (i === this.rr) {
|
||||
this.rr = e;
|
||||
this.h.tt = e;
|
||||
} else {
|
||||
const t = i.tt;
|
||||
if (t.Y === i) {
|
||||
t.Y = e;
|
||||
} else t.Z = e;
|
||||
}
|
||||
e.tt = i.tt;
|
||||
t.tt = e;
|
||||
i.tt = e;
|
||||
i.ee = 1;
|
||||
return {
|
||||
parentNode: t,
|
||||
grandParent: i,
|
||||
curNode: e
|
||||
};
|
||||
} else {
|
||||
t.ee = 0;
|
||||
if (i === this.rr) {
|
||||
this.rr = i.te();
|
||||
} else i.te();
|
||||
i.ee = 1;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
ne(e, t, i) {
|
||||
if (this.rr === undefined) {
|
||||
this.i += 1;
|
||||
this.rr = new this.re(e, t);
|
||||
this.rr.ee = 0;
|
||||
this.rr.tt = this.h;
|
||||
this.h.tt = this.rr;
|
||||
this.h.Y = this.rr;
|
||||
this.h.Z = this.rr;
|
||||
return;
|
||||
}
|
||||
let s;
|
||||
const r = this.h.Y;
|
||||
const n = this.v(r.u, e);
|
||||
if (n === 0) {
|
||||
r.l = t;
|
||||
return;
|
||||
} else if (n > 0) {
|
||||
r.Y = new this.re(e, t);
|
||||
r.Y.tt = r;
|
||||
s = r.Y;
|
||||
this.h.Y = s;
|
||||
} else {
|
||||
const r = this.h.Z;
|
||||
const n = this.v(r.u, e);
|
||||
if (n === 0) {
|
||||
r.l = t;
|
||||
return;
|
||||
} else if (n < 0) {
|
||||
r.Z = new this.re(e, t);
|
||||
r.Z.tt = r;
|
||||
s = r.Z;
|
||||
this.h.Z = s;
|
||||
} else {
|
||||
if (i !== undefined) {
|
||||
const r = i.o;
|
||||
if (r !== this.h) {
|
||||
const i = this.v(r.u, e);
|
||||
if (i === 0) {
|
||||
r.l = t;
|
||||
return;
|
||||
} else if (i > 0) {
|
||||
const i = r.L();
|
||||
const n = this.v(i.u, e);
|
||||
if (n === 0) {
|
||||
i.l = t;
|
||||
return;
|
||||
} else if (n < 0) {
|
||||
s = new this.re(e, t);
|
||||
if (i.Z === undefined) {
|
||||
i.Z = s;
|
||||
s.tt = i;
|
||||
} else {
|
||||
r.Y = s;
|
||||
s.tt = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (s === undefined) {
|
||||
s = this.rr;
|
||||
while (true) {
|
||||
const i = this.v(s.u, e);
|
||||
if (i > 0) {
|
||||
if (s.Y === undefined) {
|
||||
s.Y = new this.re(e, t);
|
||||
s.Y.tt = s;
|
||||
s = s.Y;
|
||||
break;
|
||||
}
|
||||
s = s.Y;
|
||||
} else if (i < 0) {
|
||||
if (s.Z === undefined) {
|
||||
s.Z = new this.re(e, t);
|
||||
s.Z.tt = s;
|
||||
s = s.Z;
|
||||
break;
|
||||
}
|
||||
s = s.Z;
|
||||
} else {
|
||||
s.l = t;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.i += 1;
|
||||
return s;
|
||||
}
|
||||
I(e, t) {
|
||||
while (e) {
|
||||
const i = this.v(e.u, t);
|
||||
if (i < 0) {
|
||||
e = e.Z;
|
||||
} else if (i > 0) {
|
||||
e = e.Y;
|
||||
} else return e;
|
||||
}
|
||||
return e || this.h;
|
||||
}
|
||||
clear() {
|
||||
this.i = 0;
|
||||
this.rr = undefined;
|
||||
this.h.tt = undefined;
|
||||
this.h.Y = this.h.Z = undefined;
|
||||
}
|
||||
updateKeyByIterator(e, t) {
|
||||
const i = e.o;
|
||||
if (i === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
if (this.i === 1) {
|
||||
i.u = t;
|
||||
return true;
|
||||
}
|
||||
if (i === this.h.Y) {
|
||||
if (this.v(i.B().u, t) > 0) {
|
||||
i.u = t;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (i === this.h.Z) {
|
||||
if (this.v(i.L().u, t) < 0) {
|
||||
i.u = t;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const s = i.L().u;
|
||||
if (this.v(s, t) >= 0) return false;
|
||||
const r = i.B().u;
|
||||
if (this.v(r, t) <= 0) return false;
|
||||
i.u = t;
|
||||
return true;
|
||||
}
|
||||
eraseElementByPos(e) {
|
||||
if (e < 0 || e > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
let t = 0;
|
||||
const i = this;
|
||||
this.oe(this.rr, (function(s) {
|
||||
if (e === t) {
|
||||
i.K(s);
|
||||
return true;
|
||||
}
|
||||
t += 1;
|
||||
return false;
|
||||
}));
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByKey(e) {
|
||||
if (this.i === 0) return false;
|
||||
const t = this.I(this.rr, e);
|
||||
if (t === this.h) return false;
|
||||
this.K(t);
|
||||
return true;
|
||||
}
|
||||
eraseElementByIterator(e) {
|
||||
const t = e.o;
|
||||
if (t === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
const i = t.Z === undefined;
|
||||
const s = e.iteratorType === 0;
|
||||
if (s) {
|
||||
if (i) e.next();
|
||||
} else {
|
||||
if (!i || t.Y === undefined) e.next();
|
||||
}
|
||||
this.K(t);
|
||||
return e;
|
||||
}
|
||||
forEach(e) {
|
||||
let t = 0;
|
||||
for (const i of this) e(i, t++, this);
|
||||
}
|
||||
getElementByPos(e) {
|
||||
if (e < 0 || e > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
let t;
|
||||
let i = 0;
|
||||
for (const s of this) {
|
||||
if (i === e) {
|
||||
t = s;
|
||||
break;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
getHeight() {
|
||||
if (this.i === 0) return 0;
|
||||
const traversal = function(e) {
|
||||
if (!e) return 0;
|
||||
return Math.max(traversal(e.Y), traversal(e.Z)) + 1;
|
||||
};
|
||||
return traversal(this.rr);
|
||||
}
|
||||
}
|
||||
|
||||
var _default = TreeContainer;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/index.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
59
node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedMap.d.ts
generated
vendored
Normal file
59
node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedMap.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import TreeContainer from './Base';
|
||||
import TreeIterator from './Base/TreeIterator';
|
||||
import { initContainer } from "../ContainerBase";
|
||||
declare class OrderedMapIterator<K, V> extends TreeIterator<K, V> {
|
||||
get pointer(): [K, V];
|
||||
copy(): OrderedMapIterator<K, V>;
|
||||
equals(iter: OrderedMapIterator<K, V>): boolean;
|
||||
}
|
||||
export type { OrderedMapIterator };
|
||||
declare class OrderedMap<K, V> extends TreeContainer<K, V> {
|
||||
/**
|
||||
* @param container - The initialization container.
|
||||
* @param cmp - The compare function.
|
||||
* @param enableIndex - Whether to enable iterator indexing function.
|
||||
* @example
|
||||
* new OrderedMap();
|
||||
* new OrderedMap([[0, 1], [2, 1]]);
|
||||
* new OrderedMap([[0, 1], [2, 1]], (x, y) => x - y);
|
||||
* new OrderedMap([[0, 1], [2, 1]], (x, y) => x - y, true);
|
||||
*/
|
||||
constructor(container?: initContainer<[K, V]>, cmp?: (x: K, y: K) => number, enableIndex?: boolean);
|
||||
begin(): OrderedMapIterator<K, V>;
|
||||
end(): OrderedMapIterator<K, V>;
|
||||
rBegin(): OrderedMapIterator<K, V>;
|
||||
rEnd(): OrderedMapIterator<K, V>;
|
||||
front(): [K, V] | undefined;
|
||||
back(): [K, V] | undefined;
|
||||
lowerBound(key: K): OrderedMapIterator<K, V>;
|
||||
upperBound(key: K): OrderedMapIterator<K, V>;
|
||||
reverseLowerBound(key: K): OrderedMapIterator<K, V>;
|
||||
reverseUpperBound(key: K): OrderedMapIterator<K, V>;
|
||||
/**
|
||||
* @description Insert a key-value pair or set value by the given key.
|
||||
* @param key - The key want to insert.
|
||||
* @param value - The value want to set.
|
||||
* @param hint - You can give an iterator hint to improve insertion efficiency.
|
||||
* @return The size of container after setting.
|
||||
* @example
|
||||
* const mp = new OrderedMap([[2, 0], [4, 0], [5, 0]]);
|
||||
* const iter = mp.begin();
|
||||
* mp.setElement(1, 0);
|
||||
* mp.setElement(3, 0, iter); // give a hint will be faster.
|
||||
*/
|
||||
setElement(key: K, value: V, hint?: OrderedMapIterator<K, V>): number;
|
||||
find(key: K): OrderedMapIterator<K, V>;
|
||||
/**
|
||||
* @description Get the value of the element of the specified key.
|
||||
* @param key - The specified key you want to get.
|
||||
* @example
|
||||
* const val = container.getElementByKey(1);
|
||||
*/
|
||||
getElementByKey(key: K): V | undefined;
|
||||
union(other: OrderedMap<K, V>): number;
|
||||
[Symbol.iterator](): Generator<[K, V], void, unknown>;
|
||||
eraseElementByIterator(iter: OrderedMapIterator<K, V>): OrderedMapIterator<K, V>;
|
||||
forEach(callback: (element: [K, V], index: number, map: OrderedMap<K, V>) => void): void;
|
||||
getElementByPos(pos: number): [K, V];
|
||||
}
|
||||
export default OrderedMap;
|
||||
123
node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedMap.js
generated
vendored
Normal file
123
node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedMap.js
generated
vendored
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _Base = _interopRequireDefault(require("./Base"));
|
||||
|
||||
var _TreeIterator = _interopRequireDefault(require("./Base/TreeIterator"));
|
||||
|
||||
var _throwError = require("../../utils/throwError");
|
||||
|
||||
function _interopRequireDefault(r) {
|
||||
return r && r.t ? r : {
|
||||
default: r
|
||||
};
|
||||
}
|
||||
|
||||
class OrderedMapIterator extends _TreeIterator.default {
|
||||
get pointer() {
|
||||
if (this.o === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
const r = this;
|
||||
return new Proxy([], {
|
||||
get(e, t) {
|
||||
if (t === "0") return r.o.u; else if (t === "1") return r.o.l;
|
||||
},
|
||||
set(e, t, s) {
|
||||
if (t !== "1") {
|
||||
throw new TypeError("props must be 1");
|
||||
}
|
||||
r.o.l = s;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
copy() {
|
||||
return new OrderedMapIterator(this.o, this.h, this.iteratorType);
|
||||
}
|
||||
}
|
||||
|
||||
class OrderedMap extends _Base.default {
|
||||
constructor(r = [], e, t) {
|
||||
super(e, t);
|
||||
const s = this;
|
||||
r.forEach((function(r) {
|
||||
s.setElement(r[0], r[1]);
|
||||
}));
|
||||
}
|
||||
* X(r) {
|
||||
if (r === undefined) return;
|
||||
yield* this.X(r.Y);
|
||||
yield [ r.u, r.l ];
|
||||
yield* this.X(r.Z);
|
||||
}
|
||||
begin() {
|
||||
return new OrderedMapIterator(this.h.Y || this.h, this.h);
|
||||
}
|
||||
end() {
|
||||
return new OrderedMapIterator(this.h, this.h);
|
||||
}
|
||||
rBegin() {
|
||||
return new OrderedMapIterator(this.h.Z || this.h, this.h, 1);
|
||||
}
|
||||
rEnd() {
|
||||
return new OrderedMapIterator(this.h, this.h, 1);
|
||||
}
|
||||
front() {
|
||||
if (this.i === 0) return;
|
||||
const r = this.h.Y;
|
||||
return [ r.u, r.l ];
|
||||
}
|
||||
back() {
|
||||
if (this.i === 0) return;
|
||||
const r = this.h.Z;
|
||||
return [ r.u, r.l ];
|
||||
}
|
||||
lowerBound(r) {
|
||||
const e = this.$(this.rr, r);
|
||||
return new OrderedMapIterator(e, this.h);
|
||||
}
|
||||
upperBound(r) {
|
||||
const e = this.er(this.rr, r);
|
||||
return new OrderedMapIterator(e, this.h);
|
||||
}
|
||||
reverseLowerBound(r) {
|
||||
const e = this.tr(this.rr, r);
|
||||
return new OrderedMapIterator(e, this.h);
|
||||
}
|
||||
reverseUpperBound(r) {
|
||||
const e = this.sr(this.rr, r);
|
||||
return new OrderedMapIterator(e, this.h);
|
||||
}
|
||||
setElement(r, e, t) {
|
||||
return this.M(r, e, t);
|
||||
}
|
||||
find(r) {
|
||||
const e = this.I(this.rr, r);
|
||||
return new OrderedMapIterator(e, this.h);
|
||||
}
|
||||
getElementByKey(r) {
|
||||
const e = this.I(this.rr, r);
|
||||
return e.l;
|
||||
}
|
||||
union(r) {
|
||||
const e = this;
|
||||
r.forEach((function(r) {
|
||||
e.setElement(r[0], r[1]);
|
||||
}));
|
||||
return this.i;
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return this.X(this.rr);
|
||||
}
|
||||
}
|
||||
|
||||
var _default = OrderedMap;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=OrderedMap.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedMap.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedMap.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
51
node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedSet.d.ts
generated
vendored
Normal file
51
node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedSet.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import TreeContainer from './Base';
|
||||
import TreeIterator from './Base/TreeIterator';
|
||||
import { initContainer } from "../ContainerBase";
|
||||
declare class OrderedSetIterator<K> extends TreeIterator<K, undefined> {
|
||||
get pointer(): NonNullable<K>;
|
||||
copy(): OrderedSetIterator<K>;
|
||||
equals(iter: OrderedSetIterator<K>): boolean;
|
||||
}
|
||||
export type { OrderedSetIterator };
|
||||
declare class OrderedSet<K> extends TreeContainer<K, undefined> {
|
||||
/**
|
||||
* @param container - The initialization container.
|
||||
* @param cmp - The compare function.
|
||||
* @param enableIndex - Whether to enable iterator indexing function.
|
||||
* @example
|
||||
* new OrderedSet();
|
||||
* new OrderedSet([0, 1, 2]);
|
||||
* new OrderedSet([0, 1, 2], (x, y) => x - y);
|
||||
* new OrderedSet([0, 1, 2], (x, y) => x - y, true);
|
||||
*/
|
||||
constructor(container?: initContainer<K>, cmp?: (x: K, y: K) => number, enableIndex?: boolean);
|
||||
begin(): OrderedSetIterator<K>;
|
||||
end(): OrderedSetIterator<K>;
|
||||
rBegin(): OrderedSetIterator<K>;
|
||||
rEnd(): OrderedSetIterator<K>;
|
||||
front(): K | undefined;
|
||||
back(): K | undefined;
|
||||
/**
|
||||
* @description Insert element to set.
|
||||
* @param key - The key want to insert.
|
||||
* @param hint - You can give an iterator hint to improve insertion efficiency.
|
||||
* @return The size of container after setting.
|
||||
* @example
|
||||
* const st = new OrderedSet([2, 4, 5]);
|
||||
* const iter = st.begin();
|
||||
* st.insert(1);
|
||||
* st.insert(3, iter); // give a hint will be faster.
|
||||
*/
|
||||
insert(key: K, hint?: OrderedSetIterator<K>): number;
|
||||
find(element: K): OrderedSetIterator<K>;
|
||||
lowerBound(key: K): OrderedSetIterator<K>;
|
||||
upperBound(key: K): OrderedSetIterator<K>;
|
||||
reverseLowerBound(key: K): OrderedSetIterator<K>;
|
||||
reverseUpperBound(key: K): OrderedSetIterator<K>;
|
||||
union(other: OrderedSet<K>): number;
|
||||
[Symbol.iterator](): Generator<K, void, unknown>;
|
||||
eraseElementByIterator(iter: OrderedSetIterator<K>): OrderedSetIterator<K>;
|
||||
forEach(callback: (element: K, index: number, tree: OrderedSet<K>) => void): void;
|
||||
getElementByPos(pos: number): K;
|
||||
}
|
||||
export default OrderedSet;
|
||||
103
node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedSet.js
generated
vendored
Normal file
103
node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedSet.js
generated
vendored
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = void 0;
|
||||
|
||||
var _Base = _interopRequireDefault(require("./Base"));
|
||||
|
||||
var _TreeIterator = _interopRequireDefault(require("./Base/TreeIterator"));
|
||||
|
||||
var _throwError = require("../../utils/throwError");
|
||||
|
||||
function _interopRequireDefault(e) {
|
||||
return e && e.t ? e : {
|
||||
default: e
|
||||
};
|
||||
}
|
||||
|
||||
class OrderedSetIterator extends _TreeIterator.default {
|
||||
get pointer() {
|
||||
if (this.o === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
return this.o.u;
|
||||
}
|
||||
copy() {
|
||||
return new OrderedSetIterator(this.o, this.h, this.iteratorType);
|
||||
}
|
||||
}
|
||||
|
||||
class OrderedSet extends _Base.default {
|
||||
constructor(e = [], r, t) {
|
||||
super(r, t);
|
||||
const i = this;
|
||||
e.forEach((function(e) {
|
||||
i.insert(e);
|
||||
}));
|
||||
}
|
||||
* X(e) {
|
||||
if (e === undefined) return;
|
||||
yield* this.X(e.Y);
|
||||
yield e.u;
|
||||
yield* this.X(e.Z);
|
||||
}
|
||||
begin() {
|
||||
return new OrderedSetIterator(this.h.Y || this.h, this.h);
|
||||
}
|
||||
end() {
|
||||
return new OrderedSetIterator(this.h, this.h);
|
||||
}
|
||||
rBegin() {
|
||||
return new OrderedSetIterator(this.h.Z || this.h, this.h, 1);
|
||||
}
|
||||
rEnd() {
|
||||
return new OrderedSetIterator(this.h, this.h, 1);
|
||||
}
|
||||
front() {
|
||||
return this.h.Y ? this.h.Y.u : undefined;
|
||||
}
|
||||
back() {
|
||||
return this.h.Z ? this.h.Z.u : undefined;
|
||||
}
|
||||
insert(e, r) {
|
||||
return this.M(e, undefined, r);
|
||||
}
|
||||
find(e) {
|
||||
const r = this.I(this.rr, e);
|
||||
return new OrderedSetIterator(r, this.h);
|
||||
}
|
||||
lowerBound(e) {
|
||||
const r = this.$(this.rr, e);
|
||||
return new OrderedSetIterator(r, this.h);
|
||||
}
|
||||
upperBound(e) {
|
||||
const r = this.er(this.rr, e);
|
||||
return new OrderedSetIterator(r, this.h);
|
||||
}
|
||||
reverseLowerBound(e) {
|
||||
const r = this.tr(this.rr, e);
|
||||
return new OrderedSetIterator(r, this.h);
|
||||
}
|
||||
reverseUpperBound(e) {
|
||||
const r = this.sr(this.rr, e);
|
||||
return new OrderedSetIterator(r, this.h);
|
||||
}
|
||||
union(e) {
|
||||
const r = this;
|
||||
e.forEach((function(e) {
|
||||
r.insert(e);
|
||||
}));
|
||||
return this.i;
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return this.X(this.rr);
|
||||
}
|
||||
}
|
||||
|
||||
var _default = OrderedSet;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=OrderedSet.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedSet.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/container/TreeContainer/OrderedSet.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
21
node_modules/js-sdsl/dist/cjs/index.d.ts
generated
vendored
Normal file
21
node_modules/js-sdsl/dist/cjs/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
export { default as Stack } from "./container/OtherContainer/Stack";
|
||||
export { default as Queue } from "./container/OtherContainer/Queue";
|
||||
export { default as PriorityQueue } from "./container/OtherContainer/PriorityQueue";
|
||||
export { default as Vector } from "./container/SequentialContainer/Vector";
|
||||
export { default as LinkList } from "./container/SequentialContainer/LinkList";
|
||||
export { default as Deque } from "./container/SequentialContainer/Deque";
|
||||
export { default as OrderedSet } from "./container/TreeContainer/OrderedSet";
|
||||
export { default as OrderedMap } from "./container/TreeContainer/OrderedMap";
|
||||
export { default as HashSet } from "./container/HashContainer/HashSet";
|
||||
export { default as HashMap } from "./container/HashContainer/HashMap";
|
||||
export type { VectorIterator } from "./container/SequentialContainer/Vector";
|
||||
export type { LinkListIterator } from "./container/SequentialContainer/LinkList";
|
||||
export type { DequeIterator } from "./container/SequentialContainer/Deque";
|
||||
export type { OrderedSetIterator } from "./container/TreeContainer/OrderedSet";
|
||||
export type { OrderedMapIterator } from "./container/TreeContainer/OrderedMap";
|
||||
export type { HashSetIterator } from "./container/HashContainer/HashSet";
|
||||
export type { HashMapIterator } from "./container/HashContainer/HashMap";
|
||||
export type { IteratorType, Container, ContainerIterator } from "./container/ContainerBase";
|
||||
export type { default as SequentialContainer } from "./container/SequentialContainer/Base";
|
||||
export type { default as TreeContainer } from "./container/TreeContainer/Base";
|
||||
export type { HashContainer } from "./container/HashContainer/Base";
|
||||
102
node_modules/js-sdsl/dist/cjs/index.js
generated
vendored
Normal file
102
node_modules/js-sdsl/dist/cjs/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
Object.defineProperty(exports, "Deque", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _Deque.default;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(exports, "HashMap", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _HashMap.default;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(exports, "HashSet", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _HashSet.default;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(exports, "LinkList", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _LinkList.default;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(exports, "OrderedMap", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _OrderedMap.default;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(exports, "OrderedSet", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _OrderedSet.default;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(exports, "PriorityQueue", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _PriorityQueue.default;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(exports, "Queue", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _Queue.default;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(exports, "Stack", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _Stack.default;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(exports, "Vector", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _Vector.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _Stack = _interopRequireDefault(require("./container/OtherContainer/Stack"));
|
||||
|
||||
var _Queue = _interopRequireDefault(require("./container/OtherContainer/Queue"));
|
||||
|
||||
var _PriorityQueue = _interopRequireDefault(require("./container/OtherContainer/PriorityQueue"));
|
||||
|
||||
var _Vector = _interopRequireDefault(require("./container/SequentialContainer/Vector"));
|
||||
|
||||
var _LinkList = _interopRequireDefault(require("./container/SequentialContainer/LinkList"));
|
||||
|
||||
var _Deque = _interopRequireDefault(require("./container/SequentialContainer/Deque"));
|
||||
|
||||
var _OrderedSet = _interopRequireDefault(require("./container/TreeContainer/OrderedSet"));
|
||||
|
||||
var _OrderedMap = _interopRequireDefault(require("./container/TreeContainer/OrderedMap"));
|
||||
|
||||
var _HashSet = _interopRequireDefault(require("./container/HashContainer/HashSet"));
|
||||
|
||||
var _HashMap = _interopRequireDefault(require("./container/HashContainer/HashMap"));
|
||||
|
||||
function _interopRequireDefault(e) {
|
||||
return e && e.t ? e : {
|
||||
default: e
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/index.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/index.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["index.js","../../src/index.ts"],"names":["Object","defineProperty","exports","value","enumerable","get","_Deque","default","_HashMap","_HashSet","_LinkList","_OrderedMap","_OrderedSet","_PriorityQueue","_Queue","_Stack","_Vector","_interopRequireDefault","require","obj","__esModule"],"mappings":"AAAA;;AAEAA,OAAOC,eAAeC,SAAS,KAAc;IAC3CC,OAAO;;;AAETH,OAAOC,eAAeC,SAAS,SAAS;IACtCE,YAAY;IACZC,KAAK;QACH,OAAOC,OAAOC;AAChB;;;AAEFP,OAAOC,eAAeC,SAAS,WAAW;IACxCE,YAAY;IACZC,KAAK;QACH,OAAOG,SAASD;AAClB;;;AAEFP,OAAOC,eAAeC,SAAS,WAAW;IACxCE,YAAY;IACZC,KAAK;QACH,OAAOI,SAASF;AAClB;;;AAEFP,OAAOC,eAAeC,SAAS,YAAY;IACzCE,YAAY;IACZC,KAAK;QACH,OAAOK,UAAUH;AACnB;;;AAEFP,OAAOC,eAAeC,SAAS,cAAc;IAC3CE,YAAY;IACZC,KAAK;QACH,OAAOM,YAAYJ;AACrB;;;AAEFP,OAAOC,eAAeC,SAAS,cAAc;IAC3CE,YAAY;IACZC,KAAK;QACH,OAAOO,YAAYL;AACrB;;;AAEFP,OAAOC,eAAeC,SAAS,iBAAiB;IAC9CE,YAAY;IACZC,KAAK;QACH,OAAOQ,eAAeN;AACxB;;;AAEFP,OAAOC,eAAeC,SAAS,SAAS;IACtCE,YAAY;IACZC,KAAK;QACH,OAAOS,OAAOP;AAChB;;;AAEFP,OAAOC,eAAeC,SAAS,SAAS;IACtCE,YAAY;IACZC,KAAK;QACH,OAAOU,OAAOR;AAChB;;;AAEFP,OAAOC,eAAeC,SAAS,UAAU;IACvCE,YAAY;IACZC,KAAK;QACH,OAAOW,QAAQT;AACjB;;;AC/DF,IAAAQ,SAAAE,uBAAAC,QAAA;;AACA,IAAAJ,SAAAG,uBAAAC,QAAA;;AACA,IAAAL,iBAAAI,uBAAAC,QAAA;;AACA,IAAAF,UAAAC,uBAAAC,QAAA;;AACA,IAAAR,YAAAO,uBAAAC,QAAA;;AACA,IAAAZ,SAAAW,uBAAAC,QAAA;;AACA,IAAAN,cAAAK,uBAAAC,QAAA;;AACA,IAAAP,cAAAM,uBAAAC,QAAA;;AACA,IAAAT,WAAAQ,uBAAAC,QAAA;;AACA,IAAAV,WAAAS,uBAAAC,QAAA;;AAAuE,SAAAD,uBAAAE;IAAA,OAAAA,KAAAA,EAAAC,IAAAD,IAAA;QAAAZ,SAAAY;;AAAA","file":"index.js","sourcesContent":[null,"export { default as Stack } from '@/container/OtherContainer/Stack';\nexport { default as Queue } from '@/container/OtherContainer/Queue';\nexport { default as PriorityQueue } from '@/container/OtherContainer/PriorityQueue';\nexport { default as Vector } from '@/container/SequentialContainer/Vector';\nexport { default as LinkList } from '@/container/SequentialContainer/LinkList';\nexport { default as Deque } from '@/container/SequentialContainer/Deque';\nexport { default as OrderedSet } from '@/container/TreeContainer/OrderedSet';\nexport { default as OrderedMap } from '@/container/TreeContainer/OrderedMap';\nexport { default as HashSet } from '@/container/HashContainer/HashSet';\nexport { default as HashMap } from '@/container/HashContainer/HashMap';\nexport type { VectorIterator } from '@/container/SequentialContainer/Vector';\nexport type { LinkListIterator } from '@/container/SequentialContainer/LinkList';\nexport type { DequeIterator } from '@/container/SequentialContainer/Deque';\nexport type { OrderedSetIterator } from '@/container/TreeContainer/OrderedSet';\nexport type { OrderedMapIterator } from '@/container/TreeContainer/OrderedMap';\nexport type { HashSetIterator } from '@/container/HashContainer/HashSet';\nexport type { HashMapIterator } from '@/container/HashContainer/HashMap';\nexport type { IteratorType, Container, ContainerIterator } from '@/container/ContainerBase';\nexport type { default as SequentialContainer } from '@/container/SequentialContainer/Base';\nexport type { default as TreeContainer } from '@/container/TreeContainer/Base';\nexport type { HashContainer } from '@/container/HashContainer/Base';\n"]}
|
||||
1
node_modules/js-sdsl/dist/cjs/utils/checkObject.d.ts
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/utils/checkObject.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
13
node_modules/js-sdsl/dist/cjs/utils/checkObject.js
generated
vendored
Normal file
13
node_modules/js-sdsl/dist/cjs/utils/checkObject.js
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = checkObject;
|
||||
|
||||
function checkObject(e) {
|
||||
const t = typeof e;
|
||||
return t === "object" && e !== null || t === "function";
|
||||
}
|
||||
//# sourceMappingURL=checkObject.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/utils/checkObject.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/utils/checkObject.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["utils/checkObject.js","../../src/utils/checkObject.ts"],"names":["Object","defineProperty","exports","value","default","checkObject","key","t"],"mappings":"AAAA;;AAEAA,OAAOC,eAAeC,SAAS,KAAc;IAC3CC,OAAO;;;AAETD,QAAQE,UAAUC;;ACCJ,SAAUA,YAAeC;IACrC,MAAMC,WAAWD;IACjB,OAAQC,MAAM,YAAYD,MAAQ,QAASC,MAAM;ADCnD","file":"checkObject.js","sourcesContent":["/**\n * @description Determine whether the type of key is `object`.\n * @param key - The key want to check.\n * @returns Whether the type of key is `object`.\n * @internal\n */\nexport default function checkObject(key) {\n const t = typeof key;\n return (t === 'object' && key !== null) || t === 'function';\n}\n","/**\n * @description Determine whether the type of key is `object`.\n * @param key - The key want to check.\n * @returns Whether the type of key is `object`.\n * @internal\n */\nexport default function checkObject<T>(key: T) {\n const t = typeof key;\n return (t === 'object' && key !== null) || t === 'function';\n}\n"]}
|
||||
1
node_modules/js-sdsl/dist/cjs/utils/throwError.d.ts
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/utils/throwError.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
12
node_modules/js-sdsl/dist/cjs/utils/throwError.js
generated
vendored
Normal file
12
node_modules/js-sdsl/dist/cjs/utils/throwError.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "t", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.throwIteratorAccessError = throwIteratorAccessError;
|
||||
|
||||
function throwIteratorAccessError() {
|
||||
throw new RangeError("Iterator access denied!");
|
||||
}
|
||||
//# sourceMappingURL=throwError.js.map
|
||||
1
node_modules/js-sdsl/dist/cjs/utils/throwError.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/cjs/utils/throwError.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["utils/throwError.js","../../src/utils/throwError.ts"],"names":["Object","defineProperty","exports","value","throwIteratorAccessError","RangeError"],"mappings":"AAAA;;AAEAA,OAAOC,eAAeC,SAAS,KAAc;IAC3CC,OAAO;;;AAETD,QAAQE,2BAA2BA;;ACD7B,SAAUA;IACd,MAAM,IAAIC,WAAW;ADCvB","file":"throwError.js","sourcesContent":["/**\n * @description Throw an iterator access error.\n * @internal\n */\nexport function throwIteratorAccessError() {\n throw new RangeError('Iterator access denied!');\n}\n","/**\n * @description Throw an iterator access error.\n * @internal\n */\nexport function throwIteratorAccessError() {\n throw new RangeError('Iterator access denied!');\n}\n"]}
|
||||
Loading…
Add table
Add a link
Reference in a new issue