diff --git a/samchon-collection/samchon-collection-tests.ts b/samchon-collection/samchon-collection-tests.ts new file mode 100644 index 0000000000..028eb32caa --- /dev/null +++ b/samchon-collection/samchon-collection-tests.ts @@ -0,0 +1,7 @@ +/// + +declare var global: any; +declare var require: (name: string) => any; + +collection = require("samchon-collection"); +console.log(collection); \ No newline at end of file diff --git a/samchon-collection/samchon-collection.d.ts b/samchon-collection/samchon-collection.d.ts new file mode 100644 index 0000000000..3decceb20b --- /dev/null +++ b/samchon-collection/samchon-collection.d.ts @@ -0,0 +1,23 @@ +// Type definitions for Samchon Collection v0.0.2 +// Project: https://github.com/samchon/framework +// Definitions by: Jeongho Nam +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// ------------------------------------------------------------------------------------ +// In Samchon Collection, merging multiple 'ts' files to a module is not possible yet. +// Instead of using "import" instruction, use such trick: +// +// +// declare var global: any; +// declare var require: Function; +// +// collection = require("samchon-collection"); +// let cont: collection.ArrayCollection = new collection.ArrayCollection(); +// +// +// Those declaration of global and require can be substituted by using "node.d.ts" +// ------------------------------------------------------------------------------------ + +/// + +declare var collection: typeof samchon.collection; \ No newline at end of file diff --git a/samchon-framework/samchon-framework-tests.ts b/samchon-framework/samchon-framework-tests.ts new file mode 100644 index 0000000000..5820b158c3 --- /dev/null +++ b/samchon-framework/samchon-framework-tests.ts @@ -0,0 +1,7 @@ +/// + +declare var global: any; +declare var require: any; + +global["samchon"] = require("samchon-framework"); +console.log(samchon); \ No newline at end of file diff --git a/samchon-framework/samchon-framework.d.ts b/samchon-framework/samchon-framework.d.ts new file mode 100644 index 0000000000..9dd52e9503 --- /dev/null +++ b/samchon-framework/samchon-framework.d.ts @@ -0,0 +1,2710 @@ +// Type definitions for Samchon Framework v1.1.0 +// Project: https://github.com/samchon/framework +// Definitions by: Jeongho Nam +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// ------------------------------------------------------------------------------------ +// In Samchon Framework, merging multiple 'ts' files to a module is not possible yet. +// Instead of using "import" instruction, use such trick: +// +// +// declare var global: any; +// declare var require: Function; +// +// global["samchon"] = require("samchon-framework"); +// let invoke: samchon.protocol.Invoke = new samchon.protocol.Invoke("setValue", 3); +// +// +// Those declaration of global and require can be substituted by using "node.d.ts" +// ------------------------------------------------------------------------------------ + +/// + +/** + * Samchon Framework, A SDN framework. + * + * @author Jeongho Nam + */ +declare namespace samchon { +} +declare namespace samchon.library { +} +declare namespace samchon.collection { +} +declare namespace samchon.protocol { +} +declare namespace samchon.protocol.service { +} +declare namespace samchon.protocol.master { +} +declare namespace samchon.protocol.slave { +} +declare namespace samchon.library { + /** + *

XML is a class representing a tree structued xml objects.

+ *

The XML class provides methods and properties for working with XML objects.

+ * + *

The XML class (along with the XMLList and Namespace) implements + * the powerful XML-handling standard defined in ECMAScript for XML (E4X) specification.

+ * + *

XML class has a recursive, hierarchical relationship.

+ * + *

Relationships between XML and XMLList

+ *
    + *
  • XML contains XMLList from dictionary of XMLList.
  • + *
  • XMLList contains XML from vector of XML.
  • + *
+ * + *

Note

+ *

Do not abuse values for expressing member variables.

+ * + * + * + * + * + * + * + * + * + * + *
Standard UsageNon-standard usage abusing value
+ * <memberList>
+ *      <member id='jhnam88' name='Jeongho+Nam' birthdate='1988-03-11' />
+ *      <member id='master' name='Administartor' birthdate='2011-07-28' />
+ * </memberList> + *
+ * <member>
+ *      <id>jhnam88</id>
+ *      <name>Jeongho+Nam</name>
+ *      <birthdate>1988-03-11</birthdate>
+ * </member> + *
+ * + * @author Jeongho Nam + */ + class XML extends std.HashMap { + /** + *

Tag name of the XML.

+ * + *
    + *
  • \<tag label='property' /\>: tag => \"tag\"
  • + *
  • \<price high='1500' low='1300' open='1450' close='1320' /\>: tag => \"price\"
  • + *
+ */ + private tag; + /** + *

Value of the XML.

+ * + *
    + *
  • \26\: value => 26
  • + *
  • \: value => null
  • + *
+ */ + private value; + /** + *

Properties belongs to the XML.

+ *

A Dictionary of properties accessing each property by its key.

+ * + *
    + *
  • \high='1500' low='1300' open='1450' close='1320' /\>: + * propertyMap => {{\"high\": 1500}, {\"low\": 1300}, {\"open\": 1450}, {\"close\", 1320}}
  • + *
  • \id='jhnam88' name='Jeongho+Nam' comment='Hello.+My+name+is+Jeongho+Nam' \>: + * propertyMap => {{\"id\", \"jhnam88\"}, {\"name\", \"Jeongho Nam \"}, + * {\"comment\", \"Hello. My name is Jeongho Nam \"}}
  • + *
+ */ + private properties; + /** + *

Default Constructor.

+ * + *

If the string parameter is not omitted, constructs its tag, value and + * properties by parsing the string. If there's children, then construct the + * children XML, XMLList objects, too.

+ * + * @param str A string to be parsed + */ + constructor(str?: string); + /** + *

Construct XML objects by parsing a string.

+ */ + private construct(str); + /** + *

Parse and fetch a tag.

+ */ + private parseTag(str); + /** + *

Parse and fetch properties.

+ */ + private parseProperty(str); + /** + *

Parse and fetch a value.

+ */ + private parseValue(str); + /** + *

Parse and construct children XML objects.

+ */ + private parseChildren(str); + /** + *

Get tag.

+ */ + getTag(): string; + /** + *

Get value.

+ */ + getValue(): any; + /** + *

Test wheter a property exists or not.

+ */ + hasProperty(key: string): boolean; + /** + *

Get property by its key.

+ */ + getProperty(key: string): any; + getPropertyMap(): std.HashMap; + /** + *

Set tag (identifier) of the XML.

+ */ + setTag(str: string): void; + /** + *

Set value of the XML.

+ * + *

Do not abuse values for expressing member variables.

+ * + * + * + * + * + * + * + * + * + *
Standard UsageNon-standard usage abusing value
+ * \\n + *     \\n + *     \\n + * \ + * + * \\n + * \jhnam88\\n + * \Jeongho+Nam\\n + * \1988-03-11\\n + * \ + *
+ * + * @param val A value to set + */ + setValue(str: any): void; + /** + *

Set a property with its key.

+ */ + setProperty(key: string, value: any): void; + /** + *

Erase a property by its key.

+ * + * @param key The key of the property to erase + * @throw exception out of range + */ + eraseProperty(key: string): void; + push(...args: std.Pair[]): number; + push(...args: [L, U][]): number; + push(...xmls: XML[]): number; + push(...xmlLists: XMLList[]): number; + addAllProperties(xml: XML): void; + clearProperties(): void; + private calcMinIndex(...args); + /** + *

Decode a value.

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
EncodedDecoded
\&\&
\<\<
\>\>
+ * + * @return A decoded string represents a value + */ + static decodeValue(str: string): string; + /** + *

Encode a value.

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
OriginalEncoded
\&\&
\<\<
\>\>
+ * + * @return A encoded string represents a value + */ + static encodeValue(str: string): string; + /** + *

Decode a property.

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
EncodedDecoded
\&\&
\<\<
\>\>
"\"
''
'
'\\t
\\n
\\r
+ * + * @return A decoded string represents a property + */ + static decodeProperty(str: string): string; + /** + *

Decode a property.

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
OriginalEncoded
\&\&
\<\<
\>\>
\""
''
'
\\t'
\\n
\\r
+ * + * @return A encoded string represents a property + */ + static encodeProperty(str: string): string; + /** + *

Convert the XML to a string.

+ */ + toString(level?: number): string; + /** + *

Convert the XML to HTML string.

+ */ + toHTML(level?: number): string; + } + /** + *

List of XML(s) having same tag.

+ * + * @author Jeongho Nam + */ + class XMLList extends std.Vector { + /** + *

Default Constructor.

+ */ + constructor(); + getTag(): string; + /** + *

Convert XMLList to string.

+ * + * @param level Level(depth) of the XMLList. + */ + toString(level?: number): string; + /** + *

Convert XMLList to HTML string.

+ * + * @param level Level(depth) of the XMLList. + */ + toHTML(level?: number): string; + } +} +declare namespace samchon.collection { + /** + * A {@link Vector} who can detect element I/O events. + * + * @author Jeongho Nam + */ + class ArrayCollection extends std.Vector implements ICollection { + private insert_handler_; + private erase_handler_; + private event_dispatcher_; + /** + * @inheritdoc + */ + set_insert_handler(listener: CollectionHandler): void; + /** + * @inheritdoc + */ + set_erase_handler(listener: CollectionHandler): void; + /** + * @inheritdoc + */ + get_insert_handler(): CollectionHandler; + /** + * @inheritdoc + */ + get_erase_handler(): CollectionHandler; + /** + * @inheritdoc + */ + push(...items: U[]): number; + /** + * @inheritdoc + */ + push_back(val: T): void; + /** + * @hidden + */ + protected insert_by_repeating_val(position: std.VectorIterator, n: number, val: T): std.VectorIterator; + /** + * @hidden + */ + protected insert_by_range>(position: std.VectorIterator, begin: InputIterator, end: InputIterator): std.VectorIterator; + /** + * @inheritdoc + */ + pop_back(): void; + /** + * @hidden + */ + protected erase_by_range(first: std.VectorIterator, last: std.VectorIterator): std.VectorIterator; + /** + * @hidden + */ + private notify_insert(first, last); + /** + * @hidden + */ + private notify_erase(first, last); + /** + * @inheritdoc + */ + hasEventListener(type: string): boolean; + /** + * @inheritdoc + */ + dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + unshift(...items: U[]): number; + /** + * @inheritdoc + */ + pop(): T; + /** + * @inheritdoc + */ + splice(start: number): T[]; + /** + * @inheritdoc + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + } +} +declare namespace samchon.protocol { + /** + *

An entity, a standard data class.

+ * + *

Entity is a class for standardization of expression method using on network I/O by XML. If + * Invoke is a standard message protocol of Samchon Framework which must be kept, Entity is a + * recommended semi-protocol of message for expressing a data class. Following the semi-protocol + * Entity is not imposed but encouraged.

+ * + *

As we could get advantages from standardization of message for network I/O with Invoke, + * we can get additional advantage from standardizing expression method of data class with Entity. + * We do not need to know a part of network communication. Thus, with the Entity, we can only + * concentrate on entity's own logics and relationships between another entities. Entity does not + * need to how network communications are being done.

+ * + *

I say repeatedly. Expression method of Entity is recommended, but not imposed. It's a semi + * protocol for network I/O but not a essential protocol must be kept. The expression method of + * Entity, using on network I/O, is expressed by XML string.

+ * + *

If your own network system has a critical performance issue on communication data class, + * it would be better to using binary communication (with ByteArray). + * Don't worry about the problem! Invoke also provides methods for binary data (ByteArray).

+ * + * @author Jeongho Nam + */ + abstract class Entity implements IEntity { + /** + *

Default Constructor.

+ */ + constructor(); + construct(xml: library.XML): void; + key(): any; + abstract TAG(): string; + toXML(): library.XML; + } +} +declare namespace samchon.library { + /** + * An event class. + * + *
    + *
  • Comments from - https://developer.mozilla.org/en-US/docs/Web/API/Event/
  • + *
+ * + * @author Jeongho Nam + */ + class BasicEvent implements Event { + NONE: number; + CAPTURING_PHASE: number; + AT_TARGET: number; + BUBBLING_PHASE: number; + private type_; + private target_; + 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 + */ + preventDefault(): void; + /** + * @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; + } + class ProgressEvent extends BasicEvent { + static PROGRESS: string; + protected numerator_: number; + protected denominator_: number; + constructor(type: string, numerator: number, denominator: number); + numerator: number; + denominator: number; + } +} +declare namespace samchon.collection { + interface CollectionEventListener extends EventListener { + (event: CollectionEvent): void; + } + class CollectionEvent extends library.BasicEvent { + static INSERT: string; + static ERASE: string; + private first_; + private last_; + constructor(type: string, first: std.Iterator, last: std.Iterator); + container: ICollection; + first: std.Iterator; + last: std.Iterator; + } +} +declare namespace samchon.collection { + /** + * A {@link Deque} who can detect element I/O events. + * + * @author Jeongho Nam + */ + class DequeCollection extends std.Deque implements ICollection { + private insert_handler_; + private erase_handler_; + private event_dispatcher_; + /** + * @inheritdoc + */ + set_insert_handler(listener: CollectionHandler): void; + /** + * @inheritdoc + */ + set_erase_handler(listener: CollectionHandler): void; + /** + * @inheritdoc + */ + get_insert_handler(): CollectionHandler; + /** + * @inheritdoc + */ + get_erase_handler(): CollectionHandler; + /** + * @inheritdoc + */ + push(...items: U[]): number; + /** + * @inheritdoc + */ + push_back(val: T): void; + /** + * @hidden + */ + protected insert_by_repeating_val(position: std.DequeIterator, n: number, val: T): std.DequeIterator; + /** + * @hidden + */ + protected insert_by_range>(position: std.DequeIterator, begin: InputIterator, end: InputIterator): std.DequeIterator; + /** + * @inheritdoc + */ + pop_back(): void; + /** + * @hidden + */ + protected erase_by_range(first: std.DequeIterator, last: std.DequeIterator): std.DequeIterator; + /** + * @hidden + */ + private notify_insert(first, last); + /** + * @hidden + */ + private notify_erase(first, last); + /** + * @inheritdoc + */ + hasEventListener(type: string): boolean; + /** + * @inheritdoc + */ + dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + } +} +declare namespace samchon.collection { + /** + * A {@link HashMap} who can detect element I/O events. + * + * @author Jeongho Nam + */ + class HashMapCollection extends std.HashMap implements ICollection> { + private insert_handler_; + private erase_handler_; + private event_dispatcher_; + /** + * @inheritdoc + */ + get_insert_handler(): MapCollectionHandler; + /** + * @inheritdoc + */ + get_erase_handler(): MapCollectionHandler; + /** + * @inheritdoc + */ + set_insert_handler(listener: MapCollectionHandler): void; + /** + * @inheritdoc + */ + set_erase_handler(listener: MapCollectionHandler): void; + /** + * @inheritdoc + */ + protected handle_insert(first: std.MapIterator, last: std.MapIterator): void; + /** + * @inheritdoc + */ + protected handle_erase(first: std.MapIterator, last: std.MapIterator): void; + /** + * @inheritdoc + */ + hasEventListener(type: string): boolean; + /** + * @inheritdoc + */ + dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + } + /** + * A {@link HashMultiMap} who can detect element I/O events. + * + * @author Jeongho Nam + */ + class HashMultiMapCollection extends std.HashMap implements ICollection> { + private insert_handler_; + private erase_handler_; + private event_dispatcher_; + /** + * @inheritdoc + */ + get_insert_handler(): MapCollectionHandler; + /** + * @inheritdoc + */ + get_erase_handler(): MapCollectionHandler; + /** + * @inheritdoc + */ + set_insert_handler(listener: MapCollectionHandler): void; + /** + * @inheritdoc + */ + set_erase_handler(listener: MapCollectionHandler): void; + /** + * @inheritdoc + */ + protected handle_insert(first: std.MapIterator, last: std.MapIterator): void; + /** + * @inheritdoc + */ + protected handle_erase(first: std.MapIterator, last: std.MapIterator): void; + /** + * @inheritdoc + */ + hasEventListener(type: string): boolean; + /** + * @inheritdoc + */ + dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + } +} +declare namespace samchon.collection { + /** + * A {@link HashSet} who can detect element I/O events. + * + * @author Jeongho Nam + */ + class HashSetCollection extends std.TreeSet implements ICollection { + private insert_handler_; + private erase_handler_; + private event_dispatcher_; + /** + * @inheritdoc + */ + set_insert_handler(listener: CollectionHandler): void; + /** + * @inheritdoc + */ + set_erase_handler(listener: CollectionHandler): void; + /** + * @inheritdoc + */ + get_insert_handler(): CollectionHandler; + /** + * @inheritdoc + */ + get_erase_handler(): CollectionHandler; + /** + * @inheritdoc + */ + protected handle_insert(first: std.SetIterator, last: std.SetIterator): void; + /** + * @inheritdoc + */ + protected handle_erase(first: std.SetIterator, last: std.SetIterator): void; + /** + * @inheritdoc + */ + hasEventListener(type: string): boolean; + /** + * @inheritdoc + */ + dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + } + class HashMultiSetCollection extends std.TreeMultiSet implements ICollection { + private insert_handler_; + private erase_handler_; + private event_dispatcher_; + /** + * @inheritdoc + */ + set_insert_handler(listener: CollectionHandler): void; + /** + * @inheritdoc + */ + set_erase_handler(listener: CollectionHandler): void; + /** + * @inheritdoc + */ + get_insert_handler(): CollectionHandler; + /** + * @inheritdoc + */ + get_erase_handler(): CollectionHandler; + /** + * @inheritdoc + */ + protected handle_insert(first: std.SetIterator, last: std.SetIterator): void; + /** + * @inheritdoc + */ + protected handle_erase(first: std.SetIterator, last: std.SetIterator): void; + /** + * @inheritdoc + */ + hasEventListener(type: string): boolean; + /** + * @inheritdoc + */ + dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + } +} +declare namespace samchon.collection { + interface CollectionHandler { + (first: std.Iterator, last: std.Iterator): void; + } + interface MapCollectionHandler extends CollectionHandler> { + (first: std.MapIterator, last: std.MapIterator): void; + } + /** + * An interface for {@link IContainer containers} who can detect element I/O events. + * + * @author Jeongho Nam + */ + interface ICollection extends std.base.IContainer, library.IEventDispatcher { + get_insert_handler(): CollectionHandler; + get_erase_handler(): CollectionHandler; + set_insert_handler(listener: CollectionHandler): any; + set_erase_handler(listener: CollectionHandler): any; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + } +} +declare namespace samchon.collection { + /** + * A {@link List} who can detect element I/O events. + * + * @author Jeongho Nam + */ + class ListCollection extends std.List implements ICollection { + private insert_handler_; + private erase_handler_; + private event_dispatcher_; + /** + * @inheritdoc + */ + set_insert_handler(listener: CollectionHandler): void; + /** + * @inheritdoc + */ + set_erase_handler(listener: CollectionHandler): void; + /** + * @inheritdoc + */ + get_insert_handler(): CollectionHandler; + /** + * @inheritdoc + */ + get_erase_handler(): CollectionHandler; + /** + * @inheritdoc + */ + push(...items: T[]): number; + /** + * @inheritdoc + */ + push_front(val: T): void; + /** + * @inheritdoc + */ + push_back(val: T): void; + /** + * @hidden + */ + protected insert_by_repeating_val(position: std.ListIterator, n: number, val: T): std.ListIterator; + /** + * @hidden + */ + protected insert_by_range>(position: std.ListIterator, begin: InputIterator, end: InputIterator): std.ListIterator; + /** + * @inheritdoc + */ + pop_front(): void; + /** + * @inheritdoc + */ + pop_back(): void; + /** + * @hidden + */ + protected erase_by_range(first: std.ListIterator, last: std.ListIterator): std.ListIterator; + /** + * @hidden + */ + private notify_insert(first, last); + /** + * @hidden + */ + private notify_erase(first, last); + /** + * @inheritdoc + */ + hasEventListener(type: string): boolean; + /** + * @inheritdoc + */ + dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + } +} +declare namespace samchon.collection { + /** + * A {@link TreeMap} who can detect element I/O events. + * + * @author Jeongho Nam + */ + class TreeMapCollection extends std.HashMap implements ICollection> { + private insert_handler_; + private erase_handler_; + private event_dispatcher_; + /** + * @inheritdoc + */ + get_insert_handler(): MapCollectionHandler; + /** + * @inheritdoc + */ + get_erase_handler(): MapCollectionHandler; + /** + * @inheritdoc + */ + set_insert_handler(listener: MapCollectionHandler): void; + /** + * @inheritdoc + */ + set_erase_handler(listener: MapCollectionHandler): void; + /** + * @inheritdoc + */ + protected handle_insert(first: std.MapIterator, last: std.MapIterator): void; + /** + * @inheritdoc + */ + protected handle_erase(first: std.MapIterator, last: std.MapIterator): void; + /** + * @inheritdoc + */ + hasEventListener(type: string): boolean; + /** + * @inheritdoc + */ + dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + } + /** + * A {@link TreeMultiMap} who can detect element I/O events. + * + * @author Jeongho Nam + */ + class TreeMultiMapCollection extends std.HashMap implements ICollection> { + private insert_handler_; + private erase_handler_; + private event_dispatcher_; + /** + * @inheritdoc + */ + get_insert_handler(): MapCollectionHandler; + /** + * @inheritdoc + */ + get_erase_handler(): MapCollectionHandler; + /** + * @inheritdoc + */ + set_insert_handler(listener: MapCollectionHandler): void; + /** + * @inheritdoc + */ + set_erase_handler(listener: MapCollectionHandler): void; + /** + * @inheritdoc + */ + protected handle_insert(first: std.MapIterator, last: std.MapIterator): void; + /** + * @inheritdoc + */ + protected handle_erase(first: std.MapIterator, last: std.MapIterator): void; + /** + * @inheritdoc + */ + hasEventListener(type: string): boolean; + /** + * @inheritdoc + */ + dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + } +} +declare namespace samchon.collection { + /** + * A {@link TreeMap} who can detect element I/O events. + * + * @author Jeongho Nam + */ + class TreeSetCollection extends std.TreeSet implements ICollection { + private insert_handler_; + private erase_handler_; + private event_dispatcher_; + /** + * @inheritdoc + */ + set_insert_handler(listener: CollectionHandler): void; + /** + * @inheritdoc + */ + set_erase_handler(listener: CollectionHandler): void; + /** + * @inheritdoc + */ + get_insert_handler(): CollectionHandler; + /** + * @inheritdoc + */ + get_erase_handler(): CollectionHandler; + /** + * @inheritdoc + */ + protected handle_insert(first: std.SetIterator, last: std.SetIterator): void; + /** + * @inheritdoc + */ + protected handle_erase(first: std.SetIterator, last: std.SetIterator): void; + /** + * @inheritdoc + */ + hasEventListener(type: string): boolean; + /** + * @inheritdoc + */ + dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + } + /** + * A {@link TreeMultiSet} who can detect element I/O events. + * + * @author Jeongho Nam + */ + class TreeMultiSetCollection extends std.TreeMultiSet implements ICollection { + private insert_handler_; + private erase_handler_; + private event_dispatcher_; + /** + * @inheritdoc + */ + set_insert_handler(listener: CollectionHandler): void; + /** + * @inheritdoc + */ + set_erase_handler(listener: CollectionHandler): void; + /** + * @inheritdoc + */ + get_insert_handler(): CollectionHandler; + /** + * @inheritdoc + */ + get_erase_handler(): CollectionHandler; + /** + * @inheritdoc + */ + protected handle_insert(first: std.SetIterator, last: std.SetIterator): void; + /** + * @inheritdoc + */ + protected handle_erase(first: std.SetIterator, last: std.SetIterator): void; + /** + * @inheritdoc + */ + hasEventListener(type: string): boolean; + /** + * @inheritdoc + */ + dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + } +} +declare namespace samchon.library { + /** + *

Case generator.

+ * + *

CaseGenerator is an abstract case generator using like a matrix.

+ *
    + *
  • nTTr(n^r) -> CombinedPermutationGenerator
  • + *
  • nPr -> PermutationGenerator
  • + *
  • n! -> FactorialGenerator
  • + *
+ * + * @author Jeongho Nam + */ + abstract class CaseGenerator { + /** + *

Size, the number of all cases.

+ */ + protected size_: number; + /** + *

N, size of the candidates.

+ */ + protected n_: number; + /** + *

R, size of elements of each case.

+ */ + protected r_: number; + /** + *

Construct from size of N and R.

+ * + * @param n Size of candidates. + * @param r Size of elements of each case. + */ + constructor(n: number, r: number); + /** + *

Get size of all cases.

+ * + * @return Get a number of the all cases. + */ + size(): number; + /** + *

Get size of the N.

+ */ + n(): number; + /** + *

Get size of the R.

+ */ + r(): number; + /** + *

Get index'th case.

+ * + * @param index Index number + * @return The row of the index'th in combined permuation case + */ + abstract at(index: number): Array; + } + /** + *

A combined-permutation case generator.

+ *

nTTr

+ * + * @inheritdoc + * @author Jeongho Nam + */ + class CombinedPermutationGenerator extends CaseGenerator { + /** + *

An array using for dividing each element index.

+ */ + private dividerArray; + /** + *

Construct from size of N and R.

+ * + * @param n Size of candidates. + * @param r Size of elements of each case. + */ + constructor(n: number, r: number); + at(index: number): Array; + } + /** + *

A permutation case generator.

+ *

nPr

+ * + * @author Jeongho Nam + * @inheritdoc + */ + class PermuationGenerator extends CaseGenerator { + /** + *

Construct from size of N and R.

+ * + * @param n Size of candidates. + * @param r Size of elements of each case. + */ + constructor(n: number, r: number); + /** + * @inheritdoc + */ + at(index: number): Array; + } + class FactorialGenerator extends PermuationGenerator { + /** + * Construct from factorial size N. + * + * @param n Factoria size N. + */ + constructor(n: number); + } +} +declare namespace samchon.library { + /** + *

The IEventDispatcher interface defines methods for adding or removing event listeners, checks + * whether specific types of event listeners are registered, and dispatches events.

+ * + *

Event targets are an important part of the Flash�� Player and Adobe AIR event model. The event + * target serves as the focal point for how events flow through the display list hierarchy. When an + * event such as a mouse click or a keypress occurs, an event object is dispatched into the event flow + * from the root of the display list. The event object makes a round-trip journey to the event target, + * which is conceptually divided into three phases: the capture phase includes the journey from the + * root to the last node before the event target's node; the target phase includes only the event + * target node; and the bubbling phase includes any subsequent nodes encountered on the return trip to + * the root of the display list.

+ * + *

In general, the easiest way for a user-defined class to gain event dispatching capabilities is + * to extend EventDispatcher. If this is impossible (that is, if the class is already extending another + * class), you can instead implement the IEventDispatcher interface, create an EventDispatcher member, + * and write simple hooks to route calls into the aggregated EventDispatcher.

+ * + *
    + *
  • Made by AS3 - http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/IEventDispatcher.html + *
+ * + * @see EventDispatcher + * @author Migrated by Jeongho Nam + */ + interface IEventDispatcher { + /** + *

Checks whether the EventDispatcher object has any listeners registered for a specific type + * of event. This allows you to determine where an EventDispatcher object has altered handling of + * an event type in the event flow hierarchy. To determine whether a specific event type actually + * triggers an event listener, use willTrigger().

+ * + *

The difference between hasEventListener() and willTrigger() is that hasEventListener() + * examines only the object to which it belongs, whereas willTrigger() examines the entire event + * flow for the event specified by the type parameter.

+ * + * @param type The type of event. + */ + hasEventListener(type: string): boolean; + /** + *

Dispatches an event into the event flow.

+ *

The event target is the EventDispatcher object upon which the dispatchEvent() method is called.

+ * + * @param event The Event object that is dispatched into the event flow. If the event is being + * redispatched, a clone of the event is created automatically. After an event is + * dispatched, its target property cannot be changed, so you must create a new copy + * of the event for redispatching to work. + */ + dispatchEvent(event: BasicEvent): boolean; + /** + *

Registers an event listener object with an EventDispatcher object so that the listener + * receives notification of an event. You can register event listeners on all nodes in the display + * list for a specific type of event, phase, and priority. + * + *

After you successfully register an event listener, you cannot change its priority through + * additional calls to addEventListener(). To change a listener's priority, you must first call + * removeEventListener(). Then you can register the listener again with the new priority level.

+ * + *

Keep in mind that after the listener is registered, subsequent calls to addEventListener() + * with a different type or useCapture value result in the creation of a separate listener + * registration. For example, if you first register a listener with useCapture set to true, + * it listens only during the capture phase. If you call addEventListener() again using the same + * listener object, but with useCapture set to false, you have two separate listeners: one that + * listens during the capture phase and another that listens during the target and bubbling phases.

+ * + *

You cannot register an event listener for only the target phase or the bubbling phase. + * Those phases are coupled during registration because bubbling applies only to the ancestors of + * the target node.

+ * + *

If you no longer need an event listener, remove it by calling removeEventListener(), or + * memory problems could result. Event listeners are not automatically removed from memory because + * the garbage collector does not remove the listener as long as the dispatching object exists + * (unless the useWeakReference parameter is set to true).

+ * + *

Copying an EventDispatcher instance does not copy the event listeners attached to it. (If + * your newly created node needs an event listener, you must attach the listener after creating + * the node.) However, if you move an EventDispatcher instance, the event listeners attached to + * it move along with it.

+ * + *

If the event listener is being registered on a node while an event is also being processed + * on this node, the event listener is not triggered during the current phase but may be triggered + * during a later phase in the event flow, such as the bubbling phase.

+ * + *

If an event listener is removed from a node while an event is being processed on the node, + * it is still triggered by the current actions. After it is removed, the event listener is never + * invoked again (unless it is registered again for future processing).

+ * + * @param event The type of event. + * @param listener The listener function that processes the event. + * This function must accept an Event object as its only parameter and must return + * nothing. + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + /** + * Removes a listener from the EventDispatcher object. If there is no matching listener registered + * with the EventDispatcher object, a call to this method has no effect. + * + * @param type The type of event. + * @param listener The listener object to remove. + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + } + /** + *

Registers an event listener object with an EventDispatcher object so that the listener + * receives notification of an event. You can register event listeners on all nodes in the display + * list for a specific type of event, phase, and priority.

+ * + *

After you successfully register an event listener, you cannot change its priority through + * additional calls to addEventListener(). To change a listener's priority, you must first call + * removeListener(). Then you can register the listener again with the new priority level.

+ * + * Keep in mind that after the listener is registered, subsequent calls to addEventListener() + * with a different type or useCapture value result in the creation of a separate listener registration. + * For example, if you first register a listener with useCapture set to true, it listens only during the + * capture phase. If you call addEventListener() again using the same listener object, but with + * useCapture set to false, you have two separate listeners: one that listens during the capture + * phase and another that listens during the target and bubbling phases. + * + *

You cannot register an event listener for only the target phase or the bubbling phase. Those + * phases are coupled during registration because bubbling applies only to the ancestors of the + * target node.

+ * + *

If you no longer need an event listener, remove it by calling removeEventListener(), + * or memory problems could result. Event listeners are not automatically removed from memory + * because the garbage collector does not remove the listener as long as the dispatching object + * exists (unless the useWeakReference parameter is set to true).

+ * + *

Copying an EventDispatcher instance does not copy the event listeners attached to it. (If your + * newly created node needs an event listener, you must attach the listener after creating the + * node.) However, if you move an EventDispatcher instance, the event listeners attached to it move + * along with it.

+ * + *

If the event listener is being registered on a node while an event is being processed on + * this node, the event listener is not triggered during the current phase but can be triggered + * during a later phase in the event flow, such as the bubbling phase.

+ * + *

If an event listener is removed from a node while an event is being processed on the node, it is + * still triggered by the current actions. After it is removed, the event listener is never invoked + * again (unless registered again for future processing).

+ * + *
    + *
  • Made by AS3 - http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/EventDispatcher.html + *
+ * + * @author Migrated by Jeongho Nam + */ + class EventDispatcher implements IEventDispatcher { + /** + * The origin object who issuing events. + */ + protected target: IEventDispatcher; + /** + * Container of listeners. + */ + protected listeners: std.HashMap>>; + /** + * Default Constructor. + */ + constructor(); + /** + * Construct from the origin event dispatcher. + * + * @param target The origin object who issuing events. + */ + constructor(target: IEventDispatcher); + /** + * @inheritdoc + */ + hasEventListener(type: string): boolean; + /** + * @inheritdoc + */ + dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg?: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg?: Object): void; + } +} +declare namespace samchon.library { + /** + *

A utility class supporting static methods of string.

+ * + * @author Jeongho Nam + */ + class StringUtil { + /** + *

Generate a substring.

+ * + *

Extracts a substring consisting of the characters from specified start to end. + * It's same with str.substring( ? = (str.find(start) + start.size()), str.find(end, ?) )

+ * + * + let str = between("ABCD[EFGH]IJK", "[", "]"); + console.log(str); // PRINTS "EFGH" + * + * + *
    + *
  • If start is not specified, extracts from begin of the string to end.
  • + *
  • If end is not specified, extracts from start to end of the string.
  • + *
  • If start and end are all omitted, returns str, itself.
  • + *
+ * + * @param str Target string to be applied between + * @param start A string for separating substring at the front + * @param end A string for separating substring at the end + * + * @return substring by specified terms + */ + static between(str: string, start?: string, end?: string): string; + /** + *

Fetch substrings.

+ * + *

Splits a string into an array of substrings dividing by specified delimeters of start and end. + * It's the array of substrings adjusted the between.

+ * + *
    + *
  • If startStr is omitted, it's same with the split by endStr not having last item.
  • + *
  • If endStr is omitted, it's same with the split by startStr not having first item.
  • + *
  • If startStr and endStar are all omitted, returns str.
  • + *
+ * + * @param str Target string to split by between + * @param start A string for separating substring at the front. + * If omitted, it's same with split(end) not having last item + * @param end A string for separating substring at the end. + * If omitted, it's same with split(start) not having first item + * @return An array of substrings + */ + static betweens(str: string, start?: string, end?: string): Array; + /** + * An array containing whitespaces. + */ + private static SPACE_ARRAY; + /** + * Remove all designated characters from the beginning and end of the specified string. + * + * @param str The string whose designated characters should be trimmed. + * @param args Designated character(s). + * + * @return Updated string where designated characters was removed from the beginning and end. + */ + static trim(str: string, ...args: string[]): string; + /** + * Remove all designated characters from the beginning of the specified string. + * + * @param str The string should be trimmed. + * @param delims Designated character(s). + * + * @return Updated string where designated characters was removed from the beginning + */ + static ltrim(str: string, ...args: string[]): string; + /** + * Remove all designated characters from the end of the specified string. + * + * @param str The string should be trimmed. + * @param delims Designated character(s). + * + * @return Updated string where designated characters was removed from the end. + */ + static rtrim(str: string, ...args: string[]): string; + /** + * Substitute {n} tokens within the specified string. + * + * @param format The string to make substitutions in. This string can contain special tokens of the form + * {n}, where n is a zero based index, that will be replaced with the + * additional parameters found at that index if specified. + * @param args Additional parameters that can be substituted in the format parameter at each + * {n} location, where n is an integer (zero based) index value into + * the array of values specified. + * + * @return New string with all of the {n} tokens replaced with the respective arguments specified. + */ + static substitute(format: string, ...args: any[]): string; + /** + * Returns a string specified word is replaced. + * + * @param str Target string to replace + * @param before Specific word you want to be replaced + * @param after Specific word you want to replace + * + * @return A string specified word is replaced + */ + static replaceAll(str: string, before: string, after: string): string; + /** + * Returns a string specified words are replaced. + * + * @param str Target string to replace + * @param pairs A specific word's pairs you want to replace and to be replaced + * + * @return A string specified words are replaced + */ + static replaceAll(str: string, ...pairs: std.Pair[]): string; + /** + *

Get a tabbed string by specified size.

+ */ + static tab(size: number): string; + /** + *

Get a tabbed HTLM string by specified size.

+ */ + static htmlTab(size: number): string; + /** + * Replace all HTML spaces to a literal space. + * + * @param str Target string to replace. + */ + static removeHTMLSpaces(str: string): string; + } +} +declare namespace samchon.protocol { + /** + * @author Jeongho Nam + */ + abstract class EntityArray extends std.Vector { + /** + * Default Constructor. + */ + constructor(); + /** + *

Construct data of the Entity from an XML object.

+ * + *

Constructs the EntityArray's own member variables only from the input XML object.

+ * + *

Do not consider about constructing children Entity objects' data in EntityArray::construct(). + * Those children Entity objects' data will constructed by their own construct() method. Even insertion + * of XML objects representing children are done by abstract method of EntityArray::toXML().

+ * + *

Constructs only data of EntityArray's own.

+ * + * @inheritdoc + */ + construct(xml: library.XML): void; + /** + *

Factory method of a child Entity.

+ * + *

EntityArray::createChild() is a factory method creating a new child Entity which is belonged + * to the EntityArray. This method is called by EntityArray::construct(). The children construction + * methods Entity::construct() will be called by abstract method of the EntityArray::construct().

+ * + * @return A new child Entity belongs to EntityArray. + */ + protected abstract createChild(xml: library.XML): Ety; + /** + * @inheritdoc + */ + key(): any; + /** + *

Whether have the item or not.

+ * + *

Indicates whether a map has an item having the specified identifier.

+ * + * @param key Key value of the element whose mapped value is accessed. + * + * @return Whether the map has an item having the specified identifier. + */ + has(key: any): boolean; + /** + *

Count elements with a specific key.

+ * + *

Searches the container for elements whose key is key and returns the number of elements found.

+ * + * @param key Key value to be searched for. + * + * @return The number of elements in the container with a key. + */ + count(key: any): number; + /** + *

Get an element

+ * + *

Returns a reference to the mapped value of the element identified with key.

+ * + * @param key Key value of the element whose mapped value is accessed. + * + * @throw exception out of range + * + * @return A reference object of the mapped value (_Ty) + */ + get(key: string): Ety; + /** + * @inheritdoc + */ + abstract TAG(): string; + /** + *

A tag name of children objects.

+ */ + abstract CHILD_TAG(): string; + /** + *

Get an XML object represents the EntityArray.

+ * + *

Archives the EntityArray's own member variables only to the returned XML object.

+ * + *

Do not consider about archiving children Entity objects' data in EntityArray::toXML(). + * Those children Entity objects will converted to XML object by their own toXML() method. The + * insertion of XML objects representing children are done by abstract method of + * EntityArray::toXML().

+ * + *

Archives only data of EntityArray's own.

+ * + * @inheritdoc + */ + toXML(): library.XML; + } +} +declare namespace samchon.protocol { + /** + *

A network driver for an external system.

+ * + *

ExternalSystem is a boundary class interacting with an external system by network communication. + * Also, ExternalSystem is an abstract class that a network role, which one is server and which one is + * client, is not determined yet.

+ * + *

The ExternalSystem has ExternalSystemRole(s) groupped methods, handling Invoke message + * interacting with the external system, by subject or unit of a moudle. The ExternalSystemRole is + * categorized in a 'control'.

+ * + *

Note

+ *

The ExternalSystem class takes a role of interaction with external system in network level. + * However, within a framework of Samchon Framework, a boundary class like the ExternalSystem is + * not such important. You can find some evidence in a relationship between ExternalSystemArray, + * ExternalSystem and ExternalSystemRole.

+ * + *

Of course, the ExternalSystemRole is belonged to an ExternalSystem. However, if you + * access an ExternalSystemRole from an ExternalSystemArray directly, not passing by a belonged + * ExternalSystem, and send an Invoke message even you're not knowing which ExternalSystem is + * related in, it's called "Proxy pattern". + * + *

Like the explanation of "Proxy pattern", you can utilize an ExternalSystemRole as a proxy + * of an ExternalSystem. With the pattern, you can only concentrate on ExternalSystemRole itself, + * what to do with Invoke message, irrespective of the ExternalSystemRole is belonged to which + * ExternalSystem.

+ * + * @author Jeongho Nam + */ + abstract class ExternalSystem extends EntityArray implements IProtocol { + /** + *

A driver for interacting with (real, physical) external system.

+ */ + protected driver: ServerConnector; + /** + *

A name can identify an external system.

+ * + *

The name must be unique in ExternalSystemArray.

+ */ + protected name: string; + /** + *

An ip address of an external system.

+ */ + protected ip: string; + /** + *

A port number of an external system.

+ */ + protected port: number; + /** + *

Default Constructor.

+ */ + constructor(); + /** + *

Start interaction.

+ *

An abstract method starting interaction with an external system.

+ * + *

If an external systems are a server, starts connection and listening Inovoke message, + * else clients, just starts listening only. You also can addict your own procudures of starting + * the driver, but if you directly override method of abstract ExternalSystem, be careful about + * virtual inheritance.

+ */ + start(): void; + key(): any; + /** + *

Get name.

+ */ + getName(): string; + /** + *

Get ip address of the external system.

+ */ + getIP(): string; + /** + *

Get port number of the external system.

+ */ + getPort(): number; + sendData(invoke: Invoke): void; + replyData(invoke: Invoke): void; + TAG(): string; + CHILD_TAG(): string; + } +} +declare namespace samchon.protocol { + /** + *

An array of ExternalSystem(s).

+ * + *

ExternalSystemArray is an abstract class containing and managing external system drivers.

+ * + *

Also, ExternalSystemArray can access to ExternalSystemRole(s) directly. With the method, you + * can use an ExternalSystemRole as "logical proxy" of an ExternalSystem. Of course, the + * ExternalSystemRole is belonged to an ExternalSystem. However, if you access an ExternalSystemRole + * from an ExternalSystemArray directly, not passing by a belonged ExternalSystem, and send an Invoke + * message even you're not knowing which ExternalSystem is related in, the ExternalSystemRole acted + * a role of proxy.

+ * + *

It's called as "Proxy pattern". With the pattern, you can only concentrate on + * ExternalSystemRole itself, what to do with Invoke message, irrespective of the ExternalSystemRole + * is belonged to which ExternalSystem.

+ * + *
    + *
  • ExternalSystemArray::getRole("something")->sendData(invoke);
  • + *
+ * + * @author Jeongho Nam + */ + abstract class ExternalSystemArray extends EntityArray implements IProtocol { + /** + * Default Constructor. + */ + constructor(); + /** + *

Start interaction.

+ *

An abstract method starting interaction with external systems.

+ * + *

If external systems are servers, starts connection to them, else clients, opens a server + * and accepts the external systems. You can addict your own procudures of starting drivers, but + * if you directly override method of abstract ExternalSystemArray, be careful about virtual + * inheritance.

+ */ + start(): void; + /** + *

Test whether has a role.

+ * + * @param name Name of an ExternalSystemRole. + * @return Whether has or not. + */ + hasRole(key: string): boolean; + /** + *

Get a role.

+ * + * @param name Name of an ExternalSystemRole + * @return A shared pointer of specialized role + */ + getRole(key: string): ExternalSystemRole; + sendData(invoke: Invoke): void; + replyData(invoke: Invoke): void; + TAG(): string; + CHILD_TAG(): string; + } +} +declare namespace samchon.protocol { + /** + *

A role belongs to an external system.

+ * + *

ExternalSystemRole is a 'control' class groupping methods, handling Invoke messages + * interacting with an external system that the ExternalSystemRole is belonged to, by a subject or + * unit of a module.

+ * + *

ExternalSystemRole can be a "logical proxy" for an ExternalSystem which is containing the + * ExternalSystemRole. Of course, the ExternalSystemRole is belonged to an ExternalSystem. However, + * if you access an ExternalSystemRole from an ExternalSystemArray directly, not passing by a + * belonged ExternalSystem, and send an Invoke message even you're not knowing which ExternalSystem + * is related in, the ExternalSystemRole acted a role of proxy.

+ * + *

It's called as "Proxy pattern". With the pattern, you can only concentrate on + * ExternalSystemRole itself, what to do with Invoke message, irrespective of the ExternalSystemRole + * is belonged to which ExternalSystem.

+ * + * @author Jeongho Nam + */ + class ExternalSystemRole extends Entity implements IProtocol { + /** + *

A driver of external system containing the ExternalSystemRole.

+ */ + protected system: ExternalSystem; + /** + *

A name representing the role.

+ */ + protected name: string; + protected sendListeners: std.HashSet; + /** + *

Construct from external system driver.

+ * + * @param system A driver of external system the ExternalSystemRole is belonged to. + */ + constructor(system: ExternalSystem); + construct(xml: library.XML): void; + getName(): string; + hasSendListener(key: string): boolean; + sendData(invoke: Invoke): void; + replyData(invoke: Invoke): void; + TAG(): string; + toXML(): library.XML; + } +} +declare namespace samchon.protocol { + /** + *

An interface of entity.

+ * + *

Entity is a class for standardization of expression method using on network I/O by XML. If + * Invoke is a standard message protocol of Samchon Framework which must be kept, Entity is a + * recommended semi-protocol of message for expressing a data class. Following the semi-protocol + * Entity is not imposed but encouraged.

+ * + *

As we could get advantages from standardization of message for network I/O with Invoke, + * we can get additional advantage from standardizing expression method of data class with Entity. + * We do not need to know a part of network communication. Thus, with the Entity, we can only + * concentrate on entity's own logics and relationships between another entities. Entity does not + * need to how network communications are being done.

+ * + *

I say repeatedly. Expression method of Entity is recommended, but not imposed. It's a semi + * protocol for network I/O but not a essential protocol must be kept. The expression method of + * Entity, using on network I/O, is expressed by XML string.

+ * + *

If your own network system has a critical performance issue on communication data class, + * it would be better to using binary communication (with ByteArray). + * Don't worry about the problem! Invoke also provides methods for binary data (ByteArray).

+ * + * @author Jeongho Nam + */ + interface IEntity { + /** + *

Construct data of the Entity from a XML object.

+ * + *

Overrides the construct() method and fetch data of member variables from the XML.

+ * + *

By recommended guidance, data representing member variables are contained in properties + * of the put XML object.

+ * + * @param xml An xml used to contruct data of entity. + */ + construct(xml: library.XML): any; + /** + *

Get a key that can identify the Entity uniquely.

+ * + *

If identifier of the Entity is not atomic value, returns a string or paired object + * that can represents the composite identifier.

+ */ + key(): any; + /** + *

A tag name when represented by XML.

+ * + *
    + *
  • <TAG {...properties} />
  • + *
+ */ + TAG(): string; + /** + *

Get a XML object represents the Entity.

+ * + *

A member variable (not object, but atomic value like number, string or date) is categorized + * as a property within the framework of entity side. Thus, when overriding a toXML() method and + * archiving member variables to an XML object to return, puts each variable to be a property + * belongs to only a XML object.

+ * + *

Don't archive the member variable of atomic value to XML::value causing enormouse creation + * of XML objects to number of member variables. An Entity must be represented by only a XML + * instance (tag).

+ * + * + * + * + * + * + * + * + * + * + *
Standard Usage Non-standard usage abusing value
+ * <memberList>
+ * <member id='jhnam88' name='Jeongho+Nam' birthdate='1988-03-11' />
+ <member id='master' name='Administartor' birthdate='2011-07-28' />
+</memberList> + *
+ * <member> + * <id>jhnam88</id> + * <name>Jeongho+Nam<name> + * <birthdate>1988-03-11</birthdate> + * </member> + *
+ * + * @return An XML object representing the Entity. + */ + toXML(): library.XML; + } +} +declare namespace samchon.protocol { + /** + *

An interface for Invoke message chain.

+ * + *

IProtocol is an interface for Invoke message, which is standard message of network I/O + * in Samchon Framework, chain. The IProtocol interface is used to network drivers and some + * classes which are in a relationship of chain of responsibility with those network drivers.

+ * + *

In Samchon Framework, server side, IProtocol is one of the basic 3 + 1 components that + * can make any type of network system in Samchon Framework with IServer and IClient. Following + * the "chain of responsibility" pa1ttern, looking around classes in Samchon Framework, you + * can see all related classes with network I/O are implemented from the IProtocol.

+ * + * @see Invoke + * @author Jeongho Nam + */ + interface IProtocol { + /** + *

Sending message.

+ *

Sends message to related system or shifts the responsibility to chain.

+ * + * @param invoke Invoke message to send + */ + replyData(invoke: Invoke): void; + /** + *

Handling replied message.

+ *

Handles replied message or shifts the responsibility to chain.

+ * + * @param invoke Replied invoke message + */ + sendData(invoke: Invoke): void; + } +} +declare namespace samchon.protocol { + /** + *

Standard message of network I/O.

+ *

Invoke is a class used in network I/O in protocol package of Samchon Framework.

+ * + *

The Invoke message has an XML structure like the result screen of provided example in below. + * We can enjoy lots of benefits by the normalized and standardized message structure used in + * network I/O.

+ * + *

The greatest advantage is that we can make any type of network system, even how the system + * is enourmously complicated. As network communication message is standardized, we only need to + * concentrate on logical relationships between network systems. We can handle each network system + * like a object (class) in OOD. And those relationships can be easily designed by using design + * pattern.

+ * + *

In Samchon Framework, you can make any type of network system with basic 3 + 1 componenets + * (IProtocol, IServer and IClient + ServerConnector), by implemens or inherits them, like designing + * classes of S/W architecture.

+ * + * @see IProtocol + * @author Jeongho Nam + */ + class Invoke extends EntityArray { + /** + *

Listener, represent function's name.

+ */ + protected listener: string; + constructor(listener: string); + /** + * Copy Constructor. + * + * @param invoke + */ + constructor(invoke: Invoke); + constructor(xml: library.XML); + constructor(listener: string, begin: std.VectorIterator, end: std.VectorIterator); + constructor(listener: string, ...parameters: any[]); + /** + * @inheritdoc + */ + protected createChild(xml: library.XML): InvokeParameter; + /** + * Get listener. + */ + getListener(): string; + /** + *

Get arguments for Function.apply().

+ * + * @return An array containing values of the contained parameters. + */ + getArguments(): Array; + /** + *

Apply to a matched function.

+ */ + apply(obj: IProtocol): boolean; + /** + * @inheritdoc + */ + TAG(): string; + /** + * @inheritdoc + */ + CHILD_TAG(): string; + } +} +declare namespace samchon.protocol { + /** + *

A history of an Invoke message.

+ * + *

InvokeHistory is a class for reporting history log of an Invoke message with elapsed time + * from a slave to its master.

+ * + *

With the elapsed time, consumed time for a process of handling the Invoke message, + * InvokeHistory is reported to the master. The master utilizies the elapsed time to estimating + * performances of each slave system. With the estimated performan index, master retrives the + * optimal solution of distributing processes.

+ * + * @author Jeongho Nam + */ + class InvokeHistory extends Entity { + /** + *

An identifier.

+ */ + protected uid: number; + /** + *

A listener of the Invoke message.

+ * + *

InvokeHistory does not archive entire data of an Invoke message. InvokeHistory only + * archives its listener. The first, formal reason is to save space, avoid wasting spaces.

+ * + *

The second, complicate reason is on an aspect of which systems are using the + * InvokeHistory class. InvokeHistory is designed to let slave reports to master elapsed time + * of a process used to handling the Invoke message. If you want to archive entire history log + * of Invoke messages, then the subject should be master, not the slave using InvokeHistory + * classes.

+ */ + protected listener: string; + /** + *

Start time of the history.

+ * + *

Means start time of a process handling the Invoke message. The start time not only + * has ordinary arguments represented Datetime (year to seconds), but also has very precise + * values under seconds, which is expressed as nano seconds (10^-9).

+ * + *

The precise start time will be used to calculate elapsed time with end time.

+ */ + protected startTime: Date; + /** + *

End time of the history.

+ * + * @details + *

Means end time of a process handling the Invoke message. The end time not only + * has ordinary arguments represented Datetime (year to seconds), but also has very precise + * values under seconds, which is expressed as nano seconds (10^-9).

+ * + *

The precise end time will be used to calculate elapsed time with start time.

+ */ + protected endTime: Date; + /** + *

Construct from an Invoke message.

+ * + *

InvokeHistory does not archive entire Invoke message, only archives its listener.

+ * + * @param invoke A message to archive its history log + */ + constructor(invoke: Invoke); + /** + *

Notify end of the process.

+ * + *

Notifies end of a process handling the matched Invoke message to InvokeHistory.

+ *

InvokeHistory archives the end datetime and calculates elapsed time as nanoseconds.

+ */ + notifyEnd(): void; + TAG(): string; + toXML(): library.XML; + /** + *

Get an Invoke message.

+ * + *

Returns an Invoke message to report to a master that how much time was elapsed on a + * process handling the Invoke message. In master, those reports are used to estimate + * performance of each slave system.

+ * + * @return An Invoke message to report master. + */ + toInvoke(): Invoke; + } +} +declare namespace samchon.protocol { + /** + * A parameter belongs to an Invoke. + * + * @see Invoke + * @author Jeongho Nam + */ + class InvokeParameter extends Entity { + /** + *

Name of the parameter.

+ * + * @details Optional property, can be omitted. + */ + protected name: string; + /** + *

Type of the parameter.

+ */ + protected type: string; + /** + *

Value of the parameter.

+ */ + protected value: any; + constructor(); + constructor(name: string, val: any); + constructor(name: string, type: string, val: any); + construct(xml: library.XML): void; + key(): any; + /** + * Get name. + */ + getName(): string; + /** + * Get type. + */ + getType(): string; + /** + * Get value. + */ + getValue(): any; + TAG(): string; + toXML(): library.XML; + } +} +declare namespace samchon.protocol { + /** + *

A server connector for a physical client.

+ * + *

ServerConnector is a class for a physical client connecting a server. If you want to connect + * to a server, then implements this ServerConnector and just override some methods like + * getIP(), getPort() and replyData(). That's all.

+ * + *

In Samchon Framework, package protocol, There are basic 3 + 1 components that can make any + * type of network system in Samchon Framework. The basic 3 components are IProtocol, IServer and + * IClient. The last, surplus one is the ServerConnector. Looking around classes in + * Samchon Framework, especially module master and slave which are designed for realizing + * distributed processing systems and parallel processing systems, physical client classes are all + * derived from this ServerConnector.

+ * + * + * + * @author Jeongho Nam + */ + class ServerConnector implements IProtocol { + /** + *

A parent object who listens and sends Invoke message.

+ * + *
    + *
  • ServerConnector.replyData(Invoke) -> parent.replyData(Invoke)
  • + *
+ */ + private parent; + /** + *

A socket for network I/O.

+ */ + private socket; + /** + *

Unused string from a server.

+ */ + private str; + /** + *

An open-event listener.

+ */ + onopen: Function; + /** + *

Constructor with parent.

+ */ + constructor(parent: IProtocol); + /** + *

Connects to a cloud server with specified host and port.

+ * + *

If the connection fails immediately, either an event is dispatched or an exception is thrown: + * an error event is dispatched if a host was specified, and an exception is thrown if no host + * was specified. Otherwise, the status of the connection is reported by an event. + * If the socket is already connected, the existing connection is closed first.

+ * + * @param ip + * The name or IP address of the host to connect to. + * If no host is specified, the host that is contacted is the host where the calling + * file resides. If you do not specify a host, use an event listener to determine whether + * the connection was successful. + * @param port + * The port number to connect to. + * + * @throws IOError + * No host was specified and the connection failed. + * @throws SecurityError + * This error occurs in SWF content for the following reasons: + * Local untrusted SWF files may not communicate with the Internet. You can work around + * this limitation by reclassifying the file as local-with-networking or as trusted. + */ + connect(ip: string, port: number): void; + /** + *

Send data to the server.

+ */ + sendData(invoke: Invoke): void; + /** + *

Shift responsiblity of handling message to parent.

+ */ + replyData(invoke: Invoke): void; + private handleConnect(event); + /** + *

Handling replied message.

+ */ + private handleReply(event); + } +} +declare namespace samchon.protocol.service { + /** + *

An application, the top class in JS-UI.

+ * + *

The Application is separated to three part, TopMenu, Movie and ServerConnector.

+ *
    + *
  • TopMenu: Menu on the top. It's not an essential component.
  • + *
  • Movie: Correspond with Service in Server. Movie has domain UI components(Movie) for the matched Service.
  • + *
  • ServerConnector: The socket connecting to the Server.
  • + *
+ * + *

The Application and its UI-layout is not fixed, essential component for Samchon Framework in Flex, + * so it's okay to do not use the provided Application and make your custom Application. + * But the custom Application, your own, has to contain the Movie and keep the construction routine.

+ * + *

+ * + *

THE CONSTRUCTION ROUTINE

+ *
    + *
  • Socket Connection
  • + *
      + *
    • Connect to the CPP-Server
    • + *
    + *
  • Fetch authority
  • + *
      + *
    • Send a request to fetching authority
    • + *
    • The window can be navigated to other page by the authority
    • + *
    + *
  • Construct Movie
  • + *
      + *
    • Determine a Movie by URLVariables::movie and construct it
    • + *
    + *
  • All the routines are done
  • + *
+ * + * @author Jeongho Nam + */ + class Application implements IProtocol { + /** + *

Invoke Socket.

+ */ + protected socket: ServerConnector; + /** + *

A movie.

+ */ + protected movie: Movie; + /** + *

Construct from arguments.

+ * + * @param movie A movie represents a service. + * @param ip An ip address of cloud server to connect. + * @param port A port number of cloud server to connect. + */ + constructor(movie: Movie, ip: string, port: number); + private handleConnect(event); + /** + *

Handle replied message or shift the responsibility.

+ */ + replyData(invoke: Invoke): void; + /** + *

Send a data to server.

+ */ + sendData(invoke: Invoke): void; + } +} +declare namespace samchon.protocol.service { + /** + * A movie belonged to an Application. + */ + class Movie implements IProtocol { + /** + *

An application the movie is belonged to + */ + protected application: Application; + /** + * Handle replied data. + */ + replyData(invoke: Invoke): void; + /** + * Send data to server. + */ + sendData(invoke: Invoke): void; + } +} +declare namespace samchon.protocol.service { +} +declare namespace samchon.protocol.slave { + /** + * @brief A slave system. + * + * @details + *

SlaveSystem, literally, means a slave system belongs to a maste system.

+ * + *

The SlaveSystem class is used in opposite side system of master::DistributedSystem + * and master::ParallelSystem and reports elapsed time of each commmand (by Invoke message) + * for estimation of its performance.

+ * + * @inheritdoc + * @author Jeongho Nam + */ + abstract class SlaveSystem extends ExternalSystem { + /** + *

Default Constructor.

+ */ + constructor(); + /** + * @inheritdoc + */ + replyData(invoke: Invoke): void; + } +} diff --git a/samchon-library/samchon-library-tests.ts b/samchon-library/samchon-library-tests.ts new file mode 100644 index 0000000000..a2b0656d5f --- /dev/null +++ b/samchon-library/samchon-library-tests.ts @@ -0,0 +1,7 @@ +/// + +declare var global: any; +declare var require: (name: string) => any; + +library = require("samchon-library"); +console.log(library); \ No newline at end of file diff --git a/samchon-library/samchon-library.d.ts b/samchon-library/samchon-library.d.ts new file mode 100644 index 0000000000..3daecf0937 --- /dev/null +++ b/samchon-library/samchon-library.d.ts @@ -0,0 +1,23 @@ +// Type definitions for Samchon Library v0.0.2 +// Project: https://github.com/samchon/framework +// Definitions by: Jeongho Nam +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// ------------------------------------------------------------------------------------ +// In Samchon Collection, merging multiple 'ts' files to a module is not possible yet. +// Instead of using "import" instruction, use such trick: +// +// +// declare var global: any; +// declare var require: Function; +// +// library = require("samchon-library"); +// let xml: library.XML = new library.XML(); +// +// +// Those declaration of global and require can be substituted by using "node.d.ts" +// ------------------------------------------------------------------------------------ + +/// + +declare var library: typeof samchon.library; \ No newline at end of file diff --git a/typescript-stl/typescript-stl.d.ts b/typescript-stl/typescript-stl.d.ts index 659bd89cc2..1286a62084 100644 --- a/typescript-stl/typescript-stl.d.ts +++ b/typescript-stl/typescript-stl.d.ts @@ -1,9 +1,45 @@ -// Type definitions for TypeScript-STL v0.9.4 +// Type definitions for TypeScript-STL v0.9.9 // Project: https://github.com/samchon/stl // Definitions by: Jeongho Nam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// ------------------------------------------------------------------------------------ +// In TypeScript, merging multiple 'ts' files to a module is not possible yet. +// Instead of using "import" instruction, use such trick: +// +// +// declare var global: any; +// declare var require: Function; +// +// global["std"] = require("typescript-stl"); +// let list: std.List = new std.List(); +// +// +// Those declaration of global and require can be substituted by using "node.d.ts" +// ------------------------------------------------------------------------------------ + +/** + * STL (Standard Template Library) Containers for TypeScript. + * + * @author Jeongho Nam + */ +declare namespace std { +} +/** + * Base classes composing STL in background. + * + * @author Jeongho Nam + */ declare namespace std.base { +} +/** + * Examples for supporting developers who use STL library. + * + * @author Jeongho Nam + */ +declare namespace std.example { +} +declare namespace std { /** *

Bi-directional iterator.

* @@ -16,23 +52,22 @@ declare namespace std.base { *

There is not a single type of {@link Iterator bidirectional iterator}: {@link IContainer Each container} * may define its own specific iterator type able to iterate through it and access its elements.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/iterator/BidirectionalIterator/
  • - *
+ *

* + * @reference http://www.cplusplus.com/reference/iterator/BidirectionalIterator * @author Jeongho Nam */ abstract class Iterator { /** * Source container of the iterator is directing for. */ - protected source_: IContainer; + protected source_: base.IContainer; /** * Construct from the source {@link IContainer container}. * * @param source The source */ - constructor(source: IContainer); + constructor(source: base.IContainer); /** *

Get iterator to previous element.

*

If current iterator is the first item(equal with {@link IContainer.begin IContainer.begin()}), @@ -58,7 +93,7 @@ declare namespace std.base { /** * Get source */ - get_source(): Container; + get_source(): base.IContainer; /** *

Whether an iterator is equal with the iterator.

* @@ -83,25 +118,221 @@ declare namespace std.base { value: T; abstract swap(obj: Iterator): void; } -} -declare namespace std.base { /** - * A reverse and bi-directional iterator.

+ *

This class reverses the direction in which a bidirectional or random-access iterator iterates through a range. + *

* + *

A copy of the original iterator (the {@link Iterator base iterator}) is kept internally and used to reflect + * the operations performed on the {@link ReverseIterator}: whenever the {@link ReverseIterator} is incremented, its + * {@link Iterator base iterator} is decreased, and vice versa. A copy of the {@link Iterator base iterator} with the + * current state can be obtained at any time by calling member {@link base}.

+ * + *

Notice however that when an iterator is reversed, the reversed version does not point to the same element in + * the range, but to the one preceding it. This is so, in order to arrange for the past-the-end element of a + * range: An iterator pointing to a past-the-end element in a range, when reversed, is pointing to the last element + * (not past it) of the range (this would be the first element of the reversed range). And if an iterator to the + * first element in a range is reversed, the reversed iterator points to the element before the first element (this + * would be the past-the-end element of the reversed range).

+ * + *

+ * + * @reference http://www.cplusplus.com/reference/iterator/reverse_iterator * @author Jeongho Nam */ - abstract class ReverseIterator extends Iterator { - protected iterator_: Iterator; - constructor(iterator: Iterator); - equal_to(obj: Iterator): boolean; - equal_to(obj: ReverseIterator): boolean; + abstract class ReverseIterator, This extends ReverseIterator> extends Iterator { + protected base_: Base; + constructor(base: Base); + base(): Base; + protected abstract create_neighbor(): This; + value: T; /** * @inheritdoc */ - value: T; - swap(obj: Iterator): void; - swap(obj: ReverseIterator): void; + prev(): This; + /** + * @inheritdoc + */ + next(): This; + /** + * @inheritdoc + */ + advance(n: number): This; + /** + * @inheritdoc + */ + equal_to(obj: This): boolean; + /** + * @inheritdoc + */ + swap(obj: This): void; } + /** + *

Return distance between {@link Iterator iterators}.

+ * + *

Calculates the number of elements between first and last.

+ * + *

If it is a {@link IArrayIterator random-access iterator}, the function uses operator- to calculate this. + * Otherwise, the function uses the increase operator {@link Iterator.next next()} repeatedly.

+ * + * @param first Iterator pointing to the initial element. + * @param last Iterator pointing to the final element. This must be reachable from first. + * + * @return The number of elements between first and last. + */ + function distance>(first: InputIterator, last: InputIterator): number; + /** + *

Advance iterator.

+ * + *

Advances the iterator it by n elements positions.

+ * + * @param it Iterator to be advanced. + * @param n Number of element positions to advance. + * + * @return An iterator to the element n positions before it. + */ + function advance>(it: InputIterator, n: number): InputIterator; + /** + *

Get iterator to previous element.

+ * + *

Returns an iterator pointing to the element that it would be pointing to if advanced -n positions.

+ * + * @param it Iterator to base position. + * @param n Number of element positions offset (1 by default). + * + * @return An iterator to the element n positions before it. + */ + function prev>(it: BidirectionalIterator, n?: number): BidirectionalIterator; + /** + *

Get iterator to next element.

+ * + *

Returns an iterator pointing to the element that it would be pointing to if advanced n positions.

+ * + * @param it Iterator to base position. + * @param n Number of element positions offset (1 by default). + * + * @return An iterator to the element n positions away from it. + */ + function next>(it: ForwardIterator, n?: number): ForwardIterator; + /** + *

Iterator to beginning.

+ * + *

Returns an iterator pointing to the first element in the sequence.

+ * + *

If the sequence is empty, the returned value shall not be dereferenced.

+ * + * @param container A container object of a class type for which member {@link IContainer.begin begin} is defined. + * + * @return The same as returned by {@link IContainer.begin container.begin()}. + */ + function begin(container: Vector): VectorIterator; + /** + *

Iterator to beginning.

+ * + *

Returns an iterator pointing to the first element in the sequence.

+ * + *

If the sequence is empty, the returned value shall not be dereferenced.

+ * + * @param container A container object of a class type for which member {@link IContainer.begin begin} is defined. + * + * @return The same as returned by {@link IContainer.begin container.begin()}. + */ + function begin(container: List): ListIterator; + /** + *

Iterator to beginning.

+ * + *

Returns an iterator pointing to the first element in the sequence.

+ * + *

If the sequence is empty, the returned value shall not be dereferenced.

+ * + * @param container A container object of a class type for which member {@link IContainer.begin begin} is defined. + * + * @return The same as returned by {@link IContainer.begin container.begin()}. + */ + function begin(container: Deque): DequeIterator; + /** + *

Iterator to beginning.

+ * + *

Returns an iterator pointing to the first element in the sequence.

+ * + *

If the sequence is empty, the returned value shall not be dereferenced.

+ * + * @param container A container object of a class type for which member {@link IContainer.begin begin} is defined. + * + * @return The same as returned by {@link IContainer.begin container.begin()}. + */ + function begin(container: base.SetContainer): SetIterator; + /** + *

Iterator to beginning.

+ * + *

Returns an iterator pointing to the first element in the sequence.

+ * + *

If the sequence is empty, the returned value shall not be dereferenced.

+ * + * @param container A container object of a class type for which member {@link IContainer.begin begin} is defined. + * + * @return The same as returned by {@link IContainer.begin container.begin()}. + */ + function begin(container: base.MapContainer): MapIterator; + /** + *

Iterator to end.

+ * + *

Returns an iterator pointing to the past-the-end element in the sequence.

+ * + *

If the sequence is {@link IContainer.empty empty}, the returned value compares equal to the one returned by {@link begin} with the same argument.

+ * + * @param container A container of a class type for which member {@link IContainer.end end} is defined. + * + * @return The same as returned by {@link IContainer.end container.end()}. + */ + function end(container: Vector): VectorIterator; + /** + *

Iterator to end.

+ * + *

Returns an iterator pointing to the past-the-end element in the sequence.

+ * + *

If the sequence is {@link IContainer.empty empty}, the returned value compares equal to the one returned by {@link begin} with the same argument.

+ * + * @param container A container of a class type for which member {@link IContainer.end end} is defined. + * + * @return The same as returned by {@link IContainer.end container.end()}. + */ + function end(container: List): ListIterator; + /** + *

Iterator to end.

+ * + *

Returns an iterator pointing to the past-the-end element in the sequence.

+ * + *

If the sequence is {@link IContainer.empty empty}, the returned value compares equal to the one returned by {@link begin} with the same argument.

+ * + * @param container A container of a class type for which member {@link IContainer.end end} is defined. + * + * @return The same as returned by {@link IContainer.end container.end()}. + */ + function end(container: Deque): DequeIterator; + /** + *

Iterator to end.

+ * + *

Returns an iterator pointing to the past-the-end element in the sequence.

+ * + *

If the sequence is {@link IContainer.empty empty}, the returned value compares equal to the one returned by {@link begin} with the same argument.

+ * + * @param container A container of a class type for which member {@link IContainer.end end} is defined. + * + * @return The same as returned by {@link IContainer.end container.end()}. + */ + function end(container: base.SetContainer): SetIterator; + /** + *

Iterator to end.

+ * + *

Returns an iterator pointing to the past-the-end element in the sequence.

+ * + *

If the sequence is {@link IContainer.empty empty}, the returned value compares equal to the one returned by {@link begin} with the same argument.

+ * + * @param container A container of a class type for which member {@link IContainer.end end} is defined. + * + * @return The same as returned by {@link IContainer.end container.end()}. + */ + function end(container: base.MapContainer): MapIterator; } declare namespace std { /** @@ -135,6 +366,8 @@ declare namespace std { * end, they perform worse than the others, and have less consistent iterators and references than {@link List}s. *

* + *

+ * *

Container properties

*
*
Sequence
@@ -150,15 +383,12 @@ declare namespace std { * *
* - *
    - *
  • Reference: http://www.cplusplus.com/reference/vector/vector/ - *
- * * @param Type of the elements. * + * @reference http://www.cplusplus.com/reference/vector/vector * @author Jeongho Nam */ - class Vector extends Array implements base.IArray { + class Vector extends Array implements base.IArrayContainer { /** * Type definition of {@link Vector}'s {@link VectorIterator iterator}. */ @@ -209,11 +439,11 @@ declare namespace std { * @param begin Input interator of the initial position in a sequence. * @param end Input interator of the final position in a sequence. */ - constructor(begin: base.Iterator, end: base.Iterator); + constructor(begin: Iterator, end: Iterator); /** * @inheritdoc */ - assign>(begin: InputIterator, end: InputIterator): void; + assign>(begin: InputIterator, end: InputIterator): void; /** * @inheritdoc */ @@ -274,10 +504,6 @@ declare namespace std { * @inheritdoc */ push_back(val: T): void; - /** - * @inheritdoc - */ - pop_back(): void; /** *

Insert an element.

* @@ -346,7 +572,92 @@ declare namespace std { * * @return An iterator that points to the first of the newly inserted elements. */ - insert>(position: VectorIterator, begin: InputIterator, end: InputIterator): VectorIterator; + insert>(position: VectorIterator, begin: InputIterator, end: InputIterator): VectorIterator; + /** + *

Insert an element.

+ * + *

The {@link Vector} is extended by inserting new element before the element at the specified + * position, effectively increasing the container size by one.

+ * + *

This causes an automatic reallocation of the allocated storage space if -and only if- the new + * {@link size} surpasses the current {@link capacity}.

+ * + *

Because {@link Vector}s use an Array as their underlying storage, inserting element in + * positions other than the {@link end end()} causes the container to relocate all the elements that were + * after position to its new position. This is generally an inefficient operation compared to the one + * performed for the same operation by other kinds of sequence containers (such as {@link List}).

+ * + * @param position Position in the {@link Vector} where the new element is inserted. + * {@link iterator} is a member type, defined as a + * {@link VectorIterator random access iterator} type that points to elements. + * @param val Value to be copied to the inserted element. + * + * @return An iterator that points to the newly inserted element. + */ + insert(position: VectorReverseIterator, val: T): VectorReverseIterator; + /** + *

Insert elements by repeated filling.

+ * + *

The {@link Vector} is extended by inserting new elements before the element at the specified + * position, effectively increasing the container size by the number of elements inserted.

+ * + *

This causes an automatic reallocation of the allocated storage space if -and only if- the new + * {@link size} surpasses the current {@link capacity}.

+ * + *

Because {@link Vector}s use an Array as their underlying storage, inserting elements in + * positions other than the {@link end end()} causes the container to relocate all the elements that were + * after position to their new positions. This is generally an inefficient operation compared to the + * one performed for the same operation by other kinds of sequence containers (such as {@link List}). + * + * @param position Position in the {@link Vector} where the new elements are inserted. + * {@link iterator} is a member type, defined as a + * {@link VectorIterator random access iterator} type that points to elements. + * @param n Number of elements to insert. Each element is initialized to a copy of val. + * @param val Value to be copied (or moved) to the inserted elements. + * + * @return An iterator that points to the first of the newly inserted elements. + */ + insert(position: VectorReverseIterator, n: number, val: T): VectorReverseIterator; + /** + *

Insert elements by range iterators.

+ * + *

The {@link Vector} is extended by inserting new elements before the element at the specified + * position, effectively increasing the container size by the number of elements inserted by range + * iterators.

+ * + *

This causes an automatic reallocation of the allocated storage space if -and only if- the new + * {@link size} surpasses the current {@link capacity}.

+ * + *

Because {@link Vector}s use an Array as their underlying storage, inserting elements in + * positions other than the {@link end end()} causes the container to relocate all the elements that were + * after position to their new positions. This is generally an inefficient operation compared to the + * one performed for the same operation by other kinds of sequence containers (such as {@link List}). + * + * @param position Position in the {@link Vector} where the new elements are inserted. + * {@link iterator} is a member type, defined as a + * {@link VectorIterator random access iterator} type that points to elements. + * @param begin Input interator of the initial position in a sequence. + * @param end Input interator of the final position in a sequence. + * + * @return An iterator that points to the first of the newly inserted elements. + */ + insert>(position: VectorReverseIterator, begin: InputIterator, end: InputIterator): VectorReverseIterator; + /** + * @hidden + */ + private insert_by_val(position, val); + /** + * @hidden + */ + protected insert_by_repeating_val(position: VectorIterator, n: number, val: T): VectorIterator; + /** + * @hidden + */ + protected insert_by_range>(position: VectorIterator, first: InputIterator, last: InputIterator): VectorIterator; + /** + * @inheritdoc + */ + pop_back(): void; /** *

Erase element.

* @@ -366,6 +677,45 @@ declare namespace std { * sequence. */ erase(position: VectorIterator): VectorIterator; + /** + *

Erase element.

+ * + *

Removes from the Vector either a single element; position.

+ * + *

This effectively reduces the container size by the number of elements removed.

+ * + *

Because {@link Vector}s use an Array as their underlying storage, erasing elements in + * position other than the {@link end end()} causes the container to relocate all the elements after the + * segment erased to their new positions. This is generally an inefficient operation compared to the one + * performed for the same operation by other kinds of sequence containers (such as {@link List}).

+ * + * @param begin An iterator specifying a range of beginning to erase. + * @param end An iterator specifying a range of end to erase. + * + * @return An iterator pointing to the new location of the element that followed the last element erased by + * the function call. This is the {@link rend rend()} if the operation erased the last element in the + * sequence. + */ + erase(first: VectorIterator, last: VectorIterator): VectorIterator; + /** + *

Erase element.

+ * + *

Removes from the {@link Vector} either a single element; position.

+ * + *

This effectively reduces the container size by the number of element removed.

+ * + *

Because {@link Vector}s use an Array as their underlying storage, erasing an element in + * position other than the {@link end end()} causes the container to relocate all the elements after the + * segment erased to their new positions. This is generally an inefficient operation compared to the one + * performed for the same operation by other kinds of sequence containers (such as {@link List}).

+ * + * @param position Iterator pointing to a single element to be removed from the {@link Vector}. + * + * @return An iterator pointing to the new location of the element that followed the last element erased by + * the function call. This is the {@link rend rend()} if the operation erased the last element in the + * sequence. + */ + erase(position: VectorReverseIterator): VectorReverseIterator; /** *

Erase element.

* @@ -385,7 +735,11 @@ declare namespace std { * the function call. This is the {@link end end()} if the operation erased the last element in the * sequence. */ - erase(begin: VectorIterator, end: VectorIterator): VectorIterator; + erase(first: VectorReverseIterator, last: VectorReverseIterator): VectorReverseIterator; + /** + * @hiddde + */ + protected erase_by_range(first: VectorIterator, last: VectorIterator): VectorIterator; /** * @inheritdoc */ @@ -394,15 +748,17 @@ declare namespace std { /** *

An iterator of Vector.

* + *

+ * * @param Type of the elements. * * @author Jeongho Nam */ - class VectorIterator extends base.Iterator implements base.IArrayIterator { + class VectorIterator extends Iterator implements base.IArrayIterator { /** * Sequence number of iterator in the source {@link Vector}. */ - protected index_: number; + private index_; /** *

Construct from the source {@link Vector container}.

* @@ -417,7 +773,7 @@ declare namespace std { /** * @hidden */ - protected vector: Vector; + private vector; /** * @inheritdoc */ @@ -425,6 +781,22 @@ declare namespace std { * Set value. */ value: T; + /** + * Get index. + */ + index: number; + /** + * @inheritdoc + */ + prev(): VectorIterator; + /** + * @inheritdoc + */ + next(): VectorIterator; + /** + * @inheritdoc + */ + advance(n: number): VectorIterator; /** *

Whether an iterator is equal with the iterator.

* @@ -441,19 +813,6 @@ declare namespace std { * @return Indicates whether equal or not. */ equal_to(obj: VectorIterator): boolean; - index: number; - /** - * @inheritdoc - */ - prev(): VectorIterator; - /** - * @inheritdoc - */ - next(): VectorIterator; - /** - * @inheritdoc - */ - advance(n: number): VectorIterator; /** * @inheritdoc */ @@ -462,35 +821,33 @@ declare namespace std { /** *

A reverse-iterator of Vector.

* + *

+ * * @param Type of the elements. * * @author Jeongho Nam */ - class VectorReverseIterator extends base.ReverseIterator implements base.IArrayIterator { - constructor(iterator: VectorIterator); + class VectorReverseIterator extends ReverseIterator, VectorReverseIterator> implements base.IArrayIterator { + constructor(base: VectorIterator); /** - * @hidden + * @inheritdoc + */ + protected create_neighbor(): VectorReverseIterator; + /** + * Set value. */ - private vector_iterator; - index: number; value: T; /** - * @inheritdoc + * Get index. */ - prev(): VectorReverseIterator; - /** - * @inheritdoc - */ - next(): VectorReverseIterator; - /** - * @inheritdoc - */ - advance(n: number): VectorReverseIterator; + index: number; } } declare namespace std.base { /** - *

An abstract

+ *

An abstract container.

+ * + *

* *

Container properties

*
@@ -550,6 +907,30 @@ declare namespace std.base { * @inheritdoc */ clear(): void; + /** + * @inheritdoc + */ + abstract begin(): Iterator; + /** + * @inheritdoc + */ + abstract end(): Iterator; + /** + * @inheritdoc + */ + abstract rbegin(): base.IReverseIterator; + /** + * @inheritdoc + */ + abstract rend(): base.IReverseIterator; + /** + * @inheritdoc + */ + abstract size(): number; + /** + * @inheritdoc + */ + empty(): boolean; /** * @inheritdoc */ @@ -569,31 +950,7 @@ declare namespace std.base { /** * @inheritdoc */ - abstract begin(): Iterator; - /** - * @inheritdoc - */ - abstract end(): Iterator; - /** - * @inheritdoc - */ - abstract rbegin(): ReverseIterator; - /** - * @inheritdoc - */ - abstract rend(): ReverseIterator; - /** - * @inheritdoc - */ - abstract size(): number; - /** - * @inheritdoc - */ - empty(): boolean; - /** - * @inheritdoc - */ - swap(obj: Container): void; + swap(obj: IContainer): void; } } declare namespace std { @@ -601,32 +958,32 @@ declare namespace std { *

Double ended queue.

* *

{@link Deque} (usually pronounced like "deck") is an irregular acronym of - * double-ended queue. Double-ended queues are sequence containers with dynamic - * sizes that can be expanded or contracted on both ends (either its front or its back).

+ * double-ended queue. Double-ended queues are sequence containers with dynamic sizes that can be + * expanded or contracted on both ends (either its front or its back).

* - *

Specific libraries may implement deques in different ways, generally as some form of dynamic - * array. But in any case, they allow for the individual elements to be accessed directly through - * random access iterators, with storage handled automatically by expanding and contracting the - * container as needed.

+ *

Specific libraries may implement deques in different ways, generally as some form of dynamic array. But in any + * case, they allow for the individual elements to be accessed directly through random access iterators, with storage + * handled automatically by expanding and contracting the container as needed.

* - *

Therefore, they provide a functionality similar to vectors, but with efficient insertion and - * deletion of elements also at the beginning of the sequence, and not only at its end. But, unlike - * {@link Vector}s, {@link Deque}s are not guaranteed to store all its elements in contiguous storage - * locations: accessing elements in a deque by offsetting a pointer to another element causes - * undefined behavior.

+ *

Therefore, they provide a functionality similar to vectors, but with efficient insertion and deletion of + * elements also at the beginning of the sequence, and not only at its end. But, unlike {@link Vector Vectors}, + * {@link Deque Deques} are not guaranteed to store all its elements in contiguous storage locations: accessing + * elements in a deque by offsetting a pointer to another element causes undefined behavior.

* - *

Both {@link Vector}s and {@link Deque}s provide a very similar interface and can be used for - * similar purposes, but internally both work in quite different ways: While {@link Vector}s use a - * single array that needs to be occasionally reallocated for growth, the elements of a {@link Deque} - * can be scattered in different chunks of storage, with the container keeping the necessary information - * internally to provide direct access to any of its elements in constant time and with a uniform - * sequential interface (through iterators). Therefore, {@link Deque}s are a little more complex - * internally than {@link Vector}s, but this allows them to grow more efficiently under certain - * circumstances, especially with very long sequences, where reallocations become more expensive.

+ *

Both {@link Vector}s and {@link Deque}s provide a very similar interface and can be used for similar purposes, + * but internally both work in quite different ways: While {@link Vector}s use a single array that needs to be + * occasionally reallocated for growth, the elements of a {@link Deque} can be scattered in different chunks of + * storage, with the container keeping the necessary information internally to provide direct access to any of its + * elements in constant time and with a uniform sequential interface (through iterators). Therefore, + * {@link Deque Deques} are a little more complex internally than {@link Vector}s, but this allows them to grow more + * efficiently under certain circumstances, especially with very long sequences, where reallocations become more + * expensive.

* - *

For operations that involve frequent insertion or removals of elements at positions other than - * the beginning or the end, {@link Deque}s perform worse and have less consistent iterators and - * references than {@link List}s.

+ *

For operations that involve frequent insertion or removals of elements at positions other than the beginning or + * the end, {@link Deque Deques} perform worse and have less consistent iterators and references than + * {@link List Lists}.

+ * + *

* *

Container properties

*
@@ -640,15 +997,12 @@ declare namespace std { * of the sequence. *
* - *
    - *
  • Reference: http://www.cplusplus.com/reference/deque/deque/
  • - *
- * * @param Type of the elements. * + * @reference http://www.cplusplus.com/reference/deque/deque/ * @author Jeongho Nam */ - class Deque extends base.Container implements base.IArray, base.IDeque { + class Deque extends base.Container implements base.IArrayContainer, base.IDequeContainer { /** * Type definition of {@link Deque}'s {@link DequeIterator iterator}. */ @@ -758,11 +1112,11 @@ declare namespace std { * @param begin Input interator of the initial position in a sequence. * @param end Input interator of the final position in a sequence. */ - constructor(begin: base.Iterator, end: base.Iterator); + constructor(begin: Iterator, end: Iterator); /** * @inheritdoc */ - assign>(begin: InputIterator, end: InputIterator): void; + assign>(begin: InputIterator, end: InputIterator): void; /** * @inheritdoc */ @@ -854,7 +1208,35 @@ declare namespace std { /** * @inheritdoc */ - insert>(position: DequeIterator, begin: InputIterator, end: InputIterator): DequeIterator; + insert>(position: DequeIterator, begin: InputIterator, end: InputIterator): DequeIterator; + /** + * @inheritdoc + */ + insert(position: DequeReverseIterator, val: T): DequeReverseIterator; + /** + * @inheritdoc + */ + insert(position: DequeReverseIterator, n: number, val: T): DequeReverseIterator; + /** + * @inheritdoc + */ + insert>(position: DequeReverseIterator, begin: InputIterator, end: InputIterator): DequeReverseIterator; + /** + * @hidden + */ + private insert_by_val(position, val); + /** + * @hidden + */ + protected insert_by_repeating_val(position: DequeIterator, n: number, val: T): DequeIterator; + /** + * @hidden + */ + protected insert_by_range>(position: DequeIterator, begin: InputIterator, end: InputIterator): DequeIterator; + /** + * @hidden + */ + private insert_by_items(position, items); /** * @inheritdoc */ @@ -862,7 +1244,19 @@ declare namespace std { /** * @inheritdoc */ - erase(begin: DequeIterator, end: DequeIterator): DequeIterator; + erase(first: DequeIterator, last: DequeIterator): DequeIterator; + /** + * @inheritdoc + */ + erase(position: DequeReverseIterator): DequeReverseIterator; + /** + * @inheritdoc + */ + erase(first: DequeReverseIterator, last: DequeReverseIterator): DequeReverseIterator; + /** + * @hidden + */ + protected erase_by_range(first: DequeIterator, last: DequeIterator): DequeIterator; /** * @inheritdoc */ @@ -873,12 +1267,13 @@ declare namespace std { private swap_deque(obj); } /** - * An iterator of {@link Deque}. + *

An iterator of {@link Deque}.

+ * + *

* * @author Jeongho Nam */ - class DequeIterator extends base.Iterator implements base.IArrayIterator { - private deque; + class DequeIterator extends Iterator implements base.IArrayIterator { /** * Sequence number of iterator in the source {@link Deque}. */ @@ -894,10 +1289,30 @@ declare namespace std { * @param index Sequence number of the element in the source {@link Deque}. */ constructor(source: Deque, index: number); + /** + * @hidden + */ + private deque; /** * @inheritdoc */ value: T; + /** + * @inheritdoc + */ + index: number; + /** + * @inheritdoc + */ + prev(): DequeIterator; + /** + * @inheritdoc + */ + next(): DequeIterator; + /** + * @inheritdoc + */ + advance(n: number): DequeIterator; /** *

Whether an iterator is equal with the iterator.

* @@ -914,22 +1329,6 @@ declare namespace std { * @return Indicates whether equal or not. */ equal_to(obj: DequeIterator): boolean; - /** - * @inheritdoc - */ - index: number; - /** - * @inheritdoc - */ - prev(): DequeIterator; - /** - * @inheritdoc - */ - next(): DequeIterator; - /** - * @inheritdoc - */ - advance(n: number): DequeIterator; /** * @inheritdoc */ @@ -938,79 +1337,72 @@ declare namespace std { /** *

A reverse-iterator of Deque.

* + *

+ * * @param Type of the elements. * * @author Jeongho Nam */ - class DequeReverseIterator extends base.ReverseIterator implements base.IArrayIterator { - constructor(iterator: DequeIterator); + class DequeReverseIterator extends ReverseIterator, DequeReverseIterator> implements base.IArrayIterator { + constructor(base: DequeIterator); /** - * @hidden + * @inheritdoc + */ + protected create_neighbor(): DequeReverseIterator; + /** + * Set value. */ - private deque_iterator; - index: number; value: T; /** - * @inheritdoc + * Get index. */ - prev(): DequeReverseIterator; - /** - * @inheritdoc - */ - next(): DequeReverseIterator; - /** - * @inheritdoc - */ - advance(n: number): DequeReverseIterator; + index: number; } } declare namespace std { /** *

Doubly linked list.

* - *

{@link List}s are sequence containers that allow constant time insert and erase operations anywhere - * within the sequence, and iteration in both directions.

+ *

{@link List}s are sequence containers that allow constant time insert and erase operations anywhere within the + * sequence, and iteration in both directions.

* - *

List containers are implemented as doubly-linked lists; Doubly linked lists can store each of the elements - * they contain in different and unrelated storage locations. The ordering is kept internally by the association - * to each element of a link to the element preceding it and a link to the element following it.

+ *

List containers are implemented as doubly-linked lists; Doubly linked lists can store each of the elements they + * contain in different and unrelated storage locations. The ordering is kept internally by the association to each + * element of a link to the element preceding it and a link to the element following it.

* - *

They are very similar to forward_list: The main difference being that forward_list objects are - * single-linked lists, and thus they can only be iterated forwards, in exchange for being somewhat smaller and - * more efficient.

+ *

They are very similar to forward_list: The main difference being that forward_list objects are single-linked + * lists, and thus they can only be iterated forwards, in exchange for being somewhat smaller and more efficient.

* - *

Compared to other base standard sequence containers (array, vector and deque), lists perform generally - * better in inserting, extracting and moving elements in any position within the container for which an iterator - * has already been obtained, and therefore also in algorithms that make intensive use of these, like sorting - * algorithms.

+ *

Compared to other base standard sequence containers (array, vector and deque), lists perform generally better + * in inserting, extracting and moving elements in any position within the container for which an iterator has already + * been obtained, and therefore also in algorithms that make intensive use of these, like sorting algorithms.

* *

The main drawback of lists and forward_lists compared to these other sequence containers is that they lack - * direct access to the elements by their position; For example, to access the sixth element in a list, one has - * to iterate from a known position (like the beginning or the end) to that position, which takes linear time in - * the distance between these. They also consume some extra memory to keep the linking information associated to - * each element (which may be an important factor for large lists of small-sized elements).

+ * direct access to the elements by their position; For example, to access the sixth element in a list, one has to + * iterate from a known position (like the beginning or the end) to that position, which takes linear time in the + * distance between these. They also consume some extra memory to keep the linking information associated to each + * element (which may be an important factor for large lists of small-sized elements).

+ * + *

* *

Container properties

*
*
Sequence
- *
Elements in sequence containers are ordered in a strict linear sequence. Individual elements are - * accessed by their position in this sequence.
+ *
Elements in sequence containers are ordered in a strict linear sequence. Individual elements are accessed by + * their position in this sequence.
* *
Doubly-linked list
- *
Each element keeps information on how to locate the next and the previous elements, allowing constant - * time insert and erase operations before or after a specific element (even of entire ranges), but no - * direct random access.
+ *
Each element keeps information on how to locate the next and the previous elements, allowing constant time + * insert and erase operations before or after a specific element (even of entire ranges), but no direct random + * access.
*
* - *
    - *
  • Reference: http://www.cplusplus.com/reference/list/list/ - *
- * * @param Type of the elements. * + * @reference http://www.cplusplus.com/reference/list/list/ * @author Jeongho Nam */ - class List extends base.Container implements base.IDeque { + class List extends base.Container implements base.IDequeContainer { /** * An iterator of beginning. */ @@ -1065,7 +1457,7 @@ declare namespace std { * @param begin Input interator of the initial position in a sequence. * @param end Input interator of the final position in a sequence. */ - constructor(begin: base.Iterator, end: base.Iterator); + constructor(begin: Iterator, end: Iterator); /** * @inheritdoc */ @@ -1073,7 +1465,7 @@ declare namespace std { /** * @inheritdoc */ - assign>(begin: InputIterator, end: InputIterator): void; + assign>(begin: InputIterator, end: InputIterator): void; /** * @inheritdoc */ @@ -1147,6 +1539,13 @@ declare namespace std { /** *

Insert elements by repeated filling.

* + *

The container is extended by inserting a new element before the element at the specified + * position. This effectively increases the {@link List.size List size} by the amount of elements + * inserted.

+ * + *

Unlike other standard sequence containers, {@link List} is specifically designed to be efficient + * inserting and removing elements in any position, even in the middle of the sequence.

+ * * @param position Position in the container where the new elements are inserted. The {@link iterator} is a * member type, defined as a {@link ListIterator bidirectional iterator} type that points to * elements. @@ -1157,6 +1556,14 @@ declare namespace std { */ insert(position: ListIterator, size: number, val: T): ListIterator; /** + *

Insert elements by range iterators.

+ * + *

The container is extended by inserting a new element before the element at the specified + * position. This effectively increases the {@link List.size List size} by the amount of elements + * inserted.

+ * + *

Unlike other standard sequence containers, {@link List} is specifically designed to be efficient + * inserting and removing elements in any position, even in the middle of the sequence.

* * @param position Position in the container where the new elements are inserted. The {@link iterator} is a * member type, defined as a {@link ListIterator bidirectional iterator} type that points to @@ -1166,7 +1573,63 @@ declare namespace std { * * @return An iterator that points to the first of the newly inserted elements. */ - insert>(position: ListIterator, begin: InputIterator, end: InputIterator): ListIterator; + insert>(position: ListIterator, begin: InputIterator, end: InputIterator): ListIterator; + /** + *

Insert an element.

+ * + *

The container is extended by inserting a new element before the element at the specified + * position. This effectively increases the {@link List.size List size} by the amount of elements + * inserted.

+ * + *

Unlike other standard sequence containers, {@link List} is specifically designed to be efficient + * inserting and removing elements in any position, even in the middle of the sequence.

+ * + * @param position Position in the container where the new element is inserted. + * {@link iterator}> is a member type, defined as a + * {@link ListReverseIterator bidirectional iterator} type that points to elements. + * @param val Value to be inserted as an element. + * + * @return An iterator that points to the newly inserted element; val. + */ + insert(position: ListReverseIterator, val: T): ListReverseIterator; + /** + *

Insert elements by repeated filling.

+ * + *

The container is extended by inserting a new element before the element at the specified + * position. This effectively increases the {@link List.size List size} by the amount of elements + * inserted.

+ * + *

Unlike other standard sequence containers, {@link List} is specifically designed to be efficient + * inserting and removing elements in any position, even in the middle of the sequence.

+ * + * @param position Position in the container where the new elements are inserted. The {@link iterator} is a + * member type, defined as a {@link ListReverseIterator bidirectional iterator} type that points to + * elements. + * @param size Number of elements to insert. + * @param val Value to be inserted as an element. + * + * @return An iterator that points to the first of the newly inserted elements. + */ + insert(position: ListReverseIterator, size: number, val: T): ListReverseIterator; + /** + *

Insert elements by range iterators.

+ * + *

The container is extended by inserting a new element before the element at the specified + * position. This effectively increases the {@link List.size List size} by the amount of elements + * inserted.

+ * + *

Unlike other standard sequence containers, {@link List} is specifically designed to be efficient + * inserting and removing elements in any position, even in the middle of the sequence.

+ * + * @param position Position in the container where the new elements are inserted. The {@link iterator} is a + * member type, defined as a {@link ListReverseIterator bidirectional iterator} type that points to + * elements. + * @param begin An iterator specifying range of the begining element. + * @param end An iterator specifying range of the ending element. + * + * @return An iterator that points to the first of the newly inserted elements. + */ + insert>(position: ListReverseIterator, begin: InputIterator, end: InputIterator): ListReverseIterator; /** * @hidden */ @@ -1174,11 +1637,11 @@ declare namespace std { /** * @hidden */ - private insertByRepeatingVal(position, size, val); + protected insert_by_repeating_val(position: ListIterator, size: number, val: T): ListIterator; /** * @hidden */ - private insert_by_range(position, begin, end); + protected insert_by_range>(position: ListIterator, begin: InputIterator, end: InputIterator): ListIterator; /** *

Erase an element.

* @@ -1213,13 +1676,42 @@ declare namespace std { */ erase(begin: ListIterator, end: ListIterator): ListIterator; /** - * @hidden + *

Erase an element.

+ * + *

Removes from the {@link List} either a single element; position.

+ * + *

This effectively reduces the container size by the number of element removed.

+ * + *

Unlike other standard sequence containers, {@link List} objects are specifically designed to be + * efficient inserting and removing elements in any position, even in the middle of the sequence.

+ * + * @param position Iterator pointing to a single element to be removed from the {@link List}. + * + * @return An iterator pointing to the element that followed the last element erased by the function call. + * This is the {@link rend rend()} if the operation erased the last element in the sequence. */ - private erase_by_iterator(it); + erase(position: ListReverseIterator): ListReverseIterator; + /** + *

Erase elements.

+ * + *

Removes from the {@link List} container a range of elements.

+ * + *

This effectively reduces the container {@link size} by the number of elements removed.

+ * + *

Unlike other standard sequence containers, {@link List} objects are specifically designed to be + * efficient inserting and removing elements in any position, even in the middle of the sequence.

+ * + * @param begin An iterator specifying a range of beginning to erase. + * @param end An iterator specifying a range of end to erase. + * + * @return An iterator pointing to the element that followed the last element erased by the function call. + * This is the {@link rend rend()} if the operation erased the last element in the sequence. + */ + erase(begin: ListReverseIterator, end: ListReverseIterator): ListReverseIterator; /** * @hidden */ - private erase_by_range(begin, end); + protected erase_by_range(first: ListIterator, last: ListIterator): ListIterator; /** *

Remove duplicate values.

* @@ -1458,12 +1950,16 @@ declare namespace std { private swap_list(obj); } /** - * An iterator, node of a List. + *

An iterator, node of a List.

+ * + *

+ * + * @author Jeongho Nam */ - class ListIterator extends base.Iterator { - protected prev_: ListIterator; - protected next_: ListIterator; - protected value_: T; + class ListIterator extends Iterator { + private prev_; + private next_; + private value_; /** *

Construct from the source {@link List container}.

* @@ -1480,15 +1976,12 @@ declare namespace std { /** * @inheritdoc */ - setPrev(prev: ListIterator): void; + set_prev(it: ListIterator): void; /** * @inheritdoc */ - setNext(next: ListIterator): void; - /** - * @inheritdoc - */ - equal_to(obj: ListIterator): boolean; + set_next(next: ListIterator): void; + private list(); /** * @inheritdoc */ @@ -1505,6 +1998,10 @@ declare namespace std { * @inheritdoc */ value: T; + /** + * @inheritdoc + */ + equal_to(obj: ListIterator): boolean; /** * @inheritdoc */ @@ -1513,29 +2010,22 @@ declare namespace std { /** *

A reverse-iterator of List.

* + *

+ * * @param Type of the elements. * * @author Jeongho Nam */ - class ListReverseIterator extends base.ReverseIterator { - constructor(iterator: ListIterator); + class ListReverseIterator extends ReverseIterator, ListReverseIterator> { + constructor(base: ListIterator); /** - * @hidden + * @inheritdoc + */ + protected create_neighbor(): ListReverseIterator; + /** + * @inheritdoc */ - private list_iterator; value: T; - /** - * @inheritdoc - */ - prev(): ListReverseIterator; - /** - * @inheritdoc - */ - next(): ListReverseIterator; - /** - * @inheritdoc - */ - advance(n: number): ListReverseIterator; } } declare namespace std { @@ -1568,12 +2058,11 @@ declare namespace std { * By default, if no container class is specified for a particular {@link Queue} class instantiation, the standard * container {@link List} is used.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/queue/queue/
  • - *
+ *

* * @param Type of elements. * + * @reference http://www.cplusplus.com/reference/queue/queue * @author Jeongho Nam */ class Queue { @@ -1770,7 +2259,7 @@ declare namespace std { * @param begin Input interator of the initial position in a sequence. * @param end Input interator of the final position in a sequence. */ - constructor(begin: base.Iterator, end: base.Iterator); + constructor(begin: Iterator, end: Iterator); /** * Range Constructor with compare. * @@ -1778,7 +2267,7 @@ declare namespace std { * @param end Input interator of the final position in a sequence. * @param compare A binary predicate determines order of elements. */ - constructor(begin: base.Iterator, end: base.Iterator, compare: (left: T, right: T) => boolean); + constructor(begin: Iterator, end: Iterator, compare: (left: T, right: T) => boolean); /** * @hidden */ @@ -1790,7 +2279,7 @@ declare namespace std { /** * @hidden */ - protected construct_from_range(begin: base.Iterator, end: base.Iterator): void; + protected construct_from_range(begin: Iterator, end: Iterator): void; /** *

Return size.

* @@ -1897,12 +2386,11 @@ declare namespace std { * By default, if no container class is specified for a particular {@link Stack} class instantiation, the standard * container {@link List} is used.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/stack/stack/
  • - *
+ *

* * @param Type of elements. * + * @reference http://www.cplusplus.com/reference/stack/stack * @author Jeongho Nam */ class Stack { @@ -2007,12 +2495,14 @@ declare namespace std.base { * {@link List} and registering {@link ListIterator iterators} of the {@link data_ list container} to an index * table like {@link RBTree tree} or {@link HashBuckets hash-table}.

* + *

+ * *

Container properties

*
*
Associative
*
* Elements in associative containers are referenced by their key and not by their absolute - * position in the + * position in the container. *
* *
Set
@@ -2054,6 +2544,10 @@ declare namespace std.base { * Construct from range iterators. */ constructor(begin: Iterator, end: Iterator); + /** + * @hidden + */ + protected init(): void; /** * @hidden */ @@ -2061,11 +2555,11 @@ declare namespace std.base { /** * @hidden */ - protected construct_from_container(container: Container): void; + protected construct_from_container(container: IContainer): void; /** * @hidden */ - protected construct_from_range(begin: Iterator, end: Iterator): void; + protected construct_from_range>(begin: InputIterator, end: InputIterator): void; /** * @inheritdoc */ @@ -2146,6 +2640,19 @@ declare namespace std.base { * same value in the {@link SetContainer}. */ insert(hint: SetIterator, val: T): SetIterator; + /** + *

Insert an element with hint.

+ * + *

Extends the container by inserting new elements, effectively increasing the container size by the + * number of elements inserted.

+ * + * @param hint Hint for the position where the element can be inserted. + * @param val Value to be inserted as an element. + * + * @return An iterator pointing to either the newly inserted element or to the element that already had its + * same value in the {@link SetContainer}. + */ + insert(hint: SetReverseIterator, val: T): SetReverseIterator; /** *

Insert elements with a range of a

* @@ -2163,11 +2670,11 @@ declare namespace std.base { /** * @hidden */ - protected insert_by_hint(hint: SetIterator, val: T): SetIterator; + protected abstract insert_by_hint(hint: SetIterator, val: T): SetIterator; /** * @hidden */ - protected insert_by_range>(begin: InputIterator, end: InputIterator): void; + protected abstract insert_by_range>(begin: InputIterator, end: InputIterator): void; /** *

Erase an element.

*

Removes from the set container the elements whose value is key.

@@ -2193,63 +2700,86 @@ declare namespace std.base { * @param end An iterator specifying a range of end to erase. */ erase(begin: SetIterator, end: SetIterator): SetIterator; + /** + * @inheritdoc + */ + erase(it: SetReverseIterator): SetReverseIterator; + /** + *

Erase elements.

+ *

Removes from the set container a range of elements..

+ * + *

This effectively reduces the container size by the number of elements removed.

+ * + * @param begin An iterator specifying a range of beginning to erase. + * @param end An iterator specifying a range of end to erase. + */ + erase(begin: SetReverseIterator, end: SetReverseIterator): SetReverseIterator; + /** + * @hidden + */ + private erase_by_iterator(first, last?); /** * @hidden */ private erase_by_val(val); - /** - * @hidden - */ - private erase_by_iterator(it); /** * @hidden */ private erase_by_range(begin, end); /** - *

Abstract method handling insertion for indexing.

+ *

Abstract method handling insertions for indexing.

* - *

This method, {@link handle_insert} is designed to register the item to somewhere storing those - * {@link SetIterator iterators} for indexing, fast accessment and retrievalance.

- * - *

When {@link insert} is called, a new element will be inserted into the {@link data_ list container} - * and a new {@link SetIterator iterator} item, pointing the element, will be created and the newly - * created iterator item will be shifted into this method {@link handle_insert} after the insertion.

- * - *

If the derived one is {@link RBTree tree-based} like {@link TreeSet}, the item will be - * registered into the {@link TreeSet.tree_ tree} as a {@link XTreeNode tree node item}. Else if the derived - * one is {@link HashBuckets hash-based} like {@link HashSet}, the item will be registered into the - * {@link HashSet.hash_buckets_ hash bucket}.

- * - * @param item Iterator of inserted item. - */ - protected abstract handle_insert(item: SetIterator): void; - /** - *

Abstract method handling deletion for indexing.

- * - *

This method, {@link handle_insert} is designed to unregister the item to somewhere storing + *

This method, {@link handle_insert} is designed to register the first to last to somewhere storing * those {@link SetIterator iterators} for indexing, fast accessment and retrievalance.

* - *

When {@link erase} is called with item, an {@link SetIterator iterator} positioning somewhere - * place to be deleted, is memorized and shifted to this method {@link handle_erase} after the deletion - * process is terminated.

+ *

When {@link insert} is called, new elements will be inserted into the {@link data_ list container} and new + * {@link SetIterator iterators} first to last, pointing the inserted elements, will be created and the + * newly created iterators first to last will be shifted into this method {@link handle_insert} after the + * insertions.

* - *

If the derived one is {@link RBTree tree-based} like {@link TreeSet}, the item will be - * unregistered from the {@link TreeSet.tree_ tree} as a {@link XTreeNode tree node item}. Else if the - * derived one is {@link HashBuckets hash-based} like {@link HashSet}, the item will be unregistered - * from the {@link HashSet.hash_buckets_ hash bucket}.

+ *

If the derived one is {@link RBTree tree-based} like {@link TreeSet}, the {@link SetIterator iterators} + * will be registered into the {@link TreeSet.tree_ tree} as a {@link XTreeNode tree node item}. Else if the + * derived one is {@link HashBuckets hash-based} like {@link HashSet}, the first to last will be + * registered into the {@link HashSet.hash_buckets_ hash bucket}.

* - * @param item Iterator of erased item. + * @param first An {@link SetIterator} to the initial position in a sequence. + * @param last An {@link SetIterator} to the final position in a sequence. The range used is + * [first, last), which contains all the elements between first and last, + * including the element pointed by first but not the element pointed by last. */ - protected abstract handle_erase(item: SetIterator): void; + protected abstract handle_insert(first: SetIterator, last: SetIterator): void; + /** + *

Abstract method handling deletions for indexing.

+ * + *

This method, {@link handle_insert} is designed to unregister the first to last to somewhere storing + * those {@link SetIterator iterators} for indexing, fast accessment and retrievalance.

+ * + *

When {@link erase} is called with first to last, {@link SetIterator iterators} positioning somewhere + * place to be deleted, is memorized and shifted to this method {@link handle_erase} after the deletion process is + * terminated.

+ * + *

If the derived one is {@link RBTree tree-based} like {@link TreeSet}, the {@link SetIterator iterators} + * will be unregistered from the {@link TreeSet.tree_ tree} as a {@link XTreeNode tree node item}. Else if the + * derived one is {@link HashBuckets hash-based} like {@link HashSet}, the first to last will be + * unregistered from the {@link HashSet.hash_buckets_ hash bucket}.

+ * + * @param first An {@link SetIterator} to the initial position in a sequence. + * @param last An {@link SetIterator} to the final position in a sequence. The range used is + * [first, last), which contains all the elements between first and last, + * including the element pointed by first but not the element pointed by last. + */ + protected abstract handle_erase(first: SetIterator, last: SetIterator): void; } } declare namespace std { /** *

An iterator of a Set.

* + *

+ * * @author Jeongho Nam */ - class SetIterator extends base.Iterator implements IComparable> { + class SetIterator extends Iterator implements IComparable> { private list_iterator_; /** *

Construct from source and index number.

@@ -2303,28 +2833,18 @@ declare namespace std { /** *

A reverse-iterator of Set.

* + *

+ * * @param Type of the elements. * * @author Jeongho Nam */ - class SetReverseIterator extends base.ReverseIterator { - constructor(iterator: SetIterator); - /** - * @hidden - */ - private set_iterator; + class SetReverseIterator extends ReverseIterator, SetReverseIterator> { + constructor(base: SetIterator); /** * @inheritdoc */ - prev(): SetReverseIterator; - /** - * @inheritdoc - */ - next(): SetReverseIterator; - /** - * @inheritdoc - */ - advance(n: number): SetReverseIterator; + protected create_neighbor(): SetReverseIterator; } } declare namespace std.base { @@ -2342,12 +2862,14 @@ declare namespace std.base { * {@link List} and registering {@link ListIterator iterators} of the {@link data_ list container} to an index * table like {@link RBTree tree} or {@link HashBuckets hash-table}.

* + *

+ * *

Container properties

*
*
Associative
*
* Elements in associative containers are referenced by their key and not by their absolute - * position in the + * position in the container. *
* *
Set
@@ -2363,10 +2885,6 @@ declare namespace std.base { * @author Jeongho Nam */ abstract class UniqueSet extends SetContainer { - /** - * Default Constructor. - */ - constructor(); /** * @inheritdoc */ @@ -2395,10 +2913,18 @@ declare namespace std.base { * @inheritdoc */ insert(hint: SetIterator, val: T): SetIterator; + /** + * @inheritdoc + */ + insert(hint: SetReverseIterator, val: T): SetReverseIterator; /** * @inheritdoc */ insert>(begin: InputIterator, end: InputIterator): void; + /** + * @inheritdoc + */ + swap(obj: UniqueSet): void; } } declare namespace std.base { @@ -2416,12 +2942,14 @@ declare namespace std.base { * {@link List} and registering {@link ListIterator iterators} of the {@link data_ list container} to an index * table like {@link RBTree tree} or {@link HashBuckets hash-table}.

* + *

+ * *

Container properties

*
*
Associative
*
* Elements in associative containers are referenced by their key and not by their absolute - * position in the + * position in the container. *
* *
Set
@@ -2437,14 +2965,6 @@ declare namespace std.base { * @author Jeongho Nam */ abstract class MultiSet extends SetContainer { - /** - * Default Constructor. - */ - constructor(); - /** - * @inheritdoc - */ - count(val: T): number; /** *

Insert an element.

* @@ -2460,10 +2980,18 @@ declare namespace std.base { * @inheritdoc */ insert(hint: SetIterator, val: T): SetIterator; + /** + * @inheritdoc + */ + insert(hint: SetReverseIterator, val: T): SetReverseIterator; /** * @inheritdoc */ insert>(begin: InputIterator, end: InputIterator): void; + /** + * @inheritdoc + */ + swap(obj: MultiSet): void; } } declare namespace std { @@ -2485,11 +3013,13 @@ declare namespace std { * elements by their key, although they are generally less efficient for range iteration through a * subset of their elements.

* + *

+ * *

Container properties

*
*
Associative
*
Elements in associative containers are referenced by their key and not by their absolute - * position in the
+ * position in the container. * *
Hashed
*
Hashed containers organize their elements using hash tables that allow for fast access to elements @@ -2502,41 +3032,22 @@ declare namespace std { *
No two elements in the container can have equivalent keys.
*
* - *
    - *
  • Reference: http://www.cplusplus.com/reference/unordered_set/unordered_set/
  • - *
- * * @param Type of the elements. * Each element in an {@link HashSet} is also uniquely identified by this value. * + * @reference http://www.cplusplus.com/reference/unordered_set/unordered_set * @author Jeongho Nam */ class HashSet extends base.UniqueSet { private hash_buckets_; /** - * Default Constructor. + * @hidden */ - constructor(); - /** - * Construct from elements. - */ - constructor(items: Array); - /** - * Copy Constructor. - */ - constructor(container: base.IContainer); - /** - * Construct from range iterators. - */ - constructor(begin: base.Iterator, end: base.Iterator); + protected init(): void; /** * @hidden */ protected construct_from_array(items: Array): void; - /** - * @inheritdoc - */ - assign>(begin: InputIterator, end: InputIterator): void; /** * @inheritdoc */ @@ -2552,19 +3063,23 @@ declare namespace std { /** * @hidden */ - protected insert_by_range>(begin: InputIterator, end: InputIterator): void; + protected insert_by_hint(hint: SetIterator, val: T): SetIterator; + /** + * @hidden + */ + protected insert_by_range>(first: InputIterator, last: InputIterator): void; /** * @inheritdoc */ - protected handle_insert(item: SetIterator): void; + protected handle_insert(first: SetIterator, last: SetIterator): void; /** * @inheritdoc */ - protected handle_erase(item: SetIterator): void; + protected handle_erase(first: SetIterator, last: SetIterator): void; /** * @inheritdoc */ - swap(obj: base.IContainer): void; + swap(obj: base.UniqueSet): void; /** * @hidden */ @@ -2588,11 +3103,13 @@ declare namespace std { *

Elements with equivalent values are grouped together in the same bucket and in such a way that an * iterator can iterate through all of them. Iterators in the container are doubly linked iterators.

* + *

+ * *

Container properties

*
*
Associative
*
Elements in associative containers are referenced by their key and not by their absolute - * position in the
+ * position in the container. * *
Hashed
*
Hashed containers organize their elements using hash tables that allow for fast access to elements @@ -2605,41 +3122,22 @@ declare namespace std { *
The container can hold multiple elements with equivalent keys.
*
* - *
    - *
  • Reference: http://www.cplusplus.com/reference/unordered_set/unordered_multiset/
  • - *
- * * @param Type of the elements. * Each element in an {@link UnorderedMultiSet} is also identified by this value.. * + * @reference http://www.cplusplus.com/reference/unordered_set/unordered_multiset * @author Jeongho Nam */ class HashMultiSet extends base.MultiSet { private hash_buckets_; /** - * Default Constructor. + * @hidden */ - constructor(); - /** - * Construct from elements. - */ - constructor(items: Array); - /** - * Copy Constructor. - */ - constructor(container: base.IContainer); - /** - * Construct from range iterators. - */ - constructor(begin: base.Iterator, end: base.Iterator); + protected init(): void; /** * @hidden */ protected construct_from_array(items: Array): void; - /** - * @inheritdoc - */ - assign>(begin: InputIterator, end: InputIterator): void; /** * @inheritdoc */ @@ -2648,6 +3146,10 @@ declare namespace std { * @inheritdoc */ find(val: T): SetIterator; + /** + * @inheritdoc + */ + count(val: T): number; /** * @hidden */ @@ -2655,19 +3157,23 @@ declare namespace std { /** * @hidden */ - protected insert_by_range>(begin: InputIterator, end: InputIterator): void; + protected insert_by_hint(hint: SetIterator, val: T): SetIterator; + /** + * @hidden + */ + protected insert_by_range>(first: InputIterator, last: InputIterator): void; /** * @inheritdoc */ - protected handle_insert(it: SetIterator): void; + protected handle_insert(first: SetIterator, last: SetIterator): void; /** * @inheritdoc */ - protected handle_erase(it: SetIterator): void; + protected handle_erase(first: SetIterator, last: SetIterator): void; /** * @inheritdoc */ - swap(obj: base.IContainer): void; + swap(obj: base.MultiSet): void; /** * @hidden */ @@ -2693,12 +3199,14 @@ declare namespace std.base { * {@link List} and registering {@link ListIterator iterators} of the {@link data_ list container} to an index * table like {@link RBTree tree} or {@link HashBuckets hash-table}.

* + *

+ * *

Container properties

*
*
Associative
*
* Elements in associative containers are referenced by their key and not by their absolute position - * in the + * in the container. *
* *
Map
@@ -2713,7 +3221,7 @@ declare namespace std.base { * * @author Jeongho Nam */ - abstract class MapContainer { + abstract class MapContainer extends base.Container> { /** * Type definition of {@link MapContainer}'s {@link MapIterator iterator}. */ @@ -2744,11 +3252,15 @@ declare namespace std.base { /** * Copy Constructor. */ - constructor(container: MapContainer); + constructor(container: IContainer>); /** * Construct from range iterators. */ - constructor(begin: MapIterator, end: MapIterator); + constructor(begin: Iterator>, end: Iterator>); + /** + * @hidden + */ + protected init(): void; /** * @hidden */ @@ -2756,25 +3268,17 @@ declare namespace std.base { /** * @hidden */ - protected construct_from_container(container: MapContainer): void; + protected construct_from_container(container: IContainer>): void; /** * @hidden */ - protected construct_from_range(begin: MapIterator, end: MapIterator): void; + protected construct_from_range>>(begin: InputIterator, end: InputIterator): void; /** - *

Assign new content to content.

- * - *

Assigns new contents to the container, replacing its current contents, and modifying its {@link size} - * accordingly.

- * - * @param begin Input interator of the initial position in a sequence. - * @param end Input interator of the final position in a sequence. + * @inheritdoc */ - assign(begin: MapIterator, end: MapIterator): void; + assign>>(first: InputIterator, last: InputIterator): void; /** - *

Clear content.

- * - *

Removes all elements from the container, leaving the container with a size of 0.

+ * @inheritdoc */ clear(): void; /** @@ -2879,9 +3383,13 @@ declare namespace std.base { */ size(): number; /** - * Test whether the container is empty. + * @inheritdoc */ - empty(): boolean; + push(...args: Pair[]): number; + /** + * @inheritdoc + */ + push(...args: [Key, T][]): number; /** *

Insert an element.

* @@ -2895,6 +3403,19 @@ declare namespace std.base { * equivalent key in the {@link MapContainer}. */ insert(hint: MapIterator, pair: Pair): MapIterator; + /** + *

Insert an element.

+ * + *

Extends the container by inserting a new element, effectively increasing the container {@link size} + * by the number of element inserted (zero or one).

+ * + * @param hint Hint for the position where the element can be inserted. + * @param pair {@link Pair} to be inserted as an element. + * + * @return An iterator pointing to either the newly inserted element or to the element that already had an + * equivalent key in the {@link MapContainer}. + */ + insert(hint: MapReverseIterator, pair: Pair): MapReverseIterator; /** *

Insert an element.

* @@ -2908,6 +3429,19 @@ declare namespace std.base { * equivalent key in the {@link MapContainer}. */ insert(hint: MapIterator, tuple: [L, U]): MapIterator; + /** + *

Insert an element.

+ * + *

Extends the container by inserting new elements, effectively increasing the container {@link size} + * by the number of elements inserted.

+ * + * @param hint Hint for the position where the element can be inserted. + * @param tuple Tuple represensts the {@link Pair} to be inserted as an element. + * + * @return An iterator pointing to either the newly inserted element or to the element that already had an + * equivalent key in the {@link MapContainer}. + */ + insert(hint: MapReverseIterator, tuple: [L, U]): MapReverseIterator; /** *

Insert elements from range iterators.

* @@ -2919,7 +3453,7 @@ declare namespace std.base { * Notice that the range includes all the elements between begin and end, * including the element pointed by begin but not the one pointed by end. */ - insert(begin: MapIterator, end: MapIterator): void; + insert>>(first: InputIterator, last: InputIterator): void; /** * @hidden */ @@ -2931,15 +3465,15 @@ declare namespace std.base { /** * @hidden */ - protected insert_by_hint(hint: MapIterator, pair: Pair): MapIterator; + protected abstract insert_by_hint(hint: MapIterator, pair: Pair): MapIterator; /** * @hidden */ - private insert_by_hint_with_tuple(hint, tuple); + private insert_by_hint_with_tuple(hint, tuple); /** * @hidden */ - protected insert_by_range(begin: MapIterator, end: MapIterator): void; + protected abstract insert_by_range>>(first: InputIterator, last: InputIterator): void; /** *

Erase an elemet by key.

* @@ -2978,6 +3512,33 @@ declare namespace std.base { * including the element pointed by begin but not the one pointed by end. */ erase(begin: MapIterator, end: MapIterator): MapIterator; + /** + *

Erase an elemet by iterator.

+ * + *

Removes from the {@link MapContainer map container} a single element.

+ * + *

This effectively reduces the container {@link size} by the number of element removed (zero or one), + * which are destroyed.

+ * + * @param it Iterator specifying position winthin the {@link MapContainer map contaier} to be removed. + */ + erase(it: MapReverseIterator): MapReverseIterator; + /** + *

Erase elements by range iterators.

+ * + *

Removes from the {@link MapContainer map container} a range of elements.

+ * + *

This effectively reduces the container {@link size} by the number of elements removed, which are + * destroyed.

+ * + * @param begin An iterator specifying initial position of a range within {@link MApContainer map container} + * to be removed. + * @param end An iterator specifying initial position of a range within {@link MApContainer map container} + * to be removed. + * Notice that the range includes all the elements between begin and end, + * including the element pointed by begin but not the one pointed by end. + */ + erase(begin: MapReverseIterator, end: MapReverseIterator): MapReverseIterator; /** * @hidden */ @@ -2985,82 +3546,69 @@ declare namespace std.base { /** * @hidden */ - private erase_by_iterator(it); + private erase_by_iterator(first, last?); /** * @hidden */ private erase_by_range(begin, end); /** - *

Abstract method handling insertion for indexing.

+ *

Abstract method handling insertions for indexing.

* - *

This method, {@link handle_insert} is designed to register the item to somewhere storing those - * {@link MapIterator iterators} for indexing, fast accessment and retrievalance.

- * - *

When {@link insert} is called, a new element will be inserted into the {@link data_ list container} - * and a new {@link MapIterator iterator} item, pointing the element, will be created and the newly - * created iterator item will be shifted into this method {@link handle_insert} after the insertion.

- * - *

If the derived one is {@link RBTree tree-based} like {@link TreeMap}, the item will be - * registered into the {@link TreeMap.tree_ tree} as a {@link XTreeNode tree node item}. Else if the derived - * one is {@link HashBuckets hash-based} like {@link HashSet}, the item will be registered into the - * {@link HashMap.hash_buckets_ hash bucket}.

- * - * @param item Iterator of inserted item. - */ - protected abstract handle_insert(item: MapIterator): void; - /** - *

Abstract method handling deletion for indexing.

- * - *

This method, {@link handle_insert} is designed to unregister the item to somewhere storing + *

This method, {@link handle_insert} is designed to register the first to last to somewhere storing * those {@link MapIterator iterators} for indexing, fast accessment and retrievalance.

* - *

When {@link erase} is called with item, an {@link MapIterator iterator} positioning somewhere - * place to be deleted, is memorized and shifted to this method {@link handle_erase} after the deletion - * process is terminated.

+ *

When {@link insert} is called, new elements will be inserted into the {@link data_ list container} and new + * {@link MapIterator iterators} first to last, pointing the inserted elements, will be created and the + * newly created iterators first to last will be shifted into this method {@link handle_insert} after the + * insertions.

* - *

If the derived one is {@link RBTree tree-based} like {@link TreeMap}, the item will be - * unregistered from the {@link TreeMap.tree_ tree} as a {@link XTreeNode tree node item}. Else if the - * derived one is {@link HashBuckets hash-based} like {@link HashSet}, the item will be unregistered - * from the {@link HashMap.hash_buckets_ hash bucket}.

+ *

If the derived one is {@link RBTree tree-based} like {@link TreeSet}, the {@link MapIterator iterators} + * will be registered into the {@link TreeSet.tree_ tree} as a {@link XTreeNode tree node item}. Else if the + * derived one is {@link HashBuckets hash-based} like {@link HashSet}, the first to last will be + * registered into the {@link HashSet.hash_buckets_ hash bucket}.

* - * @param item Iterator of erased item. + * @param first An {@link MapIterator} to the initial position in a sequence. + * @param last An {@link MapIterator} to the final position in a sequence. The range used is + * [first, last), which contains all the elements between first and last, + * including the element pointed by first but not the element pointed by last. */ - protected abstract handle_erase(item: MapIterator): void; + protected abstract handle_insert(first: MapIterator, last: MapIterator): void; /** - *

Swap content.

+ *

Abstract method handling deletions for indexing.

* - *

Exchanges the content of the container by the content of obj, which is another - * {@link MapContainer map} of the same type. Sizes abd container type may differ.

+ *

This method, {@link handle_insert} is designed to unregister the first to last to somewhere storing + * those {@link MapIterator iterators} for indexing, fast accessment and retrievalance.

* - *

After the call to this member function, the elements in this container are those which were - * in obj before the call, and the elements of obj are those which were in this. All - * iterators, references and pointers remain valid for the swapped objects.

+ *

When {@link erase} is called with first to last, {@link MapIterator iterators} positioning somewhere + * place to be deleted, is memorized and shifted to this method {@link handle_erase} after the deletion process is + * terminated.

* - *

Notice that a non-member function exists with the same name, {@link std.swap swap}, overloading that - * algorithm with an optimization that behaves like this member function.

+ *

If the derived one is {@link RBTree tree-based} like {@link TreeSet}, the {@link MapIterator iterators} + * will be unregistered from the {@link TreeSet.tree_ tree} as a {@link XTreeNode tree node item}. Else if the + * derived one is {@link HashBuckets hash-based} like {@link HashSet}, the first to last will be + * unregistered from the {@link HashSet.hash_buckets_ hash bucket}.

* - * @param obj Another {@link MapContainer map container} of the same type of elements as this (i.e., - * with the same template parameters, Key and T) whose content is swapped - * with that of this {@link MapContaier container}. + * @param first An {@link MapIterator} to the initial position in a sequence. + * @param last An {@link MapIterator} to the final position in a sequence. The range used is + * [first, last), which contains all the elements between first and last, + * including the element pointed by first but not the element pointed by last. */ - swap(obj: MapContainer): void; + protected abstract handle_erase(first: MapIterator, last: MapIterator): void; } } declare namespace std { /** - * An iterator of {@link MapColntainer map container}. + *

An iterator of {@link MapContainer map container}.

+ * + *

* * @author Jeongho Nam */ - class MapIterator implements IComparable> { - /** - * The source {@link MapContainer} of the iterator is directing for. - */ - protected source_: base.MapContainer; + class MapIterator extends Iterator> implements IComparable> { /** * A {@link ListIterator} pointing {@link Pair} of key and value. */ - protected list_iterator_: ListIterator>; + private list_iterator_; /** * Construct from the {@link MapContainer source map} and {@link ListIterator list iterator}. * @@ -3084,13 +3632,17 @@ declare namespace std { */ advance(step: number): MapIterator; /** - * Get source. + * @hidden */ - get_source(): base.MapContainer; + private map; /** * Get ListIterator. */ get_list_iterator(): ListIterator>; + /** + * @inheritdoc + */ + value: Pair; /** * Get first, key element. */ @@ -3115,33 +3667,27 @@ declare namespace std { hash(): number; swap(obj: MapIterator): void; } -} -declare namespace std { /** - * A reverse-iterator of {@link MapColntainer map container}. + *

A reverse-iterator of {@link MapContainer map container}.

+ * + *

* * @author Jeongho Nam */ - class MapReverseIterator extends MapIterator { + class MapReverseIterator extends ReverseIterator, MapIterator, MapReverseIterator> { + constructor(base: MapIterator); + protected create_neighbor(): MapReverseIterator; /** - * Construct from the {@link MapContainer source map} and {@link ListIterator list iterator}. - * - * @param source The source {@link MapContainer}. - * @param list_iterator A {@link ListIterator} pointing {@link Pair} of key and value. + * Get first, key element. */ - constructor(source: base.MapContainer, list_iterator: ListIterator>); + first: Key; /** - * @inheritdoc + * Get second, value element. */ - prev(): MapReverseIterator; /** - * @inheritdoc + * Set second value. */ - next(): MapReverseIterator; - /** - * @inheritdoc - */ - advance(step: number): MapReverseIterator; + second: T; } } declare namespace std.base { @@ -3163,12 +3709,14 @@ declare namespace std.base { * {@link List} and registering {@link ListIterator iterators} of the {@link data_ list container} to an index * table like {@link RBTree tree} or {@link HashBuckets hash-table}.

* + *

+ * *

Container properties

*
*
Associative
*
* Elements in associative containers are referenced by their key and not by their absolute position - * in the + * in the container. *
* *
Map
@@ -3187,28 +3735,6 @@ declare namespace std.base { * @author Jeongho Nam */ abstract class UniqueMap extends MapContainer { - /** - * Default Constructor. - */ - constructor(); - /** - * Construct from elements. - */ - constructor(items: Array>); - /** - * Contruct from tuples. - * - * @param array Tuples to be contained. - */ - constructor(array: Array<[Key, T]>); - /** - * Copy Constructor. - */ - constructor(container: MapContainer); - /** - * Construct from range iterators. - */ - constructor(begin: MapIterator, end: MapIterator); /** * @inheritdoc */ @@ -3281,6 +3807,10 @@ declare namespace std.base { * @inheritdoc */ insert(hint: MapIterator, pair: Pair): MapIterator; + /** + * @inheritdoc + */ + insert(hint: MapReverseIterator, pair: Pair): MapReverseIterator; /** * @inheritdoc */ @@ -3288,7 +3818,29 @@ declare namespace std.base { /** * @inheritdoc */ - insert(begin: MapIterator, end: MapIterator): void; + insert(hint: MapReverseIterator, tuple: [L, U]): MapReverseIterator; + /** + * @inheritdoc + */ + insert>>(first: InputIterator, last: InputIterator): void; + /** + *

Swap content.

+ * + *

Exchanges the content of the container by the content of obj, which is another + * {@link UniqueMap map} of the same type. Sizes abd container type may differ.

+ * + *

After the call to this member function, the elements in this container are those which were + * in obj before the call, and the elements of obj are those which were in this. All + * iterators, references and pointers remain valid for the swapped objects.

+ * + *

Notice that a non-member function exists with the same name, {@link std.swap swap}, overloading that + * algorithm with an optimization that behaves like this member function.

+ * + * @param obj Another {@link UniqueMap map container} of the same type of elements as this (i.e., + * with the same template parameters, Key and T) whose content is swapped + * with that of this {@link UniqueMap container}. + */ + swap(obj: UniqueMap): void; } } declare namespace std.base { @@ -3310,12 +3862,14 @@ declare namespace std.base { * {@link List} and registering {@link ListIterator iterators} of the {@link data_ list container} to an index * table like {@link RBTree tree} or {@link HashBuckets hash-table}.

* + *

+ * *

Container properties

*
*
Associative
*
* Elements in associative containers are referenced by their key and not by their absolute position - * in the + * in the container. *
* *
Map
@@ -3334,32 +3888,6 @@ declare namespace std.base { * @author Jeongho Nam */ abstract class MultiMap extends MapContainer { - /** - * Default Constructor. - */ - constructor(); - /** - * Construct from elements. - */ - constructor(items: Array>); - /** - * Contruct from tuples. - * - * @param array Tuples to be contained. - */ - constructor(array: Array<[Key, T]>); - /** - * Copy Constructor. - */ - constructor(container: MapContainer); - /** - * Construct from range iterators. - */ - constructor(begin: MapIterator, end: MapIterator); - /** - * @inheritdoc - */ - count(key: Key): number; /** *

Insert elements.

* @@ -3386,6 +3914,10 @@ declare namespace std.base { * @inheritdoc */ insert(hint: MapIterator, pair: Pair): MapIterator; + /** + * @inheritdoc + */ + insert(hint: MapReverseIterator, pair: Pair): MapReverseIterator; /** * @inheritdoc */ @@ -3393,35 +3925,58 @@ declare namespace std.base { /** * @inheritdoc */ - insert(begin: MapIterator, end: MapIterator): void; + insert(hint: MapReverseIterator, tuple: [L, U]): MapReverseIterator; + /** + * @inheritdoc + */ + insert>>(first: InputIterator, last: InputIterator): void; + /** + *

Swap content.

+ * + *

Exchanges the content of the container by the content of obj, which is another + * {@link UniqueMap map} of the same type. Sizes abd container type may differ.

+ * + *

After the call to this member function, the elements in this container are those which were + * in obj before the call, and the elements of obj are those which were in this. All + * iterators, references and pointers remain valid for the swapped objects.

+ * + *

Notice that a non-member function exists with the same name, {@link std.swap swap}, overloading that + * algorithm with an optimization that behaves like this member function.

+ * + * @param obj Another {@link MultiMap map container} of the same type of elements as this (i.e., + * with the same template parameters, Key and T) whose content is swapped + * with that of this {@link MultiMap container}. + */ + swap(obj: MultiMap): void; } } declare namespace std { /** *

Hashed, unordered map.

* - *

{@link HashMap}s are associative containers that store elements formed by the - * combination of a key value and a mapped value, and which allows for fast - * retrieval of individual elements based on their keys.

+ *

{@link HashMap}s are associative containers that store elements formed by the combination of a key value + * and a mapped value, and which allows for fast retrieval of individual elements based on their keys. + *

* - *

In an {@link HashMap}, the key value is generally used to uniquely identify - * the element, while the mapped value is an object with the content associated to this - * key. Types of key and mapped value may differ.

+ *

In an {@link HashMap}, the key value is generally used to uniquely identify the element, while the + * mapped value is an object with the content associated to this key. Types of key and + * mapped value may differ.

* - *

Internally, the elements in the {@link HashMap} are not sorted in any particular order - * with respect to either their key or mapped values, but organized into buckets - * depending on their hash values to allow for fast access to individual elements directly by - * their key values (with a constant average time complexity on average).

+ *

Internally, the elements in the {@link HashMap} are not sorted in any particular order with respect to either + * their key or mapped values, but organized into buckets depending on their hash values to allow + * for fast access to individual elements directly by their key values (with a constant average time complexity + * on average).

* - *

{@link HashMap} containers are faster than {@link TreeMap} containers to access - * individual elements by their key, although they are generally less efficient for range - * iteration through a subset of their elements.

+ *

{@link HashMap} containers are faster than {@link TreeMap} containers to access individual elements by their + * key, although they are generally less efficient for range iteration through a subset of their elements.

+ * + *

* *

Container properties

*
*
Associative
*
Elements in associative containers are referenced by their key and not by their absolute - * position in the
+ * position in the container. * *
Hashed
*
Hashed containers organize their elements using hash tables that allow for fast access to elements @@ -3435,56 +3990,24 @@ declare namespace std { *
No two elements in the container can have equivalent keys.
*
* - *
    - *
  • Reference: http://www.cplusplus.com/reference/unordered_map/unordered_map/
  • - *
- * * @param Type of the key values. * Each element in an {@link HashMap} is uniquely identified by its key value. * @param Type of the mapped value. * Each element in an {@link HashMap} is used to store some data as its mapped value. * + * @reference http://www.cplusplus.com/reference/unordered_map/unordered_map * @author Jeongho Nam */ class HashMap extends base.UniqueMap { private hash_buckets_; /** - * Default Constructor. + * @hidden */ - constructor(); - /** - * Contruct from elements. - * - * @param array Elements to be contained. - */ - constructor(array: Array>); - /** - * Contruct from tuples. - * - * @param array Tuples to be contained. - */ - constructor(array: Array<[Key, T]>); - /** - * Copy Constructor. - * - * @param container Another map to copy. - */ - constructor(container: base.MapContainer); - /** - * Range Constructor. - * - * @param begin nput interator of the initial position in a sequence. - * @param end Input interator of the final position in a sequence. - */ - constructor(begin: MapIterator, end: MapIterator); + protected init(): void; /** * @hidden */ protected construct_from_array(items: Array>): void; - /** - * @inheritdoc - */ - assign(begin: MapIterator, end: MapIterator): void; /** * @inheritdoc */ @@ -3500,19 +4023,23 @@ declare namespace std { /** * @hidden */ - protected insert_by_range(begin: MapIterator, end: MapIterator): void; + protected insert_by_hint(hint: MapIterator, pair: Pair): MapIterator; + /** + * @hidden + */ + protected insert_by_range>>(first: InputIterator, last: InputIterator): void; /** * @inheritdoc */ - protected handle_insert(it: MapIterator): void; + protected handle_insert(first: MapIterator, last: MapIterator): void; /** * @inheritdoc */ - protected handle_erase(it: MapIterator): void; + protected handle_erase(first: MapIterator, last: MapIterator): void; /** * @inheritdoc */ - swap(obj: base.MapContainer): void; + swap(obj: base.UniqueMap): void; /** * @hidden */ @@ -3537,11 +4064,13 @@ declare namespace std { *

Elements with equivalent keys are grouped together in the same bucket and in such a way that * an iterator can iterate through all of them. Iterators in the container are doubly linked iterators.

* + *

+ * *

Container properties

*
*
Associative
*
Elements in associative containers are referenced by their key and not by their absolute - * position in the
+ * position in the container. * *
Hashed
*
Hashed containers organize their elements using hash tables that allow for fast access to elements @@ -3555,15 +4084,12 @@ declare namespace std { *
The container can hold multiple elements with equivalent keys.
*
* - *
    - *
  • Reference: http://www.cplusplus.com/reference/unordered_map/unordered_multimap/
  • - *
- * * @param Type of the key values. * Each element in an {@link HashMap} is identified by a key value. * @param Type of the mapped value. * Each element in an {@link HashMap} is used to store some data as its mapped value. * + * @reference http://www.cplusplus.com/reference/unordered_map/unordered_multimap * @author Jeongho Nam */ class HashMultiMap extends base.MultiMap { @@ -3572,42 +4098,13 @@ declare namespace std { */ private hash_buckets_; /** - * Default Constructor. + * @hidden */ - constructor(); - /** - * Contruct from elements. - * - * @param array Elements to be contained. - */ - constructor(array: Array>); - /** - * Contruct from tuples. - * - * @param array Tuples to be contained. - */ - constructor(array: Array<[Key, T]>); - /** - * Copy Constructor. - * - * @param container Another map to copy. - */ - constructor(container: base.MapContainer); - /** - * Range Constructor. - * - * @param begin nput interator of the initial position in a sequence. - * @param end Input interator of the final position in a sequence. - */ - constructor(begin: MapIterator, end: MapIterator); + protected init(): void; /** * @hidden */ protected construct_from_array(items: Array>): void; - /** - * @inheritdoc - */ - assign(begin: MapIterator, end: MapIterator): void; /** * @inheritdoc */ @@ -3616,6 +4113,10 @@ declare namespace std { * @inheritdoc */ find(key: Key): MapIterator; + /** + * @inheritdoc + */ + count(key: Key): number; /** * @hidden */ @@ -3623,19 +4124,23 @@ declare namespace std { /** * @hidden */ - protected insert_by_range(begin: MapIterator, end: MapIterator): void; + protected insert_by_hint(hint: MapIterator, pair: Pair): MapIterator; + /** + * @hidden + */ + protected insert_by_range>>(first: InputIterator, last: InputIterator): void; /** * @inheritdoc */ - protected handle_insert(it: MapIterator): void; + protected handle_insert(first: MapIterator, last: MapIterator): void; /** * @inheritdoc */ - protected handle_erase(it: MapIterator): void; + protected handle_erase(first: MapIterator, last: MapIterator): void; /** * @inheritdoc */ - swap(obj: base.MapContainer): void; + swap(obj: base.MultiMap): void; /** * @hidden */ @@ -3662,12 +4167,14 @@ declare namespace std { * *

{@link TreeSet}s are typically implemented as binary search trees.

* + *

+ * *

Container properties

*
*
Associative
*
* Elements in associative containers are referenced by their key and not by their absolute - * position in the + * position in the container. *
* *
Ordered
@@ -3683,13 +4190,10 @@ declare namespace std { *
No two elements in the container can have equivalent keys.
*
* - *
    - *
  • Reference: http://www.cplusplus.com/reference/set/set/
  • - *
- * * @param Type of the elements. * Each element in an {@link TreeSet} is also uniquely identified by this value. * + * @reference http://www.cplusplus.com/reference/set/set * @author Jeongho Nam */ class TreeSet extends base.UniqueSet { @@ -3723,21 +4227,21 @@ declare namespace std { /** * Copy Constructor. */ - constructor(container: base.Container); + constructor(container: base.IContainer); /** * Copy Constructor with compare. * * @param container A container to be copied. * @param compare A binary predicate determines order of elements. */ - constructor(container: base.Container, compare: (left: T, right: T) => boolean); + constructor(container: base.IContainer, compare: (left: T, right: T) => boolean); /** * Range Constructor. * * @param begin Input interator of the initial position in a sequence. * @param end Input interator of the final position in a sequence. */ - constructor(begin: base.Iterator, end: base.Iterator); + constructor(begin: Iterator, end: Iterator); /** * Range Constructor with compare. * @@ -3745,11 +4249,7 @@ declare namespace std { * @param end Input interator of the final position in a sequence. * @param compare A binary predicate determines order of elements. */ - constructor(begin: base.Iterator, end: base.Iterator, compare: (left: T, right: T) => boolean); - /** - * @inheritdoc - */ - assign>(begin: InputIterator, end: InputIterator): void; + constructor(begin: Iterator, end: Iterator, compare: (left: T, right: T) => boolean); /** * @inheritdoc */ @@ -3829,18 +4329,23 @@ declare namespace std { * @hidden */ protected insert_by_val(val: T): any; + protected insert_by_hint(hint: SetIterator, val: T): SetIterator; + /** + * @hidden + */ + protected insert_by_range>(first: InputIterator, last: InputIterator): void; /** * @inheritdoc */ - protected handle_insert(item: SetIterator): void; + protected handle_insert(first: SetIterator, last: SetIterator): void; /** * @inheritdoc */ - protected handle_erase(item: SetIterator): void; + protected handle_erase(first: SetIterator, last: SetIterator): void; /** * @inheritdoc */ - swap(obj: base.IContainer): void; + swap(obj: base.UniqueSet): void; /** * @hidden */ @@ -3866,12 +4371,14 @@ declare namespace std { * *

{@link TreeMultiSet TreeMultiSets} are typically implemented as binary search trees.

* + *

+ * *

Container properties

*
*
Associative
*
* Elements in associative containers are referenced by their key and not by their absolute - * position in the + * position in the container. *
* *
Ordered
@@ -3887,13 +4394,10 @@ declare namespace std { *
Multiple elements in the container can have equivalent keys.
*
* - *
    - *
  • Reference: http://www.cplusplus.com/reference/set/multiset/
  • - *
- * * @param Type of the elements. Each element in a {@link TreeMultiSet} container is also identified * by this value (each value is itself also the element's key). * + * @reference http://www.cplusplus.com/reference/set/multiset * @author Jeongho Nam */ class TreeMultiSet extends base.MultiSet { @@ -3941,7 +4445,7 @@ declare namespace std { * @param begin Input interator of the initial position in a sequence. * @param end Input interator of the final position in a sequence. */ - constructor(begin: base.Iterator, end: base.Iterator); + constructor(begin: Iterator, end: Iterator); /** * Construct from range and compare. * @@ -3949,11 +4453,7 @@ declare namespace std { * @param end Input interator of the final position in a sequence. * @param compare A binary predicate determines order of elements. */ - constructor(begin: base.Iterator, end: base.Iterator, compare: (left: T, right: T) => boolean); - /** - * @inheritdoc - */ - assign>(begin: InputIterator, end: InputIterator): void; + constructor(begin: Iterator, end: Iterator, compare: (left: T, right: T) => boolean); /** * @inheritdoc */ @@ -3962,6 +4462,10 @@ declare namespace std { * @inheritdoc */ find(val: T): SetIterator; + /** + * @inheritdoc + */ + count(val: T): number; /** *

Return iterator to lower bound.

* @@ -4033,17 +4537,25 @@ declare namespace std { */ protected insert_by_val(val: T): any; /** - * @inheritdoc + * @hidden */ - protected handle_insert(item: SetIterator): void; + protected insert_by_hint(hint: SetIterator, val: T): SetIterator; + /** + * @hidden + */ + protected insert_by_range>(first: InputIterator, last: InputIterator): void; /** * @inheritdoc */ - protected handle_erase(item: SetIterator): void; + protected handle_insert(first: SetIterator, last: SetIterator): void; /** * @inheritdoc */ - swap(obj: base.IContainer): void; + protected handle_erase(first: SetIterator, last: SetIterator): void; + /** + * @inheritdoc + */ + swap(obj: base.MultiSet): void; /** * @hidden */ @@ -4057,27 +4569,28 @@ declare namespace std { *

{@link TreeMap TreeMaps} are associative containers that store elements formed by a combination of a * key value (Key) and a mapped value (T), following order.

* - *

In a {@link TreeMap}, the key values are generally used to sort and uniquely identify - * the elements, while the mapped values store the content associated to this key. The types of - * key and mapped value may differ, and are grouped together in member type value_type, - * which is a {@link Pair} type combining both:

+ *

In a {@link TreeMap}, the key values are generally used to sort and uniquely identify the elements, + * while the mapped values store the content associated to this key. The types of key and + * mapped value may differ, and are grouped together in member type value_type, which is a {@link Pair} + * type combining both:

* *

typedef Pair value_type;

* - *

Internally, the elements in a {@link TreeMap} are always sorted by its key following - * a strict weak ordering criterion indicated by its internal comparison method {@link less}. + *

Internally, the elements in a {@link TreeMap} are always sorted by its key following a + * strict weak ordering criterion indicated by its internal comparison method {@link less}. * - *

{@link TreeMap} containers are generally slower than {@link HashMap HashMap} containers to - * access individual elements by their key, but they allow the direct iteration on subsets based on - * their order.

+ *

{@link TreeMap} containers are generally slower than {@link HashMap HashMap} containers to access individual + * elements by their key, but they allow the direct iteration on subsets based on their order.

* *

{@link TreeMap}s are typically implemented as binary search trees.

* + *

+ * *

Container properties

*
*
Associative
*
Elements in associative containers are referenced by their key and not by their absolute - * position in the
+ * position in the container. * *
Ordered
*
The elements in the container follow a strict order at all times. All inserted elements are @@ -4091,13 +4604,10 @@ declare namespace std { *
No two elements in the container can have equivalent keys.
*
* - *
    - *
  • Reference: http://www.cplusplus.com/reference/map/map/
  • - *
- * * @param Type of the keys. Each element in a map is uniquely identified by its key value. * @param Type of the mapped value. Each element in a map stores some data as its mapped value. * + * @reference http://www.cplusplus.com/reference/map/map * @author Jeongho Nam */ class TreeMap extends base.UniqueMap { @@ -4160,7 +4670,7 @@ declare namespace std { * @param begin nput interator of the initial position in a sequence. * @param end Input interator of the final position in a sequence. */ - constructor(begin: MapIterator, end: MapIterator); + constructor(begin: Iterator>, end: Iterator>); /** * Range Constructor. * @@ -4168,11 +4678,7 @@ declare namespace std { * @param end Input interator of the final position in a sequence. * @param compare A binary predicate determines order of elements. */ - constructor(begin: MapIterator, end: MapIterator, compare: (left: Key, right: Key) => boolean); - /** - * @inheritdoc - */ - assign(begin: MapIterator, end: MapIterator): void; + constructor(begin: Iterator>, end: Iterator>, compare: (left: Key, right: Key) => boolean); /** * @inheritdoc */ @@ -4255,17 +4761,25 @@ declare namespace std { */ protected insert_by_pair(pair: Pair): any; /** - * @inheritdoc + * @hidden */ - protected handle_insert(item: MapIterator): void; + protected insert_by_hint(hint: MapIterator, pair: Pair): MapIterator; + /** + * @hidden + */ + protected insert_by_range>>(first: InputIterator, last: InputIterator): void; /** * @inheritdoc */ - protected handle_erase(item: MapIterator): void; + protected handle_insert(first: MapIterator, last: MapIterator): void; /** * @inheritdoc */ - swap(obj: base.MapContainer): void; + protected handle_erase(first: MapIterator, last: MapIterator): void; + /** + * @inheritdoc + */ + swap(obj: base.UniqueMap): void; /** * @hidden */ @@ -4294,12 +4808,14 @@ declare namespace std { * *

{@link TreeMultiMap TreeMultiMaps} are typically implemented as binary search trees.

* + *

+ * *

Container properties

*
*
Associative
*
* Elements in associative containers are referenced by their key and not by their absolute - * position in the + * position in the container. *
* *
Ordered
@@ -4318,13 +4834,10 @@ declare namespace std { *
Multiple elements in the container can have equivalent keys.
*
* - *
    - *
  • Reference: http://www.cplusplus.com/reference/map/multimap/
  • - *
- * * @param Type of the keys. Each element in a map is uniquely identified by its key value. * @param Type of the mapped value. Each element in a map stores some data as its mapped value. * + * @reference http://www.cplusplus.com/reference/map/multimap * @author Jeongho Nam */ class TreeMultiMap extends base.MultiMap { @@ -4384,7 +4897,7 @@ declare namespace std { * @param begin nput interator of the initial position in a sequence. * @param end Input interator of the final position in a sequence. */ - constructor(begin: MapIterator, end: MapIterator); + constructor(begin: Iterator>, end: Iterator>); /** * Range Constructor. * @@ -4392,11 +4905,7 @@ declare namespace std { * @param end Input interator of the final position in a sequence. * @param compare A binary predicate determines order of elements. */ - constructor(begin: MapIterator, end: MapIterator, compare: (left: Key, right: Key) => boolean); - /** - * @inheritdoc - */ - assign(begin: MapIterator, end: MapIterator): void; + constructor(begin: Iterator>, end: Iterator>, compare: (left: Key, right: Key) => boolean); /** * @inheritdoc */ @@ -4405,6 +4914,10 @@ declare namespace std { * @inheritdoc */ find(key: Key): MapIterator; + /** + * @inheritdoc + */ + count(key: Key): number; /** *

Return iterator to lower bound.

* @@ -4476,17 +4989,25 @@ declare namespace std { */ protected insert_by_pair(pair: Pair): any; /** - * @inheritdoc + * @hidden */ - protected handle_insert(item: MapIterator): void; + protected insert_by_hint(hint: MapIterator, pair: Pair): MapIterator; + /** + * @hidden + */ + protected insert_by_range>>(first: InputIterator, last: InputIterator): void; /** * @inheritdoc */ - protected handle_erase(item: MapIterator): void; + protected handle_insert(first: MapIterator, last: MapIterator): void; /** * @inheritdoc */ - swap(obj: base.MapContainer): void; + protected handle_erase(first: MapIterator, last: MapIterator): void; + /** + * @inheritdoc + */ + swap(obj: base.MultiMap): void; /** * @hidden */ @@ -4508,7 +5029,7 @@ declare namespace std { * * @return Returns fn. */ - function for_each, Func extends (val: T) => any>(first: Iterator, last: Iterator, fn: Func): Func; + function for_each, Func extends (val: T) => any>(first: InputIterator, last: InputIterator, fn: Func): Func; /** *

Test condition on all elements in range.

* @@ -4527,7 +5048,7 @@ declare namespace std { * @return true if pred returns true for all the elements in the range or if the range is * {@link IContainer.empty empty}, and false otherwise. */ - function all_of>(first: Iterator, last: Iterator, pred: (val: T) => boolean): boolean; + function all_of>(first: InputIterator, last: InputIterator, pred: (val: T) => boolean): boolean; /** *

Test if any element in range fulfills condition.

* @@ -4549,7 +5070,7 @@ declare namespace std { * [first, last), and false otherwise. If [first, last) is an * {@link IContainer.empty empty} range, the function returns false. */ - function any_of>(first: Iterator, last: Iterator, pred: (val: T) => boolean): boolean; + function any_of>(first: InputIterator, last: InputIterator, pred: (val: T) => boolean): boolean; /** *

Test if no elements fulfill condition.

* @@ -4569,7 +5090,7 @@ declare namespace std { * [first, last) or if the range is {@link IContainer.empty empty}, and false * otherwise. */ - function none_of>(first: Iterator, last: Iterator, pred: (val: T) => boolean): boolean; + function none_of>(first: InputIterator, last: InputIterator, pred: (val: T) => boolean): boolean; /** *

Test whether the elements in two ranges are equal.

* @@ -4586,7 +5107,7 @@ declare namespace std { * @return true if all the elements in the range [first1, last1) compare equal to those * of the range starting at first2, and false otherwise. */ - function equal>(first1: Iterator1, last1: Iterator1, first2: base.Iterator): boolean; + function equal>(first1: Iterator1, last1: Iterator1, first2: Iterator): boolean; /** *

Test whether the elements in two ranges are equal.

* @@ -4606,7 +5127,7 @@ declare namespace std { * @return true if all the elements in the range [first1, last1) compare equal to those * of the range starting at first2, and false otherwise. */ - function equal>(first1: Iterator1, last1: Iterator1, first2: base.Iterator, pred: (x: T, y: T) => boolean): boolean; + function equal>(first1: Iterator1, last1: Iterator1, first2: Iterator, pred: (x: T, y: T) => boolean): boolean; /** *

Test whether range is permutation of another.

* @@ -4624,7 +5145,7 @@ declare namespace std { * @return true if all the elements in the range [first1, last1) compare equal to those * of the range starting at first2 in any order, and false otherwise. */ - function is_permutation, Iterator2 extends base.Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2): boolean; + function is_permutation, Iterator2 extends Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2): boolean; /** *

Test whether range is permutation of another.

* @@ -4645,7 +5166,7 @@ declare namespace std { * @return true if all the elements in the range [first1, last1) compare equal to those * of the range starting at first2 in any order, and false otherwise. */ - function is_permutation, Iterator2 extends base.Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, pred: (x: T, y: T) => boolean): boolean; + function is_permutation, Iterator2 extends Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, pred: (x: T, y: T) => boolean): boolean; /** *

Lexicographical less-than comparison.

* @@ -4671,7 +5192,7 @@ declare namespace std { * @return true if the first range compares lexicographically less than than the second. * false otherwise (including when all the elements of both ranges are equivalent). */ - function lexicographical_compare, Iterator2 extends base.Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, last2: Iterator2): boolean; + function lexicographical_compare, Iterator2 extends Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, last2: Iterator2): boolean; /** *

Lexicographical comparison.

* @@ -4700,7 +5221,7 @@ declare namespace std { * @return true if the first range compares lexicographically relationship than than the * second. false otherwise (including when all the elements of both ranges are equivalent). */ - function lexicographical_compare, Iterator2 extends base.Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, last2: Iterator2, compare: (x: T, y: T) => boolean): boolean; + function lexicographical_compare, Iterator2 extends Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, last2: Iterator2, compare: (x: T, y: T) => boolean): boolean; /** *

Find value in range.

* @@ -4718,7 +5239,7 @@ declare namespace std { * @return An {@link Iterator} to the first element in the range that compares equal to val. If no elements * match, the function returns last. */ - function find>(first: Iterator, last: Iterator, val: T): Iterator; + function find>(first: InputIterator, last: InputIterator, val: T): InputIterator; /** *

Find element in range.

* @@ -4737,7 +5258,7 @@ declare namespace std { * false. If pred is false for all elements, the function returns * last. */ - function find_if>(first: Iterator, last: Iterator, pred: (val: T) => boolean): Iterator; + function find_if>(first: InputIterator, last: InputIterator, pred: (val: T) => boolean): InputIterator; /** *

Find element in range.

* @@ -4755,7 +5276,7 @@ declare namespace std { * @return An {@link Iterator} to the first element in the range for which pred returns false. * If pred is true for all elements, the function returns last. */ - function find_if_not>(first: Iterator, last: Iterator, pred: (val: T) => boolean): Iterator; + function find_if_not>(first: InputIterator, last: InputIterator, pred: (val: T) => boolean): InputIterator; /** *

Find last subsequence in range.

* @@ -4785,7 +5306,7 @@ declare namespace std { * [first1, last1). If the sequence is not found, the function returns ,i>last1. Otherwise * [first2, last2) is an empty range, the function returns last1. */ - function find_end, Iterator2 extends base.Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, last2: Iterator2): Iterator1; + function find_end, Iterator2 extends Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, last2: Iterator2): Iterator1; /** *

Find last subsequence in range.

* @@ -4815,7 +5336,7 @@ declare namespace std { * [first1, last1). If the sequence is not found, the function returns ,i>last1. Otherwise * [first2, last2) is an empty range, the function returns last1. */ - function find_end, Iterator2 extends base.Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, last2: Iterator2, pred: (x: T, y: T) => boolean): Iterator1; + function find_end, Iterator2 extends Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, last2: Iterator2, pred: (x: T, y: T) => boolean): Iterator1; /** *

Find element from set in range.

* @@ -4836,7 +5357,7 @@ declare namespace std { * @return An {@link Iterator} to the first element in [first1, last1) that is part of * [first2, last2). If no matches are found, the function returns last1. */ - function find_first_of, Iterator2 extends base.Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, last2: Iterator2): Iterator1; + function find_first_of, Iterator2 extends Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, last2: Iterator2): Iterator1; /** *

Find element from set in range.

* @@ -4860,7 +5381,7 @@ declare namespace std { * @return An {@link Iterator} to the first element in [first1, last1) that is part of * [first2, last2). If no matches are found, the function returns last1. */ - function find_first_of, Iterator2 extends base.Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, last2: Iterator2, pred: (x: T, y: T) => boolean): Iterator1; + function find_first_of, Iterator2 extends Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, last2: Iterator2, pred: (x: T, y: T) => boolean): Iterator1; /** *

Find equal adjacent elements in range.

* @@ -4877,7 +5398,7 @@ declare namespace std { * @return An {@link Iterator} to the first element of the first pair of matching consecutive elements in the range * [first, last). If no such pair is found, the function returns last. */ - function adjacent_find>(first: Iterator, last: Iterator): Iterator; + function adjacent_find>(first: InputIterator, last: InputIterator): InputIterator; /** *

Find equal adjacent elements in range.

* @@ -4897,7 +5418,7 @@ declare namespace std { * @return An {@link Iterator} to the first element of the first pair of matching consecutive elements in the range * [first, last). If no such pair is found, the function returns last. */ - function adjacent_find>(first: Iterator, last: Iterator, pred: (x: T, y: T) => boolean): Iterator; + function adjacent_find>(first: InputIterator, last: InputIterator, pred: (x: T, y: T) => boolean): InputIterator; /** *

Search range for subsequence.

* @@ -4924,7 +5445,7 @@ declare namespace std { * and last1. If the sequence is not found, the function returns last1. Otherwise * [first2, last2) is an empty range, the function returns first1. */ - function search, ForwardIterator2 extends base.Iterator>(first1: ForwardIterator1, last1: ForwardIterator1, first2: ForwardIterator2, last2: ForwardIterator2): ForwardIterator1; + function search, ForwardIterator2 extends Iterator>(first1: ForwardIterator1, last1: ForwardIterator1, first2: ForwardIterator2, last2: ForwardIterator2): ForwardIterator1; /** *

Search range for subsequence.

* @@ -4955,7 +5476,7 @@ declare namespace std { * [first1, last1). If the sequence is not found, the function returns last1. Otherwise * [first2, last2) is an empty range, the function returns first1. */ - function search, ForwardIterator2 extends base.Iterator>(first1: ForwardIterator1, last1: ForwardIterator1, first2: ForwardIterator2, last2: ForwardIterator2, pred: (x: T, y: T) => boolean): ForwardIterator1; + function search, ForwardIterator2 extends Iterator>(first1: ForwardIterator1, last1: ForwardIterator1, first2: ForwardIterator2, last2: ForwardIterator2, pred: (x: T, y: T) => boolean): ForwardIterator1; /** *

Search range for elements.

* @@ -5022,7 +5543,7 @@ declare namespace std { * to last1 and {@link Pair.second second} set to the element in that same relative position in the * second sequence. If none matched, it returns {@link make_pair}(first1, first2). */ - function mismatch, Iterator2 extends base.Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2): Pair; + function mismatch, Iterator2 extends Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2): Pair; /** *

Return first position where two ranges differ.

* @@ -5048,7 +5569,7 @@ declare namespace std { * to last1 and {@link Pair.second second} set to the element in that same relative position in the * second sequence. If none matched, it returns {@link make_pair}(first1, first2). */ - function mismatch, Iterator2 extends base.Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, compare: (x: T, y: T) => boolean): Pair; + function mismatch, Iterator2 extends Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, compare: (x: T, y: T) => boolean): Pair; /** *

Count appearances of value in range.

* @@ -5064,7 +5585,7 @@ declare namespace std { * * @return The number of elements in the range [first, last) that compare equal to val. */ - function count>(first: Iterator, last: Iterator, val: T): number; + function count>(first: InputIterator, last: InputIterator, val: T): number; /** *

Return number of elements in range satisfying condition.

* @@ -5080,7 +5601,7 @@ declare namespace std { * The function shall not modify its argument. This can either be a function pointer or a function * object. */ - function count_if>(first: Iterator, last: Iterator, pred: (val: T) => boolean): number; + function count_if>(first: InputIterator, last: InputIterator, pred: (val: T) => boolean): number; /** *

Copy range of elements.

* @@ -5101,7 +5622,7 @@ declare namespace std { * * @return An iterator to the end of the destination range where elements have been copied. */ - function copy, OutputIterator extends base.Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator): OutputIterator; + function copy, OutputIterator extends Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator): OutputIterator; /** *

Copy elements.

* @@ -5125,7 +5646,7 @@ declare namespace std { * * @return An iterator to the end of the destination range where elements have been copied. */ - function copy_n, OutputIterator extends base.Iterator>(first: InputIterator, n: number, result: OutputIterator): OutputIterator; + function copy_n, OutputIterator extends Iterator>(first: InputIterator, n: number, result: OutputIterator): OutputIterator; /** *

Copy certain elements of range.

* @@ -5144,7 +5665,7 @@ declare namespace std { * * @return An iterator to the end of the destination range where elements have been copied. */ - function copy_if, OutputIterator extends base.Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator, pred: (x: T) => boolean): OutputIterator; + function copy_if, OutputIterator extends Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator, pred: (x: T) => boolean): OutputIterator; /** *

Copy range of elements backward.

* @@ -5171,7 +5692,7 @@ declare namespace std { * * @return An iterator to the first element of the destination sequence where elements have been copied. */ - function copy_backward, BidirectionalIterator2 extends base.Iterator>(first: BidirectionalIterator1, last: BidirectionalIterator1, result: BidirectionalIterator2): BidirectionalIterator2; + function copy_backward, BidirectionalIterator2 extends Iterator>(first: BidirectionalIterator1, last: BidirectionalIterator1, result: BidirectionalIterator2): BidirectionalIterator2; /** *

Fill range with value.

* @@ -5185,7 +5706,7 @@ declare namespace std { * but not the element pointed by last. * @param val Value to assign to the elements in the filled range. */ - function fill>(first: ForwardIterator, last: ForwardIterator, val: T): void; + function fill>(first: ForwardIterator, last: ForwardIterator, val: T): void; /** *

Fill sequence with value.

* @@ -5198,7 +5719,7 @@ declare namespace std { * * @return An iterator pointing to the element that follows the last element filled. */ - function fill_n>(first: OutputIterator, n: number, val: T): OutputIterator; + function fill_n>(first: OutputIterator, n: number, val: T): OutputIterator; /** *

Transform range.

* @@ -5216,7 +5737,7 @@ declare namespace std { * * @return An iterator pointing to the element that follows the last element written in the result sequence. */ - function transform, OutputIterator extends base.Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator, op: (val: T) => T): OutputIterator; + function transform, OutputIterator extends Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator, op: (val: T) => T): OutputIterator; /** *

Transform range.

* @@ -5237,7 +5758,7 @@ declare namespace std { * * @return An iterator pointing to the element that follows the last element written in the result sequence. */ - function transform, InputIterator2 extends base.Iterator, OutputIterator extends base.Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, result: OutputIterator, binary_op: (x: T, y: T) => T): OutputIterator; + function transform, InputIterator2 extends Iterator, OutputIterator extends Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, result: OutputIterator, binary_op: (x: T, y: T) => T): OutputIterator; /** *

Generate values for range with function.

* @@ -5251,7 +5772,7 @@ declare namespace std { * @param gen Generator function that is called with no arguments and returns some value of a type convertible to * those pointed by the iterators. */ - function generate>(first: ForwardIterator, last: ForwardIterator, gen: () => T): void; + function generate>(first: ForwardIterator, last: ForwardIterator, gen: () => T): void; /** *

Generate values for sequence with function.

* @@ -5266,7 +5787,7 @@ declare namespace std { * * @return An iterator pointing to the element that follows the last element whose value has been generated. */ - function generate_n>(first: ForwardIterator, n: number, gen: () => T): ForwardIterator; + function generate_n>(first: ForwardIterator, n: number, gen: () => T): ForwardIterator; /** *

Remove consecutive duplicates in range.

* @@ -5289,7 +5810,7 @@ declare namespace std { * @return An iterator to the element that follows the last element not removed. The range between first and * this iterator includes all the elements in the sequence that were not considered duplicates. */ - function unique>(first: Iterator, last: Iterator): Iterator; + function unique>(first: InputIterator, last: InputIterator): InputIterator; /** *

Remove consecutive duplicates in range.

* @@ -5316,7 +5837,7 @@ declare namespace std { * @return An iterator to the element that follows the last element not removed. The range between first and * this iterator includes all the elements in the sequence that were not considered duplicates. */ - function unique>(first: Iterator, last: Iterator, pred: (left: t, right: t) => boolean): Iterator; + function unique>(first: InputIterator, last: InputIterator, pred: (left: t, right: t) => boolean): InputIterator; /** *

Copy range removing duplicates.

* @@ -5338,7 +5859,7 @@ declare namespace std { * * @return An iterator pointing to the end of the copied range, which contains no consecutive duplicates. */ - function unique_copy, OutputIterator extends base.Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator): OutputIterator; + function unique_copy, OutputIterator extends Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator): OutputIterator; /** *

Copy range removing duplicates.

* @@ -5364,7 +5885,7 @@ declare namespace std { * * @return An iterator pointing to the end of the copied range, which contains no consecutive duplicates. */ - function unique_copy, OutputIterator extends base.Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator, pred: (x: T, y: T) => boolean): OutputIterator; + function unique_copy, OutputIterator extends Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator, pred: (x: T, y: T) => boolean): OutputIterator; /** *

Remove value from range.

* @@ -5385,7 +5906,7 @@ declare namespace std { * first but not the element pointed by last. * @param val Value to be removed. */ - function remove>(first: Iterator, last: Iterator, val: T): Iterator; + function remove>(first: InputIterator, last: InputIterator, val: T): InputIterator; /** *

Remove elements from range.

* @@ -5408,7 +5929,7 @@ declare namespace std { * bool. The value returned indicates whether the element is to be removed (if * true, it is removed). The function shall not modify its argument. */ - function remove_if>(first: Iterator, last: Iterator, pred: (left: T) => boolean): Iterator; + function remove_if>(first: InputIterator, last: InputIterator, pred: (left: T) => boolean): InputIterator; /** *

Copy range removing value.

* @@ -5432,7 +5953,7 @@ declare namespace std { * @return An iterator pointing to the end of the copied range, which includes all the elements in * [first, last) except those that compare equal to val. */ - function remove_copy, OutputIterator extends base.Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator, val: T): OutputIterator; + function remove_copy, OutputIterator extends Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator, val: T): OutputIterator; /** *

Copy range removing values.

* @@ -5456,7 +5977,7 @@ declare namespace std { * @return An iterator pointing to the end of the copied range, which includes all the elements in * [first, last) except those for which pred returns true. */ - function remove_copy_if, OutputIterator extends base.Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator, pred: (val: T) => boolean): OutputIterator; + function remove_copy_if, OutputIterator extends Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator, pred: (val: T) => boolean): OutputIterator; /** *

Replace value in range.

* @@ -5472,7 +5993,7 @@ declare namespace std { * @param old_val Value to be replaced. * @param new_val Replacement value. */ - function replace>(first: Iterator, last: Iterator, old_val: T, new_val: T): void; + function replace>(first: InputIterator, last: InputIterator, old_val: T, new_val: T): void; /** *

Replace value in range.

* @@ -5488,7 +6009,7 @@ declare namespace std { * true, it is replaced). The function shall not modify its argument. * @param new_val Value to assign to replaced elements. */ - function replace_if>(first: InputIterator, last: InputIterator, pred: (val: T) => boolean, new_val: T): void; + function replace_if>(first: InputIterator, last: InputIterator, pred: (val: T) => boolean, new_val: T): void; /** *

Copy range replacing value.

* @@ -5512,7 +6033,7 @@ declare namespace std { * * @return An iterator pointing to the element that follows the last element written in the result sequence. */ - function replace_copy, OutputIterator extends base.Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator, old_val: T, new_val: T): OutputIterator; + function replace_copy, OutputIterator extends Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator, old_val: T, new_val: T): OutputIterator; /** *

Copy range replacing value.

* @@ -5533,7 +6054,7 @@ declare namespace std { * * @return An iterator pointing to the element that follows the last element written in the result sequence. */ - function replace_copy_if, OutputIterator extends base.Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator, pred: (val: T) => boolean, new_val: T): OutputIterator; + function replace_copy_if, OutputIterator extends Iterator>(first: InputIterator, last: InputIterator, result: OutputIterator, pred: (val: T) => boolean, new_val: T): OutputIterator; /** *

Exchange values of objects pointed to by two iterators.

* @@ -5544,7 +6065,7 @@ declare namespace std { * @param x {@link Iterator Forward iterator} to the objects to swap. * @param y {@link Iterator Forward iterator} to the objects to swap. */ - function iter_swap(x: base.Iterator, y: base.Iterator): void; + function iter_swap(x: Iterator, y: Iterator): void; /** *

Exchange values of two ranges.

* @@ -5562,7 +6083,7 @@ declare namespace std { * * @return An iterator to the last element swapped in the second sequence. */ - function swap_ranges, ForwardIterator2 extends base.Iterator>(first1: ForwardIterator1, last1: ForwardIterator1, first2: ForwardIterator2): ForwardIterator2; + function swap_ranges, ForwardIterator2 extends Iterator>(first1: ForwardIterator1, last1: ForwardIterator1, first2: ForwardIterator2): ForwardIterator2; /** *

Reverse range.

* @@ -5575,7 +6096,7 @@ declare namespace std { * which contains all the elements between first and last, including the element pointed by * first but not the element pointed by last. */ - function reverse>(first: Iterator, last: Iterator): void; + function reverse>(first: InputIterator, last: InputIterator): void; /** *

Copy range reversed.

* @@ -5593,7 +6114,7 @@ declare namespace std { * @return An output iterator pointing to the end of the copied range, which contains the same elements in reverse * order. */ - function reverse_copy, OutputIterator extends base.Iterator>(first: BidirectionalIterator, last: BidirectionalIterator, result: OutputIterator): OutputIterator; + function reverse_copy, OutputIterator extends Iterator>(first: BidirectionalIterator, last: BidirectionalIterator, result: OutputIterator): OutputIterator; /** *

Rotate left the elements in range.

* @@ -5609,7 +6130,7 @@ declare namespace std { * * @return An iterator pointing to the element that now contains the value previously pointed by first. */ - function rotate>(first: Iterator, middle: Iterator, last: Iterator): Iterator; + function rotate>(first: InputIterator, middle: InputIterator, last: InputIterator): InputIterator; /** *

Copy range rotated left.

* @@ -5629,7 +6150,7 @@ declare namespace std { * * @return An output iterator pointing to the end of the copied range. */ - function rotate_copy, OutputIterator extends base.Iterator>(first: ForwardIterator, middle: ForwardIterator, last: ForwardIterator, result: OutputIterator): OutputIterator; + function rotate_copy, OutputIterator extends Iterator>(first: ForwardIterator, middle: ForwardIterator, last: ForwardIterator, result: OutputIterator): OutputIterator; /** *

Randomly rearrange elements in range.

* @@ -5777,7 +6298,7 @@ declare namespace std { * * @return An iterator pointing to the element that follows the last element written in the result sequence. */ - function partial_sort_copy, RandomAccessIterator extends base.Iterator>(first: InputIterator, last: InputIterator, result_first: RandomAccessIterator, result_last: RandomAccessIterator): RandomAccessIterator; + function partial_sort_copy, RandomAccessIterator extends Iterator>(first: InputIterator, last: InputIterator, result_first: RandomAccessIterator, result_last: RandomAccessIterator): RandomAccessIterator; /** *

Copy and partially sort range.

* @@ -5806,7 +6327,7 @@ declare namespace std { * * @return An iterator pointing to the element that follows the last element written in the result sequence. */ - function partial_sort_copy, RandomAccessIterator extends base.Iterator>(first: InputIterator, last: InputIterator, result_first: RandomAccessIterator, result_last: RandomAccessIterator, compare: (x: T, y: T) => boolean): RandomAccessIterator; + function partial_sort_copy, RandomAccessIterator extends Iterator>(first: InputIterator, last: InputIterator, result_first: RandomAccessIterator, result_last: RandomAccessIterator, compare: (x: T, y: T) => boolean): RandomAccessIterator; /** *

Check whether range is sorted.

* @@ -5823,7 +6344,7 @@ declare namespace std { * false otherwise. If the range [first, last) contains less than two elements, * the function always returns true. */ - function is_sorted>(first: ForwardIterator, last: ForwardIterator): boolean; + function is_sorted>(first: ForwardIterator, last: ForwardIterator): boolean; /** *

Check whether range is sorted.

* @@ -5844,7 +6365,7 @@ declare namespace std { * false otherwise. If the range [first, last) contains less than two elements, * the function always returns true. */ - function is_sorted>(first: ForwardIterator, last: ForwardIterator, compare: (x: T, y: T) => boolean): boolean; + function is_sorted>(first: ForwardIterator, last: ForwardIterator, compare: (x: T, y: T) => boolean): boolean; /** *

Find first unsorted element in range.

* @@ -5869,7 +6390,7 @@ declare namespace std { * @return An iterator to the first element in the range which does not follow an ascending order, or last if * all elements are sorted or if the range contains less than two elements. */ - function is_sorted_until>(first: ForwardIterator, last: ForwardIterator): ForwardIterator; + function is_sorted_until>(first: ForwardIterator, last: ForwardIterator): ForwardIterator; /** *

Find first unsorted element in range.

* @@ -5894,7 +6415,7 @@ declare namespace std { * @return An iterator to the first element in the range which does not follow an ascending order, or last if * all elements are sorted or if the range contains less than two elements. */ - function is_sorted_until>(first: ForwardIterator, last: ForwardIterator, compare: (x: T, y: T) => boolean): ForwardIterator; + function is_sorted_until>(first: ForwardIterator, last: ForwardIterator, compare: (x: T, y: T) => boolean): ForwardIterator; /** *

Return iterator to lower bound.

* @@ -5923,7 +6444,7 @@ declare namespace std { * @return An iterator to the lower bound of val in the range. If all the element in the range compare less than * val, the function returns last. */ - function lower_bound>(first: ForwardIterator, last: ForwardIterator, val: T): ForwardIterator; + function lower_bound>(first: ForwardIterator, last: ForwardIterator, val: T): ForwardIterator; /** *

Return iterator to lower bound.

* @@ -5955,7 +6476,7 @@ declare namespace std { * @return An iterator to the lower bound of val in the range. If all the element in the range compare less than * val, the function returns last. */ - function lower_bound>(first: ForwardIterator, last: ForwardIterator, val: T, compare: (x: T, y: T) => boolean): ForwardIterator; + function lower_bound>(first: ForwardIterator, last: ForwardIterator, val: T, compare: (x: T, y: T) => boolean): ForwardIterator; /** *

Return iterator to upper bound.

* @@ -5984,7 +6505,7 @@ declare namespace std { * @return An iterator to the upper bound of val in the range. If no element in the range comparse greater than * val, the function returns last. */ - function upper_bound>(first: ForwardIterator, last: ForwardIterator, val: T): ForwardIterator; + function upper_bound>(first: ForwardIterator, last: ForwardIterator, val: T): ForwardIterator; /** *

Return iterator to upper bound.

* @@ -6016,7 +6537,7 @@ declare namespace std { * @return An iterator to the upper bound of val in the range. If no element in the range comparse greater than * val, the function returns last. */ - function upper_bound>(first: ForwardIterator, last: ForwardIterator, val: T, compare: (x: T, y: T) => boolean): ForwardIterator; + function upper_bound>(first: ForwardIterator, last: ForwardIterator, val: T, compare: (x: T, y: T) => boolean): ForwardIterator; /** *

Get subrange of equal elements.

* @@ -6046,7 +6567,7 @@ declare namespace std { * equivalent values, and {@link Pair.second} its upper bound. The values are the same as those that would be * returned by functions {@link lower_bound} and {@link upper_bound} respectively. */ - function equal_range>(first: ForwardIterator, last: ForwardIterator, val: T): Pair; + function equal_range>(first: ForwardIterator, last: ForwardIterator, val: T): Pair; /** *

Get subrange of equal elements.

* @@ -6079,7 +6600,7 @@ declare namespace std { * equivalent values, and {@link Pair.second} its upper bound. The values are the same as those that would be * returned by functions {@link lower_bound} and {@link upper_bound} respectively. */ - function equal_range>(first: ForwardIterator, last: ForwardIterator, val: T, compare: (x: T, y: T) => boolean): Pair; + function equal_range>(first: ForwardIterator, last: ForwardIterator, val: T, compare: (x: T, y: T) => boolean): Pair; /** *

Get subrange of equal elements.

* @@ -6107,7 +6628,7 @@ declare namespace std { * * @return true if an element equivalent to val is found, and false otherwise. */ - function binary_search>(first: ForwardIterator, last: ForwardIterator, val: T): boolean; + function binary_search>(first: ForwardIterator, last: ForwardIterator, val: T): boolean; /** *

Get subrange of equal elements.

* @@ -6138,7 +6659,7 @@ declare namespace std { * * @return true if an element equivalent to val is found, and false otherwise. */ - function binary_search>(first: ForwardIterator, last: ForwardIterator, val: T, compare: (x: T, y: T) => boolean): boolean; + function binary_search>(first: ForwardIterator, last: ForwardIterator, val: T, compare: (x: T, y: T) => boolean): boolean; /** *

Test whether range is partitioned.

* @@ -6160,7 +6681,7 @@ declare namespace std { * true precede those for which it returns false. Otherwise it returns * false. If the range is {@link IContainer.empty empty}, the function returns true. */ - function is_partitioned>(first: InputIterator, last: InputIterator, pred: (x: T) => boolean): boolean; + function is_partitioned>(first: InputIterator, last: InputIterator, pred: (x: T) => boolean): boolean; /** *

Partition range in two.

* @@ -6183,7 +6704,7 @@ declare namespace std { * @return An iterator that points to the first element of the second group of elements (those for which pred * returns false), or last if this group is {@link IContainer.empty empty}. */ - function partition>(first: BidirectionalIterator, last: BidirectionalIterator, pred: (x: T) => boolean): BidirectionalIterator; + function partition>(first: BidirectionalIterator, last: BidirectionalIterator, pred: (x: T) => boolean): BidirectionalIterator; /** *

Partition range in two - stable ordering.

* @@ -6205,7 +6726,7 @@ declare namespace std { * @return An iterator that points to the first element of the second group of elements (those for which pred * returns false), or last if this group is {@link IContainer.empty empty}. */ - function stable_partition>(first: BidirectionalIterator, last: BidirectionalIterator, pred: (x: T) => boolean): BidirectionalIterator; + function stable_partition>(first: BidirectionalIterator, last: BidirectionalIterator, pred: (x: T) => boolean): BidirectionalIterator; /** *

Partition range into two.

* @@ -6231,7 +6752,7 @@ declare namespace std { * member {@link Pair.second second} points to the element that follows the last element copied to the sequence * of elements for which pred returned false. */ - function partition_copy, OutputIterator1 extends base.Iterator, OutputIterator2 extends base.Iterator>(first: InputIterator, last: InputIterator, result_true: OutputIterator1, result_false: OutputIterator2, pred: (val: T) => T): Pair; + function partition_copy, OutputIterator1 extends Iterator, OutputIterator2 extends Iterator>(first: InputIterator, last: InputIterator, result_true: OutputIterator1, result_false: OutputIterator2, pred: (val: T) => T): Pair; /** *

Get partition point.

* @@ -6256,7 +6777,7 @@ declare namespace std { * @return An iterator to the first element in the partitioned range [first, last) for which pred * is not true, or last if it is not true for any element. */ - function partition_point>(first: ForwardIterator, last: ForwardIterator, pred: (x: T) => boolean): ForwardIterator; + function partition_point>(first: ForwardIterator, last: ForwardIterator, pred: (x: T) => boolean): ForwardIterator; /** *

Merge sorted ranges.

* @@ -6278,7 +6799,7 @@ declare namespace std { * * @return An iterator pointing to the past-the-end element in the resulting sequence. */ - function merge, InputIterator2 extends base.Iterator, OutputIterator extends base.Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator): OutputIterator; + function merge, InputIterator2 extends Iterator, OutputIterator extends Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator): OutputIterator; /** *

Merge sorted ranges.

* @@ -6304,7 +6825,7 @@ declare namespace std { * * @return An iterator pointing to the past-the-end element in the resulting sequence. */ - function merge, InputIterator2 extends base.Iterator, OutputIterator extends base.Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator, compare: (x: T, y: T) => boolean): OutputIterator; + function merge, InputIterator2 extends Iterator, OutputIterator extends Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator, compare: (x: T, y: T) => boolean): OutputIterator; /** *

Merge consecutive sorted ranges.

* @@ -6326,7 +6847,7 @@ declare namespace std { * sequence. This is also the past-the-end position of the range where the resulting merged range is * stored. */ - function inplace_merge>(first: BidirectionalIterator, middle: BidirectionalIterator, last: BidirectionalIterator): void; + function inplace_merge>(first: BidirectionalIterator, middle: BidirectionalIterator, last: BidirectionalIterator): void; /** *

Merge consecutive sorted ranges.

* @@ -6352,7 +6873,7 @@ declare namespace std { * considered to go before the second in the specific strict weak ordering it defines. The * function shall not modify any of its arguments. */ - function inplace_merge>(first: BidirectionalIterator, middle: BidirectionalIterator, last: BidirectionalIterator, compare: (x: T, y: T) => boolean): void; + function inplace_merge>(first: BidirectionalIterator, middle: BidirectionalIterator, last: BidirectionalIterator, compare: (x: T, y: T) => boolean): void; /** *

Test whether sorted range includes another sorted range.

* @@ -6377,7 +6898,7 @@ declare namespace std { * [first1, last1), false otherwise. If [first2, last2) is an empty * range, the function returns true. */ - function includes, InputIterator2 extends base.Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2): boolean; + function includes, InputIterator2 extends Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2): boolean; /** *

Test whether sorted range includes another sorted range.

* @@ -6406,7 +6927,7 @@ declare namespace std { * [first1, last1), false otherwise. If [first2, last2) is an empty * range, the function returns true. */ - function includes, InputIterator2 extends base.Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, compare: (x: T, y: T) => boolean): boolean; + function includes, InputIterator2 extends Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, compare: (x: T, y: T) => boolean): boolean; /** *

Union of two sorted ranges.

* @@ -6435,7 +6956,7 @@ declare namespace std { * * @return An iterator to the end of the constructed range. */ - function set_union, InputIterator2 extends base.Iterator, OutputIterator extends base.Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator): OutputIterator; + function set_union, InputIterator2 extends Iterator, OutputIterator extends Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator): OutputIterator; /** *

Union of two sorted ranges.

* @@ -6468,7 +6989,7 @@ declare namespace std { * * @return An iterator to the end of the constructed range. */ - function set_union, InputIterator2 extends base.Iterator, OutputIterator extends base.Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator, compare: (x: T, y: T) => boolean): OutputIterator; + function set_union, InputIterator2 extends Iterator, OutputIterator extends Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator, compare: (x: T, y: T) => boolean): OutputIterator; /** *

Intersection of two sorted ranges.

* @@ -6496,7 +7017,7 @@ declare namespace std { * * @return An iterator to the end of the constructed range. */ - function set_intersection, InputIterator2 extends base.Iterator, OutputIterator extends base.Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator): OutputIterator; + function set_intersection, InputIterator2 extends Iterator, OutputIterator extends Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator): OutputIterator; /** *

Intersection of two sorted ranges.

* @@ -6528,7 +7049,7 @@ declare namespace std { * * @return An iterator to the end of the constructed range. */ - function set_intersection, InputIterator2 extends base.Iterator, OutputIterator extends base.Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator, compare: (x: T, y: T) => boolean): OutputIterator; + function set_intersection, InputIterator2 extends Iterator, OutputIterator extends Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator, compare: (x: T, y: T) => boolean): OutputIterator; /** *

Difference of two sorted ranges.

* @@ -6562,7 +7083,7 @@ declare namespace std { * * @return An iterator to the end of the constructed range. */ - function set_difference, InputIterator2 extends base.Iterator, OutputIterator extends base.Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator): OutputIterator; + function set_difference, InputIterator2 extends Iterator, OutputIterator extends Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator): OutputIterator; /** *

Difference of two sorted ranges.

* @@ -6600,7 +7121,7 @@ declare namespace std { * * @return An iterator to the end of the constructed range. */ - function set_difference, InputIterator2 extends base.Iterator, OutputIterator extends base.Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator, compare: (x: T, y: T) => boolean): OutputIterator; + function set_difference, InputIterator2 extends Iterator, OutputIterator extends Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator, compare: (x: T, y: T) => boolean): OutputIterator; /** *

Symmetric difference of two sorted ranges.

* @@ -6634,7 +7155,7 @@ declare namespace std { * * @return An iterator to the end of the constructed range. */ - function set_symmetric_difference, InputIterator2 extends base.Iterator, OutputIterator extends base.Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator): OutputIterator; + function set_symmetric_difference, InputIterator2 extends Iterator, OutputIterator extends Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator): OutputIterator; /** *

Symmetric difference of two sorted ranges.

* @@ -6668,7 +7189,7 @@ declare namespace std { * * @return An iterator to the end of the constructed range. */ - function set_symmetric_difference, InputIterator2 extends base.Iterator, OutputIterator extends base.Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator, compare: (x: T, y: T) => boolean): OutputIterator; + function set_symmetric_difference, InputIterator2 extends Iterator, OutputIterator extends Iterator>(first1: InputIterator1, last1: InputIterator1, first2: InputIterator2, last2: InputIterator2, result: OutputIterator, compare: (x: T, y: T) => boolean): OutputIterator; /** *

Return the smallest.

* @@ -6717,7 +7238,7 @@ declare namespace std { * * @return An iterator to smallest value in the range, or last if the range is empty. */ - function min_element>(first: ForwardIterator, last: ForwardIterator): ForwardIterator; + function min_element>(first: ForwardIterator, last: ForwardIterator): ForwardIterator; /** *

Return smallest element in range.

* @@ -6738,7 +7259,7 @@ declare namespace std { * * @return An iterator to smallest value in the range, or last if the range is empty. */ - function min_element>(first: ForwardIterator, last: ForwardIterator, compare: (x: T, y: T) => boolean): ForwardIterator; + function min_element>(first: ForwardIterator, last: ForwardIterator, compare: (x: T, y: T) => boolean): ForwardIterator; /** *

Return largest element in range.

* @@ -6756,7 +7277,7 @@ declare namespace std { * * @return An iterator to largest value in the range, or last if the range is empty. */ - function max_element>(first: ForwardIterator, last: ForwardIterator): ForwardIterator; + function max_element>(first: ForwardIterator, last: ForwardIterator): ForwardIterator; /** *

Return largest element in range.

* @@ -6777,7 +7298,7 @@ declare namespace std { * * @return An iterator to largest value in the range, or last if the range is empty. */ - function max_element>(first: ForwardIterator, last: ForwardIterator, compare: (x: T, y: T) => boolean): ForwardIterator; + function max_element>(first: ForwardIterator, last: ForwardIterator, compare: (x: T, y: T) => boolean): ForwardIterator; /** *

Return smallest and largest elements in range.

* @@ -6803,7 +7324,7 @@ declare namespace std { * @return A {@link Pair} with an iterator pointing to the element with the smallest value in the range * [first, last) as first element, and the largest as second. */ - function minmax_element>(first: ForwardIterator, last: ForwardIterator): Pair; + function minmax_element>(first: ForwardIterator, last: ForwardIterator): Pair; /** *

Return smallest and largest elements in range.

* @@ -6829,7 +7350,7 @@ declare namespace std { * @return A {@link Pair} with an iterator pointing to the element with the smallest value in the range * [first, last) as first element, and the largest as second. */ - function minmax_element>(first: ForwardIterator, last: ForwardIterator, compare: (x: T, y: T) => boolean): Pair; + function minmax_element>(first: ForwardIterator, last: ForwardIterator, compare: (x: T, y: T) => boolean): Pair; } declare namespace std { /** @@ -7314,22 +7835,6 @@ declare namespace std { const _20: PlaceHolder; } } -declare namespace std { - /** - *

Return distance between {@link Iterator iterators}.

- * - *

Calculates the number of elements between first and last.

- * - *

If it is a {@link IArrayIterator random-access iterator}, the function uses operator- to calculate this. - * Otherwise, the function uses the increase operator {@link Iterator.next next()} repeatedly.

- * - * @param first Iterator pointing to the initial element. - * @param last Iterator pointing to the final element. This must be reachable from first. - * - * @return The number of elements between first and last. - */ - function distance>(first: Iterator, last: Iterator): number; -} declare namespace std { /** *

Standard exception class.

@@ -7339,10 +7844,9 @@ declare namespace std { *

All objects thrown by components of the standard library are derived from this class. * Therefore, all standard exceptions can be caught by catching this type by reference.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/exception/exception/ - *
+ *

* + * @reference http://www.cplusplus.com/reference/exception/exception * @author Jeongho Nam */ class Exception { @@ -7380,10 +7884,9 @@ declare namespace std { * *

It is used as a base class for several logical error exceptions.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/stdexcept/logic_error/ - *
+ *

* + * @reference http://www.cplusplus.com/reference/stdexcept/logic_error * @author Jeongho Nam */ class LogicError extends Exception { @@ -7406,10 +7909,9 @@ declare namespace std { *

No component of the standard library throws exceptions of this type. It is designed as a standard * exception to be thrown by programs.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/stdexcept/domain_error/ - *
+ *

* + * @reference http://www.cplusplus.com/reference/stdexcept/domain_error * @author Jeongho Nam */ class DomainError extends LogicError { @@ -7428,10 +7930,9 @@ declare namespace std { *

It is a standard exception that can be thrown by programs. Some components of the standard library * also throw exceptions of this type to signal invalid arguments.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/stdexcept/invalid_argument/ - *
+ *

* + * @reference http://www.cplusplus.com/reference/stdexcept/invalid_argument * @author Jeongho Nam */ class InvalidArgument extends LogicError { @@ -7450,10 +7951,9 @@ declare namespace std { *

It is a standard exception that can be thrown by programs. Some components of the standard library, * such as vector and string also throw exceptions of this type to signal errors resizing.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/stdexcept/length_error/ - *
+ *

* + * @reference http://www.cplusplus.com/reference/stdexcept/length_error * @author Jeongho Nam */ class LengthError extends LogicError { @@ -7473,10 +7973,9 @@ declare namespace std { * such as vector, deque, string and bitset also throw exceptions of this type to signal arguments * out of range.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/stdexcept/out_of_range/ - *
+ *

* + * @reference http://www.cplusplus.com/reference/stdexcept/out_of_range * @author Jeongho Nam */ class OutOfRange extends LogicError { @@ -7495,10 +7994,9 @@ declare namespace std { * *

It is used as a base class for several runtime error exceptions.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/stdexcept/runtime_error/ - *
+ *

* + * @reference http://www.cplusplus.com/reference/stdexcept/runtime_error * @author Jeongho Nam */ class RuntimeError extends Exception { @@ -7517,10 +8015,9 @@ declare namespace std { *

It is a standard exception that can be thrown by programs. Some components of the standard library * also throw exceptions of this type to signal range errors.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/stdexcept/outflow_error/ - *
+ *

* + * @reference http://www.cplusplus.com/reference/stdexcept/outflow_error * @author Jeongho Nam */ class OverflowError extends RuntimeError { @@ -7539,10 +8036,9 @@ declare namespace std { *

No component of the standard library throws exceptions of this type. It is designed as a standard * exception to be thrown by programs.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/stdexcept/underflow_error/ - *
+ *

* + * @reference http://www.cplusplus.com/reference/stdexcept/underflow_error * @author Jeongho Nam */ class UnderflowError extends RuntimeError { @@ -7562,10 +8058,9 @@ declare namespace std { *

It is a standard exception that can be thrown by programs. Some components of the standard library * also throw exceptions of this type to signal range errors.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/stdexcept/range_error/ - *
+ *

* + * @reference http://www.cplusplus.com/reference/stdexcept/range_error * @author Jeongho Nam */ class RangeError extends RuntimeError { @@ -7592,9 +8087,11 @@ declare namespace std.base { * so that they can be interpreted when needed as more abstract (and portable) * {@link ErrorCondition error conditions}.

* + *

+ * * @author Jeongho Nam */ - class ErrorInstance { + abstract class ErrorInstance { /** * A reference to an {@link ErrorCategory} object. */ @@ -7699,10 +8196,9 @@ declare namespace std { *

The class inherits from {@link RuntimeError}, to which it adds an {@link ErrorCode} as * member code (and defines a specialized what member).

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/system_error/system_error/ - *
+ *

* + * @reference http://www.cplusplus.com/reference/system_error/system_error * @author Jeongho Nam */ class SystemError extends RuntimeError { @@ -7763,10 +8259,9 @@ declare namespace std { * passed by reference. As such, only one object of each of these types shall exist, each uniquely identifying its own * category: all error codes and conditions of a same category shall return a reference to same object.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/system_error/error_category/
  • - *
+ *

* + * @reference http://www.cplusplus.com/reference/system_error/error_category * @author Jeongho Nam */ abstract class ErrorCategory { @@ -7889,10 +8384,9 @@ declare namespace std { *

The {@link ErrorCategory categories} associated with the {@link ErrorCondition} and the * {@link ErrorCode} define the equivalences between them.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/system_error/error_condition/
  • - *
+ *

* + * @reference http://www.cplusplus.com/reference/system_error/error_condition * @author Jeongho Nam */ class ErrorCondition extends base.ErrorInstance { @@ -7920,10 +8414,9 @@ declare namespace std { *

Objects of this class associate such numerical codes to {@link ErrorCategory error categories}, so that they * can be interpreted when needed as more abstract (and portable) {@link ErrorCondition error conditions}.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/system_error/error_code/
  • - *
+ *

* + * @reference http://www.cplusplus.com/reference/system_error/error_code * @author Jeongho Nam */ class ErrorCode extends base.ErrorInstance { @@ -7948,13 +8441,10 @@ declare namespace std { * T2). The individual values can be accessed through its public members {@link first} and * {@link second}.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/utility/pair/
  • - *
- * * @param Type of member {@link first}. * @param Type of member {@link second}. * + * @reference http://www.cplusplus.com/reference/utility/pair * @author Jeongho Nam */ class Pair { @@ -8083,12 +8573,9 @@ declare namespace std.base { * maximal paths have the same number of black nodes, by property 5, this shows * that no path is more than twice as long as any other path.

* - *
    - *
  • Reference: https://en.wikipedia.org/w/index.php?title=Red%E2%80%93black_tree&redirect=no
  • - *
- * * @param Type of elements. * + * @reference https://en.wikipedia.org/w/index.php?title=Red%E2%80%93black_tree * @inventor Rudolf Bayer * @author Migrated by Jeongho Nam */ @@ -8114,8 +8601,8 @@ declare namespace std.base { * @return The maximum node. */ protected fetch_maximum(node: XTreeNode): XTreeNode; - abstract is_equals(left: T, right: T): boolean; abstract is_less(left: T, right: T): boolean; + abstract is_equal_to(left: T, right: T): boolean; /** *

Insert an element with a new node.

* @@ -8632,6 +9119,10 @@ declare namespace std.base { } declare namespace std.base { /** + *

A red-black Tree storing {@link SetIterator SetIterators}.

+ * + *

+ * * @author Jeongho Nam */ class AtomicTree extends XTree> { @@ -8650,7 +9141,7 @@ declare namespace std.base { /** * @inheritdoc */ - is_equals(left: SetIterator, right: SetIterator): boolean; + is_equal_to(left: SetIterator, right: SetIterator): boolean; /** * @inheritdoc */ @@ -8709,7 +9200,7 @@ declare namespace std.base { * * @author Jeongho Nam */ - class HashBuckets { + abstract class HashBuckets { private buckets_; private item_size_; /** @@ -8726,7 +9217,7 @@ declare namespace std.base { size(): number; item_size(): number; at(index: number): Vector; - private hash_index(val); + hash_index(val: T): number; insert(val: T): void; erase(val: T): void; } @@ -8761,6 +9252,8 @@ declare namespace std.base { * beginning or the end, {@link IArray} objects perform worse and have less consistent iterators and references * than {@link List Lists}

. * + *

+ * *

Container properties

*
*
Sequence
@@ -8780,7 +9273,7 @@ declare namespace std.base { * * @author Jeongho Nam */ - interface IArray extends ILinearContainer { + interface IArrayContainer extends ILinearContainer { /** *

Request a change in capacity.

* @@ -8871,10 +9364,9 @@ declare namespace std.base { *

There is not a single type of {@link IArrayIterator random-access iterator}: Each container may define its * own specific iterator type able to iterate through it and access its elements.

* - *
    - *
  • Reference: http://www.cplusplus.com/reference/iterator/RandomAccessIterator/
  • - *
+ *

* + * @reference http://www.cplusplus.com/reference/iterator/RandomAccessIterator * @author Jeongho Nam */ interface IArrayIterator extends Iterator { @@ -8896,11 +9388,13 @@ declare namespace std.base { } declare namespace std.base { /** - *

An interface of

+ *

An interface of containers.

* *

{@link IContainer} is an interface designed for sequence containers. Sequence containers of STL * (Standard Template Library) are based on the {@link IContainer}.

* + *

+ * *

Container properties

*
*
Sequence
@@ -8980,7 +9474,7 @@ declare namespace std.base { * * @return A {@link ReverseIterator reverse iterator} to the reverse beginning of the sequence */ - rbegin(): ReverseIterator; + rbegin(): base.IReverseIterator; /** *

Return {@link ReverseIterator reverse iterator} to reverse end.

* @@ -8992,7 +9486,7 @@ declare namespace std.base { * * @return A {@link ReverseIterator reverse iterator} to the reverse end of the sequence */ - rend(): ReverseIterator; + rend(): base.IReverseIterator; /** * Return the number of elements in the Container. * @@ -9082,14 +9576,18 @@ declare namespace std.base { */ swap(obj: IContainer): void; } + interface IReverseIterator extends ReverseIterator, IReverseIterator> { + } } declare namespace std.base { /** *

An interface for deque

* + *

+ * * @author Jeongho Nam */ - interface IDeque extends ILinearContainer { + interface IDequeContainer extends ILinearContainer { /** *

Insert element at beginning.

* @@ -9111,7 +9609,9 @@ declare namespace std.base { } declare namespace std.base { /** - *

Linear

+ *

An interface for linear containers.

+ * + *

* * @author Jeonngho Nam */ @@ -9221,6 +9721,13 @@ declare namespace std.base { } } declare namespace std.base { + /** + *

Hash buckets storing {@link MapIterator MapIterators}.

+ * + *

+ * + * @author Jeongho Nam + */ class MapHashBuckets extends HashBuckets> { private map; constructor(map: MapContainer); @@ -9229,6 +9736,10 @@ declare namespace std.base { } declare namespace std.base { /** + *

A red-black Tree storing {@link MapIterator MapIterators}.

+ * + *

+ * * @author Jeongho Nam */ class PairTree extends XTree> { @@ -9247,7 +9758,7 @@ declare namespace std.base { /** * @inheritdoc */ - is_equals(left: MapIterator, right: MapIterator): boolean; + is_equal_to(left: MapIterator, right: MapIterator): boolean; /** * @inheritdoc */ @@ -9255,6 +9766,13 @@ declare namespace std.base { } } declare namespace std.base { + /** + *

Hash buckets storing {@link SetIterator SetIterators}.

+ * + *

+ * + * @author Jeongho Nam + */ class SetHashBuckets extends HashBuckets> { private set; constructor(set: SetContainer); @@ -9312,27 +9830,6 @@ declare namespace std.base { uncle: XTreeNode; } } -/** -* STL (Standard Template Library) Containers for TypeScript. -* -* @author Jeongho Nam -*/ -declare namespace std { -} -/** - * Base classes composing STL in background. - * - * @author Jeongho Nam - */ -declare namespace std.base { -} -/** - * Examples for supporting developers who use STL library. - * - * @author Jeongho Nam - */ -declare namespace std.example { -} declare namespace std.example { function test_bind(): void; }