Tracking de l'application VApp (IHM du jeu)
This commit is contained in:
18
VApp/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeIterator.d.ts
generated
vendored
Normal file
18
VApp/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeIterator.d.ts
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
import { ContainerIterator } from "../../ContainerBase";
|
||||
import TreeContainer from "./index";
|
||||
declare abstract class TreeIterator<K, V> extends ContainerIterator<K | [K, V]> {
|
||||
abstract readonly container: TreeContainer<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
VApp/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeIterator.js
generated
vendored
Normal file
80
VApp/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.U) {
|
||||
(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.W) {
|
||||
(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.U) {
|
||||
i += t.U.rt;
|
||||
}
|
||||
while (t !== r) {
|
||||
const r = t.tt;
|
||||
if (t === r.W) {
|
||||
i += 1;
|
||||
if (r.U) {
|
||||
i += r.U.rt;
|
||||
}
|
||||
}
|
||||
t = r;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
var _default = TreeIterator;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=TreeIterator.js.map
|
1
VApp/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeIterator.js.map
generated
vendored
Normal file
1
VApp/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
47
VApp/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeNode.d.ts
generated
vendored
Normal file
47
VApp/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeNode.d.ts
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
export declare const enum TreeNodeColor {
|
||||
RED = 1,
|
||||
BLACK = 0
|
||||
}
|
||||
export declare class TreeNode<K, V> {
|
||||
_color: TreeNodeColor;
|
||||
_key: K | undefined;
|
||||
_value: V | undefined;
|
||||
_left: TreeNode<K, V> | undefined;
|
||||
_right: TreeNode<K, V> | undefined;
|
||||
_parent: TreeNode<K, V> | undefined;
|
||||
constructor(key?: K, value?: V);
|
||||
/**
|
||||
* @description Get the pre node.
|
||||
* @returns TreeNode about the pre node.
|
||||
*/
|
||||
_pre(): TreeNode<K, V>;
|
||||
/**
|
||||
* @description Get the next node.
|
||||
* @returns TreeNode about the next node.
|
||||
*/
|
||||
_next(): TreeNode<K, V>;
|
||||
/**
|
||||
* @description Rotate left.
|
||||
* @returns TreeNode about moved to original position after rotation.
|
||||
*/
|
||||
_rotateLeft(): TreeNode<K, V>;
|
||||
/**
|
||||
* @description Rotate right.
|
||||
* @returns TreeNode about moved to original position after rotation.
|
||||
*/
|
||||
_rotateRight(): TreeNode<K, V>;
|
||||
}
|
||||
export declare class TreeNodeEnableIndex<K, V> extends TreeNode<K, V> {
|
||||
_subTreeSize: number;
|
||||
/**
|
||||
* @description Rotate left and do recount.
|
||||
* @returns TreeNode about moved to original position after rotation.
|
||||
*/
|
||||
_rotateLeft(): TreeNodeEnableIndex<K, V>;
|
||||
/**
|
||||
* @description Rotate right and do recount.
|
||||
* @returns TreeNode about moved to original position after rotation.
|
||||
*/
|
||||
_rotateRight(): TreeNodeEnableIndex<K, V>;
|
||||
_recount(): void;
|
||||
}
|
115
VApp/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeNode.js
generated
vendored
Normal file
115
VApp/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.U = undefined;
|
||||
this.W = undefined;
|
||||
this.tt = undefined;
|
||||
this.u = e;
|
||||
this.l = t;
|
||||
}
|
||||
L() {
|
||||
let e = this;
|
||||
if (e.ee === 1 && e.tt.tt === e) {
|
||||
e = e.W;
|
||||
} else if (e.U) {
|
||||
e = e.U;
|
||||
while (e.W) {
|
||||
e = e.W;
|
||||
}
|
||||
} else {
|
||||
let t = e.tt;
|
||||
while (t.U === e) {
|
||||
e = t;
|
||||
t = e.tt;
|
||||
}
|
||||
e = t;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
B() {
|
||||
let e = this;
|
||||
if (e.W) {
|
||||
e = e.W;
|
||||
while (e.U) {
|
||||
e = e.U;
|
||||
}
|
||||
return e;
|
||||
} else {
|
||||
let t = e.tt;
|
||||
while (t.W === e) {
|
||||
e = t;
|
||||
t = e.tt;
|
||||
}
|
||||
if (e.W !== t) {
|
||||
return t;
|
||||
} else return e;
|
||||
}
|
||||
}
|
||||
te() {
|
||||
const e = this.tt;
|
||||
const t = this.W;
|
||||
const s = t.U;
|
||||
if (e.tt === this) e.tt = t; else if (e.U === this) e.U = t; else e.W = t;
|
||||
t.tt = e;
|
||||
t.U = this;
|
||||
this.tt = t;
|
||||
this.W = s;
|
||||
if (s) s.tt = this;
|
||||
return t;
|
||||
}
|
||||
se() {
|
||||
const e = this.tt;
|
||||
const t = this.U;
|
||||
const s = t.W;
|
||||
if (e.tt === this) e.tt = t; else if (e.U === this) e.U = t; else e.W = t;
|
||||
t.tt = e;
|
||||
t.W = this;
|
||||
this.tt = t;
|
||||
this.U = 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.U) {
|
||||
this.rt += this.U.rt;
|
||||
}
|
||||
if (this.W) {
|
||||
this.rt += this.W.rt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.TreeNodeEnableIndex = TreeNodeEnableIndex;
|
||||
//# sourceMappingURL=TreeNode.js.map
|
1
VApp/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/TreeNode.js.map
generated
vendored
Normal file
1
VApp/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
VApp/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/index.d.ts
generated
vendored
Normal file
58
VApp/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
VApp/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/index.js
generated
vendored
Normal file
514
VApp/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.Y = 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.V = 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.V = this.fe;
|
||||
}
|
||||
this.h = new this.re;
|
||||
}
|
||||
X(e, t) {
|
||||
let i = this.h;
|
||||
while (e) {
|
||||
const s = this.v(e.u, t);
|
||||
if (s < 0) {
|
||||
e = e.W;
|
||||
} else if (s > 0) {
|
||||
i = e;
|
||||
e = e.U;
|
||||
} else return e;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
Z(e, t) {
|
||||
let i = this.h;
|
||||
while (e) {
|
||||
const s = this.v(e.u, t);
|
||||
if (s <= 0) {
|
||||
e = e.W;
|
||||
} else {
|
||||
i = e;
|
||||
e = e.U;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
$(e, t) {
|
||||
let i = this.h;
|
||||
while (e) {
|
||||
const s = this.v(e.u, t);
|
||||
if (s < 0) {
|
||||
i = e;
|
||||
e = e.W;
|
||||
} else if (s > 0) {
|
||||
e = e.U;
|
||||
} else return e;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
rr(e, t) {
|
||||
let i = this.h;
|
||||
while (e) {
|
||||
const s = this.v(e.u, t);
|
||||
if (s < 0) {
|
||||
i = e;
|
||||
e = e.W;
|
||||
} else {
|
||||
e = e.U;
|
||||
}
|
||||
}
|
||||
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.U) {
|
||||
const i = t.W;
|
||||
if (i.ee === 1) {
|
||||
i.ee = 0;
|
||||
t.ee = 1;
|
||||
if (t === this.Y) {
|
||||
this.Y = t.te();
|
||||
} else t.te();
|
||||
} else {
|
||||
if (i.W && i.W.ee === 1) {
|
||||
i.ee = t.ee;
|
||||
t.ee = 0;
|
||||
i.W.ee = 0;
|
||||
if (t === this.Y) {
|
||||
this.Y = t.te();
|
||||
} else t.te();
|
||||
return;
|
||||
} else if (i.U && i.U.ee === 1) {
|
||||
i.ee = 1;
|
||||
i.U.ee = 0;
|
||||
i.se();
|
||||
} else {
|
||||
i.ee = 1;
|
||||
e = t;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const i = t.U;
|
||||
if (i.ee === 1) {
|
||||
i.ee = 0;
|
||||
t.ee = 1;
|
||||
if (t === this.Y) {
|
||||
this.Y = t.se();
|
||||
} else t.se();
|
||||
} else {
|
||||
if (i.U && i.U.ee === 1) {
|
||||
i.ee = t.ee;
|
||||
t.ee = 0;
|
||||
i.U.ee = 0;
|
||||
if (t === this.Y) {
|
||||
this.Y = t.se();
|
||||
} else t.se();
|
||||
return;
|
||||
} else if (i.W && i.W.ee === 1) {
|
||||
i.ee = 1;
|
||||
i.W.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.U || t.W) {
|
||||
if (t.W) {
|
||||
t = t.W;
|
||||
while (t.U) t = t.U;
|
||||
} else {
|
||||
t = t.U;
|
||||
}
|
||||
[e.u, t.u] = [ t.u, e.u ];
|
||||
[e.l, t.l] = [ t.l, e.l ];
|
||||
e = t;
|
||||
}
|
||||
if (this.h.U === t) {
|
||||
this.h.U = t.tt;
|
||||
} else if (this.h.W === t) {
|
||||
this.h.W = t.tt;
|
||||
}
|
||||
this.ue(t);
|
||||
const i = t.tt;
|
||||
if (t === i.U) {
|
||||
i.U = undefined;
|
||||
} else i.W = undefined;
|
||||
this.i -= 1;
|
||||
this.Y.ee = 0;
|
||||
return i;
|
||||
}
|
||||
oe(e, t) {
|
||||
if (e === undefined) return false;
|
||||
const i = this.oe(e.U, t);
|
||||
if (i) return true;
|
||||
if (t(e)) return true;
|
||||
return this.oe(e.W, t);
|
||||
}
|
||||
he(e) {
|
||||
while (true) {
|
||||
const t = e.tt;
|
||||
if (t.ee === 0) return;
|
||||
const i = t.tt;
|
||||
if (t === i.U) {
|
||||
const s = i.W;
|
||||
if (s && s.ee === 1) {
|
||||
s.ee = t.ee = 0;
|
||||
if (i === this.Y) return;
|
||||
i.ee = 1;
|
||||
e = i;
|
||||
continue;
|
||||
} else if (e === t.W) {
|
||||
e.ee = 0;
|
||||
if (e.U) e.U.tt = t;
|
||||
if (e.W) e.W.tt = i;
|
||||
t.W = e.U;
|
||||
i.U = e.W;
|
||||
e.U = t;
|
||||
e.W = i;
|
||||
if (i === this.Y) {
|
||||
this.Y = e;
|
||||
this.h.tt = e;
|
||||
} else {
|
||||
const t = i.tt;
|
||||
if (t.U === i) {
|
||||
t.U = e;
|
||||
} else t.W = 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.Y) {
|
||||
this.Y = i.se();
|
||||
} else i.se();
|
||||
i.ee = 1;
|
||||
}
|
||||
} else {
|
||||
const s = i.U;
|
||||
if (s && s.ee === 1) {
|
||||
s.ee = t.ee = 0;
|
||||
if (i === this.Y) return;
|
||||
i.ee = 1;
|
||||
e = i;
|
||||
continue;
|
||||
} else if (e === t.U) {
|
||||
e.ee = 0;
|
||||
if (e.U) e.U.tt = i;
|
||||
if (e.W) e.W.tt = t;
|
||||
i.W = e.U;
|
||||
t.U = e.W;
|
||||
e.U = i;
|
||||
e.W = t;
|
||||
if (i === this.Y) {
|
||||
this.Y = e;
|
||||
this.h.tt = e;
|
||||
} else {
|
||||
const t = i.tt;
|
||||
if (t.U === i) {
|
||||
t.U = e;
|
||||
} else t.W = 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.Y) {
|
||||
this.Y = i.te();
|
||||
} else i.te();
|
||||
i.ee = 1;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
ne(e, t, i) {
|
||||
if (this.Y === undefined) {
|
||||
this.i += 1;
|
||||
this.Y = new this.re(e, t);
|
||||
this.Y.ee = 0;
|
||||
this.Y.tt = this.h;
|
||||
this.h.tt = this.Y;
|
||||
this.h.U = this.Y;
|
||||
this.h.W = this.Y;
|
||||
return;
|
||||
}
|
||||
let s;
|
||||
const r = this.h.U;
|
||||
const n = this.v(r.u, e);
|
||||
if (n === 0) {
|
||||
r.l = t;
|
||||
return;
|
||||
} else if (n > 0) {
|
||||
r.U = new this.re(e, t);
|
||||
r.U.tt = r;
|
||||
s = r.U;
|
||||
this.h.U = s;
|
||||
} else {
|
||||
const r = this.h.W;
|
||||
const n = this.v(r.u, e);
|
||||
if (n === 0) {
|
||||
r.l = t;
|
||||
return;
|
||||
} else if (n < 0) {
|
||||
r.W = new this.re(e, t);
|
||||
r.W.tt = r;
|
||||
s = r.W;
|
||||
this.h.W = 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.W === undefined) {
|
||||
i.W = s;
|
||||
s.tt = i;
|
||||
} else {
|
||||
r.U = s;
|
||||
s.tt = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (s === undefined) {
|
||||
s = this.Y;
|
||||
while (true) {
|
||||
const i = this.v(s.u, e);
|
||||
if (i > 0) {
|
||||
if (s.U === undefined) {
|
||||
s.U = new this.re(e, t);
|
||||
s.U.tt = s;
|
||||
s = s.U;
|
||||
break;
|
||||
}
|
||||
s = s.U;
|
||||
} else if (i < 0) {
|
||||
if (s.W === undefined) {
|
||||
s.W = new this.re(e, t);
|
||||
s.W.tt = s;
|
||||
s = s.W;
|
||||
break;
|
||||
}
|
||||
s = s.W;
|
||||
} 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.W;
|
||||
} else if (i > 0) {
|
||||
e = e.U;
|
||||
} else return e;
|
||||
}
|
||||
return e || this.h;
|
||||
}
|
||||
clear() {
|
||||
this.i = 0;
|
||||
this.Y = undefined;
|
||||
this.h.tt = undefined;
|
||||
this.h.U = this.h.W = 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.U) {
|
||||
if (this.v(i.B().u, t) > 0) {
|
||||
i.u = t;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (i === this.h.W) {
|
||||
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.Y, (function(s) {
|
||||
if (e === t) {
|
||||
i.V(s);
|
||||
return true;
|
||||
}
|
||||
t += 1;
|
||||
return false;
|
||||
}));
|
||||
return this.i;
|
||||
}
|
||||
eraseElementByKey(e) {
|
||||
if (this.i === 0) return false;
|
||||
const t = this.I(this.Y, e);
|
||||
if (t === this.h) return false;
|
||||
this.V(t);
|
||||
return true;
|
||||
}
|
||||
eraseElementByIterator(e) {
|
||||
const t = e.o;
|
||||
if (t === this.h) {
|
||||
(0, _throwError.throwIteratorAccessError)();
|
||||
}
|
||||
const i = t.W === undefined;
|
||||
const s = e.iteratorType === 0;
|
||||
if (s) {
|
||||
if (i) e.next();
|
||||
} else {
|
||||
if (!i || t.U === undefined) e.next();
|
||||
}
|
||||
this.V(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.U), traversal(e.W)) + 1;
|
||||
};
|
||||
return traversal(this.Y);
|
||||
}
|
||||
}
|
||||
|
||||
var _default = TreeContainer;
|
||||
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=index.js.map
|
1
VApp/node_modules/js-sdsl/dist/cjs/container/TreeContainer/Base/index.js.map
generated
vendored
Normal file
1
VApp/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
Reference in New Issue
Block a user