decord/source/7101_Node.js

130 lines
2.9 KiB
JavaScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 7101
// Function ID: 7102
2026-07-29 08:29:29 +00:00
// Name: Node
2026-08-05 07:35:12 +00:00
// Dependencies: [7100]
2026-07-29 08:29:29 +00:00
2026-08-05 07:35:12 +00:00
// Module 7101 (Node)
2026-07-29 08:29:29 +00:00
class Node {
constructor(arg0) {
return;
}
get_child(arg0) {
self = this;
return global ? self.right : self.left;
}
set_child(arg0, arg1) {
self = this;
if (global) {
self.right = require;
} else {
self.left = require;
}
return;
}
}
2026-07-30 10:14:41 +00:00
class BinTree {
2026-07-29 08:29:29 +00:00
constructor(arg0) {
return;
}
insert(arg0) {
self = this;
if (null === this._root) {
2026-07-30 10:14:41 +00:00
tmp10 = Node;
2026-07-29 08:29:29 +00:00
obj = Object.create(Node.prototype);
obj1 = {};
obj1.data = global;
obj1.left = null;
obj1.right = null;
self._root = obj1;
self.size = self.size + 1;
2026-07-30 10:14:41 +00:00
flag3 = true;
return true;
2026-07-29 08:29:29 +00:00
} else {
2026-07-30 10:14:41 +00:00
_root = self._root;
2026-07-29 08:29:29 +00:00
num2 = 0;
2026-07-30 10:14:41 +00:00
tmp5 = null;
num = 0;
tmp2 = tmp5;
tmp3 = num;
while (null !== _root) {
if (0 === self._comparator(_root.data, global)) {
flag = false;
return false;
2026-07-29 08:29:29 +00:00
} else {
2026-07-30 10:14:41 +00:00
tmp4 = self._comparator(_root.data, global) < 0;
_root = _root.get_child(tmp4);
tmp5 = tmp;
num = tmp4;
2026-07-29 08:29:29 +00:00
continue;
}
}
2026-07-30 10:14:41 +00:00
tmp6 = Node;
obj2 = Object.create(Node.prototype);
obj = {};
obj.data = global;
obj.left = null;
obj.right = null;
set_childResult = tmp5.set_child(num, obj);
tmp9 = globalThis;
flag2 = true;
globalThis.ret = true;
self.size = self.size + 1;
return true;
2026-07-29 08:29:29 +00:00
}
}
remove(arg0) {
self = this;
if (null === this._root) {
2026-07-30 10:14:41 +00:00
flag2 = false;
2026-07-29 08:29:29 +00:00
return false;
} else {
2026-07-30 10:14:41 +00:00
tmp9 = Node;
2026-07-29 08:29:29 +00:00
obj = Object.create(Node.prototype);
obj1 = {};
obj1.data = undefined;
obj1.left = null;
obj1.right = null;
obj1.right = self._root;
num2 = 1;
num3 = 0;
num = 1;
2026-07-30 10:14:41 +00:00
tmp5 = null;
obj2 = obj1;
tmp6 = null;
obj3 = obj1;
tmp7 = null;
2026-07-29 08:29:29 +00:00
if (null !== require("module_1")) {
do {
2026-07-30 10:14:41 +00:00
get_childResult = obj2.get_child(num);
2026-07-29 08:29:29 +00:00
_comparatorResult = self._comparator(global, get_childResult.data);
tmp2 = _comparatorResult > 0;
2026-07-30 10:14:41 +00:00
tmp3 = tmp5;
tmp4 = obj2;
2026-07-29 08:29:29 +00:00
if (0 === _comparatorResult) {
2026-07-30 10:14:41 +00:00
tmp3 = get_childResult;
2026-07-29 08:29:29 +00:00
}
2026-07-30 10:14:41 +00:00
tmp5 = tmp3;
2026-07-29 08:29:29 +00:00
num = tmp2;
2026-07-30 10:14:41 +00:00
obj2 = get_childResult;
tmp6 = tmp3;
tmp7 = tmp4;
obj3 = get_childResult;
2026-07-29 08:29:29 +00:00
} while (null !== get_childResult.get_child(tmp2));
}
2026-07-30 10:14:41 +00:00
flag = null !== tmp6;
if (flag) {
tmp6.data = obj3.data;
({ set_child, right } = tmp7);
set_childResult = set_child(right === obj3, obj3.get_child(null === obj3.left));
self._root = obj1.right;
2026-07-29 08:29:29 +00:00
self.size = self.size - 1;
2026-07-30 10:14:41 +00:00
flag = true;
2026-07-29 08:29:29 +00:00
}
2026-07-30 10:14:41 +00:00
return flag;
2026-07-29 08:29:29 +00:00
}
}
}
2026-07-30 10:14:41 +00:00
BinTree.prototype = new require("Iterator")();
2026-07-29 08:29:29 +00:00
2026-07-30 10:14:41 +00:00
export default BinTree;