declarations
Version:
[](https://www.npmjs.com/package/declarations)
1,292 lines (1,288 loc) • 254 kB
TypeScript
// Type definitions for Samchon Framework v2.0.0-beta.8
// Project: https://github.com/samchon/framework
// Definitions by: Jeongho Nam <http://samchon.org>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../typescript-stl/typescript-stl.d.ts" />
declare module "samchon-framework"
{
export = samchon;
}
/**
* <h1> Samchon-Framework </h1>
*
* <p> <a href="https://nodei.co/npm/samchon-framework">
* <img src="https://nodei.co/npm/samchon-framework.png?downloads=true&downloadRank=true&stars=true"> </a> </p>
*
* <p> Samchon, a SDN (Software Defined Network) framework. </p>
*
* <p> With Samchon Framework, you can implement distributed processing system within framework of OOD like
* handling S/W objects (classes). You can realize cloud and distributed system very easily with provided
* system templates and even integration with C++ is possible. </p>
*
* <p> The goal, ultimate utilization model of Samchon Framework is, building cloud system with NodeJS and
* takING heavy works to C++ distributed systems with provided modules (those are system templates). </p>
*
* @git https://github.com/samchon/framework
* @author Jeongho Nam <http://samchon.org>
*/
declare namespace samchon {
/**
* <p> Running on Node. </p>
*
* <p> Test whether the JavaScript is running on Node. </p>
*
* @references http://stackoverflow.com/questions/17575790/environment-detection-node-js-or-browser
*/
function is_node(): boolean;
}
declare namespace samchon.collection {
/**
* A {@link Vector} who can detect element I/O events.
*
* <ul>
* <li> <i>insert</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link insert} </li>
* <li> {@link push} </li>
* <li> {@link push_back} </li>
* <li> {@link unshift} </li>
* </ul></li>
* <li> <i>erase</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link clear} </li>
* <li> {@link erase} </li>
* <li> {@link pop_back} </li>
* <li> {@link shift} </li>
* <li> {@link pop} </li>
* <li> {@link splice} </li>
* </ul></li>
* <li> <i>erase</i> typed events: <ul>
* <li> {@link sort} </li>
* </ul></li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class ArrayCollection<T> extends std.Vector<T> implements ICollection<T> {
/**
* A chain object taking responsibility of dispatching events.
*/
private event_dispatcher_;
/**
* @inheritdoc
*/
push<U extends T>(...items: U[]): number;
/**
* @inheritdoc
*/
push_back(val: T): void;
/**
* @hidden
*/
protected _Insert_by_repeating_val(position: std.VectorIterator<T>, n: number, val: T): std.VectorIterator<T>;
/**
* @hidden
*/
protected _Insert_by_range<U extends T, InputIterator extends std.Iterator<U>>(position: std.VectorIterator<T>, begin: InputIterator, end: InputIterator): std.VectorIterator<T>;
/**
* @hidden
*/
protected _Erase_by_range(first: std.VectorIterator<T>, last: std.VectorIterator<T>): std.VectorIterator<T>;
/**
* @hidden
*/
private notify_insert(first, last);
/**
* @hidden
*/
private notify_erase(first, last);
/**
* @inheritdoc
*/
hasEventListener(type: string): boolean;
/**
* @inheritdoc
*/
dispatchEvent(event: library.BasicEvent): boolean;
/**
* @inheritdoc
*/
refresh(): void;
/**
* @inheritdoc
*/
refresh(it: std.VectorIterator<T>): void;
/**
* @inheritdoc
*/
refresh(first: std.VectorIterator<T>, last: std.VectorIterator<T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener): void;
addEventListener(type: "insert", listener: CollectionEventListener<T>): void;
addEventListener(type: "erase", listener: CollectionEventListener<T>): void;
addEventListener(type: "refresh", listener: CollectionEventListener<T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
addEventListener(type: "insert", listener: CollectionEventListener<T>, thisArg: Object): void;
addEventListener(type: "erase", listener: CollectionEventListener<T>, thisArg: Object): void;
addEventListener(type: "refresh", listener: CollectionEventListener<T>, thisArg: Object): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener): void;
removeEventListener(type: "insert", listener: CollectionEventListener<T>): void;
removeEventListener(type: "erase", listener: CollectionEventListener<T>): void;
removeEventListener(type: "refresh", listener: CollectionEventListener<T>): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
removeEventListener(type: "insert", listener: CollectionEventListener<T>, thisArg: Object): void;
removeEventListener(type: "erase", listener: CollectionEventListener<T>, thisArg: Object): void;
removeEventListener(type: "refresh", listener: CollectionEventListener<T>, thisArg: Object): void;
/**
* @inheritdoc
*/
unshift<U extends T>(...items: U[]): number;
/**
* @inheritdoc
*/
pop(): T;
/**
* @inheritdoc
*/
splice(start: number): T[];
/**
* @inheritdoc
*/
splice(start: number, deleteCount: number, ...items: T[]): T[];
}
}
declare namespace samchon.library {
/**
* A basic event class of Samchon Framework.
*
* @reference https://developer.mozilla.org/en-US/docs/Web/API/Event
* @author Jeongho Nam <http://samchon.org>
*/
class BasicEvent {
protected type_: string;
protected target_: IEventDispatcher;
private currentTarget_;
protected trusted_: boolean;
protected bubbles_: boolean;
protected cancelable_: boolean;
protected defaultPrevented_: boolean;
protected cancelBubble_: boolean;
private timeStamp_;
constructor(type: string, bubbles?: boolean, cancelable?: boolean);
/**
* @inheritdoc
*/
initEvent(type: string, bubbles: boolean, cancelable: boolean): void;
/**
* @inheritdoc
*/
/**
* @inheritdoc
*/
stopImmediatePropagation(): void;
/**
* @inheritdoc
*/
stopPropagation(): void;
/**
* @inheritdoc
*/
type: string;
/**
* @inheritdoc
*/
target: IEventDispatcher;
/**
* @inheritdoc
*/
currentTarget: IEventDispatcher;
/**
* @inheritdoc
*/
isTrusted: boolean;
/**
* @inheritdoc
*/
bubbles: boolean;
/**
* @inheritdoc
*/
cancelable: boolean;
/**
* @inheritdoc
*/
eventPhase: number;
/**
* @inheritdoc
*/
defaultPrevented: boolean;
/**
* @inheritdoc
*/
srcElement: Element;
/**
* @inheritdoc
*/
cancelBubble: boolean;
/**
* @inheritdoc
*/
timeStamp: number;
/**
* Don't know what it is.
*/
returnValue: boolean;
}
}
declare namespace samchon.collection {
/**
* Type of function pointer for listener of {@link CollectionEvent CollectionEvents}.
*/
type CollectionEventListener<T> = (event: CollectionEvent<T>) => void;
}
declare namespace samchon.collection {
/**
* @author Jeongho Nam <http://samchon.org>
*/
class CollectionEvent<T> extends library.BasicEvent {
/**
* @hidden
*/
protected first_: std.Iterator<T>;
/**
* @hidden
*/
protected last_: std.Iterator<T>;
private temporary_container_;
private origin_first_;
/**
* Initialization Constructor.
*
* @param type Type of collection event.
* @param first
* @param last
*/
constructor(type: string, first: std.Iterator<T>, last: std.Iterator<T>);
constructor(type: "insert", first: std.Iterator<T>, last: std.Iterator<T>);
constructor(type: "erase", first: std.Iterator<T>, last: std.Iterator<T>);
constructor(type: "refresh", first: std.Iterator<T>, last: std.Iterator<T>);
/**
* Get associative target, the container.
*/
target: ICollection<T>;
/**
* Get range of the first.
*/
first: std.Iterator<T>;
/**
* Get range of the last.
*/
last: std.Iterator<T>;
/**
* @inheritdoc
*/
preventDefault(): void;
}
}
/**
* @hidden
*/
declare namespace samchon.collection.CollectionEvent {
const INSERT: "insert";
const ERASE: "erase";
const REFRESH: "refresh";
}
declare namespace samchon.collection {
/**
* A {@link Deque} who can detect element I/O events.
*
* <p> Below are list of methods who are dispatching {@link CollectionEvent}: </p>
*
* <ul>
* <li> <i>insert</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link insert} </li>
* <li> {@link push} </li>
* <li> {@link push_front} </li>
* <li> {@link push_back} </li>
* </ul></li>
* <li> <i>erase</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link clear} </li>
* <li> {@link erase} </li>
* <li> {@link pop_front} </li>
* <li> {@link pop_back} </li>
* </ul></li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class DequeCollection<T> extends std.Deque<T> implements ICollection<T> {
/**
* A chain object taking responsibility of dispatching events.
*/
private event_dispatcher_;
/**
* @inheritdoc
*/
push<U extends T>(...items: U[]): number;
/**
* @inheritdoc
*/
push_back(val: T): void;
/**
* @hidden
*/
protected _Insert_by_repeating_val(position: std.DequeIterator<T>, n: number, val: T): std.DequeIterator<T>;
/**
* @hidden
*/
protected _Insert_by_range<U extends T, InputIterator extends std.Iterator<U>>(position: std.DequeIterator<T>, begin: InputIterator, end: InputIterator): std.DequeIterator<T>;
/**
* @inheritdoc
*/
pop_back(): void;
/**
* @hidden
*/
protected _Erase_by_range(first: std.DequeIterator<T>, last: std.DequeIterator<T>): std.DequeIterator<T>;
/**
* @hidden
*/
private notify_insert(first, last);
/**
* @hidden
*/
private notify_erase(first, last);
/**
* @inheritdoc
*/
hasEventListener(type: string): boolean;
/**
* @inheritdoc
*/
dispatchEvent(event: library.BasicEvent): boolean;
/**
* @inheritdoc
*/
refresh(): void;
/**
* @inheritdoc
*/
refresh(it: std.DequeIterator<T>): void;
/**
* @inheritdoc
*/
refresh(first: std.DequeIterator<T>, last: std.DequeIterator<T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener): void;
addEventListener(type: "insert", listener: CollectionEventListener<T>): void;
addEventListener(type: "erase", listener: CollectionEventListener<T>): void;
addEventListener(type: "refresh", listener: CollectionEventListener<T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
addEventListener(type: "insert", listener: CollectionEventListener<T>, thisArg: Object): void;
addEventListener(type: "erase", listener: CollectionEventListener<T>, thisArg: Object): void;
addEventListener(type: "refresh", listener: CollectionEventListener<T>, thisArg: Object): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener): void;
removeEventListener(type: "insert", listener: CollectionEventListener<T>): void;
removeEventListener(type: "erase", listener: CollectionEventListener<T>): void;
removeEventListener(type: "refresh", listener: CollectionEventListener<T>): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
removeEventListener(type: "insert", listener: CollectionEventListener<T>, thisArg: Object): void;
removeEventListener(type: "erase", listener: CollectionEventListener<T>, thisArg: Object): void;
removeEventListener(type: "refresh", listener: CollectionEventListener<T>, thisArg: Object): void;
}
}
declare namespace samchon.collection {
/**
* A {@link HashMap} who can detect element I/O events.
*
* <ul>
* <li> <i>insert</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link insert} </li>
* <li> {@link push} </li>
* <li> {@link set} </li>
* <li> {@link insert_or_assign} </li>
* </ul></li>
* <li> <i>erase</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link clear} </li>
* <li> {@link erase} </li>
* <li> {@link extract} </li>
* </ul></li>
* <li> <i>refresh</i> typed events: <ul>
* <li> {@link set} </li>
* <li> {@link insert_or_assign} </li>
* </ul></li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class HashMapCollection<Key, T> extends std.HashMap<Key, T> implements ICollection<std.Pair<Key, T>> {
/**
* A chain object taking responsibility of dispatching events.
*/
private event_dispatcher_;
/**
* @inheritdoc
*/
protected _Handle_insert(first: std.MapIterator<Key, T>, last: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
protected _Handle_erase(first: std.MapIterator<Key, T>, last: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
hasEventListener(type: string): boolean;
/**
* @inheritdoc
*/
dispatchEvent(event: library.BasicEvent): boolean;
/**
* @inheritdoc
*/
refresh(): void;
/**
* @inheritdoc
*/
refresh(it: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
refresh(first: std.MapIterator<Key, T>, last: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener): void;
addEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>): void;
addEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>): void;
addEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
addEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
addEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
addEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener): void;
removeEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>): void;
removeEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>): void;
removeEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
removeEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
removeEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
removeEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
}
}
declare namespace samchon.collection {
/**
* A {@link HashMultiMap} who can detect element I/O events.
*
* <ul>
* <li> <i>insert</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link insert} </li>
* <li> {@link push} </li>
* </ul></li>
* <li> <i>erase</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link clear} </li>
* <li> {@link erase} </li>
* </ul></li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class HashMultiMapCollection<Key, T> extends std.HashMap<Key, T> implements ICollection<std.Pair<Key, T>> {
/**
* A chain object taking responsibility of dispatching events.
*/
private event_dispatcher_;
/**
* @inheritdoc
*/
protected _Handle_insert(first: std.MapIterator<Key, T>, last: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
protected _Handle_erase(first: std.MapIterator<Key, T>, last: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
hasEventListener(type: string): boolean;
/**
* @inheritdoc
*/
dispatchEvent(event: library.BasicEvent): boolean;
/**
* @inheritdoc
*/
refresh(): void;
/**
* @inheritdoc
*/
refresh(it: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
refresh(first: std.MapIterator<Key, T>, last: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener): void;
addEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>): void;
addEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>): void;
addEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
addEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
addEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
addEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener): void;
removeEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>): void;
removeEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>): void;
removeEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
removeEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
removeEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
removeEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
}
}
declare namespace samchon.collection {
/**
* A {@link HashMultiSet} who can detect element I/O events.
*
* <ul>
* <li> <i>insert</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link insert} </li>
* <li> {@link push} </li>
* </ul></li>
* <li> <i>erase</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link clear} </li>
* <li> {@link erase} </li>
* </ul></li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class HashMultiSetCollection<T> extends std.HashMultiSet<T> implements ICollection<T> {
/**
* A chain object taking responsibility of dispatching events.
*/
private event_dispatcher_;
/**
* @inheritdoc
*/
protected _Handle_insert(first: std.SetIterator<T>, last: std.SetIterator<T>): void;
/**
* @inheritdoc
*/
protected _Handle_erase(first: std.SetIterator<T>, last: std.SetIterator<T>): void;
/**
* @inheritdoc
*/
hasEventListener(type: string): boolean;
/**
* @inheritdoc
*/
dispatchEvent(event: library.BasicEvent): boolean;
/**
* @inheritdoc
*/
refresh(): void;
/**
* @inheritdoc
*/
refresh(it: std.SetIterator<T>): void;
/**
* @inheritdoc
*/
refresh(first: std.SetIterator<T>, last: std.SetIterator<T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener): void;
addEventListener(type: "insert", listener: CollectionEventListener<T>): void;
addEventListener(type: "erase", listener: CollectionEventListener<T>): void;
addEventListener(type: "refresh", listener: CollectionEventListener<T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
addEventListener(type: "insert", listener: CollectionEventListener<T>, thisArg: Object): void;
addEventListener(type: "erase", listener: CollectionEventListener<T>, thisArg: Object): void;
addEventListener(type: "refresh", listener: CollectionEventListener<T>, thisArg: Object): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener): void;
removeEventListener(type: "insert", listener: CollectionEventListener<T>): void;
removeEventListener(type: "erase", listener: CollectionEventListener<T>): void;
removeEventListener(type: "refresh", listener: CollectionEventListener<T>): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
removeEventListener(type: "insert", listener: CollectionEventListener<T>, thisArg: Object): void;
removeEventListener(type: "erase", listener: CollectionEventListener<T>, thisArg: Object): void;
removeEventListener(type: "refresh", listener: CollectionEventListener<T>, thisArg: Object): void;
}
}
declare namespace samchon.collection {
/**
* A {@link HashSet} who can detect element I/O events.
*
* <ul>
* <li> <i>insert</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link insert} </li>
* <li> {@link push} </li>
* </ul></li>
* <li> <i>erase</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link clear} </li>
* <li> {@link erase} </li>
* <li> {@link extract} </li>
* </ul></li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class HashSetCollection<T> extends std.HashSet<T> implements ICollection<T> {
/**
* A chain object taking responsibility of dispatching events.
*/
private event_dispatcher_;
/**
* @inheritdoc
*/
protected _Handle_insert(first: std.SetIterator<T>, last: std.SetIterator<T>): void;
/**
* @inheritdoc
*/
protected _Handle_erase(first: std.SetIterator<T>, last: std.SetIterator<T>): void;
/**
* @inheritdoc
*/
hasEventListener(type: string): boolean;
/**
* @inheritdoc
*/
dispatchEvent(event: library.BasicEvent): boolean;
/**
* @inheritdoc
*/
refresh(): void;
/**
* @inheritdoc
*/
refresh(it: std.SetIterator<T>): void;
/**
* @inheritdoc
*/
refresh(first: std.SetIterator<T>, last: std.SetIterator<T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener): void;
addEventListener(type: "insert", listener: CollectionEventListener<T>): void;
addEventListener(type: "erase", listener: CollectionEventListener<T>): void;
addEventListener(type: "refresh", listener: CollectionEventListener<T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
addEventListener(type: "insert", listener: CollectionEventListener<T>, thisArg: Object): void;
addEventListener(type: "erase", listener: CollectionEventListener<T>, thisArg: Object): void;
addEventListener(type: "refresh", listener: CollectionEventListener<T>, thisArg: Object): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener): void;
removeEventListener(type: "insert", listener: CollectionEventListener<T>): void;
removeEventListener(type: "erase", listener: CollectionEventListener<T>): void;
removeEventListener(type: "refresh", listener: CollectionEventListener<T>): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
removeEventListener(type: "insert", listener: CollectionEventListener<T>, thisArg: Object): void;
removeEventListener(type: "erase", listener: CollectionEventListener<T>, thisArg: Object): void;
removeEventListener(type: "refresh", listener: CollectionEventListener<T>, thisArg: Object): void;
}
}
declare namespace samchon.collection {
/**
* An interface for {@link IContainer containers} who can detect element I/O events.
*
* <p> Below are list of methods who are dispatching {@link CollectionEvent}: </p>
*
* <ul>
* <li> <i>insert</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link insert} </li>
* <li> {@link push} </li>
* </ul></li>
* <li> <i>erase</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link clear} </li>
* <li> {@link erase} </li>
* </ul></li>
*
* @author Jeongho Nam <http://samchon.org>
*/
interface ICollection<T> extends std.base.IContainer<T>, library.IEventDispatcher {
/**
* <p> Dispatch a {@link CollectionEvent} with <i>refresh</i> typed. </p>
*
* <p> {@link ICollection} dispatches {@link CollectionEvent} typed <i>insert</i> or <i>erase</i> whenever
* elements I/O has occured. However, unlike those elements I/O events, content change in element level can't be
* detected. There's no way to detect those events automatically by {@link IContainer}. </p>
*
* <p> If you want to dispatch those typed events (notifying change on contents in element level), you've to
* dispatch <i>refresh</i> typed event manually, by yourself. Call {@link refresh refresh()} with specified
* iterators who're pointing the elements whose content have changed. Then a {@link CollectionEvent} with
* <i>refresh</i> typed will be dispatched. </p>
*
* <p> If you don't specify any iterator, then the range of the <i>refresh<i> event will be all elements in this
* {@link ICollection collection}; {@link begin begin()} to {@link end end()}. </p>
*/
refresh(): void;
/**
* <p> Dispatch a {@link CollectionEvent} with <i>refresh</i> typed. </p>
*
* <p> {@link ICollection} dispatches {@link CollectionEvent} typed <i>insert</i> or <i>erase</i> whenever
* elements I/O has occured. However, unlike those elements I/O events, content change in element level can't be
* detected. There's no way to detect those events automatically by {@link IContainer}. </p>
*
* <p> If you want to dispatch those typed events (notifying change on contents in element level), you've to
* dispatch <i>refresh</i> typed event manually, by yourself. Call {@link refresh refresh()} with specified
* iterators who're pointing the elements whose content have changed. Then a {@link CollectionEvent} with
* <i>refresh</i> typed will be dispatched. </p>
*
* @param it An iterator targeting the content changed element.
*/
refresh(it: std.Iterator<T>): void;
/**
* <p> Dispatch a {@link CollectionEvent} with <i>refresh</i> typed. </p>
*
* <p> {@link ICollection} dispatches {@link CollectionEvent} typed <i>insert</i> or <i>erase</i> whenever
* elements I/O has occured. However, unlike those elements I/O events, content change in element level can't be
* detected. There's no way to detect those events automatically by {@link IContainer}. </p>
*
* <p> If you want to dispatch those typed events (notifying change on contents in element level), you've to
* dispatch <i>refresh</i> typed event manually, by yourself. Call {@link refresh refresh()} with specified
* iterators who're pointing the elements whose content have changed. Then a {@link CollectionEvent} with
* <i>refresh</i> typed will be dispatched. </p>
*
* @param first An Iterator to the initial position in a sequence of the content changed elmeents.
* @param last An {@link Iterator} to the final position in a sequence of the content changed elements. The range
* used is [<i>first</i>, <i>last</i>), which contains all the elements between <i>first</i> and
* <i>last</i>, including the element pointed by <i>first</i> but not the element pointed by
* <i>last</i>.
*/
refresh(first: std.Iterator<T>, last: std.Iterator<T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener): void;
addEventListener(type: "insert", listener: CollectionEventListener<T>): void;
addEventListener(type: "erase", listener: CollectionEventListener<T>): void;
addEventListener(type: "refresh", listener: CollectionEventListener<T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
addEventListener(type: "insert", listener: CollectionEventListener<T>, thisArg: Object): void;
addEventListener(type: "erase", listener: CollectionEventListener<T>, thisArg: Object): void;
addEventListener(type: "refresh", listener: CollectionEventListener<T>, thisArg: Object): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener): void;
removeEventListener(type: "insert", listener: CollectionEventListener<T>): void;
removeEventListener(type: "erase", listener: CollectionEventListener<T>): void;
removeEventListener(type: "refresh", listener: CollectionEventListener<T>): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
removeEventListener(type: "insert", listener: CollectionEventListener<T>, thisArg: Object): void;
removeEventListener(type: "erase", listener: CollectionEventListener<T>, thisArg: Object): void;
removeEventListener(type: "refresh", listener: CollectionEventListener<T>, thisArg: Object): void;
}
/**
* @hidden
*/
namespace ICollection {
function _Dispatch_CollectionEvent<T>(collection: ICollection<T>, type: string, first: std.Iterator<T>, last: std.Iterator<T>): void;
function _Dispatch_MapCollectionEvent<Key, T>(collection: ICollection<std.Pair<Key, T>>, type: string, first: std.MapIterator<Key, T>, last: std.MapIterator<Key, T>): void;
}
}
declare namespace samchon.collection {
/**
* A {@link List} who can detect element I/O events.
*
* <ul>
* <li> <i>insert</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link insert} </li>
* <li> {@link push} </li>
* <li> {@link push_front} </li>
* <li> {@link push_back} </li>
* <li> {@link merge} </li>
* </ul></li>
* <li> <i>erase</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link clear} </li>
* <li> {@link erase} </li>
* <li> {@link pop_front} </li>
* <li> {@link pop_back} </li>
* <li> {@link unique} </li>
* <li> {@link remove} </li>
* <li> {@link remove_if} </li>
* <li> {@link splice} </li>
* </ul></li>
* <li> <i>erase</i> typed events: <ul>
* <li> {@link sort} </li>
* </ul></li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class ListCollection<T> extends std.List<T> implements ICollection<T> {
/**
* A chain object taking responsibility of dispatching events.
*/
private event_dispatcher_;
/**
* @inheritdoc
*/
push<U extends T>(...items: T[]): number;
/**
* @inheritdoc
*/
push_front(val: T): void;
/**
* @inheritdoc
*/
push_back(val: T): void;
/**
* @hidden
*/
protected _Insert_by_repeating_val(position: std.ListIterator<T>, n: number, val: T): std.ListIterator<T>;
/**
* @hidden
*/
protected _Insert_by_range<U extends T, InputIterator extends std.Iterator<U>>(position: std.ListIterator<T>, begin: InputIterator, end: InputIterator): std.ListIterator<T>;
/**
* @inheritdoc
*/
pop_front(): void;
/**
* @inheritdoc
*/
pop_back(): void;
/**
* @hidden
*/
protected _Erase_by_range(first: std.ListIterator<T>, last: std.ListIterator<T>): std.ListIterator<T>;
/**
* @hidden
*/
private notify_insert(first, last);
/**
* @hidden
*/
private notify_erase(first, last);
/**
* @inheritdoc
*/
hasEventListener(type: string): boolean;
/**
* @inheritdoc
*/
dispatchEvent(event: library.BasicEvent): boolean;
/**
* @inheritdoc
*/
refresh(): void;
/**
* @inheritdoc
*/
refresh(it: std.ListIterator<T>): void;
/**
* @inheritdoc
*/
refresh(first: std.ListIterator<T>, last: std.ListIterator<T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener): void;
addEventListener(type: "insert", listener: CollectionEventListener<T>): void;
addEventListener(type: "erase", listener: CollectionEventListener<T>): void;
addEventListener(type: "refresh", listener: CollectionEventListener<T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
addEventListener(type: "insert", listener: CollectionEventListener<T>, thisArg: Object): void;
addEventListener(type: "erase", listener: CollectionEventListener<T>, thisArg: Object): void;
addEventListener(type: "refresh", listener: CollectionEventListener<T>, thisArg: Object): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener): void;
removeEventListener(type: "insert", listener: CollectionEventListener<T>): void;
removeEventListener(type: "erase", listener: CollectionEventListener<T>): void;
removeEventListener(type: "refresh", listener: CollectionEventListener<T>): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
removeEventListener(type: "insert", listener: CollectionEventListener<T>, thisArg: Object): void;
removeEventListener(type: "erase", listener: CollectionEventListener<T>, thisArg: Object): void;
removeEventListener(type: "refresh", listener: CollectionEventListener<T>, thisArg: Object): void;
}
}
declare namespace samchon.collection {
type MapCollectionEventListener<Key, T> = (event: MapCollectionEvent<Key, T>) => void;
class MapCollectionEvent<Key, T> extends CollectionEvent<std.Pair<Key, T>> {
/**
* @inheritdoc
*/
first: std.MapIterator<Key, T>;
/**
* @inheritdoc
*/
last: std.MapIterator<Key, T>;
}
}
declare namespace samchon.collection {
/**
* A {@link TreeMap} who can detect element I/O events.
*
* <ul>
* <li> <i>insert</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link insert} </li>
* <li> {@link push} </li>
* <li> {@link set} </li>
* <li> {@link insert_or_assign} </li>
* </ul></li>
* <li> <i>erase</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link clear} </li>
* <li> {@link erase} </li>
* <li> {@link extract} </li>
* </ul></li>
* <li> <i>refresh</i> typed events: <ul>
* <li> {@link set} </li>
* <li> {@link insert_or_assign} </li>
* </ul></li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class TreeMapCollection<Key, T> extends std.TreeMap<Key, T> implements ICollection<std.Pair<Key, T>> {
/**
* A chain object taking responsibility of dispatching events.
*/
private event_dispatcher_;
/**
* @inheritdoc
*/
protected _Handle_insert(first: std.MapIterator<Key, T>, last: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
protected _Handle_erase(first: std.MapIterator<Key, T>, last: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
hasEventListener(type: string): boolean;
/**
* @inheritdoc
*/
dispatchEvent(event: library.BasicEvent): boolean;
/**
* @inheritdoc
*/
refresh(): void;
/**
* @inheritdoc
*/
refresh(it: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
refresh(first: std.MapIterator<Key, T>, last: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener): void;
addEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>): void;
addEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>): void;
addEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
addEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
addEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
addEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener): void;
removeEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>): void;
removeEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>): void;
removeEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
removeEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
removeEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
removeEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
}
}
declare namespace samchon.collection {
/**
* A {@link TreeMultiMap} who can detect element I/O events.
*
* <ul>
* <li> <i>insert</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link insert} </li>
* <li> {@link push} </li>
* </ul></li>
* <li> <i>erase</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link clear} </li>
* <li> {@link erase} </li>
* </ul></li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class TreeMultiMapCollection<Key, T> extends std.TreeMultiMap<Key, T> implements ICollection<std.Pair<Key, T>> {
/**
* A chain object taking responsibility of dispatching events.
*/
private event_dispatcher_;
/**
* @inheritdoc
*/
protected _Handle_insert(first: std.MapIterator<Key, T>, last: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
protected _Handle_erase(first: std.MapIterator<Key, T>, last: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
hasEventListener(type: string): boolean;
/**
* @inheritdoc
*/
dispatchEvent(event: library.BasicEvent): boolean;
/**
* @inheritdoc
*/
refresh(): void;
/**
* @inheritdoc
*/
refresh(it: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
refresh(first: std.MapIterator<Key, T>, last: std.MapIterator<Key, T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener): void;
addEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>): void;
addEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>): void;
addEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
addEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
addEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
addEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener): void;
removeEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>): void;
removeEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>): void;
removeEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
removeEventListener(type: "insert", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
removeEventListener(type: "erase", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
removeEventListener(type: "refresh", listener: MapCollectionEventListener<Key, T>, thisArg: Object): void;
}
}
declare namespace samchon.collection {
/**
* A {@link TreeMultiSet} who can detect element I/O events.
*
* <ul>
* <li> <i>insert</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link insert} </li>
* <li> {@link push} </li>
* </ul></li>
* <li> <i>erase</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link clear} </li>
* <li> {@link erase} </li>
* </ul></li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class TreeMultiSetCollection<T> extends std.TreeMultiSet<T> implements ICollection<T> {
/**
* A chain object taking responsibility of dispatching events.
*/
private event_dispatcher_;
/**
* @inheritdoc
*/
protected _Handle_insert(first: std.SetIterator<T>, last: std.SetIterator<T>): void;
/**
* @inheritdoc
*/
protected _Handle_erase(first: std.SetIterator<T>, last: std.SetIterator<T>): void;
/**
* @inheritdoc
*/
hasEventListener(type: string): boolean;
/**
* @inheritdoc
*/
dispatchEvent(event: library.BasicEvent): boolean;
/**
* @inheritdoc
*/
refresh(): void;
/**
* @inheritdoc
*/
refresh(it: std.SetIterator<T>): void;
/**
* @inheritdoc
*/
refresh(first: std.SetIterator<T>, last: std.SetIterator<T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener): void;
addEventListener(type: "insert", listener: CollectionEventListener<T>): void;
addEventListener(type: "erase", listener: CollectionEventListener<T>): void;
addEventListener(type: "refresh", listener: CollectionEventListener<T>): void;
/**
* @inheritdoc
*/
addEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
addEventListener(type: "insert", listener: CollectionEventListener<T>, thisArg: Object): void;
addEventListener(type: "erase", listener: CollectionEventListener<T>, thisArg: Object): void;
addEventListener(type: "refresh", listener: CollectionEventListener<T>, thisArg: Object): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener): void;
removeEventListener(type: "insert", listener: CollectionEventListener<T>): void;
removeEventListener(type: "erase", listener: CollectionEventListener<T>): void;
removeEventListener(type: "refresh", listener: CollectionEventListener<T>): void;
/**
* @inheritdoc
*/
removeEventListener(type: string, listener: library.BasicEventListener, thisArg: Object): void;
removeEventListener(type: "insert", listener: CollectionEventListener<T>, thisArg: Object): void;
removeEventListener(type: "erase", listener: CollectionEventListener<T>, thisArg: Object): void;
removeEventListener(type: "refresh", listener: CollectionEventListener<T>, thisArg: Object): void;
}
}
declare namespace samchon.collection {
/**
* A {@link TreeMap} who can detect element I/O events.
*
* <ul>
* <li> <i>insert</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link insert} </li>
* <li> {@link push} </li>
* </ul></li>
* <li> <i>erase</i> typed events: <ul>
* <li> {@link assign} </li>
* <li> {@link clear} </li>
* <li> {@link erase} </li>
* <li> {@link extract} </li>
* </ul></li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class TreeSetCollection<T> extends std.TreeSet<T> implements ICollection<T> {
/**
* A chain object taking responsibility of dispatching events.
*/
private event_dispatcher_;
/**
* @inheritdoc
*/
protected _Handle_insert(first: std.SetIterator<T>, last: std.SetIterator<T>): void;
/**
* @inheritdoc
*/
protected _Handle_erase(first: std.SetIterator<T>, last: std.SetIterator<T>): void;
/**
* @inheritdoc