mqtt and socket added

This commit is contained in:
Miisa Ekholm
2022-10-21 11:17:48 +03:00
parent 52370df9ce
commit 9e3d953b9e
751 changed files with 185105 additions and 153 deletions

View File

@@ -0,0 +1,13 @@
import { ContainerIterator } from "../../ContainerBase/index";
export declare abstract class RandomIterator<T> extends ContainerIterator<T> {
protected node: number;
protected readonly size: () => number;
protected readonly getElementByPos: (pos: number) => T;
protected readonly setElementByPos: (pos: number, element: T) => void;
pre: () => this;
next: () => this;
constructor(index: number, size: () => number, getElementByPos: (pos: number) => T, setElementByPos: (pos: number, element: T) => void, iteratorType?: boolean);
get pointer(): T;
set pointer(newValue: T);
equals(obj: RandomIterator<T>): boolean;
}

View File

@@ -0,0 +1,58 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RandomIterator = void 0;
const checkParams_1 = require("../../../utils/checkParams");
const index_1 = require("../../ContainerBase/index");
class RandomIterator extends index_1.ContainerIterator {
constructor(index, size, getElementByPos, setElementByPos, iteratorType) {
super(iteratorType);
this.node = index;
this.size = size;
this.getElementByPos = getElementByPos;
this.setElementByPos = setElementByPos;
if (this.iteratorType === index_1.ContainerIterator.NORMAL) {
this.pre = function () {
if (this.node === 0) {
throw new RangeError('Deque iterator access denied!');
}
this.node -= 1;
return this;
};
this.next = function () {
if (this.node === this.size()) {
throw new RangeError('Deque Iterator access denied!');
}
this.node += 1;
return this;
};
}
else {
this.pre = function () {
if (this.node === this.size() - 1) {
throw new RangeError('Deque iterator access denied!');
}
this.node += 1;
return this;
};
this.next = function () {
if (this.node === -1) {
throw new RangeError('Deque iterator access denied!');
}
this.node -= 1;
return this;
};
}
}
get pointer() {
(0, checkParams_1.checkWithinAccessParams)(this.node, 0, this.size() - 1);
return this.getElementByPos(this.node);
}
set pointer(newValue) {
(0, checkParams_1.checkWithinAccessParams)(this.node, 0, this.size() - 1);
this.setElementByPos(this.node, newValue);
}
equals(obj) {
return this.node === obj.node;
}
}
exports.RandomIterator = RandomIterator;

View File

@@ -0,0 +1,44 @@
import { Container } from "../../ContainerBase/index";
declare abstract class SequentialContainer<T> extends Container<T> {
/**
* @description Push the element to the back.
* @param element The element you want to push.
*/
abstract pushBack(element: T): void;
/**
* @description Removes the last element.
*/
abstract popBack(): void;
/**
* @description Sets element by position.
* @param pos The position you want to change.
* @param element The element's value you want to update.
*/
abstract setElementByPos(pos: number, element: T): void;
/**
* @description Removes the elements of the specified value.
* @param value The value you want to remove.
*/
abstract eraseElementByValue(value: T): void;
/**
* @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).
*/
abstract insert(pos: number, element: T, num?: number): void;
/**
* @description Reverses the container.
*/
abstract reverse(): void;
/**
* @description Removes the duplication of elements in the container.
*/
abstract unique(): void;
/**
* @description Sort the container.
* @param cmp Comparison function.
*/
abstract sort(cmp?: (x: T, y: T) => number): void;
}
export default SequentialContainer;

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("../../ContainerBase/index");
class SequentialContainer extends index_1.Container {
}
exports.default = SequentialContainer;