From ce1b9ab23456cf096a31ea0359bdf098bd2b7408 Mon Sep 17 00:00:00 2001 From: Thomas Townsend Date: Thu, 2 Jun 2016 14:43:58 +0200 Subject: [PATCH 01/60] Add immutable typings (#9412) * Add immutable typings * Fix header * Rename immutable test --- immutable/immutable-tests.ts | 329 +++++ immutable/immutable.d.ts | 2546 ++++++++++++++++++++++++++++++++++ 2 files changed, 2875 insertions(+) create mode 100644 immutable/immutable-tests.ts create mode 100644 immutable/immutable.d.ts diff --git a/immutable/immutable-tests.ts b/immutable/immutable-tests.ts new file mode 100644 index 0000000000..17240ebe9c --- /dev/null +++ b/immutable/immutable-tests.ts @@ -0,0 +1,329 @@ +/// + +import immutable = require('immutable') + +// List tests + +let list: immutable.List = immutable.List([0, 1, 2, 3, 4, 5]); +let list1: immutable.List = immutable.List(list); + +list = immutable.List.of(0, 1, 2, 3, 4); +let bool: boolean = immutable.List.isList(list); + +list = list.set(0, 1); +list = list.delete(0); +list = list.remove(0); +list = list.insert(0, 1); +list = list.clear(); +list = list.push(0, 1, 2, 3, 4, 5); +list = list.pop(); +list = list.unshift(1, 2, 3); +list = list.shift(); +list = list.update((value: immutable.List) => value); +list = list.update(1, (value: number) => value); +list = list.update(1, 1, (value: number) => value); +list = list.merge(list1, list); +list = list.merge([0, 1, 2], [3, 4, 5]); +list = list.mergeWith((prev: number, next: number, key: number) => prev, list, list1); +list = list.mergeWith((prev: number, next: number, key: number) => prev, [0, 1, 2], [3, 4, 5]); +list = list.mergeDeep(list1, list); +list = list.mergeDeep([0, 1, 2], [3, 4, 5]); +list = list.mergeDeepWith((prev: number, next: number, key: number) => prev, list, list1); +list = list.mergeDeepWith((prev: number, next: number, key: number) => prev, [0, 1, 2], [3, 4, 5]); +list = list.setSize(5); +list = list.setIn([0, 1, 2], 5); +list = list.deleteIn([0, 1, 2]); +list = list.removeIn([0, 1, 2]); +list = list.updateIn([0, 1, 2], value => value); +list = list.updateIn([0, 1, 2], 1, value => value); +list = list.mergeIn([0, 1, 2], list, list1); +list = list.mergeIn([0, 1, 2], [0, 1, 2], [3, 4, 5]); +list = list.mergeDeepIn([0, 1, 2], list, list1); +list = list.mergeDeepIn([0, 1, 2], [0, 1, 2], [3, 4, 5]); +list = list.withMutations((mutable: immutable.List) => mutable); +list = list.asMutable(); +list = list.asImmutable(); + +// Collection.Indexed +let indexedSeq: immutable.Seq.Indexed = list.toSeq(); + +// Iterable tests +let value: number = list.get(0); +value = list.get(0, 1); +list = list.interpose(0); +list = list.interleave(list, list1); +list = list.splice(0, 2, 4, 5, 6); +list = list.zip(list1); +let indexedIterable: immutable.Iterable.Indexed = list.zipWith( + (value: number, other: number) => value + other, + list1 +); +let indexedIterable1: immutable.Iterable.Indexed = list.zipWith( + (value: number, other: number, third: number) => value + other + third, + list1, + indexedIterable +); +indexedIterable = list.zipWith( + (value: number, other: number, third: number) => value + other + third, + list1, + indexedIterable1 +); +value = list.indexOf(1); +value = list.lastIndexOf(1); +value = list.findIndex((value: number, index: number, iter: immutable.List) => true); +value = list.findLastIndex((value: number, index: number, iter: immutable.List) => true); +value = list.size; + +bool = list.equals(list1); +value = list.hashCode(); +bool = list.has(1); +bool = list.includes(1); +bool = list.contains(1); +value = list.first(); +value = list.last(); +let toArr: number[] = list.toArray(); +let toMap: immutable.Map = list.toMap(); +let toOrderedMap: immutable.OrderedMap = list.toOrderedMap(); +let toSet: immutable.Set = list.toSet(); +let toOrderedSet: immutable.OrderedSet = list.toOrderedSet(); +list = list.toList(); +let toStack: immutable.Stack = list.toStack(); +let toKeyedSeq: immutable.Seq.Keyed = list.toKeyedSeq(); +indexedSeq = list.toIndexedSeq(); +let toSetSeq: immutable.Seq.Set = list.toSetSeq(); + +let iter: immutable.Iterator = list.keys(); +iter = list.values(); +let iter1: immutable.Iterator<[number, number]> = list.entries(); + +indexedSeq = list.keySeq(); +indexedSeq = list.valueSeq(); +let indexedSeq1: immutable.Seq.Indexed<[number, number]> = list.entrySeq(); + +let iter2: immutable.Iterable = list.map( + (value: number, key: number, iter: immutable.List) => "foo" +) + +list = list.filterNot((value: number, key: number, iter: immutable.List) => true); +list = list.reverse(); +list = list.sort((valA: number, valB: number) => 0); +list = list.sortBy( + (value: number, key: number, iter: immutable.List) => "foo", + (valueA: string, valueB: string) => 0 +); + +let keyedSeq2: immutable.Seq.Keyed> = list.groupBy( + (value: number, key: number, iter: immutable.List) => "" +); + +value = list.forEach((value: number, key: number, iter: immutable.List) => true); +list = list.slice(0, 1); +list = list.rest(); +list = list.butLast(); +list = list.skip(0); +list = list.skipLast(0); +list = list.skipWhile( + (value: number, key: number, iter: immutable.List) => true +); +list = list.take(2); +list = list.takeLast(2); +list = list.takeWhile( + (value: number, key: number, iter: immutable.List) => true +); +list = list.takeUntil( + (value: number, key: number, iter: immutable.List) => true +); +list = list.concat(list1, 2, 3); +list = list.flatten(1); +list = list.flatten(true); +let str: string = list.reduce( + (red: string, value: number, key: number, iter: immutable.List) => red + "bar", + "foo" +); +str = list.reduceRight( + (red: string, value: number, key: number, iter: immutable.List) => red + "bar", + "foo" +); +bool = list.every( + (value: number, key: number, iter: immutable.List) => true +); +bool = list.some( + (value: number, key: number, iter: immutable.List) => true +); +str = list.join(","); +bool = list.isEmpty(); +value = list.count(); +value = list.count( + (value: number, key: number, iter: immutable.List) => true +); +let keyedSeq3: immutable.Seq.Keyed = list.countBy( + (value: number, key: number, iter: immutable.List) => "foo" +); +value = list.find( + (value: number, key: number, iter: immutable.List) => true, + null, + 0 +); +value = list.findLast( + (value: number, key: number, iter: immutable.List) => true, + null, + 0 +); +let tuple: [number, number] = list.findEntry( + (value: number, key: number, iter: immutable.List) => true, + null, + 0 +); +tuple = list.findLastEntry( + (value: number, key: number, iter: immutable.List) => true, + null, + 0 +); +value = list.findKey( + (value: number, key: number, iter: immutable.List) => true, + null +); +value = list.findLastKey( + (value: number, key: number, iter: immutable.List) => true, + null +); +value = list.keyOf(0); +value = list.lastKeyOf(0); +value = list.max((valA: number, valB: number) => 0); +value = list.maxBy( + (value: number, key: number, iter: immutable.List) => "foo", + (valueA: string, valueB: string) => 0 +); +value = list.min((valA: number, valB: number) => 0); +value = list.minBy( + (value: number, key: number, iter: immutable.List) => "foo", + (valueA: string, valueB: string) => 0 +); +bool = list.isSubset(list1); +bool = list.isSubset([0, 1, 2]); +bool = list.isSuperset(list1); +bool = list.isSuperset([0, 1, 2]); + + +// Map tests + +let map: immutable.Map = immutable.Map(); +map = immutable.Map([["foo", 1], ["bar", 2]]); +let map1: immutable.Map = immutable.Map(map); +map = map.set("baz", 3); +map.delete("foo"); +map.remove("foo"); +map = map.clear(); +map = map.update((value: immutable.Map) => value); +map = map.update("foo", (value: number) => value); +map = map.update("bar", 1, (value: number) => value); +map = map.merge(map1, map); +map = map.merge({ "foo": 0, "bar": 1}, {"baz": 2}); +map = map.mergeWith((prev: number, next: number, key: string) => prev, map, map1); +map = map.mergeWith((prev: number, next: number, key: string) => prev,{ "foo": 0, "bar": 1}, {"baz": 2}); +map = map.mergeDeep(map1, map); +map = map.mergeDeep({ "foo": 0, "bar": 1}, {"baz": 2}); +map = map.mergeDeepWith((prev: number, next: number, key: string) => prev, map, map1); +map = map.mergeDeepWith((prev: number, next: number, key: string) => prev, { "foo": 0, "bar": 1}, {"baz": 2}); +map = map.setIn([0, 1, 2], 5); +map = map.deleteIn([0, 1, 2]); +map = map.removeIn([0, 1, 2]); +map = map.updateIn([0, 1, 2], value => value); +map = map.updateIn([0, 1, 2], 1, value => value); +map = map.mergeIn([0, 1, 2], map, map1); +map = map.mergeIn([0, 1, 2], { "foo": 0, "bar": 1}, {"baz": 2}); +map = map.mergeDeepIn([0, 1, 2], map, map1); +map = map.mergeDeepIn([0, 1, 2], { "foo": 0, "bar": 1}, {"baz": 2}); +map = map.withMutations((mutable: immutable.Map) => mutable); +map = map.asMutable(); +map = map.asImmutable(); + +bool = immutable.Map.isMap(map); +map = immutable.Map.of("foo", 0, "bar", 1); + +// OrderedMap tests +bool = immutable.OrderedMap.isOrderedMap(toOrderedMap); +toOrderedMap = immutable.OrderedMap(toOrderedMap); + +// Set tests +let set: immutable.Set = immutable.Set.of(0, 1, 2, 3); +bool = immutable.Set.isSet(set); +set = immutable.Set.fromKeys(toMap); +let set1: immutable.Set = immutable.Set.fromKeys({ "foo": 1, "bar": 2}); +set = immutable.Set(); +set = immutable.Set(set); +set = set.add(3); +set.delete(1); +set.remove(2); +set = set.clear(); +set = set.union(map, list); +set = set.union([1, 2, 3], [4, 5, 6]); +set = set.merge(map1, list); +set = set.merge([1, 2, 3], [4, 5, 6]); +set = set.intersect(map1, list); +set = set.intersect([1, 2, 3], [4, 5, 6]); +set = set.subtract(map1, list); +set = set.subtract([1, 2, 3], [4, 5, 6]); +set = set.withMutations((mutable: immutable.Set) => mutable); +set = set.asMutable(); +set = set.asImmutable(); + + +// OrderedSet tests +bool = immutable.OrderedSet.isOrderedSet(set); +let orderedSet1: immutable.OrderedSet = immutable.OrderedSet.of(0, 1, 2, 3); +orderedSet1 = immutable.OrderedSet.fromKeys(toMap); +let orderedSet2: immutable.Set = immutable.Set.fromKeys({ "foo": 1, "bar": 2}); + +// Stack tests + +let stack: immutable.Stack = immutable.Stack(); +bool = immutable.Stack.isStack(stack); +stack = immutable.Stack.of(0, 1, 2, 3, 4, 5); +stack = immutable.Stack(list); +value = stack.peek(); +stack = stack.clear(); +stack = stack.unshift(0, 1, 2); +stack = stack.unshiftAll(list); +stack = stack.unshiftAll([1, 2, 3]); +stack = stack.shift(); +stack = stack.push(1, 2, 3); +stack = stack.pushAll(list); +stack = stack.pushAll([1, 2, 3]); +stack = stack.pop(); +stack = stack.withMutations((mutable: immutable.Stack) => mutable); +stack = stack.asMutable(); +stack = stack.asImmutable(); + + +// Range and Repeat function tests + +let funcSeqIndexed: immutable.Seq.Indexed = immutable.Range(0, 3, 1); +funcSeqIndexed = immutable.Repeat(2, 10); + + +// Seq tests +let seq: immutable.Seq = immutable.Seq(); +bool = immutable.Seq.isSeq(seq); +funcSeqIndexed = immutable.Seq.of(0, 1, 2, 3); +seq = immutable.Seq(map); +value = seq.size; +seq = seq.cacheResult(); + + +// keyed +let seqKeyed: immutable.Seq.Keyed = immutable.Seq.Keyed(); +seqKeyed = immutable.Seq.Keyed(map); +seqKeyed = seqKeyed.toSeq(); + +// indexed +let seqIndexed: immutable.Seq.Indexed = immutable.Seq.Indexed(); +seqIndexed = immutable.Seq.Indexed.of(0, 1, 2, 3); +seqIndexed = immutable.Seq.Indexed(list); +seqIndexed = seqIndexed.toSeq(); + +// indexed +let seqSet: immutable.Seq.Set = immutable.Seq.Set(); +seqSet = immutable.Seq.Set.of(0, 1, 2, 3); +seqSet = immutable.Seq.Set(list); +seqSet = seqSet.toSeq(); diff --git a/immutable/immutable.d.ts b/immutable/immutable.d.ts new file mode 100644 index 0000000000..5ca32ecfe4 --- /dev/null +++ b/immutable/immutable.d.ts @@ -0,0 +1,2546 @@ +// Type definitions for Facebook's Immutable 3.8.1 +// Project: https://github.com/facebook/immutable-js +// Definitions by: tht13 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Core of typings are from repository itself + +/** + * Copyright (c) 2014-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +/** + * Immutable data encourages pure functions (data-in, data-out) and lends itself + * to much simpler application development and enabling techniques from + * functional programming such as lazy evaluation. + * + * While designed to bring these powerful functional concepts to JavaScript, it + * presents an Object-Oriented API familiar to Javascript engineers and closely + * mirroring that of Array, Map, and Set. It is easy and efficient to convert to + * and from plain Javascript types. + + * Note: all examples are presented in [ES6][]. To run in all browsers, they + * need to be translated to ES3. For example: + * + * // ES6 + * foo.map(x => x * x); + * // ES3 + * foo.map(function (x) { return x * x; }); + * + * [ES6]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla + */ + +declare namespace __Immutable { + + /** + * Deeply converts plain JS objects and arrays to Immutable Maps and Lists. + * + * If a `reviver` is optionally provided, it will be called with every + * collection as a Seq (beginning with the most nested collections + * and proceeding to the top-level collection itself), along with the key + * refering to each collection and the parent JS object provided as `this`. + * For the top level, object, the key will be `""`. This `reviver` is expected + * to return a new Immutable Iterable, allowing for custom conversions from + * deep JS objects. + * + * This example converts JSON to List and OrderedMap: + * + * Immutable.fromJS({a: {b: [10, 20, 30]}, c: 40}, function (key, value) { + * var isIndexed = Immutable.Iterable.isIndexed(value); + * return isIndexed ? value.toList() : value.toOrderedMap(); + * }); + * + * // true, "b", {b: [10, 20, 30]} + * // false, "a", {a: {b: [10, 20, 30]}, c: 40} + * // false, "", {"": {a: {b: [10, 20, 30]}, c: 40}} + * + * If `reviver` is not provided, the default behavior will convert Arrays into + * Lists and Objects into Maps. + * + * `reviver` acts similarly to the [same parameter in `JSON.parse`][1]. + * + * `Immutable.fromJS` is conservative in its conversion. It will only convert + * arrays which pass `Array.isArray` to Lists, and only raw objects (no custom + * prototype) to Map. + * + * Keep in mind, when using JS objects to construct Immutable Maps, that + * JavaScript Object properties are always strings, even if written in a + * quote-less shorthand, while Immutable Maps accept keys of any type. + * + * ```js + * var obj = { 1: "one" }; + * Object.keys(obj); // [ "1" ] + * obj["1"]; // "one" + * obj[1]; // "one" + * + * var map = Map(obj); + * map.get("1"); // "one" + * map.get(1); // undefined + * ``` + * + * Property access for JavaScript Objects first converts the key to a string, + * but since Immutable Map keys can be of any type the argument to `get()` is + * not altered. + * + * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter + * "Using the reviver parameter" + */ + export function fromJS( + json: any, + reviver?: (k: any, v: Iterable) => any + ): any; + + + /** + * Value equality check with semantics similar to `Object.is`, but treats + * Immutable `Iterable`s as values, equal if the second `Iterable` includes + * equivalent values. + * + * It's used throughout Immutable when checking for equality, including `Map` + * key equality and `Set` membership. + * + * var map1 = Immutable.Map({a:1, b:1, c:1}); + * var map2 = Immutable.Map({a:1, b:1, c:1}); + * assert(map1 !== map2); + * assert(Object.is(map1, map2) === false); + * assert(Immutable.is(map1, map2) === true); + * + * Note: Unlike `Object.is`, `Immutable.is` assumes `0` and `-0` are the same + * value, matching the behavior of ES6 Map key equality. + */ + export function is(first: any, second: any): boolean; + + + /** + * Lists are ordered indexed dense collections, much like a JavaScript + * Array. + * + * Lists are immutable and fully persistent with O(log32 N) gets and sets, + * and O(1) push and pop. + * + * Lists implement Deque, with efficient addition and removal from both the + * end (`push`, `pop`) and beginning (`unshift`, `shift`). + * + * Unlike a JavaScript Array, there is no distinction between an + * "unset" index and an index set to `undefined`. `List#forEach` visits all + * indices from 0 to size, regardless of whether they were explicitly defined. + */ + export module List { + + /** + * True if the provided value is a List + */ + function isList(maybeList: any): boolean; + + /** + * Creates a new List containing `values`. + */ + function of(...values: T[]): List; + } + + /** + * Create a new immutable List containing the values of the provided + * iterable-like. + */ + export function List(): List; + export function List(iter: Iterable.Indexed): List; + export function List(iter: Iterable.Set): List; + export function List(iter: Iterable.Keyed): List<[K,V]>; + export function List(array: Array): List; + export function List(iterator: Iterator): List; + export function List(iterable: Iterable): List; + + + export interface List extends Collection.Indexed { + + // Persistent changes + + /** + * Returns a new List which includes `value` at `index`. If `index` already + * exists in this List, it will be replaced. + * + * `index` may be a negative number, which indexes back from the end of the + * List. `v.set(-1, "value")` sets the last item in the List. + * + * If `index` larger than `size`, the returned List's `size` will be large + * enough to include the `index`. + */ + set(index: number, value: T): List; + + /** + * Returns a new List which excludes this `index` and with a size 1 less + * than this List. Values at indices above `index` are shifted down by 1 to + * fill the position. + * + * This is synonymous with `list.splice(index, 1)`. + * + * `index` may be a negative number, which indexes back from the end of the + * List. `v.delete(-1)` deletes the last item in the List. + * + * Note: `delete` cannot be safely used in IE8 + * @alias remove + */ + delete(index: number): List; + remove(index: number): List; + + /** + * Returns a new List with `value` at `index` with a size 1 more than this + * List. Values at indices above `index` are shifted over by 1. + * + * This is synonymous with `list.splice(index, 0, value) + */ + insert(index: number, value: T): List; + + /** + * Returns a new List with 0 size and no values. + */ + clear(): List; + + /** + * Returns a new List with the provided `values` appended, starting at this + * List's `size`. + */ + push(...values: T[]): List; + + /** + * Returns a new List with a size ones less than this List, excluding + * the last index in this List. + * + * Note: this differs from `Array#pop` because it returns a new + * List rather than the removed value. Use `last()` to get the last value + * in this List. + */ + pop(): List; + + /** + * Returns a new List with the provided `values` prepended, shifting other + * values ahead to higher indices. + */ + unshift(...values: T[]): List; + + /** + * Returns a new List with a size ones less than this List, excluding + * the first index in this List, shifting all other values to a lower index. + * + * Note: this differs from `Array#shift` because it returns a new + * List rather than the removed value. Use `first()` to get the first + * value in this List. + */ + shift(): List; + + /** + * Returns a new List with an updated value at `index` with the return + * value of calling `updater` with the existing value, or `notSetValue` if + * `index` was not set. If called with a single argument, `updater` is + * called with the List itself. + * + * `index` may be a negative number, which indexes back from the end of the + * List. `v.update(-1)` updates the last item in the List. + * + * @see `Map#update` + */ + update(updater: (value: List) => List): List; + update(index: number, updater: (value: T) => T): List; + update(index: number, notSetValue: T, updater: (value: T) => T): List; + + /** + * @see `Map#merge` + */ + merge(...iterables: Iterable.Indexed[]): List; + merge(...iterables: Array[]): List; + + /** + * @see `Map#mergeWith` + */ + mergeWith( + merger: (previous?: T, next?: T, key?: number) => T, + ...iterables: Iterable.Indexed[] + ): List; + mergeWith( + merger: (previous?: T, next?: T, key?: number) => T, + ...iterables: Array[] + ): List; + + /** + * @see `Map#mergeDeep` + */ + mergeDeep(...iterables: Iterable.Indexed[]): List; + mergeDeep(...iterables: Array[]): List; + + /** + * @see `Map#mergeDeepWith` + */ + mergeDeepWith( + merger: (previous?: T, next?: T, key?: number) => T, + ...iterables: Iterable.Indexed[] + ): List; + mergeDeepWith( + merger: (previous?: T, next?: T, key?: number) => T, + ...iterables: Array[] + ): List; + + /** + * Returns a new List with size `size`. If `size` is less than this + * List's size, the new List will exclude values at the higher indices. + * If `size` is greater than this List's size, the new List will have + * undefined values for the newly available indices. + * + * When building a new List and the final size is known up front, `setSize` + * used in conjunction with `withMutations` may result in the more + * performant construction. + */ + setSize(size: number): List; + + + // Deep persistent changes + + /** + * Returns a new List having set `value` at this `keyPath`. If any keys in + * `keyPath` do not exist, a new immutable Map will be created at that key. + * + * Index numbers are used as keys to determine the path to follow in + * the List. + */ + setIn(keyPath: Array, value: any): List; + setIn(keyPath: Iterable, value: any): List; + + /** + * Returns a new List having removed the value at this `keyPath`. If any + * keys in `keyPath` do not exist, no change will occur. + * + * @alias removeIn + */ + deleteIn(keyPath: Array): List; + deleteIn(keyPath: Iterable): List; + removeIn(keyPath: Array): List; + removeIn(keyPath: Iterable): List; + + /** + * @see `Map#updateIn` + */ + updateIn( + keyPath: Array, + updater: (value: any) => any + ): List; + updateIn( + keyPath: Array, + notSetValue: any, + updater: (value: any) => any + ): List; + updateIn( + keyPath: Iterable, + updater: (value: any) => any + ): List; + updateIn( + keyPath: Iterable, + notSetValue: any, + updater: (value: any) => any + ): List; + + /** + * @see `Map#mergeIn` + */ + mergeIn( + keyPath: Iterable, + ...iterables: Iterable.Indexed[] + ): List; + mergeIn( + keyPath: Array, + ...iterables: Iterable.Indexed[] + ): List; + mergeIn( + keyPath: Array, + ...iterables: Array[] + ): List; + + /** + * @see `Map#mergeDeepIn` + */ + mergeDeepIn( + keyPath: Iterable, + ...iterables: Iterable.Indexed[] + ): List; + mergeDeepIn( + keyPath: Array, + ...iterables: Iterable.Indexed[] + ): List; + mergeDeepIn( + keyPath: Array, + ...iterables: Array[] + ): List; + + + // Transient changes + + /** + * Note: Not all methods can be used on a mutable collection or within + * `withMutations`! Only `set`, `push`, `pop`, `shift`, `unshift` and + * `merge` may be used mutatively. + * + * @see `Map#withMutations` + */ + withMutations(mutator: (mutable: List) => any): List; + + /** + * @see `Map#asMutable` + */ + asMutable(): List; + + /** + * @see `Map#asImmutable` + */ + asImmutable(): List; + } + + + /** + * Immutable Map is an unordered Iterable.Keyed of (key, value) pairs with + * `O(log32 N)` gets and `O(log32 N)` persistent sets. + * + * Iteration order of a Map is undefined, however is stable. Multiple + * iterations of the same Map will iterate in the same order. + * + * Map's keys can be of any type, and use `Immutable.is` to determine key + * equality. This allows the use of any value (including NaN) as a key. + * + * Because `Immutable.is` returns equality based on value semantics, and + * Immutable collections are treated as values, any Immutable collection may + * be used as a key. + * + * Map().set(List.of(1), 'listofone').get(List.of(1)); + * // 'listofone' + * + * Any JavaScript object may be used as a key, however strict identity is used + * to evaluate key equality. Two similar looking objects will represent two + * different keys. + * + * Implemented by a hash-array mapped trie. + */ + export module Map { + + /** + * True if the provided value is a Map + */ + function isMap(maybeMap: any): boolean; + + /** + * Creates a new Map from alternating keys and values + */ + function of(...keyValues: (K|V)[]): Map; + } + + /** + * Creates a new Immutable Map. + * + * Created with the same key value pairs as the provided Iterable.Keyed or + * JavaScript Object or expects an Iterable of [K, V] tuple entries. + * + * var newMap = Map({key: "value"}); + * var newMap = Map([["key", "value"]]); + * + * Keep in mind, when using JS objects to construct Immutable Maps, that + * JavaScript Object properties are always strings, even if written in a + * quote-less shorthand, while Immutable Maps accept keys of any type. + * + * ```js + * var obj = { 1: "one" }; + * Object.keys(obj); // [ "1" ] + * obj["1"]; // "one" + * obj[1]; // "one" + * + * var map = Map(obj); + * map.get("1"); // "one" + * map.get(1); // undefined + * ``` + * + * Property access for JavaScript Objects first converts the key to a string, + * but since Immutable Map keys can be of any type the argument to `get()` is + * not altered. + */ + export function Map(): Map; + export function Map(iter: Iterable.Keyed): Map; + export function Map(iter: Iterable): Map; + export function Map(array: Array<[K,V]>): Map; + export function Map(obj: {[key: string]: V}): Map; + export function Map(iterator: Iterator<[K,V]>): Map; + export function Map(iterable: Iterable): Map; + + export interface Map extends Collection.Keyed { + + // Persistent changes + + /** + * Returns a new Map also containing the new key, value pair. If an equivalent + * key already exists in this Map, it will be replaced. + */ + set(key: K, value: V): Map; + + /** + * Returns a new Map which excludes this `key`. + * + * Note: `delete` cannot be safely used in IE8, but is provided to mirror + * the ES6 collection API. + * @alias remove + */ + delete(key: K): Map; + remove(key: K): Map; + + /** + * Returns a new Map containing no keys or values. + */ + clear(): Map; + + /** + * Returns a new Map having updated the value at this `key` with the return + * value of calling `updater` with the existing value, or `notSetValue` if + * the key was not set. If called with only a single argument, `updater` is + * called with the Map itself. + * + * Equivalent to: `map.set(key, updater(map.get(key, notSetValue)))`. + */ + update(updater: (value: Map) => Map): Map; + update(key: K, updater: (value: V) => V): Map; + update(key: K, notSetValue: V, updater: (value: V) => V): Map; + + /** + * Returns a new Map resulting from merging the provided Iterables + * (or JS objects) into this Map. In other words, this takes each entry of + * each iterable and sets it on this Map. + * + * If any of the values provided to `merge` are not Iterable (would return + * false for `Immutable.Iterable.isIterable`) then they are deeply converted + * via `Immutable.fromJS` before being merged. However, if the value is an + * Iterable but includes non-iterable JS objects or arrays, those nested + * values will be preserved. + * + * var x = Immutable.Map({a: 10, b: 20, c: 30}); + * var y = Immutable.Map({b: 40, a: 50, d: 60}); + * x.merge(y) // { a: 50, b: 40, c: 30, d: 60 } + * y.merge(x) // { b: 20, a: 10, d: 60, c: 30 } + * + */ + merge(...iterables: Iterable[]): Map; + merge(...iterables: {[key: string]: V}[]): Map; + + /** + * Like `merge()`, `mergeWith()` returns a new Map resulting from merging + * the provided Iterables (or JS objects) into this Map, but uses the + * `merger` function for dealing with conflicts. + * + * var x = Immutable.Map({a: 10, b: 20, c: 30}); + * var y = Immutable.Map({b: 40, a: 50, d: 60}); + * x.mergeWith((prev, next) => prev / next, y) // { a: 0.2, b: 0.5, c: 30, d: 60 } + * y.mergeWith((prev, next) => prev / next, x) // { b: 2, a: 5, d: 60, c: 30 } + * + */ + mergeWith( + merger: (previous?: V, next?: V, key?: K) => V, + ...iterables: Iterable[] + ): Map; + mergeWith( + merger: (previous?: V, next?: V, key?: K) => V, + ...iterables: {[key: string]: V}[] + ): Map; + + /** + * Like `merge()`, but when two Iterables conflict, it merges them as well, + * recursing deeply through the nested data. + * + * var x = Immutable.fromJS({a: { x: 10, y: 10 }, b: { x: 20, y: 50 } }); + * var y = Immutable.fromJS({a: { x: 2 }, b: { y: 5 }, c: { z: 3 } }); + * x.mergeDeep(y) // {a: { x: 2, y: 10 }, b: { x: 20, y: 5 }, c: { z: 3 } } + * + */ + mergeDeep(...iterables: Iterable[]): Map; + mergeDeep(...iterables: {[key: string]: V}[]): Map; + + /** + * Like `mergeDeep()`, but when two non-Iterables conflict, it uses the + * `merger` function to determine the resulting value. + * + * var x = Immutable.fromJS({a: { x: 10, y: 10 }, b: { x: 20, y: 50 } }); + * var y = Immutable.fromJS({a: { x: 2 }, b: { y: 5 }, c: { z: 3 } }); + * x.mergeDeepWith((prev, next) => prev / next, y) + * // {a: { x: 5, y: 10 }, b: { x: 20, y: 10 }, c: { z: 3 } } + * + */ + mergeDeepWith( + merger: (previous?: V, next?: V, key?: K) => V, + ...iterables: Iterable[] + ): Map; + mergeDeepWith( + merger: (previous?: V, next?: V, key?: K) => V, + ...iterables: {[key: string]: V}[] + ): Map; + + + // Deep persistent changes + + /** + * Returns a new Map having set `value` at this `keyPath`. If any keys in + * `keyPath` do not exist, a new immutable Map will be created at that key. + */ + setIn(keyPath: Array, value: any): Map; + setIn(KeyPath: Iterable, value: any): Map; + + /** + * Returns a new Map having removed the value at this `keyPath`. If any keys + * in `keyPath` do not exist, no change will occur. + * + * @alias removeIn + */ + deleteIn(keyPath: Array): Map; + deleteIn(keyPath: Iterable): Map; + removeIn(keyPath: Array): Map; + removeIn(keyPath: Iterable): Map; + + /** + * Returns a new Map having applied the `updater` to the entry found at the + * keyPath. + * + * If any keys in `keyPath` do not exist, new Immutable `Map`s will + * be created at those keys. If the `keyPath` does not already contain a + * value, the `updater` function will be called with `notSetValue`, if + * provided, otherwise `undefined`. + * + * var data = Immutable.fromJS({ a: { b: { c: 10 } } }); + * data = data.updateIn(['a', 'b', 'c'], val => val * 2); + * // { a: { b: { c: 20 } } } + * + * If the `updater` function returns the same value it was called with, then + * no change will occur. This is still true if `notSetValue` is provided. + * + * var data1 = Immutable.fromJS({ a: { b: { c: 10 } } }); + * data2 = data1.updateIn(['x', 'y', 'z'], 100, val => val); + * assert(data2 === data1); + * + */ + updateIn( + keyPath: Array, + updater: (value: any) => any + ): Map; + updateIn( + keyPath: Array, + notSetValue: any, + updater: (value: any) => any + ): Map; + updateIn( + keyPath: Iterable, + updater: (value: any) => any + ): Map; + updateIn( + keyPath: Iterable, + notSetValue: any, + updater: (value: any) => any + ): Map; + + /** + * A combination of `updateIn` and `merge`, returning a new Map, but + * performing the merge at a point arrived at by following the keyPath. + * In other words, these two lines are equivalent: + * + * x.updateIn(['a', 'b', 'c'], abc => abc.merge(y)); + * x.mergeIn(['a', 'b', 'c'], y); + * + */ + mergeIn( + keyPath: Iterable, + ...iterables: Iterable[] + ): Map; + mergeIn( + keyPath: Array, + ...iterables: Iterable[] + ): Map; + mergeIn( + keyPath: Array, + ...iterables: {[key: string]: V}[] + ): Map; + + /** + * A combination of `updateIn` and `mergeDeep`, returning a new Map, but + * performing the deep merge at a point arrived at by following the keyPath. + * In other words, these two lines are equivalent: + * + * x.updateIn(['a', 'b', 'c'], abc => abc.mergeDeep(y)); + * x.mergeDeepIn(['a', 'b', 'c'], y); + * + */ + mergeDeepIn( + keyPath: Iterable, + ...iterables: Iterable[] + ): Map; + mergeDeepIn( + keyPath: Array, + ...iterables: Iterable[] + ): Map; + mergeDeepIn( + keyPath: Array, + ...iterables: {[key: string]: V}[] + ): Map; + + + // Transient changes + + /** + * Every time you call one of the above functions, a new immutable Map is + * created. If a pure function calls a number of these to produce a final + * return value, then a penalty on performance and memory has been paid by + * creating all of the intermediate immutable Maps. + * + * If you need to apply a series of mutations to produce a new immutable + * Map, `withMutations()` creates a temporary mutable copy of the Map which + * can apply mutations in a highly performant manner. In fact, this is + * exactly how complex mutations like `merge` are done. + * + * As an example, this results in the creation of 2, not 4, new Maps: + * + * var map1 = Immutable.Map(); + * var map2 = map1.withMutations(map => { + * map.set('a', 1).set('b', 2).set('c', 3); + * }); + * assert(map1.size === 0); + * assert(map2.size === 3); + * + * Note: Not all methods can be used on a mutable collection or within + * `withMutations`! Only `set` and `merge` may be used mutatively. + * + */ + withMutations(mutator: (mutable: Map) => any): Map; + + /** + * Another way to avoid creation of intermediate Immutable maps is to create + * a mutable copy of this collection. Mutable copies *always* return `this`, + * and thus shouldn't be used for equality. Your function should never return + * a mutable copy of a collection, only use it internally to create a new + * collection. If possible, use `withMutations` as it provides an easier to + * use API. + * + * Note: if the collection is already mutable, `asMutable` returns itself. + * + * Note: Not all methods can be used on a mutable collection or within + * `withMutations`! Only `set` and `merge` may be used mutatively. + */ + asMutable(): Map; + + /** + * The yin to `asMutable`'s yang. Because it applies to mutable collections, + * this operation is *mutable* and returns itself. Once performed, the mutable + * copy has become immutable and can be safely returned from a function. + */ + asImmutable(): Map; + } + + + /** + * A type of Map that has the additional guarantee that the iteration order of + * entries will be the order in which they were set(). + * + * The iteration behavior of OrderedMap is the same as native ES6 Map and + * JavaScript Object. + * + * Note that `OrderedMap` are more expensive than non-ordered `Map` and may + * consume more memory. `OrderedMap#set` is amortized O(log32 N), but not + * stable. + */ + + export module OrderedMap { + + /** + * True if the provided value is an OrderedMap. + */ + function isOrderedMap(maybeOrderedMap: any): boolean; + } + + /** + * Creates a new Immutable OrderedMap. + * + * Created with the same key value pairs as the provided Iterable.Keyed or + * JavaScript Object or expects an Iterable of [K, V] tuple entries. + * + * The iteration order of key-value pairs provided to this constructor will + * be preserved in the OrderedMap. + * + * var newOrderedMap = OrderedMap({key: "value"}); + * var newOrderedMap = OrderedMap([["key", "value"]]); + * + */ + export function OrderedMap(): OrderedMap; + export function OrderedMap(iter: Iterable.Keyed): OrderedMap; + export function OrderedMap(iter: Iterable): OrderedMap; + export function OrderedMap(array: Array<[K,V]>): OrderedMap; + export function OrderedMap(obj: {[key: string]: V}): OrderedMap; + export function OrderedMap(iterator: Iterator<[K,V]>): OrderedMap; + export function OrderedMap(iterable: Iterable): OrderedMap; + + export interface OrderedMap extends Map {} + + + /** + * A Collection of unique values with `O(log32 N)` adds and has. + * + * When iterating a Set, the entries will be (value, value) pairs. Iteration + * order of a Set is undefined, however is stable. Multiple iterations of the + * same Set will iterate in the same order. + * + * Set values, like Map keys, may be of any type. Equality is determined using + * `Immutable.is`, enabling Sets to uniquely include other Immutable + * collections, custom value types, and NaN. + */ + export module Set { + + /** + * True if the provided value is a Set + */ + function isSet(maybeSet: any): boolean; + + /** + * Creates a new Set containing `values`. + */ + function of(...values: T[]): Set; + + /** + * `Set.fromKeys()` creates a new immutable Set containing the keys from + * this Iterable or JavaScript Object. + */ + function fromKeys(iter: Iterable): Set; + function fromKeys(obj: {[key: string]: any}): Set; + } + + /** + * Create a new immutable Set containing the values of the provided + * iterable-like. + */ + export function Set(): Set; + export function Set(iter: Iterable.Set): Set; + export function Set(iter: Iterable.Indexed): Set; + export function Set(iter: Iterable.Keyed): Set<[K,V]>; + export function Set(array: Array): Set; + export function Set(iterator: Iterator): Set; + export function Set(iterable: Iterable): Set; + + export interface Set extends Collection.Set { + + // Persistent changes + + /** + * Returns a new Set which also includes this value. + */ + add(value: T): Set; + + /** + * Returns a new Set which excludes this value. + * + * Note: `delete` cannot be safely used in IE8 + * @alias remove + */ + delete(value: T): Set; + remove(value: T): Set; + + /** + * Returns a new Set containing no values. + */ + clear(): Set; + + /** + * Returns a Set including any value from `iterables` that does not already + * exist in this Set. + * @alias merge + */ + union(...iterables: Iterable[]): Set; + union(...iterables: Array[]): Set; + merge(...iterables: Iterable[]): Set; + merge(...iterables: Array[]): Set; + + + /** + * Returns a Set which has removed any values not also contained + * within `iterables`. + */ + intersect(...iterables: Iterable[]): Set; + intersect(...iterables: Array[]): Set; + + /** + * Returns a Set excluding any values contained within `iterables`. + */ + subtract(...iterables: Iterable[]): Set; + subtract(...iterables: Array[]): Set; + + + // Transient changes + + /** + * Note: Not all methods can be used on a mutable collection or within + * `withMutations`! Only `add` may be used mutatively. + * + * @see `Map#withMutations` + */ + withMutations(mutator: (mutable: Set) => any): Set; + + /** + * @see `Map#asMutable` + */ + asMutable(): Set; + + /** + * @see `Map#asImmutable` + */ + asImmutable(): Set; + } + + + /** + * A type of Set that has the additional guarantee that the iteration order of + * values will be the order in which they were `add`ed. + * + * The iteration behavior of OrderedSet is the same as native ES6 Set. + * + * Note that `OrderedSet` are more expensive than non-ordered `Set` and may + * consume more memory. `OrderedSet#add` is amortized O(log32 N), but not + * stable. + */ + export module OrderedSet { + + /** + * True if the provided value is an OrderedSet. + */ + function isOrderedSet(maybeOrderedSet: any): boolean; + + /** + * Creates a new OrderedSet containing `values`. + */ + function of(...values: T[]): OrderedSet; + + /** + * `OrderedSet.fromKeys()` creates a new immutable OrderedSet containing + * the keys from this Iterable or JavaScript Object. + */ + function fromKeys(iter: Iterable): OrderedSet; + function fromKeys(obj: {[key: string]: any}): OrderedSet; + } + + /** + * Create a new immutable OrderedSet containing the values of the provided + * iterable-like. + */ + export function OrderedSet(): OrderedSet; + export function OrderedSet(iter: Iterable.Set): OrderedSet; + export function OrderedSet(iter: Iterable.Indexed): OrderedSet; + export function OrderedSet(iter: Iterable.Keyed): OrderedSet<[K,V]>; + export function OrderedSet(array: Array): OrderedSet; + export function OrderedSet(iterator: Iterator): OrderedSet; + export function OrderedSet(iterable: Iterable): OrderedSet; + + export interface OrderedSet extends Set {} + + + /** + * Stacks are indexed collections which support very efficient O(1) addition + * and removal from the front using `unshift(v)` and `shift()`. + * + * For familiarity, Stack also provides `push(v)`, `pop()`, and `peek()`, but + * be aware that they also operate on the front of the list, unlike List or + * a JavaScript Array. + * + * Note: `reverse()` or any inherent reverse traversal (`reduceRight`, + * `lastIndexOf`, etc.) is not efficient with a Stack. + * + * Stack is implemented with a Single-Linked List. + */ + export module Stack { + + /** + * True if the provided value is a Stack + */ + function isStack(maybeStack: any): boolean; + + /** + * Creates a new Stack containing `values`. + */ + function of(...values: T[]): Stack; + } + + /** + * Create a new immutable Stack containing the values of the provided + * iterable-like. + * + * The iteration order of the provided iterable is preserved in the + * resulting `Stack`. + */ + export function Stack(): Stack; + export function Stack(iter: Iterable.Indexed): Stack; + export function Stack(iter: Iterable.Set): Stack; + export function Stack(iter: Iterable.Keyed): Stack<[K,V]>; + export function Stack(array: Array): Stack; + export function Stack(iterator: Iterator): Stack; + export function Stack(iterable: Iterable): Stack; + + export interface Stack extends Collection.Indexed { + + // Reading values + + /** + * Alias for `Stack.first()`. + */ + peek(): T; + + + // Persistent changes + + /** + * Returns a new Stack with 0 size and no values. + */ + clear(): Stack; + + /** + * Returns a new Stack with the provided `values` prepended, shifting other + * values ahead to higher indices. + * + * This is very efficient for Stack. + */ + unshift(...values: T[]): Stack; + + /** + * Like `Stack#unshift`, but accepts a iterable rather than varargs. + */ + unshiftAll(iter: Iterable): Stack; + unshiftAll(iter: Array): Stack; + + /** + * Returns a new Stack with a size ones less than this Stack, excluding + * the first item in this Stack, shifting all other values to a lower index. + * + * Note: this differs from `Array#shift` because it returns a new + * Stack rather than the removed value. Use `first()` or `peek()` to get the + * first value in this Stack. + */ + shift(): Stack; + + /** + * Alias for `Stack#unshift` and is not equivalent to `List#push`. + */ + push(...values: T[]): Stack; + + /** + * Alias for `Stack#unshiftAll`. + */ + pushAll(iter: Iterable): Stack; + pushAll(iter: Array): Stack; + + /** + * Alias for `Stack#shift` and is not equivalent to `List#pop`. + */ + pop(): Stack; + + + // Transient changes + + /** + * Note: Not all methods can be used on a mutable collection or within + * `withMutations`! Only `set`, `push`, and `pop` may be used mutatively. + * + * @see `Map#withMutations` + */ + withMutations(mutator: (mutable: Stack) => any): Stack; + + /** + * @see `Map#asMutable` + */ + asMutable(): Stack; + + /** + * @see `Map#asImmutable` + */ + asImmutable(): Stack; + } + + + /** + * Returns a Seq.Indexed of numbers from `start` (inclusive) to `end` + * (exclusive), by `step`, where `start` defaults to 0, `step` to 1, and `end` to + * infinity. When `start` is equal to `end`, returns empty range. + * + * Range() // [0,1,2,3,...] + * Range(10) // [10,11,12,13,...] + * Range(10,15) // [10,11,12,13,14] + * Range(10,30,5) // [10,15,20,25] + * Range(30,10,5) // [30,25,20,15] + * Range(30,30,5) // [] + * + */ + export function Range(start?: number, end?: number, step?: number): Seq.Indexed; + + + /** + * Returns a Seq.Indexed of `value` repeated `times` times. When `times` is + * not defined, returns an infinite `Seq` of `value`. + * + * Repeat('foo') // ['foo','foo','foo',...] + * Repeat('bar',4) // ['bar','bar','bar','bar'] + * + */ + export function Repeat(value: T, times?: number): Seq.Indexed; + + + /** + * Creates a new Class which produces Record instances. A record is similar to + * a JS object, but enforce a specific set of allowed string keys, and have + * default values. + * + * var ABRecord = Record({a:1, b:2}) + * var myRecord = new ABRecord({b:3}) + * + * Records always have a value for the keys they define. `remove`ing a key + * from a record simply resets it to the default value for that key. + * + * myRecord.size // 2 + * myRecord.get('a') // 1 + * myRecord.get('b') // 3 + * myRecordWithoutB = myRecord.remove('b') + * myRecordWithoutB.get('b') // 2 + * myRecordWithoutB.size // 2 + * + * Values provided to the constructor not found in the Record type will + * be ignored. For example, in this case, ABRecord is provided a key "x" even + * though only "a" and "b" have been defined. The value for "x" will be + * ignored for this record. + * + * var myRecord = new ABRecord({b:3, x:10}) + * myRecord.get('x') // undefined + * + * Because Records have a known set of string keys, property get access works + * as expected, however property sets will throw an Error. + * + * Note: IE8 does not support property access. Only use `get()` when + * supporting IE8. + * + * myRecord.b // 3 + * myRecord.b = 5 // throws Error + * + * Record Classes can be extended as well, allowing for custom methods on your + * Record. This is not a common pattern in functional environments, but is in + * many JS programs. + * + * Note: TypeScript does not support this type of subclassing. + * + * class ABRecord extends Record({a:1,b:2}) { + * getAB() { + * return this.a + this.b; + * } + * } + * + * var myRecord = new ABRecord({b: 3}) + * myRecord.getAB() // 4 + * + */ + export module Record { + export interface Class { + new (): Map; + new (values: {[key: string]: any}): Map; + new (values: Iterable): Map; // deprecated + + (): Map; + (values: {[key: string]: any}): Map; + (values: Iterable): Map; // deprecated + } + } + + export function Record( + defaultValues: {[key: string]: any}, name?: string + ): Record.Class; + + + /** + * Represents a sequence of values, but may not be backed by a concrete data + * structure. + * + * **Seq is immutable** — Once a Seq is created, it cannot be + * changed, appended to, rearranged or otherwise modified. Instead, any + * mutative method called on a `Seq` will return a new `Seq`. + * + * **Seq is lazy** — Seq does as little work as necessary to respond to any + * method call. Values are often created during iteration, including implicit + * iteration when reducing or converting to a concrete data structure such as + * a `List` or JavaScript `Array`. + * + * For example, the following performs no work, because the resulting + * Seq's values are never iterated: + * + * var oddSquares = Immutable.Seq.of(1,2,3,4,5,6,7,8) + * .filter(x => x % 2).map(x => x * x); + * + * Once the Seq is used, it performs only the work necessary. In this + * example, no intermediate data structures are ever created, filter is only + * called three times, and map is only called once: + * + * console.log(oddSquares.get(1)); // 9 + * + * Seq allows for the efficient chaining of operations, + * allowing for the expression of logic that can otherwise be very tedious: + * + * Immutable.Seq({a:1, b:1, c:1}) + * .flip().map(key => key.toUpperCase()).flip().toObject(); + * // Map { A: 1, B: 1, C: 1 } + * + * As well as expressing logic that would otherwise be memory or time limited: + * + * Immutable.Range(1, Infinity) + * .skip(1000) + * .map(n => -n) + * .filter(n => n % 2 === 0) + * .take(2) + * .reduce((r, n) => r * n, 1); + * // 1006008 + * + * Seq is often used to provide a rich collection API to JavaScript Object. + * + * Immutable.Seq({ x: 0, y: 1, z: 2 }).map(v => v * 2).toObject(); + * // { x: 0, y: 2, z: 4 } + */ + + export module Seq { + /** + * True if `maybeSeq` is a Seq, it is not backed by a concrete + * structure such as Map, List, or Set. + */ + function isSeq(maybeSeq: any): boolean; + + /** + * Returns a Seq of the values provided. Alias for `Seq.Indexed.of()`. + */ + function of(...values: T[]): Seq.Indexed; + + + /** + * `Seq` which represents key-value pairs. + */ + export module Keyed {} + + /** + * Always returns a Seq.Keyed, if input is not keyed, expects an + * iterable of [K, V] tuples. + */ + export function Keyed(): Seq.Keyed; + export function Keyed(seq: Iterable.Keyed): Seq.Keyed; + export function Keyed(seq: Iterable): Seq.Keyed; + export function Keyed(array: Array<[K,V]>): Seq.Keyed; + export function Keyed(obj: {[key: string]: V}): Seq.Keyed; + export function Keyed(iterator: Iterator<[K,V]>): Seq.Keyed; + export function Keyed(iterable: Iterable): Seq.Keyed; + + export interface Keyed extends Seq, Iterable.Keyed { + + /** + * Returns itself + */ + toSeq(): this + } + + + /** + * `Seq` which represents an ordered indexed list of values. + */ + module Indexed { + + /** + * Provides an Seq.Indexed of the values provided. + */ + function of(...values: T[]): Seq.Indexed; + } + + /** + * Always returns Seq.Indexed, discarding associated keys and + * supplying incrementing indices. + */ + export function Indexed(): Seq.Indexed; + export function Indexed(seq: Iterable.Indexed): Seq.Indexed; + export function Indexed(seq: Iterable.Set): Seq.Indexed; + export function Indexed(seq: Iterable.Keyed): Seq.Indexed<[K,V]>; + export function Indexed(array: Array): Seq.Indexed; + export function Indexed(iterator: Iterator): Seq.Indexed; + export function Indexed(iterable: Iterable): Seq.Indexed; + + export interface Indexed extends Seq, Iterable.Indexed { + + /** + * Returns itself + */ + toSeq(): this + } + + + /** + * `Seq` which represents a set of values. + * + * Because `Seq` are often lazy, `Seq.Set` does not provide the same guarantee + * of value uniqueness as the concrete `Set`. + */ + export module Set { + + /** + * Returns a Seq.Set of the provided values + */ + function of(...values: T[]): Seq.Set; + } + + /** + * Always returns a Seq.Set, discarding associated indices or keys. + */ + export function Set(): Seq.Set; + export function Set(seq: Iterable.Set): Seq.Set; + export function Set(seq: Iterable.Indexed): Seq.Set; + export function Set(seq: Iterable.Keyed): Seq.Set<[K,V]>; + export function Set(array: Array): Seq.Set; + export function Set(iterator: Iterator): Seq.Set; + export function Set(iterable: Iterable): Seq.Set; + + export interface Set extends Seq, Iterable.Set { + + /** + * Returns itself + */ + toSeq(): this + } + + } + + /** + * Creates a Seq. + * + * Returns a particular kind of `Seq` based on the input. + * + * * If a `Seq`, that same `Seq`. + * * If an `Iterable`, a `Seq` of the same kind (Keyed, Indexed, or Set). + * * If an Array-like, an `Seq.Indexed`. + * * If an Object with an Iterator, an `Seq.Indexed`. + * * If an Iterator, an `Seq.Indexed`. + * * If an Object, a `Seq.Keyed`. + * + */ + export function Seq(): Seq; + export function Seq(seq: Seq): Seq; + export function Seq(iterable: Iterable): Seq; + export function Seq(array: Array): Seq.Indexed; + export function Seq(obj: {[key: string]: V}): Seq.Keyed; + export function Seq(iterator: Iterator): Seq.Indexed; + export function Seq(iterable: Iterable): Seq.Indexed; + + export interface Seq extends Iterable { + + /** + * Some Seqs can describe their size lazily. When this is the case, + * size will be an integer. Otherwise it will be undefined. + * + * For example, Seqs returned from `map()` or `reverse()` + * preserve the size of the original `Seq` while `filter()` does not. + * + * Note: `Range`, `Repeat` and `Seq`s made from `Array`s and `Object`s will + * always have a size. + */ + size: number/*?*/; + + + // Force evaluation + + /** + * Because Sequences are lazy and designed to be chained together, they do + * not cache their results. For example, this map function is called a total + * of 6 times, as each `join` iterates the Seq of three values. + * + * var squares = Seq.of(1,2,3).map(x => x * x); + * squares.join() + squares.join(); + * + * If you know a `Seq` will be used multiple times, it may be more + * efficient to first cache it in memory. Here, the map function is called + * only 3 times. + * + * var squares = Seq.of(1,2,3).map(x => x * x).cacheResult(); + * squares.join() + squares.join(); + * + * Use this method judiciously, as it must fully evaluate a Seq which can be + * a burden on memory and possibly performance. + * + * Note: after calling `cacheResult`, a Seq will always have a `size`. + */ + cacheResult(): this; + } + + /** + * The `Iterable` is a set of (key, value) entries which can be iterated, and + * is the base class for all collections in `immutable`, allowing them to + * make use of all the Iterable methods (such as `map` and `filter`). + * + * Note: An iterable is always iterated in the same order, however that order + * may not always be well defined, as is the case for the `Map` and `Set`. + */ + export module Iterable { + /** + * True if `maybeIterable` is an Iterable, or any of its subclasses. + */ + function isIterable(maybeIterable: any): boolean; + + /** + * True if `maybeKeyed` is an Iterable.Keyed, or any of its subclasses. + */ + function isKeyed(maybeKeyed: any): boolean; + + /** + * True if `maybeIndexed` is a Iterable.Indexed, or any of its subclasses. + */ + function isIndexed(maybeIndexed: any): boolean; + + /** + * True if `maybeAssociative` is either a keyed or indexed Iterable. + */ + function isAssociative(maybeAssociative: any): boolean; + + /** + * True if `maybeOrdered` is an Iterable where iteration order is well + * defined. True for Iterable.Indexed as well as OrderedMap and OrderedSet. + */ + function isOrdered(maybeOrdered: any): boolean; + + + /** + * Keyed Iterables have discrete keys tied to each value. + * + * When iterating `Iterable.Keyed`, each iteration will yield a `[K, V]` + * tuple, in other words, `Iterable#entries` is the default iterator for + * Keyed Iterables. + */ + export module Keyed {} + + /** + * Creates an Iterable.Keyed + * + * Similar to `Iterable()`, however it expects iterable-likes of [K, V] + * tuples if not constructed from a Iterable.Keyed or JS Object. + */ + export function Keyed(iter: Iterable.Keyed): Iterable.Keyed; + export function Keyed(iter: Iterable): Iterable.Keyed; + export function Keyed(array: Array<[K,V]>): Iterable.Keyed; + export function Keyed(obj: {[key: string]: V}): Iterable.Keyed; + export function Keyed(iterator: Iterator<[K,V]>): Iterable.Keyed; + export function Keyed(iterable: Iterable): Iterable.Keyed; + + export interface Keyed extends Iterable { + + /** + * Returns Seq.Keyed. + * @override + */ + toSeq(): Seq.Keyed; + + + // Sequence functions + + /** + * Returns a new Iterable.Keyed of the same type where the keys and values + * have been flipped. + * + * Seq({ a: 'z', b: 'y' }).flip() // { z: 'a', y: 'b' } + * + */ + flip(): this; + + /** + * Returns a new Iterable.Keyed of the same type with keys passed through + * a `mapper` function. + * + * Seq({ a: 1, b: 2 }) + * .mapKeys(x => x.toUpperCase()) + * // Seq { A: 1, B: 2 } + * + */ + mapKeys( + mapper: (key?: K, value?: V, iter?: this) => M, + context?: any + ): /*this*/Iterable.Keyed; + + /** + * Returns a new Iterable.Keyed of the same type with entries + * ([key, value] tuples) passed through a `mapper` function. + * + * Seq({ a: 1, b: 2 }) + * .mapEntries(([k, v]) => [k.toUpperCase(), v * 2]) + * // Seq { A: 2, B: 4 } + * + */ + mapEntries( + mapper: ( + entry?: [K, V], + index?: number, + iter?: this + ) => [KM, VM], + context?: any + ): /*this*/Iterable.Keyed; + } + + + /** + * Indexed Iterables have incrementing numeric keys. They exhibit + * slightly different behavior than `Iterable.Keyed` for some methods in order + * to better mirror the behavior of JavaScript's `Array`, and add methods + * which do not make sense on non-indexed Iterables such as `indexOf`. + * + * Unlike JavaScript arrays, `Iterable.Indexed`s are always dense. "Unset" + * indices and `undefined` indices are indistinguishable, and all indices from + * 0 to `size` are visited when iterated. + * + * All Iterable.Indexed methods return re-indexed Iterables. In other words, + * indices always start at 0 and increment until size. If you wish to + * preserve indices, using them as keys, convert to a Iterable.Keyed by + * calling `toKeyedSeq`. + */ + export module Indexed {} + + /** + * Creates a new Iterable.Indexed. + */ + export function Indexed(iter: Iterable.Indexed): Iterable.Indexed; + export function Indexed(iter: Iterable.Set): Iterable.Indexed; + export function Indexed(iter: Iterable.Keyed): Iterable.Indexed<[K,V]>; + export function Indexed(array: Array): Iterable.Indexed; + export function Indexed(iterator: Iterator): Iterable.Indexed; + export function Indexed(iterable: Iterable): Iterable.Indexed; + + export interface Indexed extends Iterable { + + // Reading values + + /** + * Returns the value associated with the provided index, or notSetValue if + * the index is beyond the bounds of the Iterable. + * + * `index` may be a negative number, which indexes back from the end of the + * Iterable. `s.get(-1)` gets the last item in the Iterable. + */ + get(index: number, notSetValue?: T): T; + + + // Conversion to Seq + + /** + * Returns Seq.Indexed. + * @override + */ + toSeq(): Seq.Indexed; + + /** + * If this is an iterable of [key, value] entry tuples, it will return a + * Seq.Keyed of those entries. + */ + fromEntrySeq(): Seq.Keyed; + + + // Combination + + /** + * Returns an Iterable of the same type with `separator` between each item + * in this Iterable. + */ + interpose(separator: T): this; + + /** + * Returns an Iterable of the same type with the provided `iterables` + * interleaved into this iterable. + * + * The resulting Iterable includes the first item from each, then the + * second from each, etc. + * + * I.Seq.of(1,2,3).interleave(I.Seq.of('A','B','C')) + * // Seq [ 1, 'A', 2, 'B', 3, 'C' ] + * + * The shortest Iterable stops interleave. + * + * I.Seq.of(1,2,3).interleave( + * I.Seq.of('A','B'), + * I.Seq.of('X','Y','Z') + * ) + * // Seq [ 1, 'A', 'X', 2, 'B', 'Y' ] + */ + interleave(...iterables: Array>): this; + + /** + * Splice returns a new indexed Iterable by replacing a region of this + * Iterable with new values. If values are not provided, it only skips the + * region to be removed. + * + * `index` may be a negative number, which indexes back from the end of the + * Iterable. `s.splice(-2)` splices after the second to last item. + * + * Seq(['a','b','c','d']).splice(1, 2, 'q', 'r', 's') + * // Seq ['a', 'q', 'r', 's', 'd'] + * + */ + splice( + index: number, + removeNum: number, + ...values: Array | T> + ): this; + + /** + * Returns an Iterable of the same type "zipped" with the provided + * iterables. + * + * Like `zipWith`, but using the default `zipper`: creating an `Array`. + * + * var a = Seq.of(1, 2, 3); + * var b = Seq.of(4, 5, 6); + * var c = a.zip(b); // Seq [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] + * + */ + zip(...iterables: Array>): this; + + /** + * Returns an Iterable of the same type "zipped" with the provided + * iterables by using a custom `zipper` function. + * + * var a = Seq.of(1, 2, 3); + * var b = Seq.of(4, 5, 6); + * var c = a.zipWith((a, b) => a + b, b); // Seq [ 5, 7, 9 ] + * + */ + zipWith( + zipper: (value: T, otherValue: U) => Z, + otherIterable: Iterable + ): Iterable.Indexed; + zipWith( + zipper: (value: T, otherValue: U, thirdValue: V) => Z, + otherIterable: Iterable, + thirdIterable: Iterable + ): Iterable.Indexed; + zipWith( + zipper: (...any: Array) => Z, + ...iterables: Array> + ): Iterable.Indexed; + + + // Search for value + + /** + * Returns the first index at which a given value can be found in the + * Iterable, or -1 if it is not present. + */ + indexOf(searchValue: T): number; + + /** + * Returns the last index at which a given value can be found in the + * Iterable, or -1 if it is not present. + */ + lastIndexOf(searchValue: T): number; + + /** + * Returns the first index in the Iterable where a value satisfies the + * provided predicate function. Otherwise -1 is returned. + */ + findIndex( + predicate: (value?: T, index?: number, iter?: this) => boolean, + context?: any + ): number; + + /** + * Returns the last index in the Iterable where a value satisfies the + * provided predicate function. Otherwise -1 is returned. + */ + findLastIndex( + predicate: (value?: T, index?: number, iter?: this) => boolean, + context?: any + ): number; + } + + + /** + * Set Iterables only represent values. They have no associated keys or + * indices. Duplicate values are possible in Seq.Sets, however the + * concrete `Set` does not allow duplicate values. + * + * Iterable methods on Iterable.Set such as `map` and `forEach` will provide + * the value as both the first and second arguments to the provided function. + * + * var seq = Seq.Set.of('A', 'B', 'C'); + * assert.equal(seq.every((v, k) => v === k), true); + * + */ + export module Set {} + + /** + * Similar to `Iterable()`, but always returns a Iterable.Set. + */ + export function Set(iter: Iterable.Set): Iterable.Set; + export function Set(iter: Iterable.Indexed): Iterable.Set; + export function Set(iter: Iterable.Keyed): Iterable.Set<[K,V]>; + export function Set(array: Array): Iterable.Set; + export function Set(iterator: Iterator): Iterable.Set; + export function Set(iterable: Iterable): Iterable.Set; + + export interface Set extends Iterable { + + /** + * Returns Seq.Set. + * @override + */ + toSeq(): Seq.Set; + } + + } + + /** + * Creates an Iterable. + * + * The type of Iterable created is based on the input. + * + * * If an `Iterable`, that same `Iterable`. + * * If an Array-like, an `Iterable.Indexed`. + * * If an Object with an Iterator, an `Iterable.Indexed`. + * * If an Iterator, an `Iterable.Indexed`. + * * If an Object, an `Iterable.Keyed`. + * + * This methods forces the conversion of Objects and Strings to Iterables. + * If you want to ensure that a Iterable of one item is returned, use + * `Seq.of`. + */ + export function Iterable(iterable: Iterable): Iterable; + export function Iterable(array: Array): Iterable.Indexed; + export function Iterable(obj: {[key: string]: V}): Iterable.Keyed; + export function Iterable(iterator: Iterator): Iterable.Indexed; + export function Iterable(iterable: Iterable): Iterable.Indexed; + export function Iterable(value: V): Iterable.Indexed; + + export interface Iterable { + + // Value equality + + /** + * True if this and the other Iterable have value equality, as defined + * by `Immutable.is()`. + * + * Note: This is equivalent to `Immutable.is(this, other)`, but provided to + * allow for chained expressions. + */ + equals(other: Iterable): boolean; + + /** + * Computes and returns the hashed identity for this Iterable. + * + * The `hashCode` of an Iterable is used to determine potential equality, + * and is used when adding this to a `Set` or as a key in a `Map`, enabling + * lookup via a different instance. + * + * var a = List.of(1, 2, 3); + * var b = List.of(1, 2, 3); + * assert(a !== b); // different instances + * var set = Set.of(a); + * assert(set.has(b) === true); + * + * If two values have the same `hashCode`, they are [not guaranteed + * to be equal][Hash Collision]. If two values have different `hashCode`s, + * they must not be equal. + * + * [Hash Collision]: http://en.wikipedia.org/wiki/Collision_(computer_science) + */ + hashCode(): number; + + + // Reading values + + /** + * Returns the value associated with the provided key, or notSetValue if + * the Iterable does not contain this key. + * + * Note: it is possible a key may be associated with an `undefined` value, + * so if `notSetValue` is not provided and this method returns `undefined`, + * that does not guarantee the key was not found. + */ + get(key: K, notSetValue?: V): V; + + /** + * True if a key exists within this `Iterable`, using `Immutable.is` to determine equality + */ + has(key: K): boolean; + + /** + * True if a value exists within this `Iterable`, using `Immutable.is` to determine equality + * @alias contains + */ + includes(value: V): boolean; + contains(value: V): boolean; + + /** + * The first value in the Iterable. + */ + first(): V; + + /** + * The last value in the Iterable. + */ + last(): V; + + + // Reading deep values + + /** + * Returns the value found by following a path of keys or indices through + * nested Iterables. + */ + getIn(searchKeyPath: Array, notSetValue?: any): any; + getIn(searchKeyPath: Iterable, notSetValue?: any): any; + + /** + * True if the result of following a path of keys or indices through nested + * Iterables results in a set value. + */ + hasIn(searchKeyPath: Array): boolean; + hasIn(searchKeyPath: Iterable): boolean; + + + // Conversion to JavaScript types + + /** + * Deeply converts this Iterable to equivalent JS. + * + * `Iterable.Indexeds`, and `Iterable.Sets` become Arrays, while + * `Iterable.Keyeds` become Objects. + * + * @alias toJSON + */ + toJS(): any; + + /** + * Shallowly converts this iterable to an Array, discarding keys. + */ + toArray(): Array; + + /** + * Shallowly converts this Iterable to an Object. + * + * Throws if keys are not strings. + */ + toObject(): { [key: string]: V }; + + + // Conversion to Collections + + /** + * Converts this Iterable to a Map, Throws if keys are not hashable. + * + * Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided + * for convenience and to allow for chained expressions. + */ + toMap(): Map; + + /** + * Converts this Iterable to a Map, maintaining the order of iteration. + * + * Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but + * provided for convenience and to allow for chained expressions. + */ + toOrderedMap(): OrderedMap; + + /** + * Converts this Iterable to a Set, discarding keys. Throws if values + * are not hashable. + * + * Note: This is equivalent to `Set(this)`, but provided to allow for + * chained expressions. + */ + toSet(): Set; + + /** + * Converts this Iterable to a Set, maintaining the order of iteration and + * discarding keys. + * + * Note: This is equivalent to `OrderedSet(this.valueSeq())`, but provided + * for convenience and to allow for chained expressions. + */ + toOrderedSet(): OrderedSet; + + /** + * Converts this Iterable to a List, discarding keys. + * + * Note: This is equivalent to `List(this)`, but provided to allow + * for chained expressions. + */ + toList(): List; + + /** + * Converts this Iterable to a Stack, discarding keys. Throws if values + * are not hashable. + * + * Note: This is equivalent to `Stack(this)`, but provided to allow for + * chained expressions. + */ + toStack(): Stack; + + + // Conversion to Seq + + /** + * Converts this Iterable to a Seq of the same kind (indexed, + * keyed, or set). + */ + toSeq(): Seq; + + /** + * Returns a Seq.Keyed from this Iterable where indices are treated as keys. + * + * This is useful if you want to operate on an + * Iterable.Indexed and preserve the [index, value] pairs. + * + * The returned Seq will have identical iteration order as + * this Iterable. + * + * Example: + * + * var indexedSeq = Immutable.Seq.of('A', 'B', 'C'); + * indexedSeq.filter(v => v === 'B').toString() // Seq [ 'B' ] + * var keyedSeq = indexedSeq.toKeyedSeq(); + * keyedSeq.filter(v => v === 'B').toString() // Seq { 1: 'B' } + * + */ + toKeyedSeq(): Seq.Keyed; + + /** + * Returns an Seq.Indexed of the values of this Iterable, discarding keys. + */ + toIndexedSeq(): Seq.Indexed; + + /** + * Returns a Seq.Set of the values of this Iterable, discarding keys. + */ + toSetSeq(): Seq.Set; + + + // Iterators + + /** + * An iterator of this `Iterable`'s keys. + * + * Note: this will return an ES6 iterator which does not support Immutable JS sequence algorithms. Use `keySeq` instead, if this is what you want. + */ + keys(): Iterator; + + /** + * An iterator of this `Iterable`'s values. + * + * Note: this will return an ES6 iterator which does not support Immutable JS sequence algorithms. Use `valueSeq` instead, if this is what you want. + */ + values(): Iterator; + + /** + * An iterator of this `Iterable`'s entries as `[key, value]` tuples. + * + * Note: this will return an ES6 iterator which does not support Immutable JS sequence algorithms. Use `entrySeq` instead, if this is what you want. + */ + entries(): Iterator<[K, V]>; + + + // Iterables (Seq) + + /** + * Returns a new Seq.Indexed of the keys of this Iterable, + * discarding values. + */ + keySeq(): Seq.Indexed; + + /** + * Returns an Seq.Indexed of the values of this Iterable, discarding keys. + */ + valueSeq(): Seq.Indexed; + + /** + * Returns a new Seq.Indexed of [key, value] tuples. + */ + entrySeq(): Seq.Indexed<[K, V]>; + + + // Sequence algorithms + + /** + * Returns a new Iterable of the same type with values passed through a + * `mapper` function. + * + * Seq({ a: 1, b: 2 }).map(x => 10 * x) + * // Seq { a: 10, b: 20 } + * + */ + map( + mapper: (value?: V, key?: K, iter?: this) => M, + context?: any + ): /*this*/Iterable; + + /** + * Returns a new Iterable of the same type with only the entries for which + * the `predicate` function returns true. + * + * Seq({a:1,b:2,c:3,d:4}).filter(x => x % 2 === 0) + * // Seq { b: 2, d: 4 } + * + */ + filter( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any + ): this; + + /** + * Returns a new Iterable of the same type with only the entries for which + * the `predicate` function returns false. + * + * Seq({a:1,b:2,c:3,d:4}).filterNot(x => x % 2 === 0) + * // Seq { a: 1, c: 3 } + * + */ + filterNot( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any + ): this; + + /** + * Returns a new Iterable of the same type in reverse order. + */ + reverse(): this; + + /** + * Returns a new Iterable of the same type which includes the same entries, + * stably sorted by using a `comparator`. + * + * If a `comparator` is not provided, a default comparator uses `<` and `>`. + * + * `comparator(valueA, valueB)`: + * + * * Returns `0` if the elements should not be swapped. + * * Returns `-1` (or any negative number) if `valueA` comes before `valueB` + * * Returns `1` (or any positive number) if `valueA` comes after `valueB` + * * Is pure, i.e. it must always return the same value for the same pair + * of values. + * + * When sorting collections which have no defined order, their ordered + * equivalents will be returned. e.g. `map.sort()` returns OrderedMap. + */ + sort(comparator?: (valueA: V, valueB: V) => number): this; + + /** + * Like `sort`, but also accepts a `comparatorValueMapper` which allows for + * sorting by more sophisticated means: + * + * hitters.sortBy(hitter => hitter.avgHits); + * + */ + sortBy( + comparatorValueMapper: (value?: V, key?: K, iter?: this) => C, + comparator?: (valueA: C, valueB: C) => number + ): this; + + /** + * Returns a `Iterable.Keyed` of `Iterable.Keyeds`, grouped by the return + * value of the `grouper` function. + * + * Note: This is always an eager operation. + */ + groupBy( + grouper: (value?: V, key?: K, iter?: this) => G, + context?: any + ): Seq.Keyed; + + + // Side effects + + /** + * The `sideEffect` is executed for every entry in the Iterable. + * + * Unlike `Array#forEach`, if any call of `sideEffect` returns + * `false`, the iteration will stop. Returns the number of entries iterated + * (including the last iteration which returned false). + */ + forEach( + sideEffect: (value?: V, key?: K, iter?: this) => any, + context?: any + ): number; + + + // Creating subsets + + /** + * Returns a new Iterable of the same type representing a portion of this + * Iterable from start up to but not including end. + * + * If begin is negative, it is offset from the end of the Iterable. e.g. + * `slice(-2)` returns a Iterable of the last two entries. If it is not + * provided the new Iterable will begin at the beginning of this Iterable. + * + * If end is negative, it is offset from the end of the Iterable. e.g. + * `slice(0, -1)` returns an Iterable of everything but the last entry. If + * it is not provided, the new Iterable will continue through the end of + * this Iterable. + * + * If the requested slice is equivalent to the current Iterable, then it + * will return itself. + */ + slice(begin?: number, end?: number): this; + + /** + * Returns a new Iterable of the same type containing all entries except + * the first. + */ + rest(): this; + + /** + * Returns a new Iterable of the same type containing all entries except + * the last. + */ + butLast(): this; + + /** + * Returns a new Iterable of the same type which excludes the first `amount` + * entries from this Iterable. + */ + skip(amount: number): this; + + /** + * Returns a new Iterable of the same type which excludes the last `amount` + * entries from this Iterable. + */ + skipLast(amount: number): this; + + /** + * Returns a new Iterable of the same type which includes entries starting + * from when `predicate` first returns false. + * + * Seq.of('dog','frog','cat','hat','god') + * .skipWhile(x => x.match(/g/)) + * // Seq [ 'cat', 'hat', 'god' ] + * + */ + skipWhile( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any + ): this; + + /** + * Returns a new Iterable of the same type which includes entries starting + * from when `predicate` first returns true. + * + * Seq.of('dog','frog','cat','hat','god') + * .skipUntil(x => x.match(/hat/)) + * // Seq [ 'hat', 'god' ] + * + */ + skipUntil( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any + ): this; + + /** + * Returns a new Iterable of the same type which includes the first `amount` + * entries from this Iterable. + */ + take(amount: number): this; + + /** + * Returns a new Iterable of the same type which includes the last `amount` + * entries from this Iterable. + */ + takeLast(amount: number): this; + + /** + * Returns a new Iterable of the same type which includes entries from this + * Iterable as long as the `predicate` returns true. + * + * Seq.of('dog','frog','cat','hat','god') + * .takeWhile(x => x.match(/o/)) + * // Seq [ 'dog', 'frog' ] + * + */ + takeWhile( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any + ): this; + + /** + * Returns a new Iterable of the same type which includes entries from this + * Iterable as long as the `predicate` returns false. + * + * Seq.of('dog','frog','cat','hat','god').takeUntil(x => x.match(/at/)) + * // ['dog', 'frog'] + * + */ + takeUntil( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any + ): this; + + + // Combination + + /** + * Returns a new Iterable of the same type with other values and + * iterable-like concatenated to this one. + * + * For Seqs, all entries will be present in + * the resulting iterable, even if they have the same key. + */ + concat(...valuesOrIterables: Array|V>): this; + + /** + * Flattens nested Iterables. + * + * Will deeply flatten the Iterable by default, returning an Iterable of the + * same type, but a `depth` can be provided in the form of a number or + * boolean (where true means to shallowly flatten one level). A depth of 0 + * (or shallow: false) will deeply flatten. + * + * Flattens only others Iterable, not Arrays or Objects. + * + * Note: `flatten(true)` operates on Iterable> and + * returns Iterable + */ + flatten(depth?: number): this; + flatten(shallow?: boolean): this; + + /** + * Flat-maps the Iterable, returning an Iterable of the same type. + * + * Similar to `iter.map(...).flatten(true)`. + */ + flatMap( + mapper: (value?: V, key?: K, iter?: this) => Iterable, + context?: any + ): /*this*/Iterable; + flatMap( + mapper: (value?: V, key?: K, iter?: this) => /*iterable-like*/any, + context?: any + ): /*this*/Iterable; + + + // Reducing a value + + /** + * Reduces the Iterable to a value by calling the `reducer` for every entry + * in the Iterable and passing along the reduced value. + * + * If `initialReduction` is not provided, or is null, the first item in the + * Iterable will be used. + * + * @see `Array#reduce`. + */ + reduce( + reducer: (reduction?: R, value?: V, key?: K, iter?: this) => R, + initialReduction?: R, + context?: any + ): R; + + /** + * Reduces the Iterable in reverse (from the right side). + * + * Note: Similar to this.reverse().reduce(), and provided for parity + * with `Array#reduceRight`. + */ + reduceRight( + reducer: (reduction?: R, value?: V, key?: K, iter?: this) => R, + initialReduction?: R, + context?: any + ): R; + + /** + * True if `predicate` returns true for all entries in the Iterable. + */ + every( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any + ): boolean; + + /** + * True if `predicate` returns true for any entry in the Iterable. + */ + some( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any + ): boolean; + + /** + * Joins values together as a string, inserting a separator between each. + * The default separator is `","`. + */ + join(separator?: string): string; + + /** + * Returns true if this Iterable includes no values. + * + * For some lazy `Seq`, `isEmpty` might need to iterate to determine + * emptiness. At most one iteration will occur. + */ + isEmpty(): boolean; + + /** + * Returns the size of this Iterable. + * + * Regardless of if this Iterable can describe its size lazily (some Seqs + * cannot), this method will always return the correct size. E.g. it + * evaluates a lazy `Seq` if necessary. + * + * If `predicate` is provided, then this returns the count of entries in the + * Iterable for which the `predicate` returns true. + */ + count(): number; + count( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any + ): number; + + /** + * Returns a `Seq.Keyed` of counts, grouped by the return value of + * the `grouper` function. + * + * Note: This is not a lazy operation. + */ + countBy( + grouper: (value?: V, key?: K, iter?: this) => G, + context?: any + ): Seq.Keyed; + + + // Search for value + + /** + * Returns the first value for which the `predicate` returns true. + */ + find( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any, + notSetValue?: V + ): V; + + /** + * Returns the last value for which the `predicate` returns true. + * + * Note: `predicate` will be called for each entry in reverse. + */ + findLast( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any, + notSetValue?: V + ): V; + + /** + * Returns the first [key, value] entry for which the `predicate` returns true. + */ + findEntry( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any, + notSetValue?: V + ): [K, V]; + + /** + * Returns the last [key, value] entry for which the `predicate` + * returns true. + * + * Note: `predicate` will be called for each entry in reverse. + */ + findLastEntry( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any, + notSetValue?: V + ): [K, V]; + + /** + * Returns the key for which the `predicate` returns true. + */ + findKey( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any + ): K; + + /** + * Returns the last key for which the `predicate` returns true. + * + * Note: `predicate` will be called for each entry in reverse. + */ + findLastKey( + predicate: (value?: V, key?: K, iter?: this) => boolean, + context?: any + ): K; + + /** + * Returns the key associated with the search value, or undefined. + */ + keyOf(searchValue: V): K; + + /** + * Returns the last key associated with the search value, or undefined. + */ + lastKeyOf(searchValue: V): K; + + /** + * Returns the maximum value in this collection. If any values are + * comparatively equivalent, the first one found will be returned. + * + * The `comparator` is used in the same way as `Iterable#sort`. If it is not + * provided, the default comparator is `>`. + * + * When two values are considered equivalent, the first encountered will be + * returned. Otherwise, `max` will operate independent of the order of input + * as long as the comparator is commutative. The default comparator `>` is + * commutative *only* when types do not differ. + * + * If `comparator` returns 0 and either value is NaN, undefined, or null, + * that value will be returned. + */ + max(comparator?: (valueA: V, valueB: V) => number): V; + + /** + * Like `max`, but also accepts a `comparatorValueMapper` which allows for + * comparing by more sophisticated means: + * + * hitters.maxBy(hitter => hitter.avgHits); + * + */ + maxBy( + comparatorValueMapper: (value?: V, key?: K, iter?: this) => C, + comparator?: (valueA: C, valueB: C) => number + ): V; + + /** + * Returns the minimum value in this collection. If any values are + * comparatively equivalent, the first one found will be returned. + * + * The `comparator` is used in the same way as `Iterable#sort`. If it is not + * provided, the default comparator is `<`. + * + * When two values are considered equivalent, the first encountered will be + * returned. Otherwise, `min` will operate independent of the order of input + * as long as the comparator is commutative. The default comparator `<` is + * commutative *only* when types do not differ. + * + * If `comparator` returns 0 and either value is NaN, undefined, or null, + * that value will be returned. + */ + min(comparator?: (valueA: V, valueB: V) => number): V; + + /** + * Like `min`, but also accepts a `comparatorValueMapper` which allows for + * comparing by more sophisticated means: + * + * hitters.minBy(hitter => hitter.avgHits); + * + */ + minBy( + comparatorValueMapper: (value?: V, key?: K, iter?: this) => C, + comparator?: (valueA: C, valueB: C) => number + ): V; + + + // Comparison + + /** + * True if `iter` includes every value in this Iterable. + */ + isSubset(iter: Iterable): boolean; + isSubset(iter: Array): boolean; + + /** + * True if this Iterable includes every value in `iter`. + */ + isSuperset(iter: Iterable): boolean; + isSuperset(iter: Array): boolean; + + + /** + * Note: this is here as a convenience to work around an issue with + * TypeScript https://github.com/Microsoft/TypeScript/issues/285, but + * Iterable does not define `size`, instead `Seq` defines `size` as + * nullable number, and `Collection` defines `size` as always a number. + * + * @ignore + */ + size: number; + } + + + /** + * Collection is the abstract base class for concrete data structures. It + * cannot be constructed directly. + * + * Implementations should extend one of the subclasses, `Collection.Keyed`, + * `Collection.Indexed`, or `Collection.Set`. + */ + export module Collection { + + + /** + * `Collection` which represents key-value pairs. + */ + export module Keyed {} + + export interface Keyed extends Collection, Iterable.Keyed { + + /** + * Returns Seq.Keyed. + * @override + */ + toSeq(): Seq.Keyed; + } + + + /** + * `Collection` which represents ordered indexed values. + */ + export module Indexed {} + + export interface Indexed extends Collection, Iterable.Indexed { + + /** + * Returns Seq.Indexed. + * @override + */ + toSeq(): Seq.Indexed; + } + + + /** + * `Collection` which represents values, unassociated with keys or indices. + * + * `Collection.Set` implementations should guarantee value uniqueness. + */ + export module Set {} + + export interface Set extends Collection, Iterable.Set { + + /** + * Returns Seq.Set. + * @override + */ + toSeq(): Seq.Set; + } + + } + + export interface Collection extends Iterable { + + /** + * All collections maintain their current `size` as an integer. + */ + size: number; + } + + + /** + * ES6 Iterator. + * + * This is not part of the Immutable library, but a common interface used by + * many types in ES6 JavaScript. + * + * @ignore + */ + export interface Iterator { + next(): { value: T; done: boolean; } + } + +} + +declare module "immutable" { + export = __Immutable +} From c16125cd7119cd3a3a82133649c2d68afcc37345 Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Thu, 2 Jun 2016 05:45:30 -0700 Subject: [PATCH 02/60] Updates to Bezier-js (#9441) * Added definitions for Bezier.Js * updates for maker.js and bezier.js * removed copyright * deleted bezierjs * Added definitions for Bezier.Js * updates for maker.js and bezier.js * deleted bezierjs * changed name to DefinitelyTyped * update tests for 0.8.0 * rename to bezier-js * add pdfkit reference * public clockwise * added signatures for split() * added extra signature for split() * Added definitions for Bezier.Js * updates for maker.js and bezier.js * removed copyright * deleted bezierjs * Added definitions for Bezier.Js * deleted bezierjs * changed name to DefinitelyTyped * rename to bezier-js * add pdfkit reference * public clockwise * added signatures for split() * added extra signature for split() --- bezier-js/bezier-js-tests.ts | 5 +++-- bezier-js/bezier-js.d.ts | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bezier-js/bezier-js-tests.ts b/bezier-js/bezier-js-tests.ts index 1814d67dc0..54c629d11b 100644 --- a/bezier-js/bezier-js-tests.ts +++ b/bezier-js/bezier-js-tests.ts @@ -31,7 +31,7 @@ function test() { bezier.get(1); bezier.getLUT()[0].x; bezier.hull(0); - bezier.inflections().values; + bezier.extrema(); bezier.intersects(bezier); bezier.length(); bezier.lineIntersects(line); @@ -48,7 +48,8 @@ function test() { bezier.scale(4); bezier.selfintersects(); bezier.simple(); - bezier.split(0, 1); + bezier.split(0, 1).clockwise; + bezier.split(0.5).left; bezier.toSVG(); bezier.update(); diff --git a/bezier-js/bezier-js.d.ts b/bezier-js/bezier-js.d.ts index 7d54a19d95..35e5cc19f1 100644 --- a/bezier-js/bezier-js.d.ts +++ b/bezier-js/bezier-js.d.ts @@ -117,7 +117,8 @@ declare module BezierJs { private __normal3(t); private __normal(t); hull(t: number): Point[]; - split(t1: number, t2?: number): Bezier | Split; + split(t1: number): Split; + split(t1: number, t2: number): Bezier; extrema(): Inflection; bbox(): BBox; overlaps(curve: Bezier): boolean; From 191daf6112933a8edb5fd9011a76bf42a8e36b12 Mon Sep 17 00:00:00 2001 From: Caleb Eggensperger Date: Thu, 2 Jun 2016 08:49:24 -0400 Subject: [PATCH 03/60] Fix component router breakage (#9442) --- angularjs/angular-component-router.d.ts | 51 +++++++++++++++++++++++++ angularjs/angular.d.ts | 44 --------------------- 2 files changed, 51 insertions(+), 44 deletions(-) diff --git a/angularjs/angular-component-router.d.ts b/angularjs/angular-component-router.d.ts index 2c56ef3a21..3b037b58b1 100644 --- a/angularjs/angular-component-router.d.ts +++ b/angularjs/angular-component-router.d.ts @@ -428,4 +428,55 @@ declare namespace angular { interface OnReuse { $routerOnReuse(next?: angular.ComponentInstruction, prev?: angular.ComponentInstruction): any; } + + /** + * Runtime representation a type that a Component or other object is instances of. + * + * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by + * the `MyCustomComponent` constructor function. + */ + interface Type extends Function { + } + + /** + * `RouteDefinition` defines a route within a {@link RouteConfig} decorator. + * + * Supported keys: + * - `path` or `aux` (requires exactly one of these) + * - `component`, `loader`, `redirectTo` (requires exactly one of these) + * - `name` or `as` (optional) (requires exactly one of these) + * - `data` (optional) + * + * See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}. + */ + interface RouteDefinition { + path?: string; + aux?: string; + component?: Type | ComponentDefinition | string; + loader?: Function; + redirectTo?: any[]; + as?: string; + name?: string; + data?: any; + useAsDefault?: boolean; + } + + /** + * Represents either a component type (`type` is `component`) or a loader function + * (`type` is `loader`). + * + * See also {@link RouteDefinition}. + */ + interface ComponentDefinition { + type: string; + loader?: Function; + component?: Type; + } + + // Supplement IComponentOptions from angular.d.ts with router-specific + // fields. + interface IComponentOptions { + $canActivate?: () => boolean; + $routeConfig?: RouteDefinition[]; + } } diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 204c645b0c..983c0ca799 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1656,50 +1656,6 @@ declare namespace angular { // see http://angularjs.blogspot.com.br/2015/11/angularjs-15-beta2-and-14-releases.html // and http://toddmotto.com/exploring-the-angular-1-5-component-method/ /////////////////////////////////////////////////////////////////////////// - /** - * Runtime representation a type that a Component or other object is instances of. - * - * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by - * the `MyCustomComponent` constructor function. - */ - interface Type extends Function { - } - - /** - * `RouteDefinition` defines a route within a {@link RouteConfig} decorator. - * - * Supported keys: - * - `path` or `aux` (requires exactly one of these) - * - `component`, `loader`, `redirectTo` (requires exactly one of these) - * - `name` or `as` (optional) (requires exactly one of these) - * - `data` (optional) - * - * See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}. - */ - interface RouteDefinition { - path?: string; - aux?: string; - component?: Type | ComponentDefinition | string; - loader?: Function; - redirectTo?: any[]; - as?: string; - name?: string; - data?: any; - useAsDefault?: boolean; - } - - /** - * Represents either a component type (`type` is `component`) or a loader function - * (`type` is `loader`). - * - * See also {@link RouteDefinition}. - */ - interface ComponentDefinition { - type: string; - loader?: Function; - component?: Type; - } - /** * Component definition object (a simplified directive definition object) */ From 61d2636c2cec3f3e290c9cf3d60646a192d817bc Mon Sep 17 00:00:00 2001 From: Chris Manning Date: Fri, 3 Jun 2016 00:50:23 +1200 Subject: [PATCH 04/60] Changed hapi IRouteConfiguration handler property to be optional (#9439) The hapi IRouteConfiguration handler property should be optional as the handler can alternatively be provided via the config property using the handler property of IRouteAdditionalConfigurationOptions. --- hapi/hapi.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 05f4aa1047..2867dd7de9 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -875,7 +875,7 @@ declare module "hapi" { /** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/ vhost?: string; /** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/ - handler: ISessionHandler | string | IRouteHandlerConfig; + handler?: ISessionHandler | string | IRouteHandlerConfig; /** - additional route options.*/ config?: IRouteAdditionalConfigurationOptions; } From d4ab7731d392a74f71c47b0e35adee5e50863737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20W=C3=BCrsch?= Date: Thu, 2 Jun 2016 14:51:06 +0200 Subject: [PATCH 05/60] WheelEvent extends MouseEvent not SyntheticEvent (#9437) --- react/react.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react/react.d.ts b/react/react.d.ts index 4dd185d89c..ce9d188d10 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -347,7 +347,7 @@ declare namespace __React { view: AbstractView; } - interface WheelEvent extends SyntheticEvent { + interface WheelEvent extends MouseEvent { deltaMode: number; deltaX: number; deltaY: number; From 65b05d550d7aeb09b8e755c89d2c7aecdd5baf04 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Thu, 2 Jun 2016 21:54:06 +0900 Subject: [PATCH 06/60] TypeScript-STL & Samchon-Framework (#9448) TypeScript-STL v0.9.9 Samchon Framework v1.1.0 --- .../samchon-collection-tests.ts | 7 + samchon-collection/samchon-collection.d.ts | 23 + samchon-framework/samchon-framework-tests.ts | 7 + samchon-framework/samchon-framework.d.ts | 2710 +++++++++++++++++ samchon-library/samchon-library-tests.ts | 7 + samchon-library/samchon-library.d.ts | 23 + typescript-stl/typescript-stl.d.ts | 2187 ++++++++----- 7 files changed, 4119 insertions(+), 845 deletions(-) create mode 100644 samchon-collection/samchon-collection-tests.ts create mode 100644 samchon-collection/samchon-collection.d.ts create mode 100644 samchon-framework/samchon-framework-tests.ts create mode 100644 samchon-framework/samchon-framework.d.ts create mode 100644 samchon-library/samchon-library-tests.ts create mode 100644 samchon-library/samchon-library.d.ts 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; } From 32e93d9fa79e9f8c239fdf365ed0a029d53c7f80 Mon Sep 17 00:00:00 2001 From: ven Date: Thu, 2 Jun 2016 14:55:22 +0200 Subject: [PATCH 07/60] fix typo (#9450) --- angularjs/angular-resource.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 0fb9351342..1482c3f047 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -95,7 +95,7 @@ declare namespace angular.resource { (params: Object, data: Object, success?: Function, error?: Function): IResourceArray; } - // Baseclass for everyresource with default actions. + // Baseclass for every resource with default actions. // If you define your new actions for the resource, you will need // to extend this interface and typecast the ResourceClass to it. // From 9161d4fca9b3eeeb74e011f2bfa5e53066b838c6 Mon Sep 17 00:00:00 2001 From: Peter Hajdu Date: Thu, 2 Jun 2016 15:02:58 +0200 Subject: [PATCH 08/60] fix angular-material import as module (#9451) [TypeScript error: xxx.ts(xx,xx): Error TS2307: Cannot find module 'angular-material'.] --- angular-material/angular-material.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index bb144d15d4..4af35c6701 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -4,6 +4,12 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// + +declare module 'angular-material' { +    var _: string; +   export = _; +} + declare namespace angular.material { interface IBottomSheetOptions { From 8ef4d9a7db3fa5bdca6bf30570620bb2c70be809 Mon Sep 17 00:00:00 2001 From: Rand Scullard Date: Thu, 2 Jun 2016 09:05:18 -0400 Subject: [PATCH 09/60] Add definitions for fontfaceobserver (#9453) --- fontfaceobserver/fontfaceobserver-tests.ts | 46 +++++++++++++++++++ .../fontfaceobserver-tests.ts.tscparams | 1 + fontfaceobserver/fontfaceobserver.d.ts | 33 +++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 fontfaceobserver/fontfaceobserver-tests.ts create mode 100644 fontfaceobserver/fontfaceobserver-tests.ts.tscparams create mode 100644 fontfaceobserver/fontfaceobserver.d.ts diff --git a/fontfaceobserver/fontfaceobserver-tests.ts b/fontfaceobserver/fontfaceobserver-tests.ts new file mode 100644 index 0000000000..1ea9a7a222 --- /dev/null +++ b/fontfaceobserver/fontfaceobserver-tests.ts @@ -0,0 +1,46 @@ +/// + +function test1() { + var font = new FontFaceObserver('My Family', { + weight: 400 + }); + + font.load().then(function () { + console.log('Font is available'); + }, function () { + console.log('Font is not available'); + }); +} + +function test2() { + var font = new FontFaceObserver('My Family'); + + font.load('中国').then(function () { + console.log('Font is available'); + }, function () { + console.log('Font is not available'); + }); +} + +function test3() { + var font = new FontFaceObserver('My Family'); + + font.load(null, 5000).then(function () { + console.log('Font is available'); + }, function () { + console.log('Font is not available after waiting 5 seconds'); + }); +} + +function test4() { + var fontA = new FontFaceObserver('Family A'); + var fontB = new FontFaceObserver('Family B'); + + fontA.load().then(function () { + console.log('Family A is available'); + }); + + fontB.load().then(function () { + console.log('Family B is available'); + }); +} diff --git a/fontfaceobserver/fontfaceobserver-tests.ts.tscparams b/fontfaceobserver/fontfaceobserver-tests.ts.tscparams new file mode 100644 index 0000000000..14fce22a5c --- /dev/null +++ b/fontfaceobserver/fontfaceobserver-tests.ts.tscparams @@ -0,0 +1 @@ +--target ES6 diff --git a/fontfaceobserver/fontfaceobserver.d.ts b/fontfaceobserver/fontfaceobserver.d.ts new file mode 100644 index 0000000000..8f461dbd4f --- /dev/null +++ b/fontfaceobserver/fontfaceobserver.d.ts @@ -0,0 +1,33 @@ +// Type definitions for fontfaceobserver +// Project: https://github.com/bramstein/fontfaceobserver +// Definitions by: Rand Scullard +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare namespace FontFaceObserver { + interface FontVariant { + weight?: number | string; + style?: string; + stretch?: string; + } +} + +declare class FontFaceObserver { + /** + * Creates a new FontFaceObserver. + * @param fontFamilyName Name of the font family to observe. + * @param variant Description of the font variant to observe. If a property is not present it will default to normal. + */ + constructor(fontFamilyName: string, variant?: FontFaceObserver.FontVariant); + + /** + * Starts observing the loading of the specified font. Immediately returns a new Promise that resolves when the font is available and rejected when the font is not available. + * @param testString If your font doesn't contain latin characters you can pass a custom test string. + * @param timeout The default timeout for giving up on font loading is 3 seconds. You can increase or decrease this by passing a number of milliseconds. + */ + load(testString?: string, timeout?: number): Promise; +} + +declare module "fontfaceobserver" { + export = FontFaceObserver; +} From f6e169d0719685d4c2cbb92a519f354e58755f0c Mon Sep 17 00:00:00 2001 From: Craig Date: Thu, 2 Jun 2016 09:09:42 -0400 Subject: [PATCH 10/60] The click event handler for the title action of Infobox entities needs to accept an optional MouseEvent input parameter (#9452) Because the Infobox title click handler is attached to an anchor tag with a hash as its destination (), the hash can cause problems in framework like Angular when used in conjunction with a void; + getTitleClickHandler(): (mouseEvent?: MouseEvent) => void; getVisible(): boolean; getWidth(): number; getZIndex(): number; @@ -329,8 +329,8 @@ declare namespace Microsoft.Maps { showPointer?: boolean; pushpin?: Pushpin; title?: string; - titleAction?: { label?: string; eventHandler: () => void; }; - titleClickHandler?: () => void; + titleAction?: { label?: string; eventHandler: (mouseEvent?: MouseEvent) => void; }; + titleClickHandler?: (mouseEvent?: MouseEvent) => void; typeName?: InfoboxType; visible?: boolean; width?: number; From 7a4bf1d15f91989c54604cd9b904c380470abf8f Mon Sep 17 00:00:00 2001 From: trevordunn Date: Thu, 2 Jun 2016 07:29:35 -0600 Subject: [PATCH 11/60] Made GET and POST variables static (#6140) (#9455) --- preloadjs/preloadjs.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/preloadjs/preloadjs.d.ts b/preloadjs/preloadjs.d.ts index 1585842356..1a9d01b1e8 100644 --- a/preloadjs/preloadjs.d.ts +++ b/preloadjs/preloadjs.d.ts @@ -20,14 +20,14 @@ declare namespace createjs { static BINARY: string; canceled: boolean; static CSS: string; - GET: string; + static GET: string; static IMAGE: string; static JAVASCRIPT: string; static JSON: string; static JSONP: string; loaded: boolean; static MANIFEST: string; - POST: string; + static POST: string; progress: number; resultFormatter: () => any; static SOUND: string; From b13eab309f2c3240a60ad8af299c84217fee613b Mon Sep 17 00:00:00 2001 From: Rajab Shakirov Date: Thu, 2 Jun 2016 16:34:54 +0300 Subject: [PATCH 12/60] init commit react-modal (#9457) --- react-modal/react-modal-tests.tsx | 49 +++++++++++++++++++++++++++++++ react-modal/react-modal.d.ts | 28 ++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 react-modal/react-modal-tests.tsx create mode 100644 react-modal/react-modal.d.ts diff --git a/react-modal/react-modal-tests.tsx b/react-modal/react-modal-tests.tsx new file mode 100644 index 0000000000..9a9814930d --- /dev/null +++ b/react-modal/react-modal-tests.tsx @@ -0,0 +1,49 @@ +/// +/// + +import * as React from "react"; +import ReactModal from 'react-modal'; + +class ExampleOfUsingReactModal extends React.Component<{}, {}> { + render() { + var onAfterOpenFn = () => { } + var onRequestCloseFn = () => { } + var customStyle = { + overlay: { + position: 'fixed', + top: 0, + left: 0, + right: 0, + bottom: 0, + backgroundColor: 'rgba(255, 255, 255, 0.75)' + }, + content: { + position: 'absolute', + top: '40px', + left: '40px', + right: '40px', + bottom: '40px', + border: '1px solid #ccc', + background: '#fff', + overflow: 'auto', + WebkitOverflowScrolling: 'touch', + borderRadius: '4px', + outline: 'none', + padding: '20px' + + } + } + return ( + +

Modal Content

+

Etc.

+
+ ); + } +}; \ No newline at end of file diff --git a/react-modal/react-modal.d.ts b/react-modal/react-modal.d.ts new file mode 100644 index 0000000000..2f2d0403d2 --- /dev/null +++ b/react-modal/react-modal.d.ts @@ -0,0 +1,28 @@ +// Type definitions for react-modal v1.3.0 +// Project: https://github.com/reactjs/react-modal +// Definitions by: Rajab Shakirov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "react-modal" { + interface ReactModal { + isOpen: boolean; + style?: { + content: { + [key: string]: any; + }, + overlay: { + [key: string]: any; + } + }, + appElement?: HTMLElement | {}, + onAfterOpen?: Function, + onRequestClose?: Function, + closeTimeoutMS?: number, + ariaHideApp?: boolean, + shouldCloseOnOverlayClick?: boolean + } + let ReactModal: __React.ClassicComponentClass; + export default ReactModal; +} From f1184e2e62085a204f85994128044500654af904 Mon Sep 17 00:00:00 2001 From: cbauerme Date: Thu, 2 Jun 2016 07:00:54 -0700 Subject: [PATCH 13/60] Added Sequelize Model.addScope method. (#9459) --- sequelize/sequelize-tests.ts | 4 ++++ sequelize/sequelize.d.ts | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/sequelize/sequelize-tests.ts b/sequelize/sequelize-tests.ts index 6e62606e19..0f274e20a9 100644 --- a/sequelize/sequelize-tests.ts +++ b/sequelize/sequelize-tests.ts @@ -841,6 +841,10 @@ User.schema( 'special' ).create( { age : 3 }, { logging : function( ) {} } ); User.getTableName(); +User.addScope('lowAccess', { where : { parent_id : 2 } }); +User.addScope('lowAccess', function() { } ); +User.addScope('lowAccess', { where : { parent_id : 2 } }, { override: true }); + User.scope( 'lowAccess' ).count(); User.scope( { where : { parent_id : 2 } } ); diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 81c7f4a165..8d058efdb2 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -2948,6 +2948,18 @@ declare module "sequelize" { } + /** + * AddScope Options for Model.addScope + */ + interface AddScopeOptions { + + /** + * If a scope of the same name already exists, should it be overwritten? + */ + override: boolean; + + } + /** * Scope Options for Model.scope */ @@ -3640,6 +3652,18 @@ declare module "sequelize" { */ getTableName( options? : { logging : Function } ) : string | Object; + /** + * Add a new scope to the model. This is especially useful for adding scopes with includes, when the model you want to include is not available at the time this model is defined. + * + * By default this will throw an error if a scope with that name already exists. Pass `override: true` in the options object to silence this error. + * + * @param {String} name The name of the scope. Use `defaultScope` to override the default scope + * @param {Object|Function} scope + * @param {Object} [options] + * @param {Boolean} [options.override=false] + */ + addScope( name : string, scope : FindOptions | Function, options? : AddScopeOptions ): void; + /** * Apply a scope created in `define` to the model. First let's look at how to create scopes: * ```js From 79aa209309897673e291696b52c833cc71457895 Mon Sep 17 00:00:00 2001 From: Jerome David Yackley Date: Thu, 2 Jun 2016 09:01:19 -0500 Subject: [PATCH 14/60] angular-ui-bootstrap - Added windowTopClass (#9458) Added the options parameter windowTopClass to IModalSettings. Here is the definition: https://github.com/angular-ui/bootstrap/blob/dd091488937060a8e4511fdfd6e1bbbf5d5403b7/src/modal/docs/readme.md. --- angular-ui-bootstrap/angular-ui-bootstrap.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts index 0a7b54775e..38a1c321bd 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts @@ -387,6 +387,12 @@ declare namespace angular.ui.bootstrap { * @default 'model-open' */ openedClass?: string; + + /** + * CSS class(es) to be added to the top modal window. + */ + + windowTopClass?: string; } interface IModalStackService { From a0d42d933647e096fe3d14db2fc75b6718cb9089 Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Thu, 2 Jun 2016 07:02:14 -0700 Subject: [PATCH 15/60] material-ui: Update material-ui to v0.15.0 (#9462) --- .../legacy/material-ui-0.14.4-tests.tsx | 2302 +++++ .../material-ui-0.14.4-tests.tsx.tscparams | 1 + material-ui/legacy/material-ui-0.14.4.d.ts | 8246 +++++++++++++++++ material-ui/material-ui-tests.tsx | 7159 +++++++++----- material-ui/material-ui.d.ts | 5768 ++++++------ 5 files changed, 18401 insertions(+), 5075 deletions(-) create mode 100644 material-ui/legacy/material-ui-0.14.4-tests.tsx create mode 100644 material-ui/legacy/material-ui-0.14.4-tests.tsx.tscparams create mode 100644 material-ui/legacy/material-ui-0.14.4.d.ts diff --git a/material-ui/legacy/material-ui-0.14.4-tests.tsx b/material-ui/legacy/material-ui-0.14.4-tests.tsx new file mode 100644 index 0000000000..0d112fcaa8 --- /dev/null +++ b/material-ui/legacy/material-ui-0.14.4-tests.tsx @@ -0,0 +1,2302 @@ +/// +/// +/// + +import * as React from "react"; +import * as LinkedStateMixin from "react-addons-linked-state-mixin"; +import * as MaterialUi from "material-ui"; +import ActionGrade from "material-ui/lib/svg-icons/action/grade"; +import AppBar from "material-ui/lib/app-bar"; +import ArrowDropRight from "material-ui/lib/svg-icons/navigation-arrow-drop-right"; +import AutoComplete from 'material-ui/lib/auto-complete'; +import Avatar from "material-ui/lib/avatar"; +import Badge from "material-ui/lib/badge"; +import Card from "material-ui/lib/card/card"; +import CardActions from "material-ui/lib/card/card-actions"; +import CardHeader from "material-ui/lib/card/card-header"; +import CardMedia from 'material-ui/lib/card/card-media'; +import CardText from "material-ui/lib/card/card-text"; +import CardTitle from 'material-ui/lib/card/card-title'; +import Checkbox from "material-ui/lib/checkbox"; +import CircularProgress from 'material-ui/lib/circular-progress'; +import ColorManipulator from 'material-ui/lib/utils/color-manipulator'; +import Colors from "material-ui/lib/styles/colors"; +import DatePicker from "material-ui/lib/date-picker/date-picker"; +import Dialog from "material-ui/lib/dialog"; +import Divider from 'material-ui/lib/divider'; +import DropDownMenu from "material-ui/lib/drop-down-menu"; +import FileFolder from "material-ui/lib/svg-icons/file/folder"; +import FlatButton from "material-ui/lib/flat-button"; +import FloatingActionButton from "material-ui/lib/floating-action-button"; +import FontIcon from "material-ui/lib/font-icon"; +import GridList from 'material-ui/lib/grid-list/grid-list'; +import GridTile from 'material-ui/lib/grid-list/grid-tile'; +import IconButton from "material-ui/lib/icon-button"; +import IconMenu from "material-ui/lib/menus/icon-menu"; +import LeftNav from 'material-ui/lib/left-nav'; +import LinearProgress from 'material-ui/lib/linear-progress'; +import List from 'material-ui/lib/lists/list'; +import ListItem from 'material-ui/lib/lists/list-item'; +import Menu from 'material-ui/lib/menus/menu'; +import MenuItem from 'material-ui/lib/menus/menu-item'; +import Paper from 'material-ui/lib/paper'; +import Popover from 'material-ui/lib/popover/popover'; +import PopoverAnimationFromTop from 'material-ui/lib/popover/popover-animation-from-top'; +import RadioButton from "material-ui/lib/radio-button"; +import RadioButtonGroup from "material-ui/lib/radio-button-group"; +import RaisedButton from "material-ui/lib/raised-button"; +import RefreshIndicator from 'material-ui/lib/refresh-indicator'; +import SelectField from "material-ui/lib/select-field"; +import Slider from 'material-ui/lib/slider'; +import Snackbar from 'material-ui/lib/snackbar'; +import Spacing from "material-ui/lib/styles/spacing"; +import Styles from 'material-ui/lib/styles'; +import SvgIcon from 'material-ui/lib/svg-icon'; +import Tab from 'material-ui/lib/tabs/tab'; +import Table from 'material-ui/lib/table/table'; +import TableBody from 'material-ui/lib/table/table-body'; +import TableFooter from 'material-ui/lib/table/table-footer'; +import TableHeader from 'material-ui/lib/table/table-header'; +import TableHeaderColumn from 'material-ui/lib/table/table-header-column'; +import TableRow from 'material-ui/lib/table/table-row'; +import TableRowColumn from 'material-ui/lib/table/table-row-column'; +import Tabs from 'material-ui/lib/tabs/tabs'; +import TextField from "material-ui/lib/text-field"; +import ThemeDecorator from 'material-ui/lib/styles/theme-decorator'; +import ThemeManager from 'material-ui/lib/styles/theme-manager'; +import TimePicker from "material-ui/lib/time-picker"; +import Toggle from "material-ui/lib/toggle"; +import ToggleStar from "material-ui/lib/svg-icons/toggle/star"; +import ToggleStarBorder from "material-ui/lib/svg-icons/toggle/star-border"; +import Toolbar from 'material-ui/lib/toolbar/toolbar'; +import ToolbarGroup from 'material-ui/lib/toolbar/toolbar-group'; +import ToolbarSeparator from 'material-ui/lib/toolbar/toolbar-separator'; +import ToolbarTitle from 'material-ui/lib/toolbar/toolbar-title'; +import Typography from "material-ui/lib/styles/typography"; +import zIndex from 'material-ui/lib/styles/zIndex'; + +import {SelectableContainerEnhance} from 'material-ui/lib/hoc/selectable-enhance'; + +import * as Icons from "material-ui/lib/svg-icons"; +import ActionAndroid from 'material-ui/lib/svg-icons/action/android'; +import ActionFavorite from 'material-ui/lib/svg-icons/action/favorite'; +import ActionFavoriteBorder from 'material-ui/lib/svg-icons/action/favorite-border'; +import ActionFlightTakeoff from 'material-ui/lib/svg-icons/action/flight-takeoff'; +import ActionHome from 'material-ui/lib/svg-icons/action/home'; +import ActionInfo from 'material-ui/lib/svg-icons/action/info'; +import CommunicationChatBubble from 'material-ui/lib/svg-icons/communication/chat-bubble'; +import ContentAdd from 'material-ui/lib/svg-icons/content/add'; +import ContentCopy from 'material-ui/lib/svg-icons/content/content-copy'; +import ContentDrafts from 'material-ui/lib/svg-icons/content/drafts'; +import ContentFilter from 'material-ui/lib/svg-icons/content/filter-list'; +import ContentInbox from 'material-ui/lib/svg-icons/content/inbox'; +import ContentLink from 'material-ui/lib/svg-icons/content/link'; +import ContentSend from 'material-ui/lib/svg-icons/content/send'; +import Delete from 'material-ui/lib/svg-icons/action/delete'; +import Download from 'material-ui/lib/svg-icons/file/file-download'; +import FileCloudDownload from 'material-ui/lib/svg-icons/file/cloud-download'; +import FolderIcon from 'material-ui/lib/svg-icons/file/folder-open'; +import HardwareVideogameAsset from 'material-ui/lib/svg-icons/hardware/videogame-asset'; +import MapsPlace from 'material-ui/lib/svg-icons/maps/place'; +import MoreVertIcon from 'material-ui/lib/svg-icons/navigation/more-vert'; +import NavigationClose from "material-ui/lib/svg-icons/navigation/close"; +import NavigationExpandMoreIcon from 'material-ui/lib/svg-icons/navigation/expand-more'; +import NotificationsIcon from 'material-ui/lib/svg-icons/social/notifications'; +import PersonAdd from 'material-ui/lib/svg-icons/social/person-add'; +import RemoveRedEye from 'material-ui/lib/svg-icons/image/remove-red-eye'; +import StarBorder from 'material-ui/lib/svg-icons/toggle/star-border'; +import UploadIcon from 'material-ui/lib/svg-icons/file/cloud-upload'; + + +type CheckboxProps = __MaterialUI.CheckboxProps; +type MuiTheme = __MaterialUI.Styles.MuiTheme; +type TouchTapEvent = __MaterialUI.TouchTapEvent; + +interface MaterialUiTestsState { + showDialogStandardActions: boolean; + showDialogCustomActions: boolean; + showDialogScrollable: boolean; + value: number; + dataSource: [string]; + minDate: Date; + maxDate: Date; + autoOk: boolean; + disableYearSelection: boolean; + open: boolean; + valueSingle: string; + valueMultiple: string[]; + anchorEl: Element; + completed: number; + message: string; + autoHideDuration: number; + fixedHeader: boolean; + fixedFooter: boolean; + stripedRows: boolean; + showRowHover: boolean; + selectable: boolean; + multiSelectable: boolean; + enableSelectAll: boolean; + deselectOnClickaway: boolean; + height: string; +} + +// "http://www.material-ui.com/#/customization/themes" +let muiTheme: MuiTheme = ThemeManager.getMuiTheme({ + spacing: Spacing, + zIndex: zIndex, + fontFamily: 'Roboto, sans-serif', + palette: { + primary1Color: Colors.cyan500, + primary2Color: Colors.cyan700, + primary3Color: Colors.lightBlack, + accent1Color: Colors.pinkA200, + accent2Color: Colors.grey100, + accent3Color: Colors.grey500, + textColor: Colors.darkBlack, + alternateTextColor: Colors.white, + canvasColor: Colors.white, + borderColor: Colors.grey300, + disabledColor: ColorManipulator.fade(Colors.darkBlack, 0.3), + pickerHeaderColor: Colors.cyan500, + } +}); + +let SelectableList = SelectableContainerEnhance(List); + +@ThemeDecorator(muiTheme) +class MaterialUiTests extends React.Component<{}, MaterialUiTestsState> implements React.LinkedStateMixin { + + // injected with mixin + linkState: (key: string) => React.ReactLink; + + private picker12hr: TimePicker; + private picker24hr: TimePicker; + + private touchTapEventHandler(e: TouchTapEvent) { + console.info("Received touch tap", e); + } + private formEventHandler(e: React.FormEvent) { + } + private selectFieldChangeHandler(e: TouchTapEvent, si: number, mi: any) { + } + private handleRequestClose(buttonClicked: boolean) { + } + private handleRequestCloseReason(reason: string) { + } + private handleToggle() { + this.setState(Object.assign({}, this.state, { open: !this.state.open })); + } + private handleClose() { + this.setState(Object.assign({}, this.state, { open: false })); + } + private handleChangeSingle(event: React.MouseEvent, value: string){ + } + private handleChangeMultiple(event: React.MouseEvent, value: string[]) { + } + + private handleChange = (e: TouchTapEvent, index: number, value: number) => this.setState(Object.assign({}, this.state, { value })); + + private handleUpdateInput(t: string) { + this.setState(Object.assign({}, this.state, { + dataSource: [t, t + t, t + t + t], + })); + } + private handleTouchTap(e: TouchTapEvent) { + alert('onTouchTap triggered on the title component'); + } + private handleActionTouchTap() { + this.setState(Object.assign({}, this.state, {open: false,})); + alert('Event removed from your calendar.'); + } + private handleChangeDuration = (event: React.FormEvent) => { + const value = event.target["value"]; + this.setState(Object.assign({}, this.state, { + autoHideDuration: value.length > 0 ? parseInt(value) : 0, + })); + } + private onRowSelection(selectedRows: number[] | string) { + } + private handleActive(tab: Tab) { + alert(`A tab with this route property ${tab.props.value} was activated.`); + } + private handleChangeTabs(value: any, e: React.FormEvent, tab: Tab) { + } + private handleChangeTimePicker12(err, time) { + this.picker12hr.setTime(time); + }; + + private handleChangeTimePicker24(err, time) { + this.picker24hr.setTime(time); + }; + + render() { + + const styles = { + title: { + cursor: 'pointer', + }, + exampleImageInput: { + cursor: 'pointer', + position: 'absolute', + top: 0, + bottom: 0, + right: 0, + left: 0, + width: '100%', + opacity: 0, + }, + button: { + margin: 12, + }, + floatingButton: { + marginRight: 20, + }, + textField: { + marginLeft: 20, + }, + floatLeft: { + float: 'left', + }, + root: { + display: 'flex', + flexWrap: 'wrap', + justifyContent: 'space-around', + }, + gridList: { + width: 500, + height: 400, + overflowY: 'auto', + marginBottom: 24, + }, + icons: { + marginRight: 24, + }, + menu: { + marginRight: 32, + marginBottom: 32, + float: 'left', + position: 'relative', + zIndex: 0, + }, + rightIcon: { + textAlign: 'center', + lineHeight: '24px', + }, + paper: { + height: 100, + width: 100, + margin: 20, + textAlign: 'center', + display: 'inline-block', + }, + popover: { + padding: 20, + }, + container: { + position: 'relative', + }, + refresh: { + display: 'inline-block', + position: 'relative', + }, + block: { + maxWidth: 250, + }, + checkbox: { + marginBottom: 16, + }, + radioButton: { + marginBottom: 16, + }, + toggle: { + marginBottom: 16, + }, + propContainerStyle: { + width: 200, + overflow: 'hidden', + margin: '20px auto 0', + }, + propToggleHeader: { + margin: '20px auto 10px', + }, + headline: { + fontSize: 24, + paddingTop: 16, + marginBottom: 12, + fontWeight: 400, + }, + errorStyle: { + color: Colors.orange500, + }, + underlineStyle: { + borderColor: Colors.orange500, + }, + }; + const colors = Styles.Colors; + + // "http://www.material-ui.com/#/customization/inline-styles" + let element: React.ReactElement; + element = + element = React.createElement(Checkbox, { + id: "checkboxId1", name: "checkboxName1", value: "checkboxValue1", label: "went for a run today", style: { + width: '50%', + margin: '0 auto' + }, iconStyle: { + fill: '#FF4081' + } + }); + + // "http://www.material-ui.com/#/components/app-bar" + const AppBarExampleIcon = () => ( + + ); + + const AppBarExampleIconButton = () => ( + Title} + onTitleTouchTap={this.handleTouchTap} + iconElementLeft={} + iconElementRight={} + /> + ); + const AppBarExampleIconMenu = () => ( + } + iconElementRight={ + + } + targetOrigin={{ horizontal: 'right', vertical: 'top' }} + anchorOrigin={{ horizontal: 'right', vertical: 'top' }} + > + + + + + } + /> + ); + + // "http://www.material-ui.com/#/components/auto-complete" + element = + + const dataSource1 = [ + { + text: 'text-value1', + value: ( + + ), + }, + { + text: 'text-value2', + value: ( + + ), + }, + ]; + + const dataSource2 = ['12345', '23456', '34567']; + + const AutoCompleteExampleNoFilter = () => ( +
+
+ +
+ ); + + const AutoCompleteExampleFilters = () => ( +
+ +
+ +
+ ); + + // "http://www.material-ui.com/#/components/avatar" + const AvatarExampleSimple = () => ( + + + } + > + Image Avatar + + } /> + } + > + FontIcon Avatar + + } + color={colors.blue300} + backgroundColor={colors.indigo900} + /> + } + > + FontIcon Avatar with custom colors + + } /> + } + > + SvgIcon Avatar + + } + color={colors.orange200} + backgroundColor={colors.pink400} + /> + } + > + SvgIcon Avatar with custom colors + + A} + > + Letter Avatar + + + A + + } + > + Letter Avatar with custom colors + + + ); + + //image avatar + element = ; + //SvgIcon avatar + element = } />; + //SvgIcon avatar with custom colors + element = } + color={Colors.orange200} + backgroundColor={Colors.pink400} />; + //FontIcon avatar + element = + } />; + //FontIcon avatar with custom colors + element = } + color={Colors.blue300} + backgroundColor={Colors.indigo900} />; + //Letter avatar + element = A; + //Letter avatar with custom colors + element = + + + // "http://www.material-ui.com/#/components/badge" + const BadgeExampleSimple = () => ( +
+ + + + + + + + +
+ ); + const BadgeExampleContent = () => ( +
+ } + > + + + + Company Name + +
+ ); + + // "http://www.material-ui.com/#/components/flat-button" + const FlatButtonExampleSimple = () => ( +
+ + + + +
+ ); + const FlatButtonExampleComplex = () => ( +
+ + + + + } + /> + + } + /> + +
+ ); + + // "http://www.material-ui.com/#/components/raised-button" + const RaisedButtonExampleSimple = () => ( +
+ + + + +
+ ); + const RaisedButtonExampleComplex = () => ( +
+ + + + } + style={styles.button} + /> + } + /> +
+ ); + + // "http://www.material-ui.com/#/components/floating-action-button" + const FloatingActionButtonExampleSimple = () => ( +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ ); + + // "http://www.material-ui.com/#/components/icon-button" + const IconButtonExampleSimple = () => ( +
+ + +
+ ); + const IconButtonExampleComplex = () => ( +
+ + + + + + + + + + home + +
+ ); + const IconButtonExampleTooltip = () => ( +
+ + + + + + +
+ ); + const IconButtonExampleTouch = () => ( +
+ + + + + + + + + + + + + + + + + + +
+ ); + //Method 1: muidocs-icon-github is defined in a style sheet. + element = ; + //Method 2: ActionGrade is a component created using mui.SvgIcon. + element = + + ; + //Method 3: Manually creating a mui.FontIcon component within IconButton + element = + + ; + //Method 4: Using Google material-icons + element = settings_system_daydream; + + + // "http://www.material-ui.com/#/components/card" + const CardExampleWithAvatar = () => ( + + + } + > + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Donec mattis pretium massa.Aliquam erat volutpat.Nulla facilisi. + Donec vulputate interdum sollicitudin.Nunc lacinia auctor quam sed pellentesque. + Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio. + + + + + + + ); + const CardExampleWithoutAvatar = () => ( + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Donec mattis pretium massa.Aliquam erat volutpat.Nulla facilisi. + Donec vulputate interdum sollicitudin.Nunc lacinia auctor quam sed pellentesque. + Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio. + + + + + + + ); + + // "http://www.material-ui.com/#/components/date-picker" + const DatePickerExampleSimple = () => ( +
+ + + +
+ ); + const DatePickerExampleInline = () => ( +
+ + +
+ ); + element = ( +
+ +
+ ); + element = ; + element = ; + element = ; + + // "http://material-ui.com/#/components/dialog" + let standardActions = [ + { text: 'Cancel' }, + { text: 'Submit', onTouchTap: this.touchTapEventHandler, ref: 'submit' } + ]; + + element = + The actions in this window are created from the json that's passed in. + ; + + //Custom Actions + let customActions = [ + , + + ]; + + element = + The actions in this window were passed in as an array of react objects. + ; + + element = +
+ Really long content +
+
; + + // "http://www.material-ui.com/#/components/divider" + const DividerExampleForm = () => ( + + + + + + + + + + + ); + const DividerExampleList = () => ( +
+ + + + + + + + + +
+ ); + const DividerExampleMenu = () => ( + + + + + + + ); + + + // "http://www.material-ui.com/#/components/grid-list" + const tilesData = [ + { + img: 'images/grid-list/00-52-29-429_640.jpg', + title: 'Breakfast', + author: 'jill111', + featured: false, + }]; + const GridListExampleSimple = () => ( +
+ + {tilesData.map(tile => ( + by {tile.author}} + actionIcon={} + > + + + )) } + +
+ ); + const GridListExampleComplex = () => ( +
+ + {tilesData.map(tile => ( + } + actionPosition="left" + titlePosition="top" + titleBackground="linear-gradient(to bottom, rgba(0,0,0,0.7) 0%,rgba(0,0,0,0.3) 70%,rgba(0,0,0,0) 100%)" + cols={tile.featured ? 2 : 1} + rows={tile.featured ? 2 : 1} + > + + + )) } + +
+ ); + + + element = ; + + element = GridTile} + actionPosition="left" + titlePosition="top" + titleBackground="rgba(0, 0, 0, 0.4)" + cols={2} + rows={1} + style={{ color: 'red' }}> +

Children are Required!

+
; + + + // "http://www.material-ui.com/#/components/font-icon" + const FontIconExampleSimple = () => ( +
+ + + + + +
+ ); + + const FontIconExampleIcons = () => ( +
+ home + flight_takeoff + cloud_download + videogame_asset +
+ ); + + + // "http://www.material-ui.com/#/components/svg-icon" + const HomeIcon = (props) => ( + + + + ); + + const SvgIconExampleSimple = () => ( +
+ + + +
+ ); + const SvgIconExampleIcons = () => ( +
+ + + + +
+ ); + element = ; + element = ; + element = home; + + + // "http://www.material-ui.com/#/components/left-nav" + element = ( +
+ + + Menu Item + Menu Item 2 + +
+ ); + element = ( +
+ + this.setState(Object.assign({}, this.state, { open })) } + > + Menu Item + Menu Item 2 + +
+ ); + element = ( +
+ + + + +
+ ); + + + // "http://material-ui.com/#/components/lists" + const ListExampleSimple = () => ( +
+ + } /> + } /> + } /> + } /> + } /> + + + + } /> + } /> + } /> + } /> + +
+ ); + const ListExampleChat = () => ( +
+ + } + rightIcon={} + /> + } + rightIcon={} + /> + } + rightIcon={} + /> + } + rightIcon={} + /> + } + rightIcon={} + /> + + + + } + /> + } + /> + +
+ ); + const ListExampleNested = () => ( +
+ + } /> + } /> + } + initiallyOpen={true} + primaryTogglesNestedList={true} + nestedItems={[ + } + />, + } + disabled={true} + nestedItems={[ + } />, + ]} + />, + ]} + /> + +
+ ); + const iconButtonElement = ( + + + + ); + const rightIconMenu = ( + + Reply + Forward + Delete + + ); + const ListExampleMessages = () => ( +
+ + } + rightIconButton={rightIconMenu} + primaryText="Brendan Lim" + secondaryText={ +

+ Brunch this weekend?
+ I' ll be in your neighborhood doing errands this weekend.Do you want to grab brunch? +

+ } + secondaryTextLines={2} + /> +
+
+ ); + const ListExampleSelectable = () => ( +
+ + } + nestedItems={[ + } + />, + ]} + /> + } + /> + } + /> + } + /> + +
+ ); + + + // "http://www.material-ui.com/#/components/menu" + const MenuExampleSimple = () => ( +
+ + + + + + + + + + + + +
+ ); + const MenuExampleDisable = () => ( +
+ + + + + + + + + + + + + + + + +
+ ); + const MenuExampleIcons = () => ( +
+ + } /> + } /> + } /> + + } /> + } /> + + } /> + + + + } /> + settings}/> + settings + } + /> + ¶} /> + §} /> + +
+ ); + const MenuExampleSecondary = () => ( +
+ + + + + + + + + } /> + } /> + } /> + } /> + } /> + + + + + + + + + + + + + +
+ ); + const MenuExampleNested = () => ( +
+ + + + + } + menuItems={[ + } + menuItems={[ + , + , + , + , + ]} + />, + , + , + , + ]} + /> + + + + + + +
+ ); + + + // "http://www.material-ui.com/#/components/icon-menu" + const IconMenuExampleSimple = () => ( +
+ } + anchorOrigin={{ horizontal: 'left', vertical: 'top' }} + targetOrigin={{ horizontal: 'left', vertical: 'top' }} + > + + + + + + + } + anchorOrigin={{ horizontal: 'left', vertical: 'bottom' }} + targetOrigin={{ horizontal: 'left', vertical: 'bottom' }} + > + + + + + + + } + anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }} + targetOrigin={{ horizontal: 'right', vertical: 'bottom' }} + > + + + + + + + } + anchorOrigin={{ horizontal: 'right', vertical: 'top' }} + targetOrigin={{ horizontal: 'right', vertical: 'top' }} + > + + + + + + +
+ ); + element = ( +
+ } + onChange={this.handleChangeSingle} + value={this.state.valueSingle} + > + + + + + + + } + onChange={this.handleChangeMultiple} + value={this.state.valueMultiple} + multiple={true} + > + + + + + + + +
+ ); + const IconMenuExampleScrollable = () => ( +
} + anchorOrigin={{ horizontal: 'left', vertical: 'top' }} + targetOrigin={{ horizontal: 'left', vertical: 'top' }} + maxHeight={272} + > + + + + ); + + + // "http://www.material-ui.com/#/components/dropdown-menu" + element = + + + + + + ; + const menuItems = []; + element = ( + + {menuItems} + + ); + element = ( + + + + + + + ); + + // "http://material-ui.com/#/components/paper" + const PaperExampleSimple = () => ( +
+ + + + + +
+ ); + const PaperExampleRounded = () => ( +
+ + + + + +
+ ); + const PaperExampleCircle = () => ( +
+ + + + + +
+ ); + + + // "http://www.material-ui.com/#/components/popover" + element = ( +
+ + +
+ +
+
+
+ ); + element = ( +
+ + +
+ +
+
+
+ ); + + + // "http://www.material-ui.com/#/components/circular-progress" + const CircularProgressExampleSimple = () => ( +
+ + + +
+ ); + element = ( +
+ + + +
+ ); + + + // "http://www.material-ui.com/#/components/linear-progress" + const LinearProgressExampleSimple = () => ( + + ); + element = ( + + ); + + + // "http://www.material-ui.com/#/components/refresh-indicator" + const RefreshIndicatorExampleSimple = () => ( +
+ + + + +
+ ); + const RefreshIndicatorExampleLoading = () => ( +
+ + +
+ ); + + + // "http://www.material-ui.com/#/components/select-field" + element = ( +
+ + + + + + + +
+ + + + +
+ ); + element = ( + + {menuItems} + + ); + element = ( + + + + + + + ); + element = ( +
+ + {menuItems} + +
+ + {menuItems} + +
+ ); + const {value} = this.state; + const night = value === 2 || value === 3; + element = ( +
+ + {menuItems} + +
+ + {menuItems} + +
+ ); + + + // "http://www.material-ui.com/#/components/slider" + const SliderExampleSimple = () => ( +
+ + + +
+ ); + const SliderExampleDisabled = () => ( +
+ + + +
+ ); + const SliderExampleStep = () => ( + + ); + + + // "http://www.material-ui.com/#/components/checkbox" + const CheckboxExampleSimple = () => ( +
+ + + + } + unCheckedIcon={} + label="Custom icon" + style={styles.checkbox} + /> + +
+ ); + + + // "http://www.material-ui.com/#/components/radio-button" + const RadioButtonExampleSimple = () => ( +
+ + + + + + + + + +
+ ); + + + // "http://www.material-ui.com/#/components/toggle" + const ToggleExampleSimple = () => ( +
+ + + + +
+ ); + + + // "http://material-ui.com/#/components/snackbar" + element = ( +
+ + +
+ ); + element = ( +
+ +
+ + +
+ ); + + // "http://www.material-ui.com/#/components/table" + element = ( + + + + ID + Name + Status + + + + + 1 + John Smith + Employed + + + 2 + Randal White + Unemployed + + + 3 + Stephanie Sanders + Employed + + + 4 + Steve Brown + Employed + + +
+ ); + const tableData = [ + { + name: 'John Smith', + status: 'Employed', + selected: true, + }, + ]; + element = ( +
+ + + + + Super Header + + + + ID + Name + Status + + + + {tableData.map( (row, index) => ( + + {index} + {row.name} + {row.status} + + ))} + + + + ID + Name + Status + + + + Super Footer + + + +
+ +
+

Table Properties

+ + + + + + +

TableBody Properties

+ + + +
+
+ ); + + // "http://www.material-ui.com/#/components/tabs" + const TabsExampleSimple = () => ( + + +
+

Tab One

+

+ This is an example tab. +

+

+ You can put any sort of HTML or react component in here. It even keeps the component state! +

+ +
+
+ +
+

Tab Two

+

+ This is another example tab. +

+
+
+ +
+

Tab Three

+

+ This is a third example tab. +

+
+
+
+ ); + element = ( + + +
+

Controllable Tab A

+

+ Tabs are also controllable if you want to programmatically pass them their values. + This allows for more functionality in Tabs such as not + having any Tab selected or assigning them different values. +

+
+
+ +
+

Controllable Tab B

+

+ This is another example of a controllable tab. Remember, if you + use controllable Tabs, you need to give all of your tabs values or else + you wont be able to select them. +

+
+
+
+ ); + const TabsExampleIcon = () => ( + + } /> + } /> + favorite} /> + + ); + + // "http://www.material-ui.com/#/components/text-field" + const TextFieldExampleSimple = () => ( +
+
+
+
+
+
+
+
+ +
+ ); + const TextFieldExampleError = () => ( +
+
+
+
+
+
+ ); + const TextFieldExampleCustomize = () => ( +
+
+
+
+ +
+ ); + const TextFieldExampleDisabled = () => ( +
+
+
+
+ +
+ ); + element = ; + + + // "http://www.material-ui.com/#/components/time-picker" + const TimePickerExampleSimple = () => ( +
+ + +
+ ); + element = ( +
+ this.picker12hr = t} + format="ampm" + hintText="12hr Format" + onChange={this.handleChangeTimePicker12} + /> + this.picker24hr = t} + format="24hr" + hintText="24hr Format" + onChange={this.handleChangeTimePicker24} + /> +
+ ); + + // "http://www.material-ui.com/#/components/toolbar" + const ToolbarExamplesSimple = () => ( + + + + + + + + + + + + + + + + + + + } + > + + + + + + + + ); + + return element; + } +} diff --git a/material-ui/legacy/material-ui-0.14.4-tests.tsx.tscparams b/material-ui/legacy/material-ui-0.14.4-tests.tsx.tscparams new file mode 100644 index 0000000000..855355b85f --- /dev/null +++ b/material-ui/legacy/material-ui-0.14.4-tests.tsx.tscparams @@ -0,0 +1 @@ +--experimentalDecorators \ No newline at end of file diff --git a/material-ui/legacy/material-ui-0.14.4.d.ts b/material-ui/legacy/material-ui-0.14.4.d.ts new file mode 100644 index 0000000000..29eeb225bd --- /dev/null +++ b/material-ui/legacy/material-ui-0.14.4.d.ts @@ -0,0 +1,8246 @@ +// Type definitions for material-ui v0.14.4 +// Project: https://github.com/callemall/material-ui +// Definitions by: Nathan Brown , Oliver Herrmann +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "material-ui" { + export import AppBar = __MaterialUI.AppBar; // require('material-ui/lib/app-bar'); + export import AppCanvas = __MaterialUI.AppCanvas; // require('material-ui/lib/app-canvas'); + export import AutoComplete = __MaterialUI.AutoComplete; // require('material-ui/lib/auto-complete'); + export import Avatar = __MaterialUI.Avatar; // require('material-ui/lib/avatar'); + export import Badge = __MaterialUI.Badge; // require('material-ui/lib/badge'); + export import BeforeAfterWrapper = __MaterialUI.BeforeAfterWrapper; // require('material-ui/lib/before-after-wrapper'); + export import Card = __MaterialUI.Card.Card; // require('material-ui/lib/card/card'); + export import CardActions = __MaterialUI.Card.CardActions; // require('material-ui/lib/card/card-actions'); + export import CardExpandable = __MaterialUI.Card.CardExpandable; // require('material-ui/lib/card/card-expandable'); + export import CardHeader = __MaterialUI.Card.CardHeader; // require('material-ui/lib/card/card-header'); + export import CardMedia = __MaterialUI.Card.CardMedia; // require('material-ui/lib/card/card-media'); + export import CardText = __MaterialUI.Card.CardText; // require('material-ui/lib/card/card-text'); + export import CardTitle = __MaterialUI.Card.CardTitle; // require('material-ui/lib/card/card-title'); + export import Checkbox = __MaterialUI.Checkbox; // require('material-ui/lib/checkbox'); + export import CircularProgress = __MaterialUI.CircularProgress; // require('material-ui/lib/circular-progress'); + export import ClearFix = __MaterialUI.ClearFix; // require('material-ui/lib/clearfix'); + export import DatePicker = __MaterialUI.DatePicker.DatePicker; // require('material-ui/lib/date-picker/date-picker'); + export import DatePickerDialog = __MaterialUI.DatePicker.DatePickerDialog; // require('material-ui/lib/date-picker/date-picker-dialog'); + export import Dialog = __MaterialUI.Dialog // require('material-ui/lib/dialog'); + export import Divider = __MaterialUI.Divider // require('material-ui/lib/divider'); + export import DropDownMenu = __MaterialUI.Menus.DropDownMenu; // require('material-ui/lib/DropDownMenu/DropDownMenu'); + export import EnhancedButton = __MaterialUI.EnhancedButton; // require('material-ui/lib/enhanced-button'); + export import FlatButton = __MaterialUI.FlatButton; // require('material-ui/lib/flat-button'); + export import FloatingActionButton = __MaterialUI.FloatingActionButton; // require('material-ui/lib/floating-action-button'); + export import FontIcon = __MaterialUI.FontIcon; // require('material-ui/lib/font-icon'); + export import GridList = __MaterialUI.GridList.GridList; // require('material-ui/lib/gridlist/grid-list'); + export import GridTile = __MaterialUI.GridList.GridTile; // require('material-ui/lib/gridlist/grid-tile'); + export import IconButton = __MaterialUI.IconButton; // require('material-ui/lib/icon-button'); + export import IconMenu = __MaterialUI.Menus.IconMenu; // require('material-ui/lib/menus/icon-menu'); + export import LeftNav = __MaterialUI.LeftNav; // require('material-ui/lib/left-nav'); + export import LinearProgress = __MaterialUI.LinearProgress; // require('material-ui/lib/linear-progress'); + export import List = __MaterialUI.Lists.List; // require('material-ui/lib/lists/list'); + export import ListDivider = __MaterialUI.Lists.ListDivider; // require('material-ui/lib/lists/list-divider'); + export import ListItem = __MaterialUI.Lists.ListItem; // require('material-ui/lib/lists/list-item'); + export import Menu = __MaterialUI.Menus.Menu; // require('material-ui/lib/menus/menu'); + export import MenuItem = __MaterialUI.Menus.MenuItem; // require('material-ui/lib/menus/menu-item'); + export import Mixins = __MaterialUI.Mixins; // require('material-ui/lib/mixins'); + export import Overlay = __MaterialUI.Overlay; // require('material-ui/lib/overlay'); + export import Paper = __MaterialUI.Paper; // require('material-ui/lib/paper'); + export import Popover = __MaterialUI.Popover.Popover; // require('material-ui/lib/popover/popover'); + export import RadioButton = __MaterialUI.RadioButton; // require('material-ui/lib/radio-button'); + export import RadioButtonGroup = __MaterialUI.RadioButtonGroup; // require('material-ui/lib/radio-button-group'); + export import RaisedButton = __MaterialUI.RaisedButton; // require('material-ui/lib/raised-button'); + export import RefreshIndicator = __MaterialUI.RefreshIndicator; // require('material-ui/lib/refresh-indicator'); + export import Ripples = __MaterialUI.Ripples; // require('material-ui/lib/ripples'); + export import SelectField = __MaterialUI.SelectField; // require('material-ui/lib/select-field'); + export import SelectableContainerEnhance = __MaterialUI.Hoc.SelectableContainerEnhance; // require('material-ui/lib/hoc/selectable-enhance'); + export import Slider = __MaterialUI.Slider; // require('material-ui/lib/slider'); + export import SvgIcon = __MaterialUI.SvgIcon; // require('material-ui/lib/svg-icon'); + export import Styles = __MaterialUI.Styles; // require('material-ui/lib/styles'); + export import Snackbar = __MaterialUI.Snackbar; // require('material-ui/lib/snackbar'); + export import Tab = __MaterialUI.Tabs.Tab; // require('material-ui/lib/tabs/tab'); + export import Tabs = __MaterialUI.Tabs.Tabs; // require('material-ui/lib/tabs/tabs'); + export import Table = __MaterialUI.Table.Table; // require('material-ui/lib/table/table'); + export import TableBody = __MaterialUI.Table.TableBody; // require('material-ui/lib/table/table-body'); + export import TableFooter = __MaterialUI.Table.TableFooter; // require('material-ui/lib/table/table-footer'); + export import TableHeader = __MaterialUI.Table.TableHeader; // require('material-ui/lib/table/table-header'); + export import TableHeaderColumn = __MaterialUI.Table.TableHeaderColumn; // require('material-ui/lib/table/table-header-column'); + export import TableRow = __MaterialUI.Table.TableRow; // require('material-ui/lib/table/table-row'); + export import TableRowColumn = __MaterialUI.Table.TableRowColumn; // require('material-ui/lib/table/table-row-column'); + export import Toggle = __MaterialUI.Toggle; // require('material-ui/lib/toggle'); + export import ThemeWrapper = __MaterialUI.ThemeWrapper; // require('material-ui/lib/theme-wrapper'); + export import TimePicker = __MaterialUI.TimePicker; // require('material-ui/lib/time-picker'); + export import TextField = __MaterialUI.TextField; // require('material-ui/lib/text-field'); + export import Toolbar = __MaterialUI.Toolbar.Toolbar; // require('material-ui/lib/toolbar/toolbar'); + export import ToolbarGroup = __MaterialUI.Toolbar.ToolbarGroup; // require('material-ui/lib/toolbar/toolbar-group'); + export import ToolbarSeparator = __MaterialUI.Toolbar.ToolbarSeparator; // require('material-ui/lib/toolbar/toolbar-separator'); + export import ToolbarTitle = __MaterialUI.Toolbar.ToolbarTitle; // require('material-ui/lib/toolbar/toolbar-title'); + export import Tooltip = __MaterialUI.Tooltip; // require('material-ui/lib/tooltip'); + export import Utils = __MaterialUI.Utils; // require('material-ui/lib/utils'); + + // svg icons + import NavigationMenu = __MaterialUI.SvgIcon; // require('material-ui/lib/svg-icon/navigation/menu'); + import NavigationChevronLeft = __MaterialUI.SvgIcon; // require('material-ui/lib/svg-icon/navigation/chevron-left'); + import NavigationChevronRight = __MaterialUI.SvgIcon; // require('material-ui/lib/svg-icon/navigation/chevron-right'); + + export const Icons: { + NavigationMenu: NavigationMenu, + NavigationChevronLeft: NavigationChevronLeft, + NavigationChevronRight: NavigationChevronRight, + }; + + // export type definitions + export type TouchTapEvent = __MaterialUI.TouchTapEvent; + export type TouchTapEventHandler = __MaterialUI.TouchTapEventHandler; + export type DialogAction = __MaterialUI.DialogAction; +} + +declare namespace __MaterialUI { + export import React = __React; + + // ReactLink is from "react/addons" + interface ReactLink { + value: T; + requestChange(newValue: T): void; + } + + // What's common between React.TouchEvent and React.MouseEvent + interface TouchTapEvent extends React.SyntheticEvent { + altKey: boolean; + ctrlKey: boolean; + getModifierState(key: string): boolean; + metaKey: boolean; + shiftKey: boolean; + } + + // What's common between React.TouchEventHandler and React.MouseEventHandler + interface TouchTapEventHandler extends React.EventHandler { } + + interface ThemeWrapperProps extends React.Props { + theme: Styles.MuiTheme; + } + export class ThemeWrapper extends React.Component { + } + + export namespace Styles { + interface AutoPrefix { + all(styles: React.CSSProperties): React.CSSProperties; + set(style: React.CSSProperties, key: string, value: string | number): void; + single(key: string): string; + singleHyphened(key: string): string; + } + export var AutoPrefix: AutoPrefix; + + interface Spacing { + iconSize?: number; + + desktopGutter?: number; + desktopGutterMore?: number; + desktopGutterLess?: number; + desktopGutterMini?: number; + desktopKeylineIncrement?: number; + desktopDropDownMenuItemHeight?: number; + desktopDropDownMenuFontSize?: number; + desktopLeftNavMenuItemHeight?: number; + desktopSubheaderHeight?: number; + desktopToolbarHeight?: number; + } + export var Spacing: Spacing; + + interface ThemePalette { + primary1Color?: string; + primary2Color?: string; + primary3Color?: string; + accent1Color?: string; + accent2Color?: string; + accent3Color?: string; + textColor?: string; + alternateTextColor?: string; + canvasColor?: string; + borderColor?: string; + disabledColor?: string; + pickerHeaderColor?: string; + clockCircleColor?: string; + shadowColor?: string; + } + interface MuiTheme { + isRtl?: boolean; + userAgent?: any; + zIndex?: zIndex; + baseTheme?: RawTheme; + rawTheme?: RawTheme; + appBar?: { + color?: string, + textColor?: string, + height?: number, + }; + avatar?: { + borderColor?: string, + } + badge?: { + color?: string, + textColor?: string, + primaryColor?: string, + primaryTextColor?: string, + secondaryColor?: string, + secondaryTextColor?: string, + }, + button?: { + height?: number, + minWidth?: number, + iconButtonSize?: number, + }, + cardText?: { + textColor?: string, + }, + checkbox?: { + boxColor?: string, + checkedColor?: string, + requiredColor?: string, + disabledColor?: string, + labelColor?: string, + labelDisabledColor?: string, + }, + datePicker?: { + color?: string, + textColor?: string, + calendarTextColor?: string, + selectColor?: string, + selectTextColor?: string, + }, + dropDownMenu?: { + accentColor?: string, + }, + flatButton?: { + color?: string, + buttonFilterColor?: string, + disabledColor?: string, + textColor?: string, + primaryTextColor?: string, + secondaryTextColor?: string, + }, + floatingActionButton?: { + buttonSize?: number, + miniSize?: number, + color?: string, + iconColor?: string, + secondaryColor?: string, + secondaryIconColor?: string, + disabledColor?: string, + disabledTextColor?: string, + }, + gridTile?: { + textColor?: string, + }, + inkBar?: { + backgroundColor?: string, + }, + leftNav?: { + width?: number, + color?: string, + }, + listItem?: { + nestedLevelDepth?: number, + }, + menu?: { + backgroundColor?: string, + containerBackgroundColor?: string, + }, + menuItem?: { + dataHeight?: number, + height?: number, + hoverColor?: string, + padding?: number, + selectedTextColor?: string, + }, + menuSubheader?: { + padding?: number, + borderColor?: string, + textColor?: string, + }, + paper?: { + backgroundColor?: string, + zDepthShadows?: string[], + }, + radioButton?: { + borderColor?: string, + backgroundColor?: string, + checkedColor?: string, + requiredColor?: string, + disabledColor?: string, + size?: number, + labelColor?: string, + labelDisabledColor?: string, + }, + raisedButton?: { + color?: string, + textColor?: string, + primaryColor?: string, + primaryTextColor?: string, + secondaryColor?: string, + secondaryTextColor?: string, + disabledColor?: string, + disabledTextColor?: string, + }, + refreshIndicator?: { + strokeColor?: string, + loadingStrokeColor?: string, + }; + slider?: { + trackSize?: number, + trackColor?: string, + trackColorSelected?: string, + handleSize?: number, + handleSizeDisabled?: number, + handleSizeActive?: number, + handleColorZero?: string, + handleFillColor?: string, + selectionColor?: string, + rippleColor?: string, + }, + snackbar?: { + textColor?: string, + backgroundColor?: string, + actionColor?: string, + }, + table?: { + backgroundColor?: string; + }; + tableHeader?: { + borderColor?: string; + }; + tableHeaderColumn?: { + textColor?: string; + height?: number; + spacing?: number; + }; + tableFooter?: { + borderColor?: string; + textColor?: string; + }; + tableRow?: { + hoverColor?: string; + stripeColor?: string; + selectedColor?: string; + textColor?: string; + borderColor?: string; + height?: number; + }; + tableRowColumn?: { + height?: number; + spacing?: number; + }; + timePicker?: { + color?: string; + textColor?: string; + accentColor?: string; + clockColor?: string; + clockCircleColor?: string; + headerColor?: string; + selectColor?: string; + selectTextColor?: string; + }; + toggle?: { + thumbOnColor?: string, + thumbOffColor?: string, + thumbDisabledColor?: string, + thumbRequiredColor?: string, + trackOnColor?: string, + trackOffColor?: string, + trackDisabledColor?: string, + labelColor?: string, + labelDisabledColor?: string + trackRequiredColor?: string, + }, + toolbar?: { + backgroundColor?: string, + height?: number, + titleFontSize?: number, + iconColor?: string, + separatorColor?: string, + menuHoverColor?: string, + }; + tabs?: { + backgroundColor?: string, + textColor?: string, + selectedTextColor?: string, + }; + textField?: { + textColor?: string; + hintColor?: string; + floatingLabelColor?: string; + disabledTextColor?: string; + errorColor?: string; + focusColor?: string; + backgroundColor?: string; + borderColor?: string; + }; + } + + interface zIndex { + menu: number; + appBar: number; + leftNavOverlay: number; + leftNav: number; + dialogOverlay: number; + dialog: number; + layer: number; + popover: number; + snackbar: number; + tooltip: number; + } + export var zIndex: zIndex; + + interface RawTheme { + spacing?: Spacing; + fontFamily?: string; + palette?: ThemePalette; + zIndex?: zIndex; + } + var lightBaseTheme: RawTheme; + var darkBaseTheme: RawTheme; + + export function ThemeDecorator(muiTheme: Styles.MuiTheme): (Component: TFunction) => TFunction; + + export function getMuiTheme(baseTheme: RawTheme, muiTheme ?: MuiTheme): MuiTheme; + + interface ThemeManager { + getMuiTheme(baseTheme: RawTheme, muiTheme?: MuiTheme): MuiTheme; + modifyRawThemeSpacing(muiTheme: MuiTheme, newSpacing: Spacing): MuiTheme; + modifyRawThemePalette(muiTheme: MuiTheme, newPaletteKeys: ThemePalette): MuiTheme; + modifyRawThemeFontFamily(muiTheme: MuiTheme, newFontFamily: string): MuiTheme; + } + export var ThemeManager: ThemeManager; + + interface Transitions { + easeOut(duration?: string, property?: string | string[], delay?: string, easeFunction?: string): string; + create(duration?: string, property?: string, delay?: string, easeFunction?: string): string; + easeOutFunction: string; + easeInOutFunction: string; + } + export var Transitions: Transitions; + + interface Typography { + textFullBlack: string; + textDarkBlack: string; + textLightBlack: string; + textMinBlack: string; + textFullWhite: string; + textDarkWhite: string; + textLightWhite: string; + + // font weight + fontWeightLight: number; + fontWeightNormal: number; + fontWeightMedium: number; + + fontStyleButtonFontSize: number; + } + export var Typography: Typography; + + export var DarkRawTheme: RawTheme; + export var LightRawTheme: RawTheme; + } + + interface AppBarProps extends React.Props { + className?: string; + iconClassNameLeft?: string; + iconClassNameRight?: string; + iconElementLeft?: React.ReactElement; + iconElementRight?: React.ReactElement; + iconStyleRight?: string; + onLeftIconButtonTouchTap?: TouchTapEventHandler; + onRightIconButtonTouchTap?: TouchTapEventHandler; + onTitleTouchTap?: TouchTapEventHandler; + showMenuIconButton?: boolean; + style?: React.CSSProperties; + title?: React.ReactNode; + titleStyle?: React.CSSProperties; + zDepth?: number; + } + export class AppBar extends React.Component{ + } + + interface AppCanvasProps extends React.Props { + } + export class AppCanvas extends React.Component { + } + + interface Origin { + horizontal: string; // oneOf(['left', 'middle', 'right']) + vertical: string; // oneOf(['top', 'center', 'bottom']) + } + + type AutoCompleteDataItem = { text: string, value: React.ReactNode } | string; + type AutoCompleteDataSource = { text: string, value: React.ReactNode }[] | string[]; + interface AutoCompleteProps extends React.Props { + anchorOrigin?: Origin; + animated?: boolean; + dataSource?: AutoCompleteDataSource; + disableFocusRipple?: boolean; + errorStyle?: React.CSSProperties; + errorText?: string; + filter?: (searchText: string, key: string, item: AutoCompleteDataItem) => boolean; + floatingLabelText?: string; + fullWidth?: boolean; + hintText?: string; + listStyle?: React.CSSProperties; + menuCloseDelay?: number; + menuProps?: any; + menuStyle?: React.CSSProperties; + onNewRequest?: (chosenRequest: string, index: number) => void; + onUpdateInput?: (searchText: string, dataSource: AutoCompleteDataSource) => void; + open?: boolean; + searchText?: string; + /** @deprecated use noFilter instead */ + showAllItems?: boolean; + style?: React.CSSProperties; + targetOrigin?: Origin; + touchTapCloseDelay?: number; + triggerUpdateOnFocus?: boolean; + /** @deprecated updateWhenFocused has been renamed to triggerUpdateOnFocus */ + updateWhenFocused?: boolean; + } + export class AutoComplete extends React.Component { + static noFilter: () => boolean; + static defaultFilter: (searchText: string, key: string) => boolean; + static caseSensitiveFilter: (searchText: string, key: string) => boolean; + static caseInsensitiveFilter: (searchText: string, key: string) => boolean; + static levenshteinDistanceFilter(distanceLessThan: number): (searchText: string, key: string) => boolean; + static fuzzyFilter: (searchText: string, key: string) => boolean; + static Item: Menus.MenuItem; + static Divider: Divider; + } + + interface AvatarProps extends React.Props { + backgroundColor?: string; + className?: string; + color?: string; + icon?: React.ReactElement; + size?: number; + src?: string; + style?: React.CSSProperties; + } + export class Avatar extends React.Component { + } + + interface BadgeProps extends React.Props { + badgeContent: React.ReactNode; + badgeStyle?: React.CSSProperties; + className?: string; + primary?: boolean; + secondary?: boolean; + style?: React.CSSProperties; + } + export class Badge extends React.Component { + } + + interface BeforeAfterWrapperProps extends React.Props { + afterElementType?: string; + afterStyle?: React.CSSProperties; + beforeElementType?: string; + beforeStyle?: React.CSSProperties; + elementType?: string; + style?: React.CSSProperties; + } + export class BeforeAfterWrapper extends React.Component { + } + + // non generally overridden elements of EnhancedButton + interface SharedEnhancedButtonProps extends React.Props { + centerRipple?: boolean; + disableFocusRipple?: boolean; + disableKeyboardFocus?: boolean; + disableTouchRipple?: boolean; + focusRippleColor?: string; + focusRippleOpacity?: number; + keyboardFocused?: boolean; + linkButton?: boolean; + onBlur?: React.FocusEventHandler; + onFocus?: React.FocusEventHandler; + onKeyboardFocus?: (e: React.FocusEvent, isKeyboardFocused: boolean) => void; + onKeyDown?: React.KeyboardEventHandler; + onKeyUp?: React.KeyboardEventHandler; + onTouchTap?: TouchTapEventHandler; + style?: React.CSSProperties; + tabIndex?: number; + touchRippleColor?: string; + touchRippleOpacity?: number; + type?: string; + } + + interface EnhancedButtonProps extends React.HTMLAttributes, SharedEnhancedButtonProps { + // container element,