include node_modules so release .zip is deployable

This commit is contained in:
2023-11-24 17:44:25 -05:00
parent 6c86cfe5d2
commit 8b11c41267
8963 changed files with 874175 additions and 1 deletions
@@ -0,0 +1,50 @@
/**
* @packageDocumentation
* @module std.internal
*/
import { IContainer } from "../../../base/container/IContainer";
/**
* Common interface for associative containers
*
* @author Jeongho Nam - https://github.com/samchon
*/
export interface IAssociativeContainer<Key, T extends Elem, SourceT extends IAssociativeContainer<Key, T, SourceT, IteratorT, ReverseIteratorT, Elem>, IteratorT extends IContainer.Iterator<T, SourceT, IteratorT, ReverseIteratorT, Elem>, ReverseIteratorT extends IContainer.ReverseIterator<T, SourceT, IteratorT, ReverseIteratorT, Elem>, Elem> extends IContainer<T, SourceT, IteratorT, ReverseIteratorT, Elem> {
/**
* Get iterator to element.
*
* @param key Key to search for.
* @return An iterator to the element, if the specified key is found, otherwise `this.end()`.
*/
find(key: Key): IteratorT;
/**
* Test whether a key exists.
*
* @param key Key to search for.
* @return Whether the specified key exists.
*/
has(key: Key): boolean;
/**
* Count elements with a specified key.
*
* @param key Key to search for.
* @return Number of elements with the specified key.
*/
count(key: Key): number;
/**
* Erase elements with a specified key.
*
* @param key Key to search for.
* @return Number of erased elements.
*/
erase(key: Key): number;
/**
* @inheritDoc
*/
erase(pos: IteratorT): IteratorT;
/**
* @inheritDoc
*/
erase(first: IteratorT, last: IteratorT): IteratorT;
}
export declare namespace IAssociativeContainer {
}
@@ -0,0 +1,69 @@
"use strict";
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));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.IAssociativeContainer = void 0;
var IAssociativeContainer;
(function (IAssociativeContainer) {
/**
* @internal
*/
function construct(source) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var ramda;
var tail;
if (args.length >= 1 && args[0] instanceof Array) {
// INITIALIZER LIST CONSTRUCTOR
ramda = function () {
var items = args[0];
source.push.apply(source, __spreadArray([], __read(items), false));
};
tail = args.slice(1);
}
else if (args.length >= 2 &&
args[0].next instanceof Function &&
args[1].next instanceof Function) {
// RANGE CONSTRUCTOR
ramda = function () {
var first = args[0];
var last = args[1];
source.assign(first, last);
};
tail = args.slice(2);
}
else {
// DEFAULT CONSTRUCTOR
ramda = null;
tail = args;
}
return { ramda: ramda, tail: tail };
}
IAssociativeContainer.construct = construct;
})(IAssociativeContainer = exports.IAssociativeContainer || (exports.IAssociativeContainer = {}));
//# sourceMappingURL=IAssociativeContainer.js.map
+77
View File
@@ -0,0 +1,77 @@
/**
* @packageDocumentation
* @module std.internal
*/
import { IAssociativeContainer } from "./IAssociativeContainer";
import { IContainer } from "../../../base/container/IContainer";
import { Hasher } from "../../functional/Hasher";
import { BinaryPredicator } from "../../functional/BinaryPredicator";
/**
* Common interface for hash containers
*
* @author Jeongho Nam - https://github.com/samchon
*/
export interface IHashContainer<Key, T extends Elem, SourceT extends IHashContainer<Key, T, SourceT, IteratorT, ReverseIteratorT, Elem>, IteratorT extends IContainer.Iterator<T, SourceT, IteratorT, ReverseIteratorT, Elem>, ReverseIteratorT extends IContainer.ReverseIterator<T, SourceT, IteratorT, ReverseIteratorT, Elem>, Elem> extends IAssociativeContainer<Key, T, SourceT, IteratorT, ReverseIteratorT, Elem> {
/**
* Get hash function.
*
* @return The hash function.
*/
hash_function(): Hasher<Key>;
/**
* Get key equality predicator.
*
* @return The key equality predicator.
*/
key_eq(): BinaryPredicator<Key>;
/**
* Compute bucket index for the *key*.
*
* @param key Target key.
* @return Index number.
*/
bucket(key: Key): number;
/**
* Get number of buckets.
*/
bucket_count(): number;
/**
* Get size of a specific bucket.
*
* @param index Specific position.
* @return Size of the specific bucket.
*/
bucket_size(index: number): number;
/**
* Compute load factor.
*
* @return `this.size() / this.bucket_count()`
*/
load_factor(): number;
/**
* Get maximum load factor that allowable.
*
* @return The maximum load factor.
*/
max_load_factor(): number;
/**
* Set maximum load factor.
*
* @param z The new value to change.
*/
max_load_factor(z: number): void;
/**
* Reserve buckets enable to store *n* elements.
*
* @param n The capacity to reserve.
*/
reserve(n: number): void;
/**
* Change of bucktes.
*
* @param n The number to change.
*/
rehash(n: number): void;
}
export declare namespace IHashContainer {
}
+87
View File
@@ -0,0 +1,87 @@
"use strict";
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));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.IHashContainer = void 0;
//================================================================
/**
* @packageDocumentation
* @module std.internal
*/
//================================================================
var IAssociativeContainer_1 = require("./IAssociativeContainer");
var hash_1 = require("../../../functional/hash");
var comparators_1 = require("../../../functional/comparators");
var IHashContainer;
(function (IHashContainer) {
/**
* @internal
*/
function construct(source, Source, bucketFactory) {
var args = [];
for (var _i = 3; _i < arguments.length; _i++) {
args[_i - 3] = arguments[_i];
}
// DECLARE MEMBERS
var post_process = null;
var hash_function = hash_1.hash;
var key_eq = comparators_1.equal_to;
//----
// INITIALIZE MEMBERS AND POST-PROCESS
//----
// BRANCH - METHOD OVERLOADINGS
if (args.length === 1 && args[0] instanceof Source) {
// PARAMETERS
var container_1 = args[0];
hash_function = container_1.hash_function();
key_eq = container_1.key_eq();
// COPY CONSTRUCTOR
post_process = function () {
var first = container_1.begin();
var last = container_1.end();
source.assign(first, last);
};
}
else {
var tuple = IAssociativeContainer_1.IAssociativeContainer.construct.apply(IAssociativeContainer_1.IAssociativeContainer, __spreadArray([source], __read(args), false));
post_process = tuple.ramda;
if (tuple.tail.length >= 1)
hash_function = tuple.tail[0];
if (tuple.tail.length >= 2)
key_eq = tuple.tail[1];
}
//----
// DO PROCESS
//----
// CONSTRUCT BUCKET
bucketFactory(hash_function, key_eq);
// ACT POST-PROCESS
if (post_process !== null)
post_process();
}
IHashContainer.construct = construct;
})(IHashContainer = exports.IHashContainer || (exports.IHashContainer = {}));
//# sourceMappingURL=IHashContainer.js.map
+50
View File
@@ -0,0 +1,50 @@
/**
* @packageDocumentation
* @module std.internal
*/
import { IAssociativeContainer } from "./IAssociativeContainer";
import { IContainer } from "../../../base/container/IContainer";
import { Comparator } from "../../functional/Comparator";
import { Pair } from "../../../utility/Pair";
/**
* Common interface for tree containers.
*
* @author Jeongho Nam - https://github.com/samchon
*/
export interface ITreeContainer<Key, T extends Elem, SourceT extends ITreeContainer<Key, T, SourceT, IteratorT, ReverseIteratorT, Elem>, IteratorT extends IContainer.Iterator<T, SourceT, IteratorT, ReverseIteratorT, Elem>, ReverseIteratorT extends IContainer.ReverseIterator<T, SourceT, IteratorT, ReverseIteratorT, Elem>, Elem> extends IAssociativeContainer<Key, T, SourceT, IteratorT, ReverseIteratorT, Elem> {
/**
* Get key comparison function.
*
* @return The key comparison function.
*/
key_comp(): Comparator<Key>;
/**
* Get value comparison function.
*
* @return The value comparison function.
*/
value_comp(): Comparator<Elem>;
/**
* Get iterator to lower bound.
*
* @param key Key to search for.
* @return Iterator to the first element equal or after to the key.
*/
lower_bound(key: Key): IteratorT;
/**
* Get iterator to upper bound.
*
* @param key Key to search for.
* @return Iterator to the first element after the key.
*/
upper_bound(key: Key): IteratorT;
/**
* Get range of equal elements.
*
* @param key Key to search for.
* @return Pair of {@link lower_bound} and {@link upper_bound}.
*/
equal_range(key: Key): Pair<IteratorT, IteratorT>;
}
export declare namespace ITreeContainer {
}
+95
View File
@@ -0,0 +1,95 @@
"use strict";
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));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ITreeContainer = void 0;
//================================================================
/**
* @packageDocumentation
* @module std.internal
*/
//================================================================
var IAssociativeContainer_1 = require("./IAssociativeContainer");
var comparators_1 = require("../../../functional/comparators");
var ITreeContainer;
(function (ITreeContainer) {
/**
* @internal
*/
function construct(source, Source, treeFactory) {
var args = [];
for (var _i = 3; _i < arguments.length; _i++) {
args[_i - 3] = arguments[_i];
}
// DECLARE MEMBERS
var post_process = null;
var comp = comparators_1.less;
//----
// INITIALIZE MEMBERS AND POST-PROCESS
//----
// BRANCH - METHOD OVERLOADINGS
if (args.length === 1 && args[0] instanceof Source) {
// PARAMETERS
var container_1 = args[0];
comp = container_1.key_comp();
// COPY CONSTRUCTOR
post_process = function () {
var first = container_1.begin();
var last = container_1.end();
source.assign(first, last);
};
}
else {
var tuple = IAssociativeContainer_1.IAssociativeContainer.construct.apply(IAssociativeContainer_1.IAssociativeContainer, __spreadArray([source], __read(args), false));
post_process = tuple.ramda;
if (tuple.tail.length >= 1)
comp = tuple.tail[0];
}
//----
// DO PROCESS
//----
// CONSTRUCT TREE
treeFactory(comp);
// ACT POST-PROCESS
if (post_process !== null)
post_process();
}
ITreeContainer.construct = construct;
/**
* @internal
*/
function emplacable(source, hint, elem) {
var prev = hint.prev();
var meet = prev.equals(source.end()) || source.value_comp()(prev.value, elem);
meet =
meet &&
(hint.equals(source.end()) ||
source.value_comp()(elem, hint.value));
return meet;
}
ITreeContainer.emplacable = emplacable;
})(ITreeContainer = exports.ITreeContainer || (exports.ITreeContainer = {}));
//# sourceMappingURL=ITreeContainer.js.map
+96
View File
@@ -0,0 +1,96 @@
/**
* @packageDocumentation
* @module std.internal
*/
import { ListContainer } from "../linear/ListContainer";
import { ListIterator } from "../../iterator/ListIterator";
import { ReverseIterator as _ReverseIterator } from "../../iterator/ReverseIterator";
import { MapContainer } from "../../../base/container/MapContainer";
import { IPair } from "../../../utility/IPair";
import { Entry } from "../../../utility/Entry";
/**
* Doubly Linked List storing map elements.
*
* @template Key Key type
* @template T Mapped type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source type
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare class MapElementList<Key, T, Unique extends boolean, Source extends MapContainer<Key, T, Unique, Source, MapElementList.Iterator<Key, T, Unique, Source>, MapElementList.ReverseIterator<Key, T, Unique, Source>>> extends ListContainer<Entry<Key, T>, Source, MapElementList.Iterator<Key, T, Unique, Source>, MapElementList.ReverseIterator<Key, T, Unique, Source>> {
private associative_;
constructor(associative: Source);
protected _Create_iterator(prev: MapElementList.Iterator<Key, T, Unique, Source>, next: MapElementList.Iterator<Key, T, Unique, Source>, val: Entry<Key, T>): MapElementList.Iterator<Key, T, Unique, Source>;
associative(): Source;
}
/**
*
*/
export declare namespace MapElementList {
/**
* Iterator of map container storing elements in a list.
*
* @template Key Key type
* @template T Mapped type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
class Iterator<Key, T, Unique extends boolean, Source extends MapContainer<Key, T, Unique, Source, Iterator<Key, T, Unique, Source>, ReverseIterator<Key, T, Unique, Source>>> extends ListIterator<Entry<Key, T>, Source, Iterator<Key, T, Unique, Source>, ReverseIterator<Key, T, Unique, Source>, IPair<Key, T>> implements MapContainer.Iterator<Key, T, Unique, Source, Iterator<Key, T, Unique, Source>, ReverseIterator<Key, T, Unique, Source>> {
private list_;
private constructor();
/**
* @inheritDoc
*/
reverse(): ReverseIterator<Key, T, Unique, Source>;
/**
* @inheritDoc
*/
source(): Source;
/**
* @inheritDoc
*/
get first(): Key;
/**
* @inheritDoc
*/
get second(): T;
/**
* @inheritDoc
*/
set second(val: T);
}
/**
* Reverse iterator of map container storing elements a list.
*
* @template Key Key type
* @template T Mapped type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
class ReverseIterator<Key, T, Unique extends boolean, Source extends MapContainer<Key, T, Unique, Source, Iterator<Key, T, Unique, Source>, ReverseIterator<Key, T, Unique, Source>>> extends _ReverseIterator<Entry<Key, T>, Source, Iterator<Key, T, Unique, Source>, ReverseIterator<Key, T, Unique, Source>, IPair<Key, T>> implements MapContainer.ReverseIterator<Key, T, Unique, Source, Iterator<Key, T, Unique, Source>, ReverseIterator<Key, T, Unique, Source>> {
protected _Create_neighbor(base: Iterator<Key, T, Unique, Source>): ReverseIterator<Key, T, Unique, Source>;
/**
* Get the first, key element.
*
* @return The first element.
*/
get first(): Key;
/**
* Get the second, stored element.
*
* @return The second element.
*/
get second(): T;
/**
* Set the second, stored element.
*
* @param val The value to set.
*/
set second(val: T);
}
}
+218
View File
@@ -0,0 +1,218 @@
"use strict";
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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MapElementList = void 0;
//================================================================
/**
* @packageDocumentation
* @module std.internal
*/
//================================================================
var ListContainer_1 = require("../linear/ListContainer");
var ListIterator_1 = require("../../iterator/ListIterator");
var ReverseIterator_1 = require("../../iterator/ReverseIterator");
/**
* Doubly Linked List storing map elements.
*
* @template Key Key type
* @template T Mapped type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var MapElementList = /** @class */ (function (_super) {
__extends(MapElementList, _super);
/* ---------------------------------------------------------
CONSTRUCTORS
--------------------------------------------------------- */
function MapElementList(associative) {
var _this = _super.call(this) || this;
_this.associative_ = associative;
return _this;
}
MapElementList.prototype._Create_iterator = function (prev, next, val) {
return MapElementList.Iterator.create(this, prev, next, val);
};
/**
* @internal
*/
MapElementList._Swap_associative = function (x, y) {
var _a;
_a = __read([y.associative_, x.associative_], 2), x.associative_ = _a[0], y.associative_ = _a[1];
};
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
MapElementList.prototype.associative = function () {
return this.associative_;
};
return MapElementList;
}(ListContainer_1.ListContainer));
exports.MapElementList = MapElementList;
/**
*
*/
(function (MapElementList) {
/**
* Iterator of map container storing elements in a list.
*
* @template Key Key type
* @template T Mapped type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var Iterator = /** @class */ (function (_super) {
__extends(Iterator, _super);
/* ---------------------------------------------------------
CONSTRUCTORS
--------------------------------------------------------- */
function Iterator(list, prev, next, val) {
var _this = _super.call(this, prev, next, val) || this;
_this.list_ = list;
return _this;
}
/**
* @internal
*/
Iterator.create = function (list, prev, next, val) {
return new Iterator(list, prev, next, val);
};
/**
* @inheritDoc
*/
Iterator.prototype.reverse = function () {
return new ReverseIterator(this);
};
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
/**
* @inheritDoc
*/
Iterator.prototype.source = function () {
return this.list_.associative();
};
Object.defineProperty(Iterator.prototype, "first", {
/**
* @inheritDoc
*/
get: function () {
return this.value.first;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Iterator.prototype, "second", {
/**
* @inheritDoc
*/
get: function () {
return this.value.second;
},
/**
* @inheritDoc
*/
set: function (val) {
this.value.second = val;
},
enumerable: false,
configurable: true
});
return Iterator;
}(ListIterator_1.ListIterator));
MapElementList.Iterator = Iterator;
/**
* Reverse iterator of map container storing elements a list.
*
* @template Key Key type
* @template T Mapped type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var ReverseIterator = /** @class */ (function (_super) {
__extends(ReverseIterator, _super);
function ReverseIterator() {
return _super !== null && _super.apply(this, arguments) || this;
}
/* ---------------------------------------------------------
CONSTRUCTORS
--------------------------------------------------------- */
ReverseIterator.prototype._Create_neighbor = function (base) {
return new ReverseIterator(base);
};
Object.defineProperty(ReverseIterator.prototype, "first", {
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
/**
* Get the first, key element.
*
* @return The first element.
*/
get: function () {
return this.base_.first;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ReverseIterator.prototype, "second", {
/**
* Get the second, stored element.
*
* @return The second element.
*/
get: function () {
return this.base_.second;
},
/**
* Set the second, stored element.
*
* @param val The value to set.
*/
set: function (val) {
this.base_.second = val;
},
enumerable: false,
configurable: true
});
return ReverseIterator;
}(ReverseIterator_1.ReverseIterator));
MapElementList.ReverseIterator = ReverseIterator;
})(MapElementList = exports.MapElementList || (exports.MapElementList = {}));
exports.MapElementList = MapElementList;
//# sourceMappingURL=MapElementList.js.map
+88
View File
@@ -0,0 +1,88 @@
/**
* @packageDocumentation
* @module std.internal
*/
import { VectorContainer } from "../linear/VectorContainer";
import { ArrayIteratorBase } from "../../iterator/ArrayIteratorBase";
import { ArrayReverseIteratorBase } from "../../iterator/ArrayReverseIteratorBase";
import { ITreeMap } from "../../../base/container/ITreeMap";
import { IPair } from "../../../utility/IPair";
import { Entry } from "../../../utility/Entry";
/**
* Vector storing map elements.
*
* @template Key Key type
* @template T Mapped type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source type
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare class MapElementVector<Key, T, Unique extends boolean, Source extends ITreeMap<Key, T, Unique, Source, MapElementVector.Iterator<Key, T, Unique, Source>, MapElementVector.ReverseIterator<Key, T, Unique, Source>>> extends VectorContainer<Entry<Key, T>, Source, MapElementVector<Key, T, Unique, Source>, MapElementVector.Iterator<Key, T, Unique, Source>, MapElementVector.ReverseIterator<Key, T, Unique, Source>> {
private associative_;
constructor(associative: Source);
nth(index: number): MapElementVector.Iterator<Key, T, Unique, Source>;
source(): Source;
}
/**
*
*/
export declare namespace MapElementVector {
/**
* Iterator of map container storing elements in a vector.
*
* @template Key Key type
* @template T Mapped type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
class Iterator<Key, T, Unique extends boolean, Source extends ITreeMap<Key, T, Unique, Source, Iterator<Key, T, Unique, Source>, ReverseIterator<Key, T, Unique, Source>>> extends ArrayIteratorBase<Entry<Key, T>, Source, MapElementVector<Key, T, Unique, Source>, Iterator<Key, T, Unique, Source>, ReverseIterator<Key, T, Unique, Source>, IPair<Key, T>> implements ITreeMap.Iterator<Key, T, Unique, Source, Iterator<Key, T, Unique, Source>, ReverseIterator<Key, T, Unique, Source>> {
/**
* @inheritDoc
*/
source(): Source;
/**
* @inheritDoc
*/
reverse(): ReverseIterator<Key, T, Unique, Source>;
/**
* @inheritDoc
*/
get first(): Key;
/**
* @inheritDoc
*/
get second(): T;
/**
* @inheritDoc
*/
set second(val: T);
}
/**
* Reverse iterator of map container storing elements in a vector.
*
* @template Key Key type
* @template T Mapped type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
class ReverseIterator<Key, T, Unique extends boolean, Source extends ITreeMap<Key, T, Unique, Source, Iterator<Key, T, Unique, Source>, ReverseIterator<Key, T, Unique, Source>>> extends ArrayReverseIteratorBase<Entry<Key, T>, Source, MapElementVector<Key, T, Unique, Source>, Iterator<Key, T, Unique, Source>, ReverseIterator<Key, T, Unique, Source>, IPair<Key, T>> implements ITreeMap.ReverseIterator<Key, T, Unique, Source, Iterator<Key, T, Unique, Source>, ReverseIterator<Key, T, Unique, Source>> {
protected _Create_neighbor(base: Iterator<Key, T, Unique, Source>): ReverseIterator<Key, T, Unique, Source>;
/**
* @inheritDoc
*/
get first(): Key;
/**
* @inheritDoc
*/
get second(): T;
/**
* @inheritDoc
*/
set second(val: T);
}
}
+205
View File
@@ -0,0 +1,205 @@
"use strict";
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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MapElementVector = void 0;
//================================================================
/**
* @packageDocumentation
* @module std.internal
*/
//================================================================
var VectorContainer_1 = require("../linear/VectorContainer");
var ArrayIteratorBase_1 = require("../../iterator/ArrayIteratorBase");
var ArrayReverseIteratorBase_1 = require("../../iterator/ArrayReverseIteratorBase");
/**
* Vector storing map elements.
*
* @template Key Key type
* @template T Mapped type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var MapElementVector = /** @class */ (function (_super) {
__extends(MapElementVector, _super);
/* ---------------------------------------------------------
CONSTRUCTORS
--------------------------------------------------------- */
function MapElementVector(associative) {
var _this = _super.call(this) || this;
_this.data_ = [];
_this.associative_ = associative;
return _this;
}
MapElementVector.prototype.nth = function (index) {
return new MapElementVector.Iterator(this, index);
};
/**
* @internal
*/
MapElementVector._Swap_associative = function (x, y) {
var _a;
_a = __read([y.associative_, x.associative_], 2), x.associative_ = _a[0], y.associative_ = _a[1];
};
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
MapElementVector.prototype.source = function () {
return this.associative_;
};
return MapElementVector;
}(VectorContainer_1.VectorContainer));
exports.MapElementVector = MapElementVector;
/**
*
*/
(function (MapElementVector) {
/**
* Iterator of map container storing elements in a vector.
*
* @template Key Key type
* @template T Mapped type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var Iterator = /** @class */ (function (_super) {
__extends(Iterator, _super);
function Iterator() {
return _super !== null && _super.apply(this, arguments) || this;
}
/* ---------------------------------------------------------
CONSTRUCTORS
--------------------------------------------------------- */
/**
* @inheritDoc
*/
Iterator.prototype.source = function () {
return this._Get_array().source();
};
/**
* @inheritDoc
*/
Iterator.prototype.reverse = function () {
return new ReverseIterator(this);
};
Object.defineProperty(Iterator.prototype, "first", {
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
/**
* @inheritDoc
*/
get: function () {
return this.value.first;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Iterator.prototype, "second", {
/**
* @inheritDoc
*/
get: function () {
return this.value.second;
},
/**
* @inheritDoc
*/
set: function (val) {
this.value.second = val;
},
enumerable: false,
configurable: true
});
return Iterator;
}(ArrayIteratorBase_1.ArrayIteratorBase));
MapElementVector.Iterator = Iterator;
/**
* Reverse iterator of map container storing elements in a vector.
*
* @template Key Key type
* @template T Mapped type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var ReverseIterator = /** @class */ (function (_super) {
__extends(ReverseIterator, _super);
function ReverseIterator() {
return _super !== null && _super.apply(this, arguments) || this;
}
/* ---------------------------------------------------------
CONSTRUCTORS
--------------------------------------------------------- */
ReverseIterator.prototype._Create_neighbor = function (base) {
return new ReverseIterator(base);
};
Object.defineProperty(ReverseIterator.prototype, "first", {
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
/**
* @inheritDoc
*/
get: function () {
return this.value.first;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ReverseIterator.prototype, "second", {
/**
* @inheritDoc
*/
get: function () {
return this.value.second;
},
/**
* @inheritDoc
*/
set: function (val) {
this.value.second = val;
},
enumerable: false,
configurable: true
});
return ReverseIterator;
}(ArrayReverseIteratorBase_1.ArrayReverseIteratorBase));
MapElementVector.ReverseIterator = ReverseIterator;
})(MapElementVector = exports.MapElementVector || (exports.MapElementVector = {}));
exports.MapElementVector = MapElementVector;
//# sourceMappingURL=MapElementVector.js.map
+62
View File
@@ -0,0 +1,62 @@
/**
* @packageDocumentation
* @module std.internal
*/
import { MultiMap } from "../../../base/container/MultiMap";
import { ITreeContainer } from "./ITreeContainer";
import { IForwardIterator } from "../../../iterator/IForwardIterator";
import { IPair } from "../../../utility/IPair";
import { Entry } from "../../../utility/Entry";
import { Pair } from "../../../utility/Pair";
import { Comparator } from "../../functional/Comparator";
/**
* Basic tree map allowing duplicated keys.
*
* @template Key Key type
* @template T Mapped type
* @template Source Derived type extending this {@link MultiTreeMap}
* @template IteratorT Iterator type
* @template ReverseT Reverse iterator type
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare abstract class MultiTreeMap<Key, T, Source extends MultiTreeMap<Key, T, Source, IteratorT, ReverseT>, IteratorT extends MultiMap.Iterator<Key, T, Source, IteratorT, ReverseT>, ReverseT extends MultiMap.ReverseIterator<Key, T, Source, IteratorT, ReverseT>> extends MultiMap<Key, T, Source, IteratorT, ReverseT> implements ITreeContainer<Key, Entry<Key, T>, Source, IteratorT, ReverseT, IPair<Key, T>> {
/**
* @inheritDoc
*/
find(key: Key): IteratorT;
/**
* @inheritDoc
*/
count(key: Key): number;
/**
* @inheritDoc
*/
abstract lower_bound(key: Key): IteratorT;
/**
* @inheritDoc
*/
abstract upper_bound(key: Key): IteratorT;
/**
* @inheritDoc
*/
equal_range(key: Key): Pair<IteratorT, IteratorT>;
/**
* @inheritDoc
*/
abstract key_comp(): Comparator<Key>;
/**
* @inheritDoc
*/
value_comp(): Comparator<IPair<Key, T>>;
protected _Key_eq(x: Key, y: Key): boolean;
/**
* @inheritDoc
*/
emplace(key: Key, val: T): IteratorT;
/**
* @inheritDoc
*/
emplace_hint(hint: IteratorT, key: Key, val: T): IteratorT;
protected _Insert_by_range<InputIterator extends Readonly<IForwardIterator<IPair<Key, T>, InputIterator>>>(first: InputIterator, last: InputIterator): void;
}
+119
View File
@@ -0,0 +1,119 @@
"use strict";
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 __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.MultiTreeMap = void 0;
//================================================================
/**
* @packageDocumentation
* @module std.internal
*/
//================================================================
var MultiMap_1 = require("../../../base/container/MultiMap");
var ITreeContainer_1 = require("./ITreeContainer");
var Entry_1 = require("../../../utility/Entry");
var Pair_1 = require("../../../utility/Pair");
/**
* Basic tree map allowing duplicated keys.
*
* @template Key Key type
* @template T Mapped type
* @template Source Derived type extending this {@link MultiTreeMap}
* @template IteratorT Iterator type
* @template ReverseT Reverse iterator type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var MultiTreeMap = /** @class */ (function (_super) {
__extends(MultiTreeMap, _super);
function MultiTreeMap() {
return _super !== null && _super.apply(this, arguments) || this;
}
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
/**
* @inheritDoc
*/
MultiTreeMap.prototype.find = function (key) {
var it = this.lower_bound(key);
if (!it.equals(this.end()) && this._Key_eq(key, it.first))
return it;
else
return this.end();
};
/**
* @inheritDoc
*/
MultiTreeMap.prototype.count = function (key) {
var it = this.find(key);
var ret = 0;
for (; !it.equals(this.end()) && this._Key_eq(it.first, key); it = it.next())
++ret;
return ret;
};
/**
* @inheritDoc
*/
MultiTreeMap.prototype.equal_range = function (key) {
return new Pair_1.Pair(this.lower_bound(key), this.upper_bound(key));
};
/**
* @inheritDoc
*/
MultiTreeMap.prototype.value_comp = function () {
var _this = this;
return function (x, y) { return _this.key_comp()(x.first, y.first); };
};
MultiTreeMap.prototype._Key_eq = function (x, y) {
return !this.key_comp()(x, y) && !this.key_comp()(y, x);
};
/* ---------------------------------------------------------
INSERT
--------------------------------------------------------- */
/**
* @inheritDoc
*/
MultiTreeMap.prototype.emplace = function (key, val) {
// FIND POSITION TO INSERT
var it = this.upper_bound(key);
// ITERATOR TO RETURN
it = this.data_.insert(it, new Entry_1.Entry(key, val));
this._Handle_insert(it, it.next());
return it;
};
/**
* @inheritDoc
*/
MultiTreeMap.prototype.emplace_hint = function (hint, key, val) {
var elem = new Entry_1.Entry(key, val);
var validate = ITreeContainer_1.ITreeContainer.emplacable(this, hint, elem);
if (validate) {
var it = this.data_.insert(hint, elem);
this._Handle_insert(it, it.next());
return it;
}
else
return this.emplace(key, val);
};
MultiTreeMap.prototype._Insert_by_range = function (first, last) {
for (var it = first; !it.equals(last); it = it.next())
this.emplace(it.value.first, it.value.second);
};
return MultiTreeMap;
}(MultiMap_1.MultiMap));
exports.MultiTreeMap = MultiTreeMap;
//# sourceMappingURL=MultiTreeMap.js.map
+54
View File
@@ -0,0 +1,54 @@
/**
* @packageDocumentation
* @module std.internal
*/
import { MultiSet } from "../../../base/container/MultiSet";
import { ITreeContainer } from "./ITreeContainer";
import { IForwardIterator } from "../../../iterator/IForwardIterator";
import { Pair } from "../../../utility/Pair";
import { Comparator } from "../../functional/Comparator";
/**
* Basic tree set allowing duplicated keys.
*
* @template Key Key type
* @template T Mapped type
* @template Source Derived type extending this {@link MultiTreeSet}
* @template IteratorT Iterator type
* @template ReverseT Reverse iterator type
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare abstract class MultiTreeSet<Key, Source extends MultiTreeSet<Key, Source, IteratorT, ReverseT>, IteratorT extends MultiSet.Iterator<Key, Source, IteratorT, ReverseT>, ReverseT extends MultiSet.ReverseIterator<Key, Source, IteratorT, ReverseT>> extends MultiSet<Key, Source, IteratorT, ReverseT> implements ITreeContainer<Key, Key, Source, IteratorT, ReverseT, Key> {
/**
* @inheritDoc
*/
find(key: Key): IteratorT;
/**
* @inheritDoc
*/
count(key: Key): number;
/**
* @inheritDoc
*/
abstract lower_bound(key: Key): IteratorT;
/**
* @inheritDoc
*/
abstract upper_bound(key: Key): IteratorT;
/**
* @inheritDoc
*/
equal_range(key: Key): Pair<IteratorT, IteratorT>;
/**
* @inheritDoc
*/
abstract key_comp(): Comparator<Key>;
/**
* @inheritDoc
*/
value_comp(): Comparator<Key>;
protected _Key_eq(x: Key, y: Key): boolean;
protected _Insert_by_key(key: Key): IteratorT;
protected _Insert_by_hint(hint: IteratorT, key: Key): IteratorT;
protected _Insert_by_range<InputIterator extends Readonly<IForwardIterator<Key, InputIterator>>>(first: InputIterator, last: InputIterator): void;
}
+110
View File
@@ -0,0 +1,110 @@
"use strict";
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 __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.MultiTreeSet = void 0;
//================================================================
/**
* @packageDocumentation
* @module std.internal
*/
//================================================================
var MultiSet_1 = require("../../../base/container/MultiSet");
var ITreeContainer_1 = require("./ITreeContainer");
var Pair_1 = require("../../../utility/Pair");
/**
* Basic tree set allowing duplicated keys.
*
* @template Key Key type
* @template T Mapped type
* @template Source Derived type extending this {@link MultiTreeSet}
* @template IteratorT Iterator type
* @template ReverseT Reverse iterator type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var MultiTreeSet = /** @class */ (function (_super) {
__extends(MultiTreeSet, _super);
function MultiTreeSet() {
return _super !== null && _super.apply(this, arguments) || this;
}
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
/**
* @inheritDoc
*/
MultiTreeSet.prototype.find = function (key) {
var it = this.lower_bound(key);
if (!it.equals(this.end()) && this._Key_eq(key, it.value))
return it;
else
return this.end();
};
/**
* @inheritDoc
*/
MultiTreeSet.prototype.count = function (key) {
var it = this.find(key);
var ret = 0;
for (; !it.equals(this.end()) && this._Key_eq(it.value, key); it = it.next())
++ret;
return ret;
};
/**
* @inheritDoc
*/
MultiTreeSet.prototype.equal_range = function (key) {
return new Pair_1.Pair(this.lower_bound(key), this.upper_bound(key));
};
/**
* @inheritDoc
*/
MultiTreeSet.prototype.value_comp = function () {
return this.key_comp();
};
MultiTreeSet.prototype._Key_eq = function (x, y) {
return !this.key_comp()(x, y) && !this.key_comp()(y, x);
};
/* ---------------------------------------------------------
INSERT
--------------------------------------------------------- */
MultiTreeSet.prototype._Insert_by_key = function (key) {
// FIND POSITION TO INSERT
var it = this.upper_bound(key);
// ITERATOR TO RETURN
it = this.data_.insert(it, key);
this._Handle_insert(it, it.next());
return it;
};
MultiTreeSet.prototype._Insert_by_hint = function (hint, key) {
var validate = ITreeContainer_1.ITreeContainer.emplacable(this, hint, key);
if (validate) {
var it = this.data_.insert(hint, key);
this._Handle_insert(it, it.next());
return it;
}
else
return this._Insert_by_key(key);
};
MultiTreeSet.prototype._Insert_by_range = function (first, last) {
for (var it = first; !it.equals(last); it = it.next())
this._Insert_by_key(it.value);
};
return MultiTreeSet;
}(MultiSet_1.MultiSet));
exports.MultiTreeSet = MultiTreeSet;
//# sourceMappingURL=MultiTreeSet.js.map
+61
View File
@@ -0,0 +1,61 @@
/**
* @packageDocumentation
* @module std.internal
*/
import { ListContainer } from "../linear/ListContainer";
import { ListIterator } from "../../iterator/ListIterator";
import { ReverseIterator as _ReverseIterator } from "../../iterator/ReverseIterator";
import { SetContainer } from "../../../base/container/SetContainer";
/**
* Doubly Linked List storing set elements.
*
* @template Key Key type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare class SetElementList<Key, Unique extends boolean, Source extends SetContainer<Key, Unique, Source, SetElementList.Iterator<Key, Unique, Source>, SetElementList.ReverseIterator<Key, Unique, Source>>> extends ListContainer<Key, Source, SetElementList.Iterator<Key, Unique, Source>, SetElementList.ReverseIterator<Key, Unique, Source>> {
private associative_;
constructor(associative: Source);
protected _Create_iterator(prev: SetElementList.Iterator<Key, Unique, Source>, next: SetElementList.Iterator<Key, Unique, Source>, val: Key): SetElementList.Iterator<Key, Unique, Source>;
associative(): Source;
}
/**
*
*/
export declare namespace SetElementList {
/**
* Iterator of set container storing elements in a list.
*
* @template Key Key type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
class Iterator<Key, Unique extends boolean, Source extends SetContainer<Key, Unique, Source, Iterator<Key, Unique, Source>, ReverseIterator<Key, Unique, Source>>> extends ListIterator<Key, Source, Iterator<Key, Unique, Source>, ReverseIterator<Key, Unique, Source>, Key> implements SetContainer.Iterator<Key, Unique, Source, Iterator<Key, Unique, Source>, ReverseIterator<Key, Unique, Source>> {
private source_;
private constructor();
/**
* @inheritDoc
*/
reverse(): ReverseIterator<Key, Unique, Source>;
/**
* @inheritDoc
*/
source(): Source;
}
/**
* Reverser iterator of set container storing elements in a list.
*
* @template Key Key type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
class ReverseIterator<Key, Unique extends boolean, Source extends SetContainer<Key, Unique, Source, Iterator<Key, Unique, Source>, ReverseIterator<Key, Unique, Source>>> extends _ReverseIterator<Key, Source, Iterator<Key, Unique, Source>, ReverseIterator<Key, Unique, Source>, Key> implements SetContainer.ReverseIterator<Key, Unique, Source, Iterator<Key, Unique, Source>, ReverseIterator<Key, Unique, Source>> {
protected _Create_neighbor(base: Iterator<Key, Unique, Source>): ReverseIterator<Key, Unique, Source>;
}
}
+151
View File
@@ -0,0 +1,151 @@
"use strict";
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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SetElementList = void 0;
//================================================================
/**
* @packageDocumentation
* @module std.internal
*/
//================================================================
var ListContainer_1 = require("../linear/ListContainer");
var ListIterator_1 = require("../../iterator/ListIterator");
var ReverseIterator_1 = require("../../iterator/ReverseIterator");
/**
* Doubly Linked List storing set elements.
*
* @template Key Key type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var SetElementList = /** @class */ (function (_super) {
__extends(SetElementList, _super);
/* ---------------------------------------------------------
CONSTRUCTORS
--------------------------------------------------------- */
function SetElementList(associative) {
var _this = _super.call(this) || this;
_this.associative_ = associative;
return _this;
}
SetElementList.prototype._Create_iterator = function (prev, next, val) {
return SetElementList.Iterator.create(this, prev, next, val);
};
/**
* @internal
*/
SetElementList._Swap_associative = function (x, y) {
var _a;
_a = __read([y.associative_, x.associative_], 2), x.associative_ = _a[0], y.associative_ = _a[1];
};
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
SetElementList.prototype.associative = function () {
return this.associative_;
};
return SetElementList;
}(ListContainer_1.ListContainer));
exports.SetElementList = SetElementList;
/**
*
*/
(function (SetElementList) {
/**
* Iterator of set container storing elements in a list.
*
* @template Key Key type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var Iterator = /** @class */ (function (_super) {
__extends(Iterator, _super);
/* ---------------------------------------------------------
CONSTRUCTORS
--------------------------------------------------------- */
function Iterator(list, prev, next, val) {
var _this = _super.call(this, prev, next, val) || this;
_this.source_ = list;
return _this;
}
/**
* @internal
*/
Iterator.create = function (list, prev, next, val) {
return new Iterator(list, prev, next, val);
};
/**
* @inheritDoc
*/
Iterator.prototype.reverse = function () {
return new ReverseIterator(this);
};
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
/**
* @inheritDoc
*/
Iterator.prototype.source = function () {
return this.source_.associative();
};
return Iterator;
}(ListIterator_1.ListIterator));
SetElementList.Iterator = Iterator;
/**
* Reverser iterator of set container storing elements in a list.
*
* @template Key Key type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var ReverseIterator = /** @class */ (function (_super) {
__extends(ReverseIterator, _super);
function ReverseIterator() {
return _super !== null && _super.apply(this, arguments) || this;
}
ReverseIterator.prototype._Create_neighbor = function (base) {
return new ReverseIterator(base);
};
return ReverseIterator;
}(ReverseIterator_1.ReverseIterator));
SetElementList.ReverseIterator = ReverseIterator;
})(SetElementList = exports.SetElementList || (exports.SetElementList = {}));
exports.SetElementList = SetElementList;
//# sourceMappingURL=SetElementList.js.map
+59
View File
@@ -0,0 +1,59 @@
/**
* @packageDocumentation
* @module std.internal
*/
import { VectorContainer } from "../linear/VectorContainer";
import { ArrayIteratorBase } from "../../iterator/ArrayIteratorBase";
import { ArrayReverseIteratorBase } from "../../iterator/ArrayReverseIteratorBase";
import { ITreeSet } from "../../../base/container/ITreeSet";
/**
* Vector storing set elements.
*
* @template Key Key type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source type
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare class SetElementVector<Key, Unique extends boolean, Source extends ITreeSet<Key, Unique, Source, SetElementVector.Iterator<Key, Unique, Source>, SetElementVector.ReverseIterator<Key, Unique, Source>>> extends VectorContainer<Key, Source, SetElementVector<Key, Unique, Source>, SetElementVector.Iterator<Key, Unique, Source>, SetElementVector.ReverseIterator<Key, Unique, Source>> {
private associative_;
constructor(associative: Source);
nth(index: number): SetElementVector.Iterator<Key, Unique, Source>;
source(): Source;
}
/**
*
*/
export declare namespace SetElementVector {
/**
* Iterator of set container storing elements in a vector.
*
* @template Key Key type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
class Iterator<Key, Unique extends boolean, Source extends ITreeSet<Key, Unique, Source, SetElementVector.Iterator<Key, Unique, Source>, SetElementVector.ReverseIterator<Key, Unique, Source>>> extends ArrayIteratorBase<Key, Source, SetElementVector<Key, Unique, Source>, SetElementVector.Iterator<Key, Unique, Source>, SetElementVector.ReverseIterator<Key, Unique, Source>, Key> implements ITreeSet.Iterator<Key, Unique, Source, SetElementVector.Iterator<Key, Unique, Source>, SetElementVector.ReverseIterator<Key, Unique, Source>> {
/**
* @inheritDoc
*/
source(): Source;
/**
* @inheritDoc
*/
reverse(): ReverseIterator<Key, Unique, Source>;
}
/**
* Reverse iterator of set container storing elements in a vector.
*
* @template Key Key type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
class ReverseIterator<Key, Unique extends boolean, Source extends ITreeSet<Key, Unique, Source, SetElementVector.Iterator<Key, Unique, Source>, SetElementVector.ReverseIterator<Key, Unique, Source>>> extends ArrayReverseIteratorBase<Key, Source, SetElementVector<Key, Unique, Source>, SetElementVector.Iterator<Key, Unique, Source>, SetElementVector.ReverseIterator<Key, Unique, Source>, Key> implements ITreeSet.ReverseIterator<Key, Unique, Source, SetElementVector.Iterator<Key, Unique, Source>, SetElementVector.ReverseIterator<Key, Unique, Source>> {
protected _Create_neighbor(base: Iterator<Key, Unique, Source>): ReverseIterator<Key, Unique, Source>;
}
}
+138
View File
@@ -0,0 +1,138 @@
"use strict";
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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SetElementVector = void 0;
//================================================================
/**
* @packageDocumentation
* @module std.internal
*/
//================================================================
var VectorContainer_1 = require("../linear/VectorContainer");
var ArrayIteratorBase_1 = require("../../iterator/ArrayIteratorBase");
var ArrayReverseIteratorBase_1 = require("../../iterator/ArrayReverseIteratorBase");
/**
* Vector storing set elements.
*
* @template Key Key type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var SetElementVector = /** @class */ (function (_super) {
__extends(SetElementVector, _super);
/* ---------------------------------------------------------
CONSTRUCTORS
--------------------------------------------------------- */
function SetElementVector(associative) {
var _this = _super.call(this) || this;
_this.data_ = [];
_this.associative_ = associative;
return _this;
}
SetElementVector.prototype.nth = function (index) {
return new SetElementVector.Iterator(this, index);
};
/**
* @internal
*/
SetElementVector._Swap_associative = function (x, y) {
var _a;
_a = __read([y.associative_, x.associative_], 2), x.associative_ = _a[0], y.associative_ = _a[1];
};
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
SetElementVector.prototype.source = function () {
return this.associative_;
};
return SetElementVector;
}(VectorContainer_1.VectorContainer));
exports.SetElementVector = SetElementVector;
/**
*
*/
(function (SetElementVector) {
/**
* Iterator of set container storing elements in a vector.
*
* @template Key Key type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var Iterator = /** @class */ (function (_super) {
__extends(Iterator, _super);
function Iterator() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @inheritDoc
*/
Iterator.prototype.source = function () {
return this._Get_array().source();
};
/**
* @inheritDoc
*/
Iterator.prototype.reverse = function () {
return new ReverseIterator(this);
};
return Iterator;
}(ArrayIteratorBase_1.ArrayIteratorBase));
SetElementVector.Iterator = Iterator;
/**
* Reverse iterator of set container storing elements in a vector.
*
* @template Key Key type
* @template Unique Whether duplicated key is blocked or not
* @template Source Source container type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var ReverseIterator = /** @class */ (function (_super) {
__extends(ReverseIterator, _super);
function ReverseIterator() {
return _super !== null && _super.apply(this, arguments) || this;
}
ReverseIterator.prototype._Create_neighbor = function (base) {
return new ReverseIterator(base);
};
return ReverseIterator;
}(ArrayReverseIteratorBase_1.ArrayReverseIteratorBase));
SetElementVector.ReverseIterator = ReverseIterator;
})(SetElementVector = exports.SetElementVector || (exports.SetElementVector = {}));
exports.SetElementVector = SetElementVector;
//# sourceMappingURL=SetElementVector.js.map
+56
View File
@@ -0,0 +1,56 @@
/**
* @packageDocumentation
* @module std.internal
*/
import { UniqueMap } from "../../../base/container/UniqueMap";
import { ITreeContainer } from "./ITreeContainer";
import { IPair } from "../../../utility/IPair";
import { Entry } from "../../../utility/Entry";
import { Pair } from "../../../utility/Pair";
import { Comparator } from "../../functional/Comparator";
/**
* Basic tree map blocking duplicated key.
*
* @template Key Key type
* @template T Mapped type
* @template Source Derived type extending this {@link UniqueTreeMap}
* @template IteratorT Iterator type
* @template ReverseT Reverse iterator type
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare abstract class UniqueTreeMap<Key, T, Source extends UniqueTreeMap<Key, T, Source, IteratorT, ReverseT>, IteratorT extends UniqueMap.Iterator<Key, T, Source, IteratorT, ReverseT>, ReverseT extends UniqueMap.ReverseIterator<Key, T, Source, IteratorT, ReverseT>> extends UniqueMap<Key, T, Source, IteratorT, ReverseT> implements ITreeContainer<Key, Entry<Key, T>, Source, IteratorT, ReverseT, IPair<Key, T>> {
/**
* @inheritDoc
*/
find(key: Key): IteratorT;
/**
* @inheritDoc
*/
abstract lower_bound(key: Key): IteratorT;
/**
* @inheritDoc
*/
abstract upper_bound(key: Key): IteratorT;
/**
* @inheritDoc
*/
equal_range(key: Key): Pair<IteratorT, IteratorT>;
/**
* @inheritDoc
*/
abstract key_comp(): Comparator<Key>;
/**
* @inheritDoc
*/
value_comp(): Comparator<IPair<Key, T>>;
protected _Key_eq(x: Key, y: Key): boolean;
/**
* @inheritDoc
*/
emplace(key: Key, val: T): Pair<IteratorT, boolean>;
/**
* @inheritDoc
*/
emplace_hint(hint: IteratorT, key: Key, val: T): IteratorT;
}
+110
View File
@@ -0,0 +1,110 @@
"use strict";
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 __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.UniqueTreeMap = void 0;
//================================================================
/**
* @packageDocumentation
* @module std.internal
*/
//================================================================
var UniqueMap_1 = require("../../../base/container/UniqueMap");
var ITreeContainer_1 = require("./ITreeContainer");
var Entry_1 = require("../../../utility/Entry");
var Pair_1 = require("../../../utility/Pair");
/**
* Basic tree map blocking duplicated key.
*
* @template Key Key type
* @template T Mapped type
* @template Source Derived type extending this {@link UniqueTreeMap}
* @template IteratorT Iterator type
* @template ReverseT Reverse iterator type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var UniqueTreeMap = /** @class */ (function (_super) {
__extends(UniqueTreeMap, _super);
function UniqueTreeMap() {
return _super !== null && _super.apply(this, arguments) || this;
}
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
/**
* @inheritDoc
*/
UniqueTreeMap.prototype.find = function (key) {
var it = this.lower_bound(key);
if (!it.equals(this.end()) && this._Key_eq(key, it.first))
return it;
else
return this.end();
};
/**
* @inheritDoc
*/
UniqueTreeMap.prototype.equal_range = function (key) {
var it = this.lower_bound(key);
return new Pair_1.Pair(it, !it.equals(this.end()) && this._Key_eq(key, it.first)
? it.next()
: it);
};
/**
* @inheritDoc
*/
UniqueTreeMap.prototype.value_comp = function () {
var _this = this;
return function (x, y) { return _this.key_comp()(x.first, y.first); };
};
UniqueTreeMap.prototype._Key_eq = function (x, y) {
return !this.key_comp()(x, y) && !this.key_comp()(y, x);
};
/* ---------------------------------------------------------
INSERT
--------------------------------------------------------- */
/**
* @inheritDoc
*/
UniqueTreeMap.prototype.emplace = function (key, val) {
// FIND POSITION TO INSERT
var it = this.lower_bound(key);
if (!it.equals(this.end()) && this._Key_eq(it.first, key))
return new Pair_1.Pair(it, false);
// ITERATOR TO RETURN
it = this.data_.insert(it, new Entry_1.Entry(key, val));
this._Handle_insert(it, it.next());
return new Pair_1.Pair(it, true);
};
/**
* @inheritDoc
*/
UniqueTreeMap.prototype.emplace_hint = function (hint, key, val) {
var elem = new Entry_1.Entry(key, val);
var validate = ITreeContainer_1.ITreeContainer.emplacable(this, hint, elem);
if (validate) {
var it = this.data_.insert(hint, elem);
this._Handle_insert(it, it.next());
return it;
}
else
return this.emplace(key, val).first;
};
return UniqueTreeMap;
}(UniqueMap_1.UniqueMap));
exports.UniqueTreeMap = UniqueTreeMap;
//# sourceMappingURL=UniqueTreeMap.js.map
+47
View File
@@ -0,0 +1,47 @@
/**
* @packageDocumentation
* @module std.internal
*/
import { UniqueSet } from "../../../base/container/UniqueSet";
import { ITreeContainer } from "./ITreeContainer";
import { Pair } from "../../../utility/Pair";
import { Comparator } from "../../functional/Comparator";
/**
* Basic tree set blocking duplicated key.
*
* @template Key Key type
* @template Source Derived type extending this {@link UniqueTreeSet}
* @template IteratorT Iterator type
* @template ReverseT Reverse iterator type
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare abstract class UniqueTreeSet<Key, Source extends UniqueTreeSet<Key, Source, IteratorT, ReverseT>, IteratorT extends UniqueSet.Iterator<Key, Source, IteratorT, ReverseT>, ReverseT extends UniqueSet.ReverseIterator<Key, Source, IteratorT, ReverseT>> extends UniqueSet<Key, Source, IteratorT, ReverseT> implements ITreeContainer<Key, Key, Source, IteratorT, ReverseT, Key> {
/**
* @inheritDoc
*/
find(key: Key): IteratorT;
/**
* @inheritDoc
*/
abstract lower_bound(key: Key): IteratorT;
/**
* @inheritDoc
*/
abstract upper_bound(key: Key): IteratorT;
/**
* @inheritDoc
*/
equal_range(key: Key): Pair<IteratorT, IteratorT>;
/**
* @inheritDoc
*/
abstract key_comp(): Comparator<Key>;
/**
* @inheritDoc
*/
value_comp(): Comparator<Key>;
protected _Key_eq(x: Key, y: Key): boolean;
protected _Insert_by_key(key: Key): Pair<IteratorT, boolean>;
protected _Insert_by_hint(hint: IteratorT, key: Key): IteratorT;
}
+100
View File
@@ -0,0 +1,100 @@
"use strict";
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 __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.UniqueTreeSet = void 0;
//================================================================
/**
* @packageDocumentation
* @module std.internal
*/
//================================================================
var UniqueSet_1 = require("../../../base/container/UniqueSet");
var ITreeContainer_1 = require("./ITreeContainer");
var Pair_1 = require("../../../utility/Pair");
/**
* Basic tree set blocking duplicated key.
*
* @template Key Key type
* @template Source Derived type extending this {@link UniqueTreeSet}
* @template IteratorT Iterator type
* @template ReverseT Reverse iterator type
*
* @author Jeongho Nam - https://github.com/samchon
*/
var UniqueTreeSet = /** @class */ (function (_super) {
__extends(UniqueTreeSet, _super);
function UniqueTreeSet() {
return _super !== null && _super.apply(this, arguments) || this;
}
/* ---------------------------------------------------------
ACCESSORS
--------------------------------------------------------- */
/**
* @inheritDoc
*/
UniqueTreeSet.prototype.find = function (key) {
var it = this.lower_bound(key);
if (!it.equals(this.end()) && this._Key_eq(key, it.value))
return it;
else
return this.end();
};
/**
* @inheritDoc
*/
UniqueTreeSet.prototype.equal_range = function (key) {
var it = this.lower_bound(key);
return new Pair_1.Pair(it, !it.equals(this.end()) && this._Key_eq(key, it.value)
? it.next()
: it);
};
/**
* @inheritDoc
*/
UniqueTreeSet.prototype.value_comp = function () {
return this.key_comp();
};
UniqueTreeSet.prototype._Key_eq = function (x, y) {
return !this.key_comp()(x, y) && !this.key_comp()(y, x);
};
/* ---------------------------------------------------------
INSERT
--------------------------------------------------------- */
UniqueTreeSet.prototype._Insert_by_key = function (key) {
// FIND POSITION TO INSERT
var it = this.lower_bound(key);
if (!it.equals(this.end()) && this._Key_eq(it.value, key))
return new Pair_1.Pair(it, false);
// ITERATOR TO RETURN
it = this.data_.insert(it, key);
this._Handle_insert(it, it.next());
return new Pair_1.Pair(it, true);
};
UniqueTreeSet.prototype._Insert_by_hint = function (hint, key) {
var validate = ITreeContainer_1.ITreeContainer.emplacable(this, hint, key);
if (validate) {
var it = this.data_.insert(hint, key);
this._Handle_insert(it, it.next());
return it;
}
else
return this._Insert_by_key(key).first;
};
return UniqueTreeSet;
}(UniqueSet_1.UniqueSet));
exports.UniqueTreeSet = UniqueTreeSet;
//# sourceMappingURL=UniqueTreeSet.js.map