mqtt and socket added
This commit is contained in:
34
WebUI/node_modules/js-sdsl/dist/esm/container/OtherContainer/PriorityQueue.d.ts
generated
vendored
Normal file
34
WebUI/node_modules/js-sdsl/dist/esm/container/OtherContainer/PriorityQueue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Base, initContainer } from "../ContainerBase/index";
|
||||
declare class PriorityQueue<T> extends Base {
|
||||
private readonly priorityQueue;
|
||||
private readonly cmp;
|
||||
/**
|
||||
* @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.
|
||||
*/
|
||||
constructor(container?: initContainer<T>, cmp?: (x: T, y: T) => number, copy?: boolean);
|
||||
/**
|
||||
* @description Adjusting parent's children to suit the nature of the heap.
|
||||
* @param parent Parent's index.
|
||||
* @private
|
||||
*/
|
||||
private adjust;
|
||||
clear(): void;
|
||||
/**
|
||||
* @description Push element into a container in order.
|
||||
* @param element The element you want to push.
|
||||
*/
|
||||
push(element: T): void;
|
||||
/**
|
||||
* @description Removes the top element.
|
||||
*/
|
||||
pop(): void;
|
||||
/**
|
||||
* @description Accesses the top element.
|
||||
*/
|
||||
top(): T | undefined;
|
||||
}
|
||||
export default PriorityQueue;
|
||||
167
WebUI/node_modules/js-sdsl/dist/esm/container/OtherContainer/PriorityQueue.js
generated
vendored
Normal file
167
WebUI/node_modules/js-sdsl/dist/esm/container/OtherContainer/PriorityQueue.js
generated
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
import { Base } from "../ContainerBase/index";
|
||||
var PriorityQueue = /** @class */ (function (_super) {
|
||||
__extends(PriorityQueue, _super);
|
||||
/**
|
||||
* @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.
|
||||
*/
|
||||
function PriorityQueue(container, cmp, copy) {
|
||||
var _a;
|
||||
if (container === void 0) { container = []; }
|
||||
if (cmp === void 0) { cmp = function (x, y) {
|
||||
if (x > y)
|
||||
return -1;
|
||||
if (x < y)
|
||||
return 1;
|
||||
return 0;
|
||||
}; }
|
||||
if (copy === void 0) { copy = true; }
|
||||
var _this = _super.call(this) || this;
|
||||
_this.cmp = cmp;
|
||||
if (Array.isArray(container)) {
|
||||
_this.priorityQueue = copy ? __spreadArray([], __read(container), false) : container;
|
||||
}
|
||||
else {
|
||||
_this.priorityQueue = [];
|
||||
container.forEach(function (element) { return _this.priorityQueue.push(element); });
|
||||
}
|
||||
_this.length = _this.priorityQueue.length;
|
||||
for (var parent_1 = (_this.length - 1) >> 1; parent_1 >= 0; --parent_1) {
|
||||
var curParent = parent_1;
|
||||
var curChild = (curParent << 1) | 1;
|
||||
while (curChild < _this.length) {
|
||||
var left = curChild;
|
||||
var right = left + 1;
|
||||
var minChild = left;
|
||||
if (right < _this.length &&
|
||||
_this.cmp(_this.priorityQueue[left], _this.priorityQueue[right]) > 0) {
|
||||
minChild = right;
|
||||
}
|
||||
if (_this.cmp(_this.priorityQueue[curParent], _this.priorityQueue[minChild]) <= 0)
|
||||
break;
|
||||
_a = __read([_this.priorityQueue[minChild], _this.priorityQueue[curParent]], 2), _this.priorityQueue[curParent] = _a[0], _this.priorityQueue[minChild] = _a[1];
|
||||
curParent = minChild;
|
||||
curChild = (curParent << 1) | 1;
|
||||
}
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* @description Adjusting parent's children to suit the nature of the heap.
|
||||
* @param parent Parent's index.
|
||||
* @private
|
||||
*/
|
||||
PriorityQueue.prototype.adjust = function (parent) {
|
||||
var _a, _b;
|
||||
var left = (parent << 1) | 1;
|
||||
var right = (parent << 1) + 2;
|
||||
if (left < this.length &&
|
||||
this.cmp(this.priorityQueue[parent], this.priorityQueue[left]) > 0) {
|
||||
_a = __read([this.priorityQueue[left], this.priorityQueue[parent]], 2), this.priorityQueue[parent] = _a[0], this.priorityQueue[left] = _a[1];
|
||||
}
|
||||
if (right < this.length &&
|
||||
this.cmp(this.priorityQueue[parent], this.priorityQueue[right]) > 0) {
|
||||
_b = __read([this.priorityQueue[right], this.priorityQueue[parent]], 2), this.priorityQueue[parent] = _b[0], this.priorityQueue[right] = _b[1];
|
||||
}
|
||||
};
|
||||
PriorityQueue.prototype.clear = function () {
|
||||
this.length = 0;
|
||||
this.priorityQueue.length = 0;
|
||||
};
|
||||
/**
|
||||
* @description Push element into a container in order.
|
||||
* @param element The element you want to push.
|
||||
*/
|
||||
PriorityQueue.prototype.push = function (element) {
|
||||
this.priorityQueue.push(element);
|
||||
this.length += 1;
|
||||
if (this.length === 1)
|
||||
return;
|
||||
var curNode = this.length - 1;
|
||||
while (curNode > 0) {
|
||||
var parent_2 = (curNode - 1) >> 1;
|
||||
if (this.cmp(this.priorityQueue[parent_2], element) <= 0)
|
||||
break;
|
||||
this.adjust(parent_2);
|
||||
curNode = parent_2;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @description Removes the top element.
|
||||
*/
|
||||
PriorityQueue.prototype.pop = function () {
|
||||
if (!this.length)
|
||||
return;
|
||||
var last = this.priorityQueue[this.length - 1];
|
||||
this.length -= 1;
|
||||
var parent = 0;
|
||||
while (parent < this.length) {
|
||||
var left = (parent << 1) | 1;
|
||||
var right = (parent << 1) + 2;
|
||||
if (left >= this.length)
|
||||
break;
|
||||
var minChild = left;
|
||||
if (right < this.length &&
|
||||
this.cmp(this.priorityQueue[left], this.priorityQueue[right]) > 0) {
|
||||
minChild = right;
|
||||
}
|
||||
if (this.cmp(this.priorityQueue[minChild], last) >= 0)
|
||||
break;
|
||||
this.priorityQueue[parent] = this.priorityQueue[minChild];
|
||||
parent = minChild;
|
||||
}
|
||||
this.priorityQueue[parent] = last;
|
||||
this.priorityQueue.pop();
|
||||
};
|
||||
/**
|
||||
* @description Accesses the top element.
|
||||
*/
|
||||
PriorityQueue.prototype.top = function () {
|
||||
return this.priorityQueue[0];
|
||||
};
|
||||
return PriorityQueue;
|
||||
}(Base));
|
||||
export default PriorityQueue;
|
||||
19
WebUI/node_modules/js-sdsl/dist/esm/container/OtherContainer/Queue.d.ts
generated
vendored
Normal file
19
WebUI/node_modules/js-sdsl/dist/esm/container/OtherContainer/Queue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Base, initContainer } from "../ContainerBase/index";
|
||||
declare class Queue<T> extends Base {
|
||||
private queue;
|
||||
constructor(container?: initContainer<T>);
|
||||
clear(): void;
|
||||
/**
|
||||
* @description Inserts element to queue's end.
|
||||
*/
|
||||
push(element: T): void;
|
||||
/**
|
||||
* @description Removes the first element.
|
||||
*/
|
||||
pop(): void;
|
||||
/**
|
||||
* @description Access the first element.
|
||||
*/
|
||||
front(): T | undefined;
|
||||
}
|
||||
export default Queue;
|
||||
54
WebUI/node_modules/js-sdsl/dist/esm/container/OtherContainer/Queue.js
generated
vendored
Normal file
54
WebUI/node_modules/js-sdsl/dist/esm/container/OtherContainer/Queue.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
import Deque from '../SequentialContainer/Deque';
|
||||
import { Base } from "../ContainerBase/index";
|
||||
var Queue = /** @class */ (function (_super) {
|
||||
__extends(Queue, _super);
|
||||
function Queue(container) {
|
||||
if (container === void 0) { container = []; }
|
||||
var _this = _super.call(this) || this;
|
||||
_this.queue = new Deque(container);
|
||||
_this.length = _this.queue.size();
|
||||
return _this;
|
||||
}
|
||||
Queue.prototype.clear = function () {
|
||||
this.queue.clear();
|
||||
this.length = 0;
|
||||
};
|
||||
/**
|
||||
* @description Inserts element to queue's end.
|
||||
*/
|
||||
Queue.prototype.push = function (element) {
|
||||
this.queue.pushBack(element);
|
||||
this.length += 1;
|
||||
};
|
||||
/**
|
||||
* @description Removes the first element.
|
||||
*/
|
||||
Queue.prototype.pop = function () {
|
||||
this.queue.popFront();
|
||||
if (this.length)
|
||||
this.length -= 1;
|
||||
};
|
||||
/**
|
||||
* @description Access the first element.
|
||||
*/
|
||||
Queue.prototype.front = function () {
|
||||
return this.queue.front();
|
||||
};
|
||||
return Queue;
|
||||
}(Base));
|
||||
export default Queue;
|
||||
19
WebUI/node_modules/js-sdsl/dist/esm/container/OtherContainer/Stack.d.ts
generated
vendored
Normal file
19
WebUI/node_modules/js-sdsl/dist/esm/container/OtherContainer/Stack.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Base, initContainer } from "../ContainerBase/index";
|
||||
declare class Stack<T> extends Base {
|
||||
private stack;
|
||||
constructor(container?: initContainer<T>);
|
||||
clear(): void;
|
||||
/**
|
||||
* @description Insert element to stack's end.
|
||||
*/
|
||||
push(element: T): void;
|
||||
/**
|
||||
* @description Removes the end element.
|
||||
*/
|
||||
pop(): void;
|
||||
/**
|
||||
* @description Accesses the end element.
|
||||
*/
|
||||
top(): T | undefined;
|
||||
}
|
||||
export default Stack;
|
||||
53
WebUI/node_modules/js-sdsl/dist/esm/container/OtherContainer/Stack.js
generated
vendored
Normal file
53
WebUI/node_modules/js-sdsl/dist/esm/container/OtherContainer/Stack.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
import { Base } from "../ContainerBase/index";
|
||||
var Stack = /** @class */ (function (_super) {
|
||||
__extends(Stack, _super);
|
||||
function Stack(container) {
|
||||
if (container === void 0) { container = []; }
|
||||
var _this = _super.call(this) || this;
|
||||
_this.stack = [];
|
||||
container.forEach(function (element) { return _this.push(element); });
|
||||
return _this;
|
||||
}
|
||||
Stack.prototype.clear = function () {
|
||||
this.length = 0;
|
||||
this.stack.length = 0;
|
||||
};
|
||||
/**
|
||||
* @description Insert element to stack's end.
|
||||
*/
|
||||
Stack.prototype.push = function (element) {
|
||||
this.stack.push(element);
|
||||
this.length += 1;
|
||||
};
|
||||
/**
|
||||
* @description Removes the end element.
|
||||
*/
|
||||
Stack.prototype.pop = function () {
|
||||
this.stack.pop();
|
||||
if (this.length > 0)
|
||||
this.length -= 1;
|
||||
};
|
||||
/**
|
||||
* @description Accesses the end element.
|
||||
*/
|
||||
Stack.prototype.top = function () {
|
||||
return this.stack[this.length - 1];
|
||||
};
|
||||
return Stack;
|
||||
}(Base));
|
||||
export default Stack;
|
||||
Reference in New Issue
Block a user