remove node_modules and .gitignore them
This commit is contained in:
-38
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std.internal
|
||||
*/
|
||||
import { IEmpty } from "../partial/IEmpty";
|
||||
import { IPush } from "../partial/IPush";
|
||||
import { ISize } from "../partial/ISize";
|
||||
/**
|
||||
* Base class for Adaptor Containers.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
export declare abstract class AdaptorContainer<T, Source extends IEmpty & ISize & IPush<T>, This extends AdaptorContainer<T, Source, This>> implements IEmpty, ISize, IPush<T> {
|
||||
protected source_: Source;
|
||||
protected constructor(source: Source);
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
size(): number;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
empty(): boolean;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
push(...elems: T[]): number;
|
||||
/**
|
||||
* Remove element.
|
||||
*/
|
||||
abstract pop(): void;
|
||||
/**
|
||||
* Swap elements.
|
||||
*
|
||||
* @param obj Target container to swap.
|
||||
*/
|
||||
swap(obj: This): void;
|
||||
}
|
||||
-79
@@ -1,79 +0,0 @@
|
||||
"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.AdaptorContainer = void 0;
|
||||
/**
|
||||
* Base class for Adaptor Containers.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
var AdaptorContainer = /** @class */ (function () {
|
||||
function AdaptorContainer(source) {
|
||||
this.source_ = source;
|
||||
}
|
||||
/* ---------------------------------------------------------
|
||||
ACCESSORS
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
AdaptorContainer.prototype.size = function () {
|
||||
return this.source_.size();
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
AdaptorContainer.prototype.empty = function () {
|
||||
return this.source_.empty();
|
||||
};
|
||||
/* ---------------------------------------------------------
|
||||
ELEMENTS I/O
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
AdaptorContainer.prototype.push = function () {
|
||||
var _a;
|
||||
var elems = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
elems[_i] = arguments[_i];
|
||||
}
|
||||
return (_a = this.source_).push.apply(_a, __spreadArray([], __read(elems), false));
|
||||
};
|
||||
/**
|
||||
* Swap elements.
|
||||
*
|
||||
* @param obj Target container to swap.
|
||||
*/
|
||||
AdaptorContainer.prototype.swap = function (obj) {
|
||||
var _a;
|
||||
_a = __read([obj.source_, this.source_], 2), this.source_ = _a[0], obj.source_ = _a[1];
|
||||
};
|
||||
return AdaptorContainer;
|
||||
}());
|
||||
exports.AdaptorContainer = AdaptorContainer;
|
||||
//# sourceMappingURL=AdaptorContainer.js.map
|
||||
-95
@@ -1,95 +0,0 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std.internal
|
||||
*/
|
||||
import { ILinearContainerBase } from "./ILinearContainerBase";
|
||||
import { Container } from "../../../base/container/Container";
|
||||
import { IContainer } from "../../../base/container/IContainer";
|
||||
import { IForwardIterator } from "../../../iterator/IForwardIterator";
|
||||
import { ArrayIteratorBase } from "../../iterator/ArrayIteratorBase";
|
||||
import { ArrayReverseIteratorBase } from "../../iterator/ArrayReverseIteratorBase";
|
||||
/**
|
||||
* Base array container.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
export declare abstract class ArrayContainer<T extends ElemT, SourceT extends IContainer<T, SourceT, IteratorT, ReverseT, ElemT>, ArrayT extends ArrayContainer<T, SourceT, ArrayT, IteratorT, ReverseT, ElemT>, IteratorT extends ArrayIteratorBase<T, SourceT, ArrayT, IteratorT, ReverseT, ElemT>, ReverseT extends ArrayReverseIteratorBase<T, SourceT, ArrayT, IteratorT, ReverseT, ElemT>, ElemT> extends Container<T, SourceT, IteratorT, ReverseT, ElemT> implements ILinearContainerBase<T, SourceT, IteratorT, ReverseT, ElemT> {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
abstract resize(n: number): void;
|
||||
protected abstract source(): SourceT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
begin(): IteratorT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
end(): IteratorT;
|
||||
abstract nth(index: number): IteratorT;
|
||||
/**
|
||||
* Get element at specific position.
|
||||
*
|
||||
* @param index Specific position.
|
||||
* @return The element at the *index*.
|
||||
*/
|
||||
at(index: number): T;
|
||||
protected abstract _At(index: number): T;
|
||||
/**
|
||||
* Change element at specific position.
|
||||
*
|
||||
* @param index Specific position.
|
||||
* @param val The new value to change.
|
||||
*/
|
||||
set(index: number, val: T): void;
|
||||
protected abstract _Set(index: number, val: T): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
front(): T;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
front(val: T): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
back(): T;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
back(val: T): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
abstract push_back(val: T): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
insert(pos: IteratorT, val: T): IteratorT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
insert(pos: IteratorT, n: number, val: T): IteratorT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
insert<InputIterator extends Readonly<IForwardIterator<T, InputIterator>>>(pos: IteratorT, first: InputIterator, last: InputIterator): IteratorT;
|
||||
protected _Insert_by_repeating_val(position: IteratorT, n: number, val: T): IteratorT;
|
||||
protected abstract _Insert_by_range<InputIterator extends Readonly<IForwardIterator<T, InputIterator>>>(pos: IteratorT, first: InputIterator, last: InputIterator): IteratorT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
pop_back(): void;
|
||||
protected abstract _Pop_back(): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
erase(it: IteratorT): IteratorT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
erase(first: IteratorT, last: IteratorT): IteratorT;
|
||||
protected abstract _Erase_by_range(first: IteratorT, last: IteratorT): IteratorT;
|
||||
}
|
||||
-144
@@ -1,144 +0,0 @@
|
||||
"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.ArrayContainer = void 0;
|
||||
var Container_1 = require("../../../base/container/Container");
|
||||
var ErrorGenerator_1 = require("../../exception/ErrorGenerator");
|
||||
var RangeError_1 = require("../../../exception/RangeError");
|
||||
var Repeater_1 = require("../../iterator/disposable/Repeater");
|
||||
/**
|
||||
* Base array container.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
var ArrayContainer = /** @class */ (function (_super) {
|
||||
__extends(ArrayContainer, _super);
|
||||
function ArrayContainer() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/* =========================================================
|
||||
ACCESSORS
|
||||
- ITERATORS
|
||||
- INDEXES
|
||||
============================================================
|
||||
ITERATORS
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ArrayContainer.prototype.begin = function () {
|
||||
return this.nth(0);
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ArrayContainer.prototype.end = function () {
|
||||
return this.nth(this.size());
|
||||
};
|
||||
/* ---------------------------------------------------------
|
||||
INDEXES
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* Get element at specific position.
|
||||
*
|
||||
* @param index Specific position.
|
||||
* @return The element at the *index*.
|
||||
*/
|
||||
ArrayContainer.prototype.at = function (index) {
|
||||
return this._At(index);
|
||||
};
|
||||
/**
|
||||
* Change element at specific position.
|
||||
*
|
||||
* @param index Specific position.
|
||||
* @param val The new value to change.
|
||||
*/
|
||||
ArrayContainer.prototype.set = function (index, val) {
|
||||
if (index < 0)
|
||||
throw ErrorGenerator_1.ErrorGenerator.negative_index(this.source(), "at", index);
|
||||
else if (index >= this.size())
|
||||
throw ErrorGenerator_1.ErrorGenerator.excessive_index(this.source(), "at", index, this.size());
|
||||
this._Set(index, val);
|
||||
};
|
||||
ArrayContainer.prototype.front = function (val) {
|
||||
if (arguments.length === 0)
|
||||
return this.at(0);
|
||||
else
|
||||
this.set(0, val);
|
||||
};
|
||||
ArrayContainer.prototype.back = function (val) {
|
||||
var index = this.size() - 1;
|
||||
if (arguments.length === 0)
|
||||
return this.at(index);
|
||||
else
|
||||
this.set(index, val);
|
||||
};
|
||||
ArrayContainer.prototype.insert = function (pos) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
// VALIDATION
|
||||
if (pos._Get_array() !== this)
|
||||
throw ErrorGenerator_1.ErrorGenerator.not_my_iterator(this.source(), "insert");
|
||||
else if (pos.index() < 0)
|
||||
throw ErrorGenerator_1.ErrorGenerator.negative_iterator(this.source(), "insert", pos.index());
|
||||
else if (pos.index() > this.size())
|
||||
pos = this.end();
|
||||
// BRANCHES
|
||||
if (args.length === 1)
|
||||
return this._Insert_by_repeating_val(pos, 1, args[0]);
|
||||
else if (args.length === 2 && typeof args[0] === "number")
|
||||
return this._Insert_by_repeating_val(pos, args[0], args[1]);
|
||||
else
|
||||
return this._Insert_by_range(pos, args[0], args[1]);
|
||||
};
|
||||
ArrayContainer.prototype._Insert_by_repeating_val = function (position, n, val) {
|
||||
var first = new Repeater_1.Repeater(0, val);
|
||||
var last = new Repeater_1.Repeater(n);
|
||||
return this._Insert_by_range(position, first, last);
|
||||
};
|
||||
/* ---------------------------------------------------------
|
||||
ERASE
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ArrayContainer.prototype.pop_back = function () {
|
||||
if (this.empty() === true)
|
||||
throw ErrorGenerator_1.ErrorGenerator.empty(this.source(), "pop_back");
|
||||
this._Pop_back();
|
||||
};
|
||||
ArrayContainer.prototype.erase = function (first, last) {
|
||||
if (last === void 0) { last = first.next(); }
|
||||
// VALIDATION
|
||||
if (first._Get_array() !== this || last._Get_array() !== this)
|
||||
throw ErrorGenerator_1.ErrorGenerator.not_my_iterator(this.source(), "erase");
|
||||
else if (first.index() < 0)
|
||||
throw ErrorGenerator_1.ErrorGenerator.negative_iterator(this.source(), "erase", first.index());
|
||||
else if (first.index() > last.index())
|
||||
throw new RangeError_1.RangeError("Error on ".concat(ErrorGenerator_1.ErrorGenerator.get_class_name(this.source()), ".erase(): first iterator has greater index than last -> (first = ").concat(first.index(), ", last = ").concat(last.index(), ")."));
|
||||
// ADJUSTMENT
|
||||
if (first.index() >= this.size())
|
||||
return this.end();
|
||||
// ERASE ELEMENTS
|
||||
return this._Erase_by_range(first, last);
|
||||
};
|
||||
return ArrayContainer;
|
||||
}(Container_1.Container));
|
||||
exports.ArrayContainer = ArrayContainer;
|
||||
//# sourceMappingURL=ArrayContainer.js.map
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std.internal
|
||||
*/
|
||||
import { IContainer } from "../../../base/container/IContainer";
|
||||
import { IPushBack } from "../partial/IPushBack";
|
||||
import { IForwardIterator } from "../../../iterator/IForwardIterator";
|
||||
export interface ILinearContainerBase<T extends ElemT, SourceT extends IContainer<T, SourceT, IteratorT, ReverseT, T>, IteratorT extends IContainer.Iterator<T, SourceT, IteratorT, ReverseT, T>, ReverseT extends IContainer.ReverseIterator<T, SourceT, IteratorT, ReverseT, T>, ElemT = T> extends IContainer<T, SourceT, IteratorT, ReverseT, ElemT>, IPushBack<T> {
|
||||
/**
|
||||
* Fill Assigner.
|
||||
*
|
||||
* @param n Initial size.
|
||||
* @param val Value to fill.
|
||||
*/
|
||||
assign(n: number, val: T): void;
|
||||
/**
|
||||
* Range Assigner.
|
||||
*
|
||||
* @param first Input iterator of the first position.
|
||||
* @param last Input iterator of the last position.
|
||||
*/
|
||||
assign<InputIterator extends Readonly<IForwardIterator<T, InputIterator>>>(first: InputIterator, last: InputIterator): void;
|
||||
/**
|
||||
* Resize this {@link Vector} forcibly.
|
||||
*
|
||||
* @param n New container size.
|
||||
*/
|
||||
resize(n: number): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
push_back(val: T): void;
|
||||
/**
|
||||
* Erase the last element.
|
||||
*/
|
||||
pop_back(): void;
|
||||
/**
|
||||
* Insert a single element.
|
||||
*
|
||||
* @param pos Position to insert.
|
||||
* @param val Value to insert.
|
||||
* @return An iterator to the newly inserted element.
|
||||
*/
|
||||
insert(pos: IteratorT, val: T): IteratorT;
|
||||
/**
|
||||
* Insert repeated elements.
|
||||
*
|
||||
* @param pos Position to insert.
|
||||
* @param n Number of elements to insert.
|
||||
* @param val Value to insert repeatedly.
|
||||
* @return An iterator to the first of the newly inserted elements.
|
||||
*/
|
||||
insert(pos: IteratorT, n: number, val: T): IteratorT;
|
||||
/**
|
||||
* Insert range elements.
|
||||
*
|
||||
* @param pos Position to insert.
|
||||
* @param first Input iterator of the first position.
|
||||
* @param last Input iteartor of the last position.
|
||||
* @return An iterator to the first of the newly inserted elements.
|
||||
*/
|
||||
insert<InputIterator extends Readonly<IForwardIterator<T, InputIterator>>>(pos: IteratorT, first: InputIterator, last: InputIterator): IteratorT;
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=ILinearContainerBase.js.map
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std.internal
|
||||
*/
|
||||
import { BinaryPredicator } from "../../functional/BinaryPredicator";
|
||||
import { Comparator } from "../../functional/Comparator";
|
||||
import { UnaryPredicator } from "../../functional/UnaryPredicator";
|
||||
export interface IListAlgorithm<T, Source> {
|
||||
/**
|
||||
* Remove duplicated elements.
|
||||
*
|
||||
* @param binary_pred A binary function predicates two arguments are equal. Default is {@link equal_to}.
|
||||
*/
|
||||
unique(binary_pred?: BinaryPredicator<T>): void;
|
||||
/**
|
||||
* Remove elements with specific value.
|
||||
*
|
||||
* @param val The value to remove.
|
||||
*/
|
||||
remove(val: T): void;
|
||||
/**
|
||||
* Remove elements with specific function.
|
||||
*
|
||||
* @param pred A unary function determines whether remove or not.
|
||||
*/
|
||||
remove_if(pred: UnaryPredicator<T>): void;
|
||||
/**
|
||||
* Merge two *sorted* containers.
|
||||
*
|
||||
* @param source Source container to transfer.
|
||||
* @param comp A binary function predicates *x* element would be placed before *y*. When returns `true`, then *x* precedes *y*. Default is {@link less}.
|
||||
*/
|
||||
merge(from: Source, comp?: Comparator<T>): void;
|
||||
/**
|
||||
* Sort elements.
|
||||
*
|
||||
* @param comp A binary function predicates *x* element would be placed before *y*. When returns `true`, then *x* precedes *y*. Default is {@link less}.
|
||||
*/
|
||||
sort(comp?: Comparator<T>): void;
|
||||
/**
|
||||
* Reverse elements.
|
||||
*/
|
||||
reverse(): void;
|
||||
/**
|
||||
* Swap elements.
|
||||
*
|
||||
* @param obj Target container to swap.
|
||||
*/
|
||||
swap(obj: Source): void;
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=IListAlgorithm.js.map
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std.internal
|
||||
*/
|
||||
import { IContainer } from "../../../base/container/IContainer";
|
||||
import { ILinearContainerBase } from "./ILinearContainerBase";
|
||||
import { Container } from "../../../base/container/Container";
|
||||
import { IForwardIterator } from "../../../iterator/IForwardIterator";
|
||||
import { ReverseIterator } from "../../iterator/ReverseIterator";
|
||||
import { ListIterator } from "../../iterator/ListIterator";
|
||||
/**
|
||||
* Basic List Container.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
export declare abstract class ListContainer<T, SourceT extends IContainer<T, SourceT, IteratorT, ReverseIteratorT, T>, IteratorT extends ListIterator<T, SourceT, IteratorT, ReverseIteratorT, T>, ReverseIteratorT extends ReverseIterator<T, SourceT, IteratorT, ReverseIteratorT, T>> extends Container<T, SourceT, IteratorT, ReverseIteratorT, T> implements ILinearContainerBase<T, SourceT, IteratorT, ReverseIteratorT, T> {
|
||||
private size_;
|
||||
protected begin_: IteratorT;
|
||||
protected end_: IteratorT;
|
||||
/**
|
||||
* Default Constructor.
|
||||
*/
|
||||
protected constructor();
|
||||
protected abstract _Create_iterator(prev: IteratorT, next: IteratorT, val?: T): IteratorT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
assign(n: number, val: T): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
assign<InputIterator extends Readonly<IForwardIterator<T, InputIterator>>>(first: InputIterator, last: InputIterator): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
clear(): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
resize(n: number): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
begin(): IteratorT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
end(): IteratorT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
size(): number;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
push_front(val: T): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
push_back(val: T): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
pop_front(): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
pop_back(): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
push(...items: T[]): number;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
insert(position: IteratorT, val: T): IteratorT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
insert(position: IteratorT, size: number, val: T): IteratorT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
insert<InputIterator extends Readonly<IForwardIterator<T, InputIterator>>>(position: IteratorT, begin: InputIterator, end: InputIterator): IteratorT;
|
||||
private _Insert_by_repeating_val;
|
||||
protected _Insert_by_range<InputIterator extends Readonly<IForwardIterator<T, InputIterator>>>(position: IteratorT, begin: InputIterator, end: InputIterator): IteratorT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
erase(position: IteratorT): IteratorT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
erase(first: IteratorT, last: IteratorT): IteratorT;
|
||||
protected _Erase_by_range(first: IteratorT, last: IteratorT): IteratorT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
swap(obj: SourceT): void;
|
||||
}
|
||||
-251
@@ -1,251 +0,0 @@
|
||||
"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.ListContainer = void 0;
|
||||
var Container_1 = require("../../../base/container/Container");
|
||||
var ListIterator_1 = require("../../iterator/ListIterator");
|
||||
var Repeater_1 = require("../../iterator/disposable/Repeater");
|
||||
var NativeArrayIterator_1 = require("../../iterator/disposable/NativeArrayIterator");
|
||||
var global_1 = require("../../../iterator/global");
|
||||
var ErrorGenerator_1 = require("../../exception/ErrorGenerator");
|
||||
/**
|
||||
* Basic List Container.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
var ListContainer = /** @class */ (function (_super) {
|
||||
__extends(ListContainer, _super);
|
||||
/* ---------------------------------------------------------
|
||||
CONSTRUCTORS
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* Default Constructor.
|
||||
*/
|
||||
function ListContainer() {
|
||||
var _this = _super.call(this) || this;
|
||||
// INIT MEMBERS
|
||||
_this.end_ = _this._Create_iterator(null, null);
|
||||
_this.clear();
|
||||
return _this;
|
||||
}
|
||||
ListContainer.prototype.assign = function (par1, par2) {
|
||||
this.clear();
|
||||
this.insert(this.end(), par1, par2);
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ListContainer.prototype.clear = function () {
|
||||
// DISCONNECT NODES
|
||||
ListIterator_1.ListIterator._Set_prev(this.end_, this.end_);
|
||||
ListIterator_1.ListIterator._Set_next(this.end_, this.end_);
|
||||
// RE-SIZE -> 0
|
||||
this.begin_ = this.end_;
|
||||
this.size_ = 0;
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ListContainer.prototype.resize = function (n) {
|
||||
var expansion = n - this.size();
|
||||
if (expansion > 0)
|
||||
this.insert(this.end(), expansion, undefined);
|
||||
else if (expansion < 0)
|
||||
this.erase((0, global_1.advance)(this.end(), -expansion), this.end());
|
||||
};
|
||||
/* ---------------------------------------------------------
|
||||
ACCESSORS
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ListContainer.prototype.begin = function () {
|
||||
return this.begin_;
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ListContainer.prototype.end = function () {
|
||||
return this.end_;
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ListContainer.prototype.size = function () {
|
||||
return this.size_;
|
||||
};
|
||||
/* =========================================================
|
||||
ELEMENTS I/O
|
||||
- PUSH & POP
|
||||
- INSERT
|
||||
- ERASE
|
||||
- POST-PROCESS
|
||||
============================================================
|
||||
PUSH & POP
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ListContainer.prototype.push_front = function (val) {
|
||||
this.insert(this.begin_, val);
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ListContainer.prototype.push_back = function (val) {
|
||||
this.insert(this.end_, val);
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ListContainer.prototype.pop_front = function () {
|
||||
if (this.empty() === true)
|
||||
throw ErrorGenerator_1.ErrorGenerator.empty(this.end_.source().constructor.name, "pop_front");
|
||||
this.erase(this.begin_);
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ListContainer.prototype.pop_back = function () {
|
||||
if (this.empty() === true)
|
||||
throw ErrorGenerator_1.ErrorGenerator.empty(this.end_.source().constructor.name, "pop_back");
|
||||
this.erase(this.end_.prev());
|
||||
};
|
||||
/* ---------------------------------------------------------
|
||||
INSERT
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ListContainer.prototype.push = function () {
|
||||
var items = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
items[_i] = arguments[_i];
|
||||
}
|
||||
if (items.length === 0)
|
||||
return this.size();
|
||||
// INSERT BY RANGE
|
||||
var first = new NativeArrayIterator_1.NativeArrayIterator(items, 0);
|
||||
var last = new NativeArrayIterator_1.NativeArrayIterator(items, items.length);
|
||||
this._Insert_by_range(this.end(), first, last);
|
||||
// RETURN SIZE
|
||||
return this.size();
|
||||
};
|
||||
ListContainer.prototype.insert = function (pos) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
// VALIDATION
|
||||
if (pos.source() !== this.end_.source())
|
||||
throw ErrorGenerator_1.ErrorGenerator.not_my_iterator(this.end_.source(), "insert");
|
||||
else if (pos.erased_ === true)
|
||||
throw ErrorGenerator_1.ErrorGenerator.erased_iterator(this.end_.source(), "insert");
|
||||
// BRANCHES
|
||||
if (args.length === 1)
|
||||
return this._Insert_by_repeating_val(pos, 1, args[0]);
|
||||
else if (args.length === 2 && typeof args[0] === "number")
|
||||
return this._Insert_by_repeating_val(pos, args[0], args[1]);
|
||||
else
|
||||
return this._Insert_by_range(pos, args[0], args[1]);
|
||||
};
|
||||
ListContainer.prototype._Insert_by_repeating_val = function (position, n, val) {
|
||||
var first = new Repeater_1.Repeater(0, val);
|
||||
var last = new Repeater_1.Repeater(n);
|
||||
return this._Insert_by_range(position, first, last);
|
||||
};
|
||||
ListContainer.prototype._Insert_by_range = function (position, begin, end) {
|
||||
var prev = position.prev();
|
||||
var first = null;
|
||||
var size = 0;
|
||||
for (var it = begin; it.equals(end) === false; it = it.next()) {
|
||||
// CONSTRUCT ITEM, THE NEW ELEMENT
|
||||
var item = this._Create_iterator(prev, null, it.value);
|
||||
if (size === 0)
|
||||
first = item;
|
||||
// PLACE ITEM ON THE NEXT OF "PREV"
|
||||
ListIterator_1.ListIterator._Set_next(prev, item);
|
||||
// SHIFT CURRENT ITEM TO PREVIOUS
|
||||
prev = item;
|
||||
++size;
|
||||
}
|
||||
// WILL FIRST BE THE BEGIN?
|
||||
if (position.equals(this.begin()) === true)
|
||||
this.begin_ = first;
|
||||
// CONNECT BETWEEN LAST AND POSITION
|
||||
ListIterator_1.ListIterator._Set_next(prev, position);
|
||||
ListIterator_1.ListIterator._Set_prev(position, prev);
|
||||
this.size_ += size;
|
||||
return first;
|
||||
};
|
||||
ListContainer.prototype.erase = function (first, last) {
|
||||
if (last === void 0) { last = first.next(); }
|
||||
return this._Erase_by_range(first, last);
|
||||
};
|
||||
ListContainer.prototype._Erase_by_range = function (first, last) {
|
||||
// VALIDATION
|
||||
if (first.source() !== this.end_.source())
|
||||
throw ErrorGenerator_1.ErrorGenerator.not_my_iterator(this.end_.source(), "insert");
|
||||
else if (first.erased_ === true)
|
||||
throw ErrorGenerator_1.ErrorGenerator.erased_iterator(this.end_.source(), "insert");
|
||||
else if (first.equals(this.end_))
|
||||
return this.end_;
|
||||
// FIND PREV AND NEXT
|
||||
var prev = first.prev();
|
||||
// SHRINK
|
||||
ListIterator_1.ListIterator._Set_next(prev, last);
|
||||
ListIterator_1.ListIterator._Set_prev(last, prev);
|
||||
for (var it = first; !it.equals(last); it = it.next()) {
|
||||
it.erased_ = true;
|
||||
--this.size_;
|
||||
}
|
||||
if (first.equals(this.begin_))
|
||||
this.begin_ = last;
|
||||
return last;
|
||||
};
|
||||
/* ---------------------------------------------------------
|
||||
SWAP
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ListContainer.prototype.swap = function (obj) {
|
||||
var _a, _b, _c;
|
||||
_a = __read([obj.begin_, this.begin_], 2), this.begin_ = _a[0], obj.begin_ = _a[1];
|
||||
_b = __read([obj.end_, this.end_], 2), this.end_ = _b[0], obj.end_ = _b[1];
|
||||
_c = __read([obj.size_, this.size_], 2), this.size_ = _c[0], obj.size_ = _c[1];
|
||||
};
|
||||
return ListContainer;
|
||||
}(Container_1.Container));
|
||||
exports.ListContainer = ListContainer;
|
||||
//# sourceMappingURL=ListContainer.js.map
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std.internal
|
||||
*/
|
||||
import { ArrayContainer } from "./ArrayContainer";
|
||||
import { IContainer } from "../../../base/container/IContainer";
|
||||
import { IForwardIterator } from "../../../iterator/IForwardIterator";
|
||||
import { ArrayIteratorBase } from "../../iterator/ArrayIteratorBase";
|
||||
import { ArrayReverseIteratorBase } from "../../iterator/ArrayReverseIteratorBase";
|
||||
export declare abstract class VectorContainer<T, SourceT extends IContainer<T, SourceT, IteratorT, ReverseT, T>, ArrayT extends VectorContainer<T, SourceT, ArrayT, IteratorT, ReverseT>, IteratorT extends ArrayIteratorBase<T, SourceT, ArrayT, IteratorT, ReverseT, T>, ReverseT extends ArrayReverseIteratorBase<T, SourceT, ArrayT, IteratorT, ReverseT, T>> extends ArrayContainer<T, SourceT, ArrayT, IteratorT, ReverseT, T> {
|
||||
protected data_: T[];
|
||||
/**
|
||||
* Default Constructor.
|
||||
*/
|
||||
protected constructor();
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
assign(n: number, val: T): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
assign<InputIterator extends Readonly<IForwardIterator<T, InputIterator>>>(begin: InputIterator, end: InputIterator): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
clear(): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
resize(n: number): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
size(): number;
|
||||
protected _At(index: number): T;
|
||||
protected _Set(index: number, val: T): void;
|
||||
/**
|
||||
* Access data.
|
||||
*
|
||||
* @return An array capsuled by this {@link Vector}.
|
||||
*/
|
||||
data(): Array<T>;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
push(...items: T[]): number;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
push_back(val: T): void;
|
||||
protected _Insert_by_range<InputIterator extends Readonly<IForwardIterator<T, InputIterator>>>(position: IteratorT, first: InputIterator, last: InputIterator): IteratorT;
|
||||
protected _Pop_back(): void;
|
||||
protected _Erase_by_range(first: IteratorT, last: IteratorT): IteratorT;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
equals(obj: SourceT): boolean;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
swap(obj: SourceT): void;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
toJSON(): Array<T>;
|
||||
}
|
||||
-199
@@ -1,199 +0,0 @@
|
||||
"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;
|
||||
};
|
||||
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.VectorContainer = void 0;
|
||||
//================================================================
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std.internal
|
||||
*/
|
||||
//================================================================
|
||||
var ArrayContainer_1 = require("./ArrayContainer");
|
||||
var VectorContainer = /** @class */ (function (_super) {
|
||||
__extends(VectorContainer, _super);
|
||||
/* ---------------------------------------------------------
|
||||
CONSTRUCTORS
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* Default Constructor.
|
||||
*/
|
||||
function VectorContainer() {
|
||||
return _super.call(this) || this;
|
||||
}
|
||||
VectorContainer.prototype.assign = function (first, second) {
|
||||
this.clear();
|
||||
this.insert(this.end(), first, second);
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
VectorContainer.prototype.clear = function () {
|
||||
this.data_.splice(0, this.data_.length);
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
VectorContainer.prototype.resize = function (n) {
|
||||
this.data_.length = n;
|
||||
};
|
||||
/* =========================================================
|
||||
ACCESSORS
|
||||
========================================================= */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
VectorContainer.prototype.size = function () {
|
||||
return this.data_.length;
|
||||
};
|
||||
VectorContainer.prototype._At = function (index) {
|
||||
return this.data_[index];
|
||||
};
|
||||
VectorContainer.prototype._Set = function (index, val) {
|
||||
this.data_[index] = val;
|
||||
};
|
||||
/**
|
||||
* Access data.
|
||||
*
|
||||
* @return An array capsuled by this {@link Vector}.
|
||||
*/
|
||||
VectorContainer.prototype.data = function () {
|
||||
return this.data_;
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
VectorContainer.prototype[Symbol.iterator] = function () {
|
||||
return this.data_[Symbol.iterator]();
|
||||
};
|
||||
/* =========================================================
|
||||
ELEMENTS I/O
|
||||
- INSERT
|
||||
- ERASE
|
||||
============================================================
|
||||
INSERT
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
VectorContainer.prototype.push = function () {
|
||||
var _a;
|
||||
var items = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
items[_i] = arguments[_i];
|
||||
}
|
||||
return (_a = this.data_).push.apply(_a, __spreadArray([], __read(items), false));
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
VectorContainer.prototype.push_back = function (val) {
|
||||
this.data_.push(val);
|
||||
};
|
||||
VectorContainer.prototype._Insert_by_range = function (position, first, last) {
|
||||
var _a;
|
||||
if (position.index() >= this.size()) {
|
||||
// WHEN INSERT TO THE LAST
|
||||
var prev_size = this.size();
|
||||
for (; !first.equals(last); first = first.next())
|
||||
this.data_.push(first.value);
|
||||
return this.nth(prev_size);
|
||||
}
|
||||
else {
|
||||
//----
|
||||
// INSERT TO THE MIDDLE POSITION
|
||||
//----
|
||||
// CUT RIGHT SIDE
|
||||
var spliced_array = this.data_.splice(position.index());
|
||||
// INSERT ELEMENTS
|
||||
for (; !first.equals(last); first = first.next())
|
||||
this.data_.push(first.value);
|
||||
(_a = this.data_).push.apply(_a, __spreadArray([], __read(spliced_array), false)); // CONCAT THE SPLICEDS
|
||||
return position;
|
||||
}
|
||||
};
|
||||
/* ---------------------------------------------------------
|
||||
ERASE
|
||||
--------------------------------------------------------- */
|
||||
VectorContainer.prototype._Pop_back = function () {
|
||||
this.data_.pop();
|
||||
};
|
||||
VectorContainer.prototype._Erase_by_range = function (first, last) {
|
||||
if (first.index() >= this.size())
|
||||
return first;
|
||||
// ERASE ELEMENTS
|
||||
if (last.index() >= this.size()) {
|
||||
this.data_.splice(first.index());
|
||||
return this.end();
|
||||
}
|
||||
else
|
||||
this.data_.splice(first.index(), last.index() - first.index());
|
||||
return first;
|
||||
};
|
||||
/* ---------------------------------------------------------------
|
||||
UTILITIES
|
||||
--------------------------------------------------------------- */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
VectorContainer.prototype.equals = function (obj) {
|
||||
return this.data_ === obj.data_;
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
VectorContainer.prototype.swap = function (obj) {
|
||||
var _a;
|
||||
_a = __read([
|
||||
obj.data_,
|
||||
this.data_,
|
||||
], 2), this.data_ = _a[0], obj.data_ = _a[1];
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
VectorContainer.prototype.toJSON = function () {
|
||||
return this.data_;
|
||||
};
|
||||
return VectorContainer;
|
||||
}(ArrayContainer_1.ArrayContainer));
|
||||
exports.VectorContainer = VectorContainer;
|
||||
//# sourceMappingURL=VectorContainer.js.map
|
||||
Reference in New Issue
Block a user