create project
This commit is contained in:
22
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/Base/index.d.ts
generated
vendored
Normal file
22
kitabcitab/node_modules/js-sdsl/dist/esm/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;
|
||||
}
|
||||
201
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/Base/index.js
generated
vendored
Normal file
201
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/Base/index.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
var __extends = this && this.t || function() {
|
||||
var extendStatics = function(t, i) {
|
||||
extendStatics = Object.setPrototypeOf || {
|
||||
__proto__: []
|
||||
} instanceof Array && function(t, i) {
|
||||
t.__proto__ = i;
|
||||
} || function(t, i) {
|
||||
for (var r in i) if (Object.prototype.hasOwnProperty.call(i, r)) t[r] = i[r];
|
||||
};
|
||||
return extendStatics(t, i);
|
||||
};
|
||||
return function(t, i) {
|
||||
if (typeof i !== "function" && i !== null) throw new TypeError("Class extends value " + String(i) + " is not a constructor or null");
|
||||
extendStatics(t, i);
|
||||
function __() {
|
||||
this.constructor = t;
|
||||
}
|
||||
t.prototype = i === null ? Object.create(i) : (__.prototype = i.prototype, new __);
|
||||
};
|
||||
}();
|
||||
|
||||
import { Container, ContainerIterator } from "../../ContainerBase";
|
||||
|
||||
import checkObject from "../../../utils/checkObject";
|
||||
|
||||
import { throwIteratorAccessError } from "../../../utils/throwError";
|
||||
|
||||
var HashContainerIterator = function(t) {
|
||||
__extends(HashContainerIterator, t);
|
||||
function HashContainerIterator(i, r, e) {
|
||||
var n = t.call(this, e) || this;
|
||||
n.o = i;
|
||||
n.h = r;
|
||||
if (n.iteratorType === 0) {
|
||||
n.pre = function() {
|
||||
if (this.o.W === this.h) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
this.o = this.o.W;
|
||||
return this;
|
||||
};
|
||||
n.next = function() {
|
||||
if (this.o === this.h) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
this.o = this.o.m;
|
||||
return this;
|
||||
};
|
||||
} else {
|
||||
n.pre = function() {
|
||||
if (this.o.m === this.h) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
this.o = this.o.m;
|
||||
return this;
|
||||
};
|
||||
n.next = function() {
|
||||
if (this.o === this.h) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
this.o = this.o.W;
|
||||
return this;
|
||||
};
|
||||
}
|
||||
return n;
|
||||
}
|
||||
return HashContainerIterator;
|
||||
}(ContainerIterator);
|
||||
|
||||
export { HashContainerIterator };
|
||||
|
||||
var HashContainer = function(t) {
|
||||
__extends(HashContainer, t);
|
||||
function HashContainer() {
|
||||
var i = t.call(this) || this;
|
||||
i._ = [];
|
||||
i.I = {};
|
||||
i.HASH_TAG = Symbol("@@HASH_TAG");
|
||||
Object.setPrototypeOf(i.I, null);
|
||||
i.h = {};
|
||||
i.h.W = i.h.m = i.l = i.M = i.h;
|
||||
return i;
|
||||
}
|
||||
HashContainer.prototype.X = function(t) {
|
||||
var i = t.W, r = t.m;
|
||||
i.m = r;
|
||||
r.W = i;
|
||||
if (t === this.l) {
|
||||
this.l = r;
|
||||
}
|
||||
if (t === this.M) {
|
||||
this.M = i;
|
||||
}
|
||||
this.i -= 1;
|
||||
};
|
||||
HashContainer.prototype.v = function(t, i, r) {
|
||||
if (r === undefined) r = checkObject(t);
|
||||
var e;
|
||||
if (r) {
|
||||
var n = t[this.HASH_TAG];
|
||||
if (n !== undefined) {
|
||||
this._[n].H = i;
|
||||
return this.i;
|
||||
}
|
||||
Object.defineProperty(t, this.HASH_TAG, {
|
||||
value: this._.length,
|
||||
configurable: true
|
||||
});
|
||||
e = {
|
||||
p: t,
|
||||
H: i,
|
||||
W: this.M,
|
||||
m: this.h
|
||||
};
|
||||
this._.push(e);
|
||||
} else {
|
||||
var s = this.I[t];
|
||||
if (s) {
|
||||
s.H = i;
|
||||
return this.i;
|
||||
}
|
||||
e = {
|
||||
p: t,
|
||||
H: i,
|
||||
W: this.M,
|
||||
m: this.h
|
||||
};
|
||||
this.I[t] = e;
|
||||
}
|
||||
if (this.i === 0) {
|
||||
this.l = e;
|
||||
this.h.m = e;
|
||||
} else {
|
||||
this.M.m = e;
|
||||
}
|
||||
this.M = e;
|
||||
this.h.W = e;
|
||||
return ++this.i;
|
||||
};
|
||||
HashContainer.prototype.g = function(t, i) {
|
||||
if (i === undefined) i = checkObject(t);
|
||||
if (i) {
|
||||
var r = t[this.HASH_TAG];
|
||||
if (r === undefined) return this.h;
|
||||
return this._[r];
|
||||
} else {
|
||||
return this.I[t] || this.h;
|
||||
}
|
||||
};
|
||||
HashContainer.prototype.clear = function() {
|
||||
var t = this.HASH_TAG;
|
||||
this._.forEach((function(i) {
|
||||
delete i.p[t];
|
||||
}));
|
||||
this._ = [];
|
||||
this.I = {};
|
||||
Object.setPrototypeOf(this.I, null);
|
||||
this.i = 0;
|
||||
this.l = this.M = this.h.W = this.h.m = this.h;
|
||||
};
|
||||
HashContainer.prototype.eraseElementByKey = function(t, i) {
|
||||
var r;
|
||||
if (i === undefined) i = checkObject(t);
|
||||
if (i) {
|
||||
var e = t[this.HASH_TAG];
|
||||
if (e === undefined) return false;
|
||||
delete t[this.HASH_TAG];
|
||||
r = this._[e];
|
||||
delete this._[e];
|
||||
} else {
|
||||
r = this.I[t];
|
||||
if (r === undefined) return false;
|
||||
delete this.I[t];
|
||||
}
|
||||
this.X(r);
|
||||
return true;
|
||||
};
|
||||
HashContainer.prototype.eraseElementByIterator = function(t) {
|
||||
var i = t.o;
|
||||
if (i === this.h) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
this.X(i);
|
||||
return t.next();
|
||||
};
|
||||
HashContainer.prototype.eraseElementByPos = function(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
var i = this.l;
|
||||
while (t--) {
|
||||
i = i.m;
|
||||
}
|
||||
this.X(i);
|
||||
return this.i;
|
||||
};
|
||||
return HashContainer;
|
||||
}(Container);
|
||||
|
||||
export { HashContainer };
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/Base/index.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/Base/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
47
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/HashMap.d.ts
generated
vendored
Normal file
47
kitabcitab/node_modules/js-sdsl/dist/esm/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;
|
||||
246
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/HashMap.js
generated
vendored
Normal file
246
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/HashMap.js
generated
vendored
Normal file
@@ -0,0 +1,246 @@
|
||||
var __extends = this && this.t || function() {
|
||||
var extendStatics = function(t, r) {
|
||||
extendStatics = Object.setPrototypeOf || {
|
||||
__proto__: []
|
||||
} instanceof Array && function(t, r) {
|
||||
t.__proto__ = r;
|
||||
} || function(t, r) {
|
||||
for (var n in r) if (Object.prototype.hasOwnProperty.call(r, n)) t[n] = r[n];
|
||||
};
|
||||
return extendStatics(t, r);
|
||||
};
|
||||
return function(t, r) {
|
||||
if (typeof r !== "function" && r !== null) throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
|
||||
extendStatics(t, r);
|
||||
function __() {
|
||||
this.constructor = t;
|
||||
}
|
||||
t.prototype = r === null ? Object.create(r) : (__.prototype = r.prototype, new __);
|
||||
};
|
||||
}();
|
||||
|
||||
var __generator = this && this.u || function(t, r) {
|
||||
var n = {
|
||||
label: 0,
|
||||
sent: function() {
|
||||
if (a[0] & 1) throw a[1];
|
||||
return a[1];
|
||||
},
|
||||
trys: [],
|
||||
ops: []
|
||||
}, e, i, a, s;
|
||||
return s = {
|
||||
next: verb(0),
|
||||
throw: verb(1),
|
||||
return: verb(2)
|
||||
}, typeof Symbol === "function" && (s[Symbol.iterator] = function() {
|
||||
return this;
|
||||
}), s;
|
||||
function verb(t) {
|
||||
return function(r) {
|
||||
return step([ t, r ]);
|
||||
};
|
||||
}
|
||||
function step(s) {
|
||||
if (e) throw new TypeError("Generator is already executing.");
|
||||
while (n) try {
|
||||
if (e = 1, i && (a = s[0] & 2 ? i["return"] : s[0] ? i["throw"] || ((a = i["return"]) && a.call(i),
|
||||
0) : i.next) && !(a = a.call(i, s[1])).done) return a;
|
||||
if (i = 0, a) s = [ s[0] & 2, a.value ];
|
||||
switch (s[0]) {
|
||||
case 0:
|
||||
case 1:
|
||||
a = s;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
n.label++;
|
||||
return {
|
||||
value: s[1],
|
||||
done: false
|
||||
};
|
||||
|
||||
case 5:
|
||||
n.label++;
|
||||
i = s[1];
|
||||
s = [ 0 ];
|
||||
continue;
|
||||
|
||||
case 7:
|
||||
s = n.ops.pop();
|
||||
n.trys.pop();
|
||||
continue;
|
||||
|
||||
default:
|
||||
if (!(a = n.trys, a = a.length > 0 && a[a.length - 1]) && (s[0] === 6 || s[0] === 2)) {
|
||||
n = 0;
|
||||
continue;
|
||||
}
|
||||
if (s[0] === 3 && (!a || s[1] > a[0] && s[1] < a[3])) {
|
||||
n.label = s[1];
|
||||
break;
|
||||
}
|
||||
if (s[0] === 6 && n.label < a[1]) {
|
||||
n.label = a[1];
|
||||
a = s;
|
||||
break;
|
||||
}
|
||||
if (a && n.label < a[2]) {
|
||||
n.label = a[2];
|
||||
n.ops.push(s);
|
||||
break;
|
||||
}
|
||||
if (a[2]) n.ops.pop();
|
||||
n.trys.pop();
|
||||
continue;
|
||||
}
|
||||
s = r.call(t, n);
|
||||
} catch (t) {
|
||||
s = [ 6, t ];
|
||||
i = 0;
|
||||
} finally {
|
||||
e = a = 0;
|
||||
}
|
||||
if (s[0] & 5) throw s[1];
|
||||
return {
|
||||
value: s[0] ? s[1] : void 0,
|
||||
done: true
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
import { HashContainer, HashContainerIterator } from "./Base";
|
||||
|
||||
import checkObject from "../../utils/checkObject";
|
||||
|
||||
import { throwIteratorAccessError } from "../../utils/throwError";
|
||||
|
||||
var HashMapIterator = function(t) {
|
||||
__extends(HashMapIterator, t);
|
||||
function HashMapIterator() {
|
||||
return t !== null && t.apply(this, arguments) || this;
|
||||
}
|
||||
Object.defineProperty(HashMapIterator.prototype, "pointer", {
|
||||
get: function() {
|
||||
if (this.o === this.h) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
var t = this;
|
||||
return new Proxy([], {
|
||||
get: function(r, n) {
|
||||
if (n === "0") return t.o.p; else if (n === "1") return t.o.H;
|
||||
},
|
||||
set: function(r, n, e) {
|
||||
if (n !== "1") {
|
||||
throw new TypeError("props must be 1");
|
||||
}
|
||||
t.o.H = e;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
HashMapIterator.prototype.copy = function() {
|
||||
return new HashMapIterator(this.o, this.h, this.iteratorType);
|
||||
};
|
||||
return HashMapIterator;
|
||||
}(HashContainerIterator);
|
||||
|
||||
var HashMap = function(t) {
|
||||
__extends(HashMap, t);
|
||||
function HashMap(r) {
|
||||
if (r === void 0) {
|
||||
r = [];
|
||||
}
|
||||
var n = t.call(this) || this;
|
||||
var e = n;
|
||||
r.forEach((function(t) {
|
||||
e.setElement(t[0], t[1]);
|
||||
}));
|
||||
return n;
|
||||
}
|
||||
HashMap.prototype.begin = function() {
|
||||
return new HashMapIterator(this.l, this.h);
|
||||
};
|
||||
HashMap.prototype.end = function() {
|
||||
return new HashMapIterator(this.h, this.h);
|
||||
};
|
||||
HashMap.prototype.rBegin = function() {
|
||||
return new HashMapIterator(this.M, this.h, 1);
|
||||
};
|
||||
HashMap.prototype.rEnd = function() {
|
||||
return new HashMapIterator(this.h, this.h, 1);
|
||||
};
|
||||
HashMap.prototype.front = function() {
|
||||
if (this.i === 0) return;
|
||||
return [ this.l.p, this.l.H ];
|
||||
};
|
||||
HashMap.prototype.back = function() {
|
||||
if (this.i === 0) return;
|
||||
return [ this.M.p, this.M.H ];
|
||||
};
|
||||
HashMap.prototype.setElement = function(t, r, n) {
|
||||
return this.v(t, r, n);
|
||||
};
|
||||
HashMap.prototype.getElementByKey = function(t, r) {
|
||||
if (r === undefined) r = checkObject(t);
|
||||
if (r) {
|
||||
var n = t[this.HASH_TAG];
|
||||
return n !== undefined ? this._[n].H : undefined;
|
||||
}
|
||||
var e = this.I[t];
|
||||
return e ? e.H : undefined;
|
||||
};
|
||||
HashMap.prototype.getElementByPos = function(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
var r = this.l;
|
||||
while (t--) {
|
||||
r = r.m;
|
||||
}
|
||||
return [ r.p, r.H ];
|
||||
};
|
||||
HashMap.prototype.find = function(t, r) {
|
||||
var n = this.g(t, r);
|
||||
return new HashMapIterator(n, this.h);
|
||||
};
|
||||
HashMap.prototype.forEach = function(t) {
|
||||
var r = 0;
|
||||
var n = this.l;
|
||||
while (n !== this.h) {
|
||||
t([ n.p, n.H ], r++, this);
|
||||
n = n.m;
|
||||
}
|
||||
};
|
||||
HashMap.prototype[Symbol.iterator] = function() {
|
||||
return function() {
|
||||
var t;
|
||||
return __generator(this, (function(r) {
|
||||
switch (r.label) {
|
||||
case 0:
|
||||
t = this.l;
|
||||
r.label = 1;
|
||||
|
||||
case 1:
|
||||
if (!(t !== this.h)) return [ 3, 3 ];
|
||||
return [ 4, [ t.p, t.H ] ];
|
||||
|
||||
case 2:
|
||||
r.sent();
|
||||
t = t.m;
|
||||
return [ 3, 1 ];
|
||||
|
||||
case 3:
|
||||
return [ 2 ];
|
||||
}
|
||||
}));
|
||||
}.bind(this)();
|
||||
};
|
||||
return HashMap;
|
||||
}(HashContainer);
|
||||
|
||||
export default HashMap;
|
||||
//# sourceMappingURL=HashMap.js.map
|
||||
1
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/HashMap.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/HashMap.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
37
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/HashSet.d.ts
generated
vendored
Normal file
37
kitabcitab/node_modules/js-sdsl/dist/esm/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;
|
||||
221
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/HashSet.js
generated
vendored
Normal file
221
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/HashSet.js
generated
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
var __extends = this && this.t || function() {
|
||||
var extendStatics = function(t, r) {
|
||||
extendStatics = Object.setPrototypeOf || {
|
||||
__proto__: []
|
||||
} instanceof Array && function(t, r) {
|
||||
t.__proto__ = r;
|
||||
} || function(t, r) {
|
||||
for (var e in r) if (Object.prototype.hasOwnProperty.call(r, e)) t[e] = r[e];
|
||||
};
|
||||
return extendStatics(t, r);
|
||||
};
|
||||
return function(t, r) {
|
||||
if (typeof r !== "function" && r !== null) throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
|
||||
extendStatics(t, r);
|
||||
function __() {
|
||||
this.constructor = t;
|
||||
}
|
||||
t.prototype = r === null ? Object.create(r) : (__.prototype = r.prototype, new __);
|
||||
};
|
||||
}();
|
||||
|
||||
var __generator = this && this.u || function(t, r) {
|
||||
var e = {
|
||||
label: 0,
|
||||
sent: function() {
|
||||
if (s[0] & 1) throw s[1];
|
||||
return s[1];
|
||||
},
|
||||
trys: [],
|
||||
ops: []
|
||||
}, n, i, s, a;
|
||||
return a = {
|
||||
next: verb(0),
|
||||
throw: verb(1),
|
||||
return: verb(2)
|
||||
}, typeof Symbol === "function" && (a[Symbol.iterator] = function() {
|
||||
return this;
|
||||
}), a;
|
||||
function verb(t) {
|
||||
return function(r) {
|
||||
return step([ t, r ]);
|
||||
};
|
||||
}
|
||||
function step(a) {
|
||||
if (n) throw new TypeError("Generator is already executing.");
|
||||
while (e) try {
|
||||
if (n = 1, i && (s = a[0] & 2 ? i["return"] : a[0] ? i["throw"] || ((s = i["return"]) && s.call(i),
|
||||
0) : i.next) && !(s = s.call(i, a[1])).done) return s;
|
||||
if (i = 0, s) a = [ a[0] & 2, s.value ];
|
||||
switch (a[0]) {
|
||||
case 0:
|
||||
case 1:
|
||||
s = a;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
e.label++;
|
||||
return {
|
||||
value: a[1],
|
||||
done: false
|
||||
};
|
||||
|
||||
case 5:
|
||||
e.label++;
|
||||
i = a[1];
|
||||
a = [ 0 ];
|
||||
continue;
|
||||
|
||||
case 7:
|
||||
a = e.ops.pop();
|
||||
e.trys.pop();
|
||||
continue;
|
||||
|
||||
default:
|
||||
if (!(s = e.trys, s = s.length > 0 && s[s.length - 1]) && (a[0] === 6 || a[0] === 2)) {
|
||||
e = 0;
|
||||
continue;
|
||||
}
|
||||
if (a[0] === 3 && (!s || a[1] > s[0] && a[1] < s[3])) {
|
||||
e.label = a[1];
|
||||
break;
|
||||
}
|
||||
if (a[0] === 6 && e.label < s[1]) {
|
||||
e.label = s[1];
|
||||
s = a;
|
||||
break;
|
||||
}
|
||||
if (s && e.label < s[2]) {
|
||||
e.label = s[2];
|
||||
e.ops.push(a);
|
||||
break;
|
||||
}
|
||||
if (s[2]) e.ops.pop();
|
||||
e.trys.pop();
|
||||
continue;
|
||||
}
|
||||
a = r.call(t, e);
|
||||
} catch (t) {
|
||||
a = [ 6, t ];
|
||||
i = 0;
|
||||
} finally {
|
||||
n = s = 0;
|
||||
}
|
||||
if (a[0] & 5) throw a[1];
|
||||
return {
|
||||
value: a[0] ? a[1] : void 0,
|
||||
done: true
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
import { HashContainer, HashContainerIterator } from "./Base";
|
||||
|
||||
import { throwIteratorAccessError } from "../../utils/throwError";
|
||||
|
||||
var HashSetIterator = function(t) {
|
||||
__extends(HashSetIterator, t);
|
||||
function HashSetIterator() {
|
||||
return t !== null && t.apply(this, arguments) || this;
|
||||
}
|
||||
Object.defineProperty(HashSetIterator.prototype, "pointer", {
|
||||
get: function() {
|
||||
if (this.o === this.h) {
|
||||
throwIteratorAccessError();
|
||||
}
|
||||
return this.o.p;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
HashSetIterator.prototype.copy = function() {
|
||||
return new HashSetIterator(this.o, this.h, this.iteratorType);
|
||||
};
|
||||
return HashSetIterator;
|
||||
}(HashContainerIterator);
|
||||
|
||||
var HashSet = function(t) {
|
||||
__extends(HashSet, t);
|
||||
function HashSet(r) {
|
||||
if (r === void 0) {
|
||||
r = [];
|
||||
}
|
||||
var e = t.call(this) || this;
|
||||
var n = e;
|
||||
r.forEach((function(t) {
|
||||
n.insert(t);
|
||||
}));
|
||||
return e;
|
||||
}
|
||||
HashSet.prototype.begin = function() {
|
||||
return new HashSetIterator(this.l, this.h);
|
||||
};
|
||||
HashSet.prototype.end = function() {
|
||||
return new HashSetIterator(this.h, this.h);
|
||||
};
|
||||
HashSet.prototype.rBegin = function() {
|
||||
return new HashSetIterator(this.M, this.h, 1);
|
||||
};
|
||||
HashSet.prototype.rEnd = function() {
|
||||
return new HashSetIterator(this.h, this.h, 1);
|
||||
};
|
||||
HashSet.prototype.front = function() {
|
||||
return this.l.p;
|
||||
};
|
||||
HashSet.prototype.back = function() {
|
||||
return this.M.p;
|
||||
};
|
||||
HashSet.prototype.insert = function(t, r) {
|
||||
return this.v(t, undefined, r);
|
||||
};
|
||||
HashSet.prototype.getElementByPos = function(t) {
|
||||
if (t < 0 || t > this.i - 1) {
|
||||
throw new RangeError;
|
||||
}
|
||||
var r = this.l;
|
||||
while (t--) {
|
||||
r = r.m;
|
||||
}
|
||||
return r.p;
|
||||
};
|
||||
HashSet.prototype.find = function(t, r) {
|
||||
var e = this.g(t, r);
|
||||
return new HashSetIterator(e, this.h);
|
||||
};
|
||||
HashSet.prototype.forEach = function(t) {
|
||||
var r = 0;
|
||||
var e = this.l;
|
||||
while (e !== this.h) {
|
||||
t(e.p, r++, this);
|
||||
e = e.m;
|
||||
}
|
||||
};
|
||||
HashSet.prototype[Symbol.iterator] = function() {
|
||||
return function() {
|
||||
var t;
|
||||
return __generator(this, (function(r) {
|
||||
switch (r.label) {
|
||||
case 0:
|
||||
t = this.l;
|
||||
r.label = 1;
|
||||
|
||||
case 1:
|
||||
if (!(t !== this.h)) return [ 3, 3 ];
|
||||
return [ 4, t.p ];
|
||||
|
||||
case 2:
|
||||
r.sent();
|
||||
t = t.m;
|
||||
return [ 3, 1 ];
|
||||
|
||||
case 3:
|
||||
return [ 2 ];
|
||||
}
|
||||
}));
|
||||
}.bind(this)();
|
||||
};
|
||||
return HashSet;
|
||||
}(HashContainer);
|
||||
|
||||
export default HashSet;
|
||||
//# sourceMappingURL=HashSet.js.map
|
||||
1
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/HashSet.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/js-sdsl/dist/esm/container/HashContainer/HashSet.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user