Tracking de l'application VApp (IHM du jeu)

This commit is contained in:
2025-05-11 18:04:12 +02:00
commit 89e9db9b62
17763 changed files with 3718499 additions and 0 deletions

View File

@ -0,0 +1,9 @@
import { ContainerIterator } from "../../ContainerBase";
import SequentialContainer from "./index";
export declare abstract class RandomIterator<T> extends ContainerIterator<T> {
abstract readonly container: SequentialContainer<T>;
get pointer(): T;
set pointer(newValue: T);
pre(): this;
next(): this;
}

View File

@ -0,0 +1,58 @@
"use strict";
Object.defineProperty(exports, "t", {
value: true
});
exports.RandomIterator = void 0;
var _ContainerBase = require("../../ContainerBase");
var _throwError = require("../../../utils/throwError");
class RandomIterator extends _ContainerBase.ContainerIterator {
constructor(t, r) {
super(r);
this.o = t;
if (this.iteratorType === 0) {
this.pre = function() {
if (this.o === 0) {
(0, _throwError.throwIteratorAccessError)();
}
this.o -= 1;
return this;
};
this.next = function() {
if (this.o === this.container.size()) {
(0, _throwError.throwIteratorAccessError)();
}
this.o += 1;
return this;
};
} else {
this.pre = function() {
if (this.o === this.container.size() - 1) {
(0, _throwError.throwIteratorAccessError)();
}
this.o += 1;
return this;
};
this.next = function() {
if (this.o === -1) {
(0, _throwError.throwIteratorAccessError)();
}
this.o -= 1;
return this;
};
}
}
get pointer() {
return this.container.getElementByPos(this.o);
}
set pointer(t) {
this.container.setElementByPos(this.o, t);
}
}
exports.RandomIterator = RandomIterator;
//# sourceMappingURL=RandomIterator.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["container/SequentialContainer/Base/RandomIterator.js","../../src/container/SequentialContainer/Base/RandomIterator.ts"],"names":["Object","defineProperty","exports","value","RandomIterator","_ContainerBase","require","_throwError","ContainerIterator","constructor","index","iteratorType","super","this","_node","pre","throwIteratorAccessError","next","container","size","pointer","getElementByPos","newValue","setElementByPos"],"mappings":"AAAA;;AAEAA,OAAOC,eAAeC,SAAS,KAAc;IAC3CC,OAAO;;;AAETD,QAAQE,sBAAsB;;ACL9B,IAAAC,iBAAAC,QAAA;;AAEA,IAAAC,cAAAD,QAAA;;AAEM,MAAgBF,uBAA0BI,eAAAA;IAS9CC,YACEC,GACAC;QAEAC,MAAMD;QACNE,KAAKC,IAAQJ;QACb,IAAIG,KAAKF,iBAAY,GAA0B;YAC7CE,KAAKE,MAAM;gBACT,IAAIF,KAAKC,MAAU,GAAG;qBACpB,GAAAE,YAAAA;ADTM;gBCWRH,KAAKC,KAAS;gBACd,OAAOD;ADTH;YCWNA,KAAKI,OAAO;gBACV,IAAIJ,KAAKC,MAAUD,KAAKK,UAAUC,QAAQ;qBACxC,GAAAH,YAAAA;ADTM;gBCWRH,KAAKC,KAAS;gBACd,OAAOD;ADTH;AACJ,eCUG;YACLA,KAAKE,MAAM;gBACT,IAAIF,KAAKC,MAAUD,KAAKK,UAAUC,SAAS,GAAG;qBAC5C,GAAAH,YAAAA;ADRM;gBCURH,KAAKC,KAAS;gBACd,OAAOD;ADRH;YCUNA,KAAKI,OAAO;gBACV,IAAIJ,KAAKC,OAAW,GAAG;qBACrB,GAAAE,YAAAA;ADRM;gBCURH,KAAKC,KAAS;gBACd,OAAOD;ADRH;AACJ;AACJ;ICUEO;QACF,OAAOP,KAAKK,UAAUG,gBAAgBR,KAAKC;ADR3C;ICUEM,YAAQE;QACVT,KAAKK,UAAUK,gBAAgBV,KAAKC,GAAOQ;ADR3C;;;ACcHpB,QAAAE,iBAAAA","file":"RandomIterator.js","sourcesContent":["import { ContainerIterator } from \"../../ContainerBase\";\nimport { throwIteratorAccessError } from \"../../../utils/throwError\";\nexport class RandomIterator extends ContainerIterator {\n /**\n * @internal\n */\n constructor(index, iteratorType) {\n super(iteratorType);\n this._node = index;\n if (this.iteratorType === 0 /* IteratorType.NORMAL */) {\n this.pre = function () {\n if (this._node === 0) {\n throwIteratorAccessError();\n }\n this._node -= 1;\n return this;\n };\n this.next = function () {\n if (this._node === this.container.size()) {\n throwIteratorAccessError();\n }\n this._node += 1;\n return this;\n };\n }\n else {\n this.pre = function () {\n if (this._node === this.container.size() - 1) {\n throwIteratorAccessError();\n }\n this._node += 1;\n return this;\n };\n this.next = function () {\n if (this._node === -1) {\n throwIteratorAccessError();\n }\n this._node -= 1;\n return this;\n };\n }\n }\n get pointer() {\n return this.container.getElementByPos(this._node);\n }\n set pointer(newValue) {\n this.container.setElementByPos(this._node, newValue);\n }\n}\n","import { ContainerIterator, IteratorType } from '@/container/ContainerBase';\nimport SequentialContainer from '@/container/SequentialContainer/Base/index';\nimport { throwIteratorAccessError } from '@/utils/throwError';\n\nexport abstract class RandomIterator<T> extends ContainerIterator<T> {\n abstract readonly container: SequentialContainer<T>;\n /**\n * @internal\n */\n _node: number;\n /**\n * @internal\n */\n protected constructor(\n index: number,\n iteratorType?: IteratorType\n ) {\n super(iteratorType);\n this._node = index;\n if (this.iteratorType === IteratorType.NORMAL) {\n this.pre = function () {\n if (this._node === 0) {\n throwIteratorAccessError();\n }\n this._node -= 1;\n return this;\n };\n this.next = function () {\n if (this._node === this.container.size()) {\n throwIteratorAccessError();\n }\n this._node += 1;\n return this;\n };\n } else {\n this.pre = function () {\n if (this._node === this.container.size() - 1) {\n throwIteratorAccessError();\n }\n this._node += 1;\n return this;\n };\n this.next = function () {\n if (this._node === -1) {\n throwIteratorAccessError();\n }\n this._node -= 1;\n return this;\n };\n }\n }\n get pointer() {\n return this.container.getElementByPos(this._node);\n }\n set pointer(newValue: T) {\n this.container.setElementByPos(this._node, newValue);\n }\n // @ts-ignore\n pre(): this;\n // @ts-ignore\n next(): this;\n}\n"]}

View File

@ -0,0 +1,67 @@
import { Container } from "../../ContainerBase";
declare abstract class SequentialContainer<T> extends Container<T> {
/**
* @description Push the element to the back.
* @param element - The element you want to push.
* @returns The size of container after pushing.
*/
abstract pushBack(element: T): number;
/**
* @description Removes the last element.
* @returns The element you popped.
*/
abstract popBack(): T | undefined;
/**
* @description Sets element by position.
* @param pos - The position you want to change.
* @param element - The element's value you want to update.
* @example
* container.setElementByPos(-1, 1); // throw a RangeError
*/
abstract setElementByPos(pos: number, element: T): void;
/**
* @description Removes the elements of the specified value.
* @param value - The value you want to remove.
* @returns The size of container after erasing.
* @example
* container.eraseElementByValue(-1);
*/
abstract eraseElementByValue(value: T): number;
/**
* @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).
* @returns The size of container after inserting.
* @example
* const container = new Vector([1, 2, 3]);
* container.insert(1, 4); // [1, 4, 2, 3]
* container.insert(1, 5, 3); // [1, 5, 5, 5, 4, 2, 3]
*/
abstract insert(pos: number, element: T, num?: number): number;
/**
* @description Reverses the container.
* @example
* const container = new Vector([1, 2, 3]);
* container.reverse(); // [3, 2, 1]
*/
abstract reverse(): void;
/**
* @description Removes the duplication of elements in the container.
* @returns The size of container after inserting.
* @example
* const container = new Vector([1, 1, 3, 2, 2, 5, 5, 2]);
* container.unique(); // [1, 3, 2, 5, 2]
*/
abstract unique(): number;
/**
* @description Sort the container.
* @param cmp - Comparison function to sort.
* @example
* const container = new Vector([3, 1, 10]);
* container.sort(); // [1, 10, 3]
* container.sort((x, y) => x - y); // [1, 3, 10]
*/
abstract sort(cmp?: (x: T, y: T) => number): void;
}
export default SequentialContainer;

View File

@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "t", {
value: true
});
exports.default = void 0;
var _ContainerBase = require("../../ContainerBase");
class SequentialContainer extends _ContainerBase.Container {}
var _default = SequentialContainer;
exports.default = _default;
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["container/SequentialContainer/Base/index.js","../../src/container/SequentialContainer/Base/index.ts"],"names":["Object","defineProperty","exports","value","default","_ContainerBase","require","SequentialContainer","Container","_default"],"mappings":"AAAA;;AAEAA,OAAOC,eAAeC,SAAS,KAAc;IAC3CC,OAAO;;;AAETD,QAAQE,eAAe;;ACLvB,IAAAC,iBAAAC,QAAA;;AAEA,MAAeC,4BAA+BC,eAAAA;;AAgE7C,IAAAC,WAEcF;;AAAmBL,QAAAE,UAAAK","file":"index.js","sourcesContent":[null,"import { Container } from '@/container/ContainerBase';\n\nabstract class SequentialContainer<T> extends Container<T> {\n /**\n * @description Push the element to the back.\n * @param element - The element you want to push.\n * @returns The size of container after pushing.\n */\n abstract pushBack(element: T): number;\n /**\n * @description Removes the last element.\n * @returns The element you popped.\n */\n abstract popBack(): T | undefined;\n /**\n * @description Sets element by position.\n * @param pos - The position you want to change.\n * @param element - The element's value you want to update.\n * @example\n * container.setElementByPos(-1, 1); // throw a RangeError\n */\n abstract setElementByPos(pos: number, element: T): void;\n /**\n * @description Removes the elements of the specified value.\n * @param value - The value you want to remove.\n * @returns The size of container after erasing.\n * @example\n * container.eraseElementByValue(-1);\n */\n abstract eraseElementByValue(value: T): number;\n /**\n * @description Insert several elements after the specified position.\n * @param pos - The position you want to insert.\n * @param element - The element you want to insert.\n * @param num - The number of elements you want to insert (default 1).\n * @returns The size of container after inserting.\n * @example\n * const container = new Vector([1, 2, 3]);\n * container.insert(1, 4); // [1, 4, 2, 3]\n * container.insert(1, 5, 3); // [1, 5, 5, 5, 4, 2, 3]\n */\n abstract insert(pos: number, element: T, num?: number): number;\n /**\n * @description Reverses the container.\n * @example\n * const container = new Vector([1, 2, 3]);\n * container.reverse(); // [3, 2, 1]\n */\n abstract reverse(): void;\n /**\n * @description Removes the duplication of elements in the container.\n * @returns The size of container after inserting.\n * @example\n * const container = new Vector([1, 1, 3, 2, 2, 5, 5, 2]);\n * container.unique(); // [1, 3, 2, 5, 2]\n */\n abstract unique(): number;\n /**\n * @description Sort the container.\n * @param cmp - Comparison function to sort.\n * @example\n * const container = new Vector([3, 1, 10]);\n * container.sort(); // [1, 10, 3]\n * container.sort((x, y) => x - y); // [1, 3, 10]\n */\n abstract sort(cmp?: (x: T, y: T) => number): void;\n}\n\nexport default SequentialContainer;\n"]}