declarations
Version:
[](https://www.npmjs.com/package/declarations)
1,471 lines (1,087 loc) • 95.3 kB
TypeScript
// Type definitions for Multiplex.js 0.9
// Project: http://github.com/multiplex/multiplex.js
// Definitions by: Kamyar Nazeri <http://github.com/KamyarNazeri>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var multiplex: multiplex.MultiplexStatic;
// Support AMD require
declare module 'multiplex' {
export = multiplex;
}
// Collapse multiplex into mx
import mx = multiplex;
// ES6 compatibility
interface Array<T> extends multiplex.Iterable<T> { }
interface String extends multiplex.Iterable<string> { }
declare namespace multiplex {
/**
* ES6 Iterable
*/
interface Iterable<T> {
"@@iterator"(): Iterator<T>
}
interface Iterator<T> {
next(): IteratorResult<T>;
return?(value?: any): IteratorResult<T>;
throw?(e?: any): IteratorResult<T>;
}
interface IteratorResult<T> {
done: boolean;
value?: T;
}
/**
* Supports a simple iteration over a collection.
*/
interface Enumerator<T> {
/**
* Advances the enumerator to the next element of the collection.
*/
next(): boolean;
/**
* Gets the element in the collection at the current position of the enumerator.
*/
current: T;
}
interface EnumeratorConstructor {
new <T>(generator: (yielder: (value: T) => T) => any): Enumerator<T>;
}
/**
* Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
* Enumerable uses ES6 Iteration protocol.
*/
interface Enumerable<T> extends Iterable<T> {
/**
* Returns an enumerator that iterates through the collection.
*/
getEnumerator(): Enumerator<T>;
}
interface EnumerableConstructor {
/**
* Exposes the enumerator, which supports an iteration over the specified Enumerable object.
* @param obj An Iterable object. eg. Enumerable, Array, String, Set, Map, Iterable & Generators
*/
new <T>(obj: Iterable<T>): Enumerable<T>;
/**
* Defines an enumerator, which supports an iteration over the specified Generator function.
* @param factory An Enumerator factory function.
*/
new <T>(factory: () => Enumerator<T>): Enumerable<T>;
/**
* Defines an enumerator, which supports an iteration over the items of the specified Array-like object.
* An Array-like object is an object which has the "length" property and indexed properties access, eg. jQuery
* @param obj An Array-like object.
*/
new <T>(obj: ArrayLike<T>): Enumerable<T>;
/**
* Defines an enumerator, which supports an iteration over the arguments local variable available within all functions.
* @param obj arguments local variable available within all functions.
*/
new (obj: IArguments): Enumerable<any>;
/**
* Defines an enumerator, which supports an iteration over the properties of the specified object.
* @param obj A regular Object.
*/
new (obj: Object): Enumerable<KeyValuePair<string, any>>;
/**
* Returns an empty Enumerable.
*/
empty<T>(): Enumerable<T>;
/**
* Detects if an object is Enumerable.
* @param obj An object to check its Enumerability.
*/
is(obj: any): boolean;
/**
* Generates a sequence of integral numbers within a specified range.
* @param start The value of the first integer in the sequence.
* @param count The number of sequential integers to generate.
*/
range(start: number, count: number): Enumerable<number>;
/**
* Generates a sequence that contains one repeated value.
* @param element The value to be repeated.
* @param count The number of times to repeat the value in the generated sequence.
*/
repeat<T>(element: T, count: number): Enumerable<T>;
}
/**
* Defines a method that a type implements to compare two objects.
*/
interface Comparer<T> {
/**
* Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
* returns An integer that indicates the relative values of x and y, as shown in the following table:
* Less than zero x is less than y.
* Zero x equals y.
* Greater than zero x is greater than y..
* @param x The first object to compare.
* @param y The second object to compare.
*/
compare(x: T, y: T): number;
}
interface ComparerConstructor {
/**
* Returns a default sort order comparer for the type specified by the generic argument.
*/
defaultComparer: Comparer<any>;
/**
* Creates a comparer by using the specified comparison.
* @param comparison The comparison to use.
*/
create<T>(comparison: (x: T, y: T) => number): Comparer<T>;
}
/**
* Provides a base class for implementations of the EqualityComparer.
*/
interface EqualityComparer<T> {
/**
* Determines whether the specified objects are equal.
* @param x The first object of type Object to compare.
* @param y The second object of type Object to compare.
*/
equals(x: T, y: T): boolean;
/**
* Returns a hash code for the specified object.
* @param obj The Object for which a hash code is to be returned.
*/
hash(obj: T): number
}
interface EqualityComparerConstructor {
/**
* Gets a default equality comparer for the type specified by the generic argument.
*/
defaultComparer: EqualityComparer<any>;
/**
* Creates an EqualityComparer by using the specified equality and hashCodeProvider.
* @param hashCodeProvider The hashCodeProvider to use for a hash code is to be returned.
* @param equality The equality function.
*/
create<T>(hashCodeProvider: (obj: T) => number, equality: (x: T, y: T) => boolean): EqualityComparer<T>;
}
/**
* Initializes a new instance of the abstract Collection class.
*/
interface Collection<T> extends Enumerable<T> {
/**
* Gets the number of elements contained in the Collection.
*/
count(): number;
/**
* Copies the Collection to an existing one-dimensional Array, starting at the specified array index.
* @param array The one-dimensional Array that is the destination of the elements copied from Dictionary keys.
* @param arrayIndex The zero-based index in array at which copying begins.
*/
copyTo(array: T[], arrayIndex: number): void
}
interface CollectionConstructor {
/**
* Initializes a new instance of the Collection class that is empty.
*/
new <T>(): Collection<T>
/**
* Initializes a new instance of the Collection class that is wrapper around the specified Enumerable.
* @param value The Iterable to wrap.
*/
new <T>(value: Iterable<T>): Collection<T>
}
/**
* Initializes a new instance of the abstract Collection class.
*/
interface ReadOnlyCollection<T> extends Collection<T> {
/**
* Gets the element at the specified index.
* @param index The zero-based index of the element to get.
*/
[index: number]: T;
/**
* Gets the element at the specified index.
* @param index The zero-based index of the element to get.
*/
get(index: number): T
/**
* Determines whether the ReadOnlyCollection contains a specific value.
* @param item The object to locate in the ReadOnlyCollection.
*/
contains(item: T): boolean
/**
* Searches for the specified object and returns the zero-based index of the first occurrence within the entire ReadOnlyCollection.
* @param item The object to locate in the ReadOnlyCollection.
*/
indexOf(item: T): number
}
interface ReadOnlyCollectionConstructor {
/**
* Initializes a new instance of the ReadOnlyCollection class that is a read-only wrapper around the specified list.
* @param list The list to wrap.
*/
new <T>(list: List<T>): ReadOnlyCollection<T>
}
/**
* Represents a strongly typed list of objects that can be accessed by index.
*/
interface List<T> extends Collection<T> {
/**
* Gets the element at the specified index.
* @param index The zero-based index of the element to get.
*/
[index: number]: T;
/**
* Adds an object to the end of the List.
* @param item The object to be added to the end of the List.
*/
add(item: T): void
/**
* Adds the elements of the specified collection to the end of the List.
* @param collection The collection whose elements should be added to the end of the List.
*/
addRange(collection: Iterable<T>): void
/**
* Returns a read-only wrapper for the current list.
*/
asReadOnly(): ReadOnlyCollection<T>
/**
* Searches the entire sorted List for an element using the default comparer and returns the zero-based index of the element.
* Returns The zero-based index of item in the sorted List, if item is found; otherwise, a negative number
* that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element,
* the bitwise complement of List.count().
* @param item The object to locate. The value can be null for reference types.
*/
binarySearch(item: T): number
/**
* Searches the entire sorted List for an element using the specified comparer and returns the zero-based index of the element.
* returns The zero-based index of item in the sorted List, if item is found; otherwise, a negative number
* that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element,
* the bitwise complement of List.count().
* @param item The object to locate. The value can be null for reference types.
* @param comparer The Comparer implementation to use when comparing elements.
*/
binarySearch(item: T, comparer: Comparer<T>): number
/**
* Searches a range of elements in the sorted List for an element using the specified comparer and returns the zero-based index of the element.
* returns The zero-based index of item in the sorted List, if item is found; otherwise, a negative number
* that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element,
* the bitwise complement of List.count().
* @param item The object to locate. The value can be null for reference types.
* @param index The zero-based starting index of the range to search.
* @param count The length of the range to search.
* @param comparer The Comparer implementation to use when comparing elements.
*/
binarySearch(item: T, index: number, count: number, comparer: Comparer<T>): number
/**
* Removes all items from the List.
*/
clear(): void
/**
* Determines whether the List contains elements that match the conditions defined by the specified predicate.
* @param match The predicate function that defines the conditions of the elements to search for.
*/
exists(match: (item: T) => boolean): boolean
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire List.
* @param match The predicate function that defines the conditions of the elements to search for.
*/
find(match: (item: T) => boolean): T
/**
* Retrieves all the elements that match the conditions defined by the specified predicate.
* @param match The predicate function that defines the conditions of the elements to search for.
*/
findAll(match: (item: T) => boolean): List<T>
/**
* Searches for an element that matches the conditions defined by the specified predicate,
* and returns the zero-based index of the first occurrence within the entire List, if found; otherwise, –1.
* @param match The predicate function that defines the conditions of the elements to search for.
*/
findIndex(match: (item: T) => boolean): number
/**
* Searches for an element that matches the conditions defined by the specified predicate,
* and returns the zero-based index of the first occurrence within the range of elements
* in the List that extends from the specified index to the last element, if found; otherwise, –1.
* @param startIndex The zero-based starting index of the search.
* @param match The predicate function that defines the conditions of the elements to search for.
*/
findIndex(startIndex: number, match: (item: T) => boolean): number
/**
* Searches for an element that matches the conditions defined by the specified predicate,
* and returns the zero-based index of the first occurrence within the range of elements
* in the List that starts at the specified index and contains the specified number of elements, if found; otherwise, –1.
* @param startIndex The zero-based starting index of the search.
* @param count The number of elements in the section to search.
* @param match The predicate function that defines the conditions of the elements to search for.
*/
findIndex(startIndex: number, count: number, match: (item: T) => boolean): number
/**
* Searches for an element that matches the conditions defined by the specified predicate,
* and returns the last occurrence within the entire List.
* @param match The predicate function that defines the conditions of the elements to search for.
*/
findLast(match: (item: T) => boolean): T
/**
* Searches for an element that matches the conditions defined by the specified predicate,
* and returns the zero-based index of the last occurrence within the entire List, if found; otherwise, –1.
* @param match The predicate function that defines the conditions of the elements to search for.
*/
findLastIndex(match: (item: T) => boolean): number
/**
* Searches for an element that matches the conditions defined by the specified predicate,
* and returns the zero-based index of the last occurrence within the range of elements
* in the List that extends from the first element to the specified index, if found; otherwise, –1.
* @param startIndex The zero-based starting index of the search.
* @param match The predicate function that defines the conditions of the elements to search for.
*/
findLastIndex(startIndex: number, match: (item: T) => boolean): number
/**
* Searches for an element that matches the conditions defined by the specified predicate,
* and returns the zero-based index of the last occurrence within the range of elements
* in the List that contains the specified number of elements and ends at the specified index, if found; otherwise, –1.
* @param startIndex The zero-based starting index of the search.
* @param count The number of elements in the section to search.
* @param match The predicate function that defines the conditions of the elements to search for.
*/
findLastIndex(startIndex: number, count: number, match: (item: T) => boolean): number
/**
* Performs the specified action on each element of the List.
* @param action The action function to perform on each element of the List.
*/
forEach(action: (item: T) => void): void
/**
* Gets the element at the specified index.
* @param index The zero-based index of the element to get.
*/
get(index: number): T
/**
* Creates a shallow copy of a range of elements in the source List.
* @param index The zero-based List index at which the range starts.
* @param count The number of elements in the range.
*/
getRange(index: number, count: number): List<T>
/**
* Searches for the specified object and returns the zero-based index of the first occurrence within the entire List, if found; otherwise, –1.
* @param item The object to locate in the List.
*/
indexOf(item: T): number
/**
* Searches for the specified object and returns the zero-based index of the first occurrence within
* the range of elements in the List that extends from the specified index to the last element, if found; otherwise, –1.
* @param item The object to locate in the List.
* @param index The zero-based starting index of the search. 0 (zero) is valid in an empty list.
*/
indexOf(item: T, index: number): number
/**
* Inserts an element into the List at the specified index.
* @param index The zero-based index at which item should be inserted.
* @param item The object to insert. The value can be null for reference types.
*/
insert(index: number, item: T): void
/**
* Inserts the elements of a collection into the List at the specified index.
* @param index The zero-based index at which item should be inserted.
* @param collection The collection whose elements should be inserted into the List.
*/
insertRange(index: number, collection: Iterable<T>): void
/**
* Gets an Array wrapper around the List.
*/
items(): T[]
/**
* Searches for the specified object and returns the zero-based index of the last occurrence within the entire List, if found; otherwise, –1.
* @param item The object to locate in the List.
*/
lastIndexOf(item: T): number
/**
* Searches for the specified object and returns the zero-based index of the last occurrence
* within the range of elements in the List that extends from the specified index to the last element if found; otherwise, –1.
* @param item The object to locate in the List.
* @param index The zero-based starting index of the search. 0 (zero) is valid in an empty list.
*/
lastIndexOf(item: T, index: number): number
/**
* Removes the first occurrence of a specific object from the List.
* @param item The object to remove from the List.
*/
remove(item: T): boolean
/**
* Removes all the elements that match the conditions defined by the specified predicate.
* @param match The predicate function that defines the conditions of the elements to remove.
*/
removeAll(match: (item: T) => boolean): number
/**
* Removes the element at the specified index of the List.
* @param index The zero-based index of the element to remove.
*/
removeAt(index: number): void
/**
* Removes a range of elements from the List.
* @param index The zero-based index of the element to remove.
* @param count The number of elements to remove.
*/
removeRange(index: number, count: number): void
/**
* Reverses the order of the elements in the entire List
*/
reverse(): any
/**
* Reverses the order of the elements in the entire List
* @param index The zero-based starting index of the range to reverse.
* @param count The number of elements in the range to reverse.
*/
reverse(index: number, count: number): void
/**
* Sets the element at the specified index.
* @param index The zero-based index of the element to set.
* @param item The object to be added at the specified index.
*/
set(index: number, value: T): void
/**
* Sorts the elements in the entire List using the default comparer.
*/
sort(): void
/**
* Sorts the elements in the entire List using the specified Comparison.
* @param comparison The comparison function to use when comparing elements.
*/
sort(comparison: (x: T, y: T) => number): void
/**
* Sorts the elements in the entire List using the specified comparer.
* @param comparer The Comparer implementation to use when comparing elements.
*/
sort(comparer: Comparer<T>): void
/**
* Sorts the elements in a range of elements in List using the specified comparer.
* @param index The zero-based starting index of the range to sort.
* @param count The length of the range to sort.
* @param comparer The Comparer implementation to use when comparing elements.
*/
sort(index: number, count: number, comparer: Comparer<T>): void
/**
* Copies the elements of the List to a new array.
*/
toArray(): T[]
/**
* Determines whether every element in the List matches the conditions defined by the specified predicate.
* @param match The Predicate function that defines the conditions to check against the elements.
*/
trueForAll(match: (item: T) => boolean): boolean
}
interface ListConstructor {
/**
* Initializes a new instance of the List class that is empty.
*/
new <T>(): List<T>
/**
* Initializes a new instance of the List class that is empty and has the specified initial capacity.
* @param capacity The number of elements that the new list can initially store.
*/
new <T>(capacity: number): List<T>
/**
* Initializes a new instance of the List class that contains elements copied from the specified arguments
* @param args Arbitrary number of arguments to copy to the new list.
*/
new <T>(...args: T[]): List<T>
/**
* Initializes a new instance of the List class that contains elements copied from the specified collection
* and has sufficient capacity to accommodate the number of elements copied.
* @param collection The collection whose elements are copied to the new list.
*/
new <T>(collection: Iterable<T>): List<T>
}
/**
* Represents a collection of key/value pairs that are sorted by key based on the associated Comparer implementation.
*/
interface SortedList<TKey, TValue> extends Collection<KeyValuePair<TKey, TValue>> {
/**
* Adds an element with the specified key and value into the SortedList.
* @param key The key of the element to add.
* @param value The value of the element to add. The value can be null for reference types.
*/
add(key: TKey, value: TValue): void
/**
* Gets the value associated with the specified key.
* @param key The key whose value to get.
*/
get(key: TKey): TValue
/**
* Gets or sets the number of elements that the SortedList can contain.
* @param value The number of elements that the SortedList can contain.
*/
capacity(value?: number): number
/**
* Removes all elements from the SortedList.
*/
clear(): void
/**
* Gets the Comparer for the sorted list.
*/
comparer(): Comparer<TKey>
/**
* Determines whether the SortedList contains a specific key.
* @param key The key to locate in the SortedList.
*/
containsKey(key: TKey): boolean
/**
* Determines whether the SortedList contains a specific value.
* @param value The value to locate in the SortedList.
*/
containsValue(value: TValue): boolean
/**
* Gets a collection containing the keys in the SortedList, in sorted order.
*/
keys(): Collection<TKey>
/**
* Gets a collection containing the values in the SortedLis.
*/
values(): Collection<TValue>
/**
* Searches for the specified key and returns the zero-based index within the entire SortedList.
* @param key The key to locate in the SortedList.
*/
indexOfKey(key: TKey): number
/**
* Searches for the specified value and returns the zero-based index of the first occurrence within the entire SortedList.
* @param value The value to locate in the SortedList.
*/
indexOfValue(value: TValue): number
/**
* Removes the element with the specified key from the SortedList.
* Returns true if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original SortedList.
* @param key The key of the element to remove.
*/
remove(key: TKey): boolean
/**
* Removes the element at the specified index of the SortedList.
* @param index The zero-based index of the element to remove.
*/
removeAt(index: number): void
/**
* Sets the value associated with the specified key.
* @param key The key whose value to get or set.
* @param value The value associated with the specified key.
*/
set(key: TKey, value: TValue): void
/**
* Sets the capacity to the actual number of elements in the SortedList, if that number is less than 90 percent of current capacity.
*/
trimExcess(): void
/**
* Gets the value associated with the specified key.
* @param key The key whose value to get.
* @param callback When this method returns, callback method is called with the value
* associated with the specified key, if the key is found; otherwise, null for the type of the value parameter.
*/
tryGetValue(key: TKey, callback: (value: TValue) => void): boolean
}
interface SortedListConstructor {
/**
* Initializes a new instance of the SortedList class that is empty,
* has the default initial capacity, and uses the default Comparer.
*/
new <TKey, TValue>(): SortedList<TKey, TValue>
/**
* Initializes a new instance of the SortedList class that contains elements copied from the specified Dictionary,
* has sufficient capacity to accommodate the number of elements copied, and uses the default Comparer.
* @param dictionary The Dictionary whose elements are copied to the new SortedList.
*/
new <TKey, TValue>(dictionary: Dictionary<TKey, TValue>): SortedList<TKey, TValue>
/**
* Initializes a new instance of the SortedList class that is empty,
* has the default initial capacity, and uses the specified Comparer.
* @param comparer The Comparer implementation to use when comparing keys.-or-null to use the default Comparer for the type of the key.
*/
new <TKey, TValue>(comparer: Comparer<TKey>): SortedList<TKey, TValue>
/**
* Initializes a new instance of the SortedList class that is empty,
* has the specified initial capacity, and uses the default Comparer.
* @param capacity The initial number of elements that the SortedList can contain.
*/
new <TKey, TValue>(capacity: number): SortedList<TKey, TValue>
/**
* Initializes a new instance of the SortedList class that contains elements copied from the specified Dictionary,
* has sufficient capacity to accommodate the number of elements copied, and uses the specified Comparer.
* @param dictionary The Dictionary whose elements are copied to the new SortedList.
* @param comparer The Comparer implementation to use when comparing keys.-or-null to use the default Comparer for the type of the key.
*/
new <TKey, TValue>(dictionary: Dictionary<TKey, TValue>, comparer: Comparer<TKey>): SortedList<TKey, TValue>
/**
* Initializes a new instance of the SortedList class that is empty,
* has the specified initial capacity, and uses the specified Comparer.
* @param capacity The initial number of elements that the SortedList can contain.
* @param comparer The Comparer implementation to use when comparing keys.-or-null to use the default Comparer for the type of the key.
*/
new <TKey, TValue>(capacity: number, comparer: Comparer<TKey>): SortedList<TKey, TValue>
}
/**
* Defines a key/value pair that can be set or retrieved.
*/
interface KeyValuePair<TKey, TValue> {
/**
* Gets the key in the key/value pair.
*/
key: TKey;
/**
* Gets the value in the key/value pair.
*/
value: TValue;
}
interface KeyValuePairConstructor {
/**
* Initializes a new instance of the KeyValuePair with the specified key and value.
* @param key The object defined in each key/value pair.
* @param value The definition associated with key.
*/
new <TKey, TValue>(key: TKey, value: TValue): KeyValuePair<TKey, TValue>
}
/**
* Represents a collection of keys and values.
*/
interface Dictionary<TKey, TValue> extends Collection<KeyValuePair<TKey, TValue>> {
/**
* Adds an element with the provided key and value to the Dictionary.
* @param key The object to use as the key of the element to add.
* @param value The object to use as the value of the element to add.
*/
add(key: TKey, value: TValue): void
/**
* Removes all keys and values from the Dictionary.
*/
clear(): void
/**
* Determines whether the Dictionary contains the specified key.
* @param key The key to locate in the Dictionary.
*/
containsKey(key: TKey): boolean
/**
* Determines whether the Dictionary contains a specific value.
* @param value The value to locate in the Dictionary.
*/
containsValue(value: TValue): boolean
/**
* Copies the Dictionary keys to an existing one-dimensional Array, starting at the specified array index.
* @param array The one-dimensional Array that is the destination of the elements copied from Dictionary keys.
* @param arrayIndex The zero-based index in array at which copying begins.
*/
copyTo(array: TKey[], arrayIndex: number): void
copyTo(array: KeyValuePair<TKey, TValue>[], arrayIndex: number): void
/**
* Gets a Collection containing the keys of the Dictionary.
*/
keys(): Collection<TKey>
/**
* Gets a Collection containing the values in the Dictionary.
*/
values(): Collection<TValue>
/**
* Gets element with the specified key.
* @param key The key of the element to get.
*/
get(key: TKey): TValue
/**
* Sets the element with the specified key.
* @param key The key of the element to set.
* @param value The object to use as the value of the element to set.
*/
set(key: TKey, value: TValue): void
/**
* Gets the value associated with the specified key.
* @param key The key whose value to get.
* @param callback When this method returns, callback method is called with the value
* associated with the specified key, if the key is found; otherwise, null for the type of the value parameter.
*/
tryGetValue(key: TKey, callback: (value: TValue) => void): boolean
/**
* Removes the element with the specified key from the Dictionary.
* @param key The key of the element to remove.
*/
remove(key: TKey): boolean
}
interface DictionaryConstructor {
/**
* Initializes a new instance of the Dictionary class that is empty,
*/
new <TKey, TValue>(): Dictionary<TKey, TValue>
/**
* Initializes a new instance of the Dictionary class that contains elements copied
* from the specified Dictionary and uses the default equality comparer for the key type.
* @param dictionary The Dictionary whose elements are copied to the new Dictionary.
*/
new <TKey, TValue>(dictionary: Dictionary<TKey, TValue>): Dictionary<TKey, TValue>
/**
* Initializes a new instance of the Dictionary class that is empty, and uses the specified EqualityComparer.
* @param comparer The EqualityComparer implementation to use when comparing keys.
*/
new <TKey, TValue>(comparer: EqualityComparer<TKey>): Dictionary<TKey, TValue>
/**
* Initializes a new instance of the Dictionary class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type.
* @param capacity The initial number of elements that the Dictionary can contain.
*/
new <TKey, TValue>(capacity: number): Dictionary<TKey, TValue>
/**
* Initializes a new instance of the Dictionary that is empty, has the specified initial capacity, and uses the specified EqualityComparer.
* @param capacity The initial number of elements that the Dictionary can contain.
* @param comparer The EqualityComparer implementation to use when comparing keys.
*/
new <TKey, TValue>(capacity: number, comparer: EqualityComparer<TKey>): Dictionary<TKey, TValue>
/**
* Initializes a new instance of the Dictionary class that contains elements copied
* from the specified Dictionary and uses the specified EqualityComparer.
* @param dictionary The Dictionary whose elements are copied to the new Dictionary.
* @param comparer The EqualityComparer implementation to use when comparing keys.
*/
new <TKey, TValue>(dictionary: Dictionary<TKey, TValue>, comparer: EqualityComparer<TKey>): Dictionary<TKey, TValue>
}
/**
* Represents a set of values.
*/
interface HashSet<T> extends Collection<T> {
/**
* Adds an element to the current set.
* @param item The element to add to the set.
*/
add(item: T): boolean
/**
* Removes all elements from a HashSet object.
*/
clear(): void
/**
* Copies the elements of a HashSet object to an array.
* @param array The one-dimensional array that is the destination of the elements copied from the HashSet object.
*/
copyTo(array: T[]): void
/**
* Copies the elements of a HashSet object to an array. starting at the specified array index.
* @param array The one-dimensional array that is the destination of the elements copied from the HashSet object.
* @param arrayIndex The zero-based index in array at which copying begins.
*/
copyTo(array: T[], arrayIndex: number): void
/**
* Copies the elements of a HashSet object to an array.
* @param array The one-dimensional array that is the destination of the elements copied from the HashSet object.
* @param arrayIndex The zero-based index in array at which copying begins.
* @param count The number of elements to copy to array.
*/
copyTo(array: T[], arrayIndex: number, count: number): void
/**
* Gets the EqualityComparer object that is used to determine equality for the values in the set.
*/
comparer(): EqualityComparer<T>
/**
* Removes the specified element from a HashSet object.
* @param item The element to remove.
*/
remove(item: T): boolean
/**
* Removes all elements that match the conditions defined by the specified predicate from a HashSet collection.
* @param match The predicate function that defines the conditions of the elements to remove.
*/
removeWhere(match: (item: T) => boolean): number
/**
* Removes all elements in the specified collection from the current set.
* @param other The collection of items to remove from the set.
*/
exceptWith(other: Iterable<T>): void
/**
* Modifies the current set so that it contains only elements that are also in a specified collection.
* @param other The collection to compare to the current set.
*/
intersectWith(other: Iterable<T>): void
/**
* Determines whether the current set is a proper (strict) subset of a specified collection.
* @param other The collection to compare to the current set.
*/
isProperSubsetOf(other: Iterable<T>): boolean
/**
* Determines whether the current set is a proper (strict) superset of a specified collection.
* @param other The collection to compare to the current set.
*/
isProperSupersetOf(other: Iterable<T>): boolean
/**
* Determines whether a set is a subset of a specified collection.
* @param other The collection to compare to the current set.
*/
isSubsetOf(other: Iterable<T>): boolean
/**
* Determines whether the current set is a superset of a specified collection.
* @param other The collection to compare to the current set.
*/
isSupersetOf(other: Iterable<T>): boolean
/**
* Determines whether the current set overlaps with the specified collection.
* @param other The collection to compare to the current set.
*/
overlaps(other: Iterable<T>): boolean
/**
* Determines whether the current set and the specified collection contain the same elements.
* @param other The collection to compare to the current set.
*/
setEquals(other: Iterable<T>): boolean
/**
* Modifies the current set so that it contains only elements that are present
* either in the current set or in the specified collection, but not both.
* @param other The collection to compare to the current set.
*/
symmetricExceptWith(other: Iterable<T>): void
/**
* Modifies the current set so that it contains all elements that are present
* in either the current set or the specified collection.
* @param other The collection to compare to the current set.
*/
unionWith(other: Iterable<T>): void
}
interface HashSetConstructor {
/**
* Initializes a new instance of the HashSet class that is empty and uses the default equality comparer for the set type.
*/
new <T>(): HashSet<T>
/**
* Initializes a new instance of the HashSet class that uses the default equality comparer for the set type,
* and contains elements copied from the specified collection.
* @param collection The collection whose elements are copied to the new set.
*/
new <T>(collection: Iterable<T>): HashSet<T>
/**
* Initializes a new instance of the HashSet class that is empty and uses the specified equality comparer for the set type.
* @param comparer The EqualityComparer implementation to use when comparing values in the set.
*/
new <T>(comparer: EqualityComparer<T>): HashSet<T>
/**
* Initializes a new instance of the HashSet class that uses the specified equality comparer for the set type,
* contains elements copied from the specified collection, and uses the specified equality comparer for the set type.
* @param collection The collection whose elements are copied to the new set.
* @param comparer The EqualityComparer implementation to use when comparing values in the set.
*/
new <T>(collection: Iterable<T>, comparer: EqualityComparer<T>): HashSet<T>
}
/**
* Represents a node in a LinkedList.
*/
interface LinkedListNode<T> {
/**
* Gets the value contained in the node.
*/
value(): T
/**
* Gets the LinkedList that the LinkedListNode belongs to.
*/
list(): LinkedList<T>
/**
* Gets the next node in the LinkedList.
*/
next(): LinkedListNode<T>
/**
* Gets the previous node in the LinkedList.
*/
previous(): LinkedListNode<T>
}
interface LinkedListNodeConstructor {
/**
* Initializes a new instance of the LinkedListNode class, containing the specified value.
* @param value The value to contain in the LinkedListNode
*/
new <T>(value: T): LinkedListNode<T>
}
/**
* Represents a doubly linked list.
*/
interface LinkedList<T> extends Collection<T> {
/**
* Adds an item to the LinkedList.
* @param item The object to add to the LinkedList.
*/
add(item: T): void
/**
* Removes all nodes from the LinkedList.
*/
clear(): void
/**
* Determines whether a value is in the LinkedList.
* @param value The value to locate in the LinkedList. The value can be null for reference types.
*/
contains(item: T): boolean
/**
* Gets the first node of the LinkedList.
*/
getFirst(): LinkedListNode<T>
/**
* Gets the last node of the LinkedList.
*/
getLast(): LinkedListNode<T>
/**
* Adds the specified new node after the specified existing node in the LinkedList and returns the new LinkedListNode.
* @param node The LinkedListNode after which to insert newNode.
* @param newNode The new LinkedListNode to add to the LinkedList.
*/
addAfter(node: LinkedListNode<T>, newNode: LinkedListNode<T>): LinkedListNode<T>
/**
* Adds the specified new node after the specified existing node in the LinkedList.
* returns The new LinkedListNode containing value.
* @param node The LinkedListNode after which to insert newNode.
* @param value The value to add to the LinkedList.
*/
addAfter(node: LinkedListNode<T>, value: T): LinkedListNode<T>
/**
* Adds the specified new node before the specified existing node in the LinkedList.
* returns The new LinkedListNode.
* @param node The LinkedListNode before which to insert newNode.
* @param newNode The new LinkedListNode to add to the LinkedList.
*/
addBefore(node: LinkedListNode<T>, newNode: LinkedListNode<T>): LinkedListNode<T>
/**
* Adds the specified new node before the specified existing node in the LinkedList.
* returns The new LinkedListNode containing value.
* @param node The LinkedListNode before which to insert newNode.
* @param value The value to add to the LinkedList.
*/
addBefore(node: LinkedListNode<T>, value: T): LinkedListNode<T>
/**
* Adds the specified new node at the start of the LinkedList.
* returns The new LinkedListNode.
* @param node The new LinkedListNode to add at the start of the LinkedList.
*/
addFirst(node: LinkedListNode<T>): LinkedListNode<T>
/**
* Adds the specified new node at the start of the LinkedList.
* returns The new LinkedListNode containing value.
* @param value The value to add at the start of the LinkedList.
*/
addFirst(value: T): LinkedListNode<T>
/**
* Adds the specified new node at the end of the LinkedList.
* returns The new LinkedListNode.
* @param node The new LinkedListNode to add at the end of the LinkedList.
*/
addLast(node: LinkedListNode<T>): LinkedListNode<T>
/**
* Adds the specified new node at the end of the LinkedList.
* returns The new LinkedListNode containing value.
* @param value The value to add at the end of the LinkedList.
*/
addLast(value: T): LinkedListNode<T>
/**
* Finds the first node that contains the specified value.
* @param value The value to locate in the LinkedList.
*/
find(value: T): LinkedListNode<T>
/**
* Finds the last node that contains the specified value.
* @param value The value to locate in the LinkedList.
*/
findLast(value: T): LinkedListNode<T>
/**
* Removes the node at the start of the LinkedList.
* returns true if the node is successfully removed; otherwise, false.
* This method also returns false if value was not found in the original LinkedList.
* @param node
*/
remove(node: LinkedListNode<T>): boolean
/**
* Removes the first occurrence of the specified value from the LinkedList.
* returns true if the element containing value is successfully removed; otherwise, false.
* This method also returns false if value was not found in the original LinkedList.
* @param value The value to remove from the LinkedList.
*/
remove(value: T): boolean
/**
* Removes the node at the start of the LinkedList.
*/
removeFirst(): void
/**
* Removes the node at the end of the LinkedList.
*/
removeLast(): void
}
interface LinkedListConstructor {
/**
* Initializes a new instance of the LinkedList class that is empty.
*/
new <T>(): LinkedList<T>
/**
* Initializes a new instance of the LinkedList class that contains elements copied from the specified Enumerable.
* @param collection The collection to copy elements from.
*/
new <T>(collection: Iterable<T>): LinkedList<T>
}
/**
* Represents a first-in, first-out collection of objects.
*/
interface Queue<T> extends Collection<T> {
/**
* Removes all objects from the Queue.
*/
clear(): void
/**
* Determines whether an element is in the Queue.
* @param item The object to locate in the Queue.
*/
contains(item: T): boolean
/**
* Removes and returns the object at the beginning of the Queue.
*/
dequeue(): T
/**
* Adds an object to the end of the Queue.
* @param item The object to add to the Queue.
*/
enqueue(item: T): void
/**
* Returns the object at the beginning of the Queue without removing it.
*/
peek(): T
/**
* Copies the Queue to a new array.
*/
toArray(): T[]
}
interface QueueConstructor {
/**
* Initializes a new instance of the Queue class that is empty.
*/
new <T>(): Queue<T>
/**
* Initializes a new instance of the Queue class that contains elements copied from the specified collection.
* @param collection The collection to copy elements from.
*/
new <T>(collection: Iterable<T>): Queue<T>
}
/**
* Represents a variable size last-in-first-out (LIFO) collection of instances of the same arbitrary type.
*/
interface Stack<T> extends Collection<T> {
/**
* Removes all objects from the Stack.
*/
clear(): void
/**
* Determines whether an element is in the Stack.
* @param item The object to locate in the Stack.
*/
contains(item: T): boolean
/**
* Returns the object at the top of the Stack without removing it.
*/
peek(): T
/**
* Removes and returns the object at the top of the Stack.
*/
pop(): T
/**
* Inserts an object at the top of the Stack.
* @param item The object to push onto the Stack.
*/
push(item: T): void
/**
* Copies the Stack to a new array.
*/
toArray(): T[]
}
interface StackConstructor {
/**
* Initializes a new instance of the Stack class that is empty.
*/
new <T>(): Stack<T>
/**
* Initializes a new instance of the Stack class that contains elements copied from the specified collection.
* @param collection The collection to copy elements from.
*/
new <T>(collection: Iterable<T>): Stack<T>
}
/**
* Defines a data structures that map keys to Enumerable sequences of values.
*/
interface Lookup<TKey, TElement> extends Collection<Grouping<TKey, TElement>> {