diff --git a/typescript-stl/index.d.ts b/typescript-stl/index.d.ts index 0182a888c3..bd6886deed 100644 --- a/typescript-stl/index.d.ts +++ b/typescript-stl/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for TypeScript-STL v1.2.0 +// Type definitions for TypeScript-STL v1.2.4 // Project: https://github.com/samchon/typescript-stl // Definitions by: Jeongho Nam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -155,45 +155,6 @@ declare namespace std { * of the range starting at first2, and false otherwise. */ function equal>(first1: InputIterator, last1: InputIterator, first2: Iterator, pred: (x: T, y: T) => boolean): boolean; - /** - *

Test whether range is permutation of another.

- * - *

Compares the elements in the range [first1, last1) with those in the range beginning at - * first2, and returns true if all of the elements in both ranges match, even in a different - * order.

- * - * @param first1 An {@link Iterator} to the initial position of the first sequence. - * @param last1 An {@link Iterator} to the final position in a sequence. The range used is - * [first1, last1), including the element pointed by first1, but not the element - * pointed by last1. - * @param first2 An {@link Iterator} to the initial position of the second sequence. The comparison includes up to - * as many elements of this sequence as those in the range [first1, last1). - * - * @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 Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2): boolean; - /** - *

Test whether range is permutation of another.

- * - *

Compares the elements in the range [first1, last1) with those in the range beginning at - * first2, and returns true if all of the elements in both ranges match, even in a different - * order.

- * - * @param first1 An {@link Iterator} to the initial position of the first sequence. - * @param last1 An {@link Iterator} to the final position in a sequence. The range used is - * [first1, last1), including the element pointed by first1, but not the element - * pointed by last1. - * @param first2 An {@link Iterator} to the initial position of the second sequence. The comparison includes up to - * as many elements of this sequence as those in the range [first1, last1). - * @param pred Binary function that accepts two elements as argument (one of each of the two sequences, in the same - * order), and returns a value convertible to bool. The value returned indicates whether - * the elements are considered to match in the context of this function. - * - * @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 Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, pred: (x: T, y: T) => boolean): boolean; /** *

Lexicographical less-than comparison.

* @@ -1464,7 +1425,7 @@ declare namespace std { * by last. {@link IArrayIterator RandomAccessIterator} shall point to a type for which * {@link Iterator.swap swap} is properly defined. */ - function make_heap>(fisrt: RandomAccessIterator, last: RandomAccessIterator): void; + function make_heap>(first: RandomAccessIterator, last: RandomAccessIterator): void; /** *

Make heap from range.

* @@ -1496,7 +1457,7 @@ declare namespace std { * The function shall not modify any of its arguments. This can either be a function pointer or a * function object. */ - function make_heap>(fisrt: RandomAccessIterator, last: RandomAccessIterator, compare: (x: T, y: T) => boolean): void; + function make_heap>(first: RandomAccessIterator, last: RandomAccessIterator, compare: (x: T, y: T) => boolean): void; /** *

Push element into heap range.

* @@ -1516,7 +1477,7 @@ declare namespace std { * pointed by last. {@link IArrayIterator RandomAccessIterator} shall point to a type for which * {@link Iterator.swap swap} is properly defined. */ - function push_heap>(fisrt: RandomAccessIterator, last: RandomAccessIterator): void; + function push_heap>(first: RandomAccessIterator, last: RandomAccessIterator): void; /** *

Push element into heap range.

* @@ -1541,7 +1502,7 @@ declare namespace std { * The function shall not modify any of its arguments. This can either be a function pointer or a * function object. */ - function push_heap>(fisrt: RandomAccessIterator, last: RandomAccessIterator, compare: (x: T, y: T) => boolean): void; + function push_heap>(first: RandomAccessIterator, last: RandomAccessIterator, compare: (x: T, y: T) => boolean): void; /** *

Pop element from heap range.

* @@ -1563,7 +1524,7 @@ declare namespace std { * {@link IArrayIterator RandomAccessIterator} shall point to a type for which {@link Iterator.swap swap} * is properly defined. */ - function pop_heap>(fisrt: RandomAccessIterator, last: RandomAccessIterator): void; + function pop_heap>(first: RandomAccessIterator, last: RandomAccessIterator): void; /** *

Pop element from heap range.

* @@ -1590,7 +1551,7 @@ declare namespace std { * The function shall not modify any of its arguments. This can either be a function pointer or a * function object. */ - function pop_heap>(fisrt: RandomAccessIterator, last: RandomAccessIterator, compare: (x: T, y: T) => boolean): void; + function pop_heap>(first: RandomAccessIterator, last: RandomAccessIterator, compare: (x: T, y: T) => boolean): void; /** *

Test if range is heap.

* @@ -1697,7 +1658,7 @@ declare namespace std { * {@link IArrayIterator RandomAccessIterator} shall point to a type for which {@link Iterator.swap swap} * is properly defined. */ - function sort_heap>(fisrt: RandomAccessIterator, last: RandomAccessIterator): void; + function sort_heap>(first: RandomAccessIterator, last: RandomAccessIterator): void; /** *

Sort elements of heap.

* @@ -1719,7 +1680,7 @@ declare namespace std { * The function shall not modify any of its arguments. This can either be a function pointer or a * function object. */ - function sort_heap>(fisrt: RandomAccessIterator, last: RandomAccessIterator, compare: (x: T, y: T) => boolean): void; + function sort_heap>(first: RandomAccessIterator, last: RandomAccessIterator, compare: (x: T, y: T) => boolean): void; } declare namespace std { /** @@ -2663,6 +2624,159 @@ declare namespace std { * [first, last) as first element, and the largest as second. */ function minmax_element>(first: ForwardIterator, last: ForwardIterator, compare: (x: T, y: T) => boolean): Pair; + /** + *

Test whether range is permutation of another.

+ * + *

Compares the elements in the range [first1, last1) with those in the range beginning at + * first2, and returns true if all of the elements in both ranges match, even in a different + * order.

+ * + * @param first1 An {@link Iterator} to the initial position of the first sequence. + * @param last1 An {@link Iterator} to the final position in a sequence. The range used is + * [first1, last1), including the element pointed by first1, but not the element + * pointed by last1. + * @param first2 An {@link Iterator} to the initial position of the second sequence. The comparison includes up to + * as many elements of this sequence as those in the range [first1, last1). + * + * @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 Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2): boolean; + /** + *

Test whether range is permutation of another.

+ * + *

Compares the elements in the range [first1, last1) with those in the range beginning at + * first2, and returns true if all of the elements in both ranges match, even in a different + * order.

+ * + * @param first1 An {@link Iterator} to the initial position of the first sequence. + * @param last1 An {@link Iterator} to the final position in a sequence. The range used is + * [first1, last1), including the element pointed by first1, but not the element + * pointed by last1. + * @param first2 An {@link Iterator} to the initial position of the second sequence. The comparison includes up to + * as many elements of this sequence as those in the range [first1, last1). + * @param pred Binary function that accepts two elements as argument (one of each of the two sequences, in the same + * order), and returns a value convertible to bool. The value returned indicates whether + * the elements are considered to match in the context of this function. + * + * @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 Iterator>(first1: Iterator1, last1: Iterator1, first2: Iterator2, pred: (x: T, y: T) => boolean): boolean; + /** + * Transform range to previous permutation. + * + * Rearranges the elements in the range [*first*, *last*) into the previous *lexicographically-ordered* permutation. + * + * A *permutation* is each one of the N! possible arrangements the elements can take (where *N* is the number of + * elements in the range). Different permutations can be ordered according to how they compare + * {@link lexicographicaly lexicographical_compare} to each other; The first such-sorted possible permutation (the one + * that would compare *lexicographically smaller* to all other permutations) is the one which has all its elements + * sorted in ascending order, and the largest has all its elements sorted in descending order. + * + * The comparisons of individual elements are performed using the {@link std.less std.less()} function. + * + * If the function can determine the previous permutation, it rearranges the elements as such and returns true. If + * that was not possible (because it is already at the lowest possible permutation), it rearranges the elements + * according to the last permutation (sorted in descending order) and returns false. + * + * @param first Bidirectional iterators to the initial positions of the sequence + * @param last Bidirectional iterators to the final positions of the 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*. + * + * @return true if the function could rearrange the object as a lexicographicaly smaller permutation. Otherwise, the + * function returns false to indicate that the arrangement is not less than the previous, but the largest + * possible (sorted in descending order). + */ + function prev_permutation>(first: BidirectionalIterator, last: BidirectionalIterator): boolean; + /** + * Transform range to previous permutation. + * + * Rearranges the elements in the range [*first*, *last*) into the previous *lexicographically-ordered* permutation. + * + * A *permutation* is each one of the N! possible arrangements the elements can take (where *N* is the number of + * elements in the range). Different permutations can be ordered according to how they compare + * {@link lexicographicaly lexicographical_compare} to each other; The first such-sorted possible permutation (the one + * that would compare *lexicographically smaller* to all other permutations) is the one which has all its elements + * sorted in ascending order, and the largest has all its elements sorted in descending order. + * + * The comparisons of individual elements are performed using the *compare*. + * + * If the function can determine the previous permutation, it rearranges the elements as such and returns true. If + * that was not possible (because it is already at the lowest possible permutation), it rearranges the elements + * according to the last permutation (sorted in descending order) and returns false. + * + * @param first Bidirectional iterators to the initial positions of the sequence + * @param last Bidirectional iterators to the final positions of the 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*. + * @param compare Binary function that accepts two arguments of the type pointed by BidirectionalIterator, and returns + * a value convertible to bool. The value returned indicates whether the first argument is considered + * to go before the second in the specific strict weak ordering it defines. + * + * @return true if the function could rearrange the object as a lexicographicaly smaller permutation. Otherwise, the + * function returns false to indicate that the arrangement is not less than the previous, but the largest + * possible (sorted in descending order). + */ + function prev_permutation>(first: BidirectionalIterator, last: BidirectionalIterator, compare: (x: T, y: T) => boolean): boolean; + /** + * Transform range to next permutation. + * + * Rearranges the elements in the range [*first*, *last*) into the next *lexicographically greater* permutation. + * + * A permutation is each one of the *N!* possible arrangements the elements can take (where *N* is the number of + * elements in the range). Different permutations can be ordered according to how they compare + * {@link lexicographicaly lexicographical_compare} to each other; The first such-sorted possible permutation (the one + * that would compare *lexicographically smaller* to all other permutations) is the one which has all its elements + * sorted in ascending order, and the largest has all its elements sorted in descending order. + * + * The comparisons of individual elements are performed using the {@link std.less} function. + * + * If the function can determine the next higher permutation, it rearranges the elements as such and returns true. If + * that was not possible (because it is already at the largest possible permutation), it rearranges the elements + * according to the first permutation (sorted in ascending order) and returns false. + * + * @param first Bidirectional iterators to the initial positions of the sequence + * @param last Bidirectional iterators to the final positions of the 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*. + * + * @return true if the function could rearrange the object as a lexicographicaly greater permutation. Otherwise, the + * function returns false to indicate that the arrangement is not greater than the previous, but the lowest + * possible (sorted in ascending order). + */ + function next_permutation>(first: BidirectionalIterator, last: BidirectionalIterator): boolean; + /** + * Transform range to next permutation. + * + * Rearranges the elements in the range [*first*, *last*) into the next *lexicographically greater* permutation. + * + * A permutation is each one of the *N!* possible arrangements the elements can take (where *N* is the number of + * elements in the range). Different permutations can be ordered according to how they compare + * {@link lexicographicaly lexicographical_compare} to each other; The first such-sorted possible permutation (the one + * that would compare *lexicographically smaller* to all other permutations) is the one which has all its elements + * sorted in ascending order, and the largest has all its elements sorted in descending order. + * + * The comparisons of individual elements are performed using the *compare*. + * + * If the function can determine the next higher permutation, it rearranges the elements as such and returns true. If + * that was not possible (because it is already at the largest possible permutation), it rearranges the elements + * according to the first permutation (sorted in ascending order) and returns false. + * + * @param first Bidirectional iterators to the initial positions of the sequence + * @param last Bidirectional iterators to the final positions of the 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*. + * @param compare Binary function that accepts two arguments of the type pointed by BidirectionalIterator, and returns + * a value convertible to bool. The value returned indicates whether the first argument is considered + * to go before the second in the specific strict weak ordering it defines. + * + * @return true if the function could rearrange the object as a lexicographicaly greater permutation. Otherwise, the + * function returns false to indicate that the arrangement is not greater than the previous, but the lowest + * possible (sorted in ascending order). + */ + function next_permutation>(first: BidirectionalIterator, last: BidirectionalIterator, compare: (x: T, y: T) => boolean): boolean; } declare namespace std.base { /** @@ -4121,16 +4235,16 @@ declare namespace std { *

Compare two iterators and returns whether they are equal or not.

* *

Note

- *

Iterator's equal_to() only compare souce container and index number.

+ *

Iterator's {@link equals equals()} only compare souce container and index number.

* - *

Although elements in a pair, key and value are equal_to, if the source map or - * index number is different, then the {@link equal_to equal_to()} will return false. If you want to + *

Although elements in a pair, key and value are {@link std.equal_to equal_to}, if the source map or + * index number is different, then the {@link equals equals()} will return false. If you want to * compare the elements of a pair, compare them directly by yourself.

* * @param obj An iterator to compare * @return Indicates whether equal or not. */ - equal_to(obj: Iterator): boolean; + equals(obj: Iterator): boolean; /** *

Get value of the iterator is pointing.

* @@ -4212,7 +4326,7 @@ declare namespace std { /** * @inheritdoc */ - equal_to(obj: This): boolean; + equals(obj: This): boolean; /** * @inheritdoc */ @@ -4425,7 +4539,7 @@ declare namespace std.base { * * @author Jeongho Nam */ - abstract class ListContainer> extends Container implements IDequeContainer { + abstract class ListContainer> extends Container implements IDequeContainer { /** * @hidden */ @@ -4442,7 +4556,14 @@ declare namespace std.base { * Default Constructor. */ protected constructor(); - protected abstract _Create_iterator(prev: BidrectionalIterator, next: BidrectionalIterator, val: T): BidrectionalIterator; + /** + * @hidden + */ + protected abstract _Create_iterator(prev: BidirectionalIterator, next: BidirectionalIterator, val: T): BidirectionalIterator; + /** + * @hidden + */ + protected _Set_begin(it: BidirectionalIterator): void; /** * @inheritdoc */ @@ -4454,11 +4575,11 @@ declare namespace std.base { /** * @inheritdoc */ - begin(): BidrectionalIterator; + begin(): BidirectionalIterator; /** * @inheritdoc */ - end(): BidrectionalIterator; + end(): BidirectionalIterator; /** * @inheritdoc */ @@ -4508,7 +4629,7 @@ declare namespace std.base { * * @return An iterator that points to the newly inserted element; val. */ - insert(position: BidrectionalIterator, val: T): BidrectionalIterator; + insert(position: BidirectionalIterator, val: T): BidirectionalIterator; /** *

Insert elements by repeated filling.

* @@ -4527,7 +4648,7 @@ declare namespace std.base { * * @return An iterator that points to the first of the newly inserted elements. */ - insert(position: BidrectionalIterator, size: number, val: T): BidrectionalIterator; + insert(position: BidirectionalIterator, size: number, val: T): BidirectionalIterator; /** *

Insert elements by range iterators.

* @@ -4546,7 +4667,7 @@ declare namespace std.base { * * @return An iterator that points to the first of the newly inserted elements. */ - insert>(position: BidrectionalIterator, begin: InputIterator, end: InputIterator): BidrectionalIterator; + insert>(position: BidirectionalIterator, begin: InputIterator, end: InputIterator): BidirectionalIterator; /** * @hidden */ @@ -4554,11 +4675,11 @@ declare namespace std.base { /** * @hidden */ - protected _Insert_by_repeating_val(position: BidrectionalIterator, size: number, val: T): BidrectionalIterator; + protected _Insert_by_repeating_val(position: BidirectionalIterator, size: number, val: T): BidirectionalIterator; /** * @hidden */ - protected _Insert_by_range>(position: BidrectionalIterator, begin: InputIterator, end: InputIterator): BidrectionalIterator; + protected _Insert_by_range>(position: BidirectionalIterator, begin: InputIterator, end: InputIterator): BidirectionalIterator; /** *

Erase an element.

* @@ -4574,7 +4695,7 @@ declare namespace std.base { * @return An iterator pointing to the element that followed the last element erased by the function call. * This is the {@link end end()} if the operation erased the last element in the sequence. */ - erase(position: BidrectionalIterator): BidrectionalIterator; + erase(position: BidirectionalIterator): BidirectionalIterator; /** *

Erase elements.

* @@ -4591,11 +4712,11 @@ declare namespace std.base { * @return An iterator pointing to the element that followed the last element erased by the function call. * This is the {@link end end()} if the operation erased the last element in the sequence. */ - erase(begin: BidrectionalIterator, end: BidrectionalIterator): BidrectionalIterator; + erase(begin: BidirectionalIterator, end: BidirectionalIterator): BidirectionalIterator; /** * @hidden */ - protected _Erase_by_range(first: BidrectionalIterator, last: BidrectionalIterator): BidrectionalIterator; + protected _Erase_by_range(first: BidirectionalIterator, last: BidirectionalIterator): BidirectionalIterator; /** *

Swap content.

* @@ -4613,7 +4734,7 @@ declare namespace std.base { * with the same template parameter, T) whose content is swapped with that of this * {@link container List}. */ - swap(obj: ListContainer): void; + swap(obj: ListContainer): void; /** * @inheritdoc */ @@ -4671,7 +4792,7 @@ declare namespace std.base { /** * @inheritdoc */ - equal_to(obj: ListIteratorBase): boolean; + equals(obj: ListIteratorBase): boolean; /** * @inheritdoc */ @@ -5155,8 +5276,10 @@ declare namespace std.base { */ class MapElementList extends ListContainer, MapIterator> { private associative_; + private rend_; constructor(associative: MapContainer); protected _Create_iterator(prev: MapIterator, next: MapIterator, val: Pair): MapIterator; + protected _Set_begin(it: MapIterator): void; get_associative(): MapContainer; rbegin(): MapReverseIterator; rend(): MapReverseIterator; @@ -5210,16 +5333,20 @@ declare namespace std { */ second: T; /** - *

Whether an iterator is equal with the iterator.

- * - *

Compare two iterators and returns whether they are equal or not.

- * - * @param obj An iterator to compare - * @return Indicates whether equal or not. + * @inheritdoc + */ + less(obj: MapIterator): boolean; + /** + * @inheritdoc + */ + equals(obj: MapIterator): boolean; + /** + * @inheritdoc + */ + hashCode(): number; + /** + * @inheritdoc */ - equal_to(obj: MapIterator): boolean; - less(obj: MapIterator): boolean; - hash(): number; swap(obj: MapIterator): void; } /** @@ -5660,8 +5787,10 @@ declare namespace std.base { */ class SetElementList extends ListContainer> { private associative_; + private rend_; constructor(associative: SetContainer); protected _Create_iterator(prev: SetIterator, next: SetIterator, val: T): SetIterator; + protected _Set_begin(it: SetIterator): void; get_associative(): SetContainer; rbegin(): SetReverseIterator; rend(): SetReverseIterator; @@ -5707,15 +5836,15 @@ declare namespace std { /** * @inheritdoc */ - equal_to(obj: SetIterator): boolean; + less(obj: SetIterator): boolean; /** * @inheritdoc */ - less(obj: SetIterator): boolean; + equals(obj: SetIterator): boolean; /** * @inheritdoc */ - hash(): number; + hashCode(): number; /** * @inheritdoc */ @@ -7617,6 +7746,14 @@ declare namespace std { * @hidden */ private get_col_size(); + /** + * @hidden + */ + private end_; + /** + * @hidden + */ + private rend_; /** *

Default Constructor.

* @@ -7886,21 +8023,9 @@ declare namespace std { */ advance(n: number): DequeIterator; /** - *

Whether an iterator is equal with the iterator.

- * - *

Compare two iterators and returns whether they are equal or not.

- * - *

Note

- *

Iterator's equal_to() only compare souce container and index number.

- * - *

Although elements in a pair, key and value are equal_to, if the source map or - * index number is different, then the {@link equal_to equal_to()} will return false. If you want to - * compare the elements of a pair, compare them directly by yourself.

- * - * @param obj An iterator to compare - * @return Indicates whether equal or not. + * @inheritdoc */ - equal_to(obj: DequeIterator): boolean; + equals(obj: DequeIterator): boolean; /** * @inheritdoc */ @@ -8427,104 +8552,6 @@ declare namespace std { * @return Result of bitwise XOR operation. */ function bit_xor(x: number, y: number): number; - /** - *

Comparable instance.

- * - *

{@link IComparable} is a common interface for objects who can compare each other.

- * - * @reference https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html - * @author Jeongho Nam - */ - interface IComparable extends Object { - /** - *

Indicates whether some other object is "equal to" this one.

- * - *

The {@link equal_to} method implements an equivalence relation on non-null object references:

- * - *
    - *
  • - * It is reflexive: for any non-null reference value x, x.equal_to(x) - * should return true. - *
  • - *
  • - * It is symmetric: for any non-null reference values x and y, - * x.equal_to(y) should return true if and only if y.equal_to(x) - * returns true.
  • - *
  • - * It is transitive: for any non-null reference values x, y, and - * z, if x.equal_to(y) returns true and y.equal_to(z) - * returns true, then x.equal_to(z) should return true. - *
  • - *
  • - * It is consistent: for any non-null reference values x and y, multiple - * invocations of x.equal_to(y) consistently return true or consistently return - * false, provided no information used in equal_to comparisons on the objects is modified. - *
  • - *
  • - * For any non-null reference value x, x.equal_to(null) should return - * false. - *
  • - *
- * - *

The {@link equal_to} method for interface {@link IComparable} implements the most discriminating possible - * equivalence relation on objects; that is, for any non-null reference values x and - * y, this method returns true if and only if x and y - * refer to the same object (x == y has the value true).

- * - *

Note that it is generally necessary to override the {@link hash_code} method whenever this method is - * overridden, so as to maintain the general contract for the {@link hash_code} method, which states that - * equal objects must have equal hash codes.

- * - *
    - *
  • {@link IComparable.equal_to} is called by {@link std.equal_to}.
  • - *
- * - * @param obj the reference object with which to compare. - * - * @return true if this object is the same as the obj argument; false otherwise. - */ - equal_to(obj: T): boolean; - /** - *

Less-than inequality comparison.

- * - *

Binary method returns whether the the instance compares less than the obj.

- * - *
    - *
  • - * {@link IComparable.less} is called by {@link std.less}. Also, this method can be used on standard - * algorithms such as {@link sort sort()}, {@link merge merge()} or - * {@link TreeMap.lower_bound lower_bound()}. - *
  • - *
- * - * @param obj the reference object with which to compare. - * - * @return Whether the first parameter is less than the second. - */ - less(obj: T): boolean; - /** - *

Issue a hash code.

- * - *

Returns a hash code value for the object. This method is supported for the benefit of hash tables such - * as those provided by hash containers; {@link HashSet}, {@link HashMap}, {@link MultiHashSet} and - * {@link MultiHashMap}.

- * - *

As much as is reasonably practical, the {@link hash_code} method defined by interface - * {@link IComparable} does return distinct integers for distinct objects. (This is typically implemented by - * converting the internal address of the object into an integer, but this implementation technique is not - * required by the JavaScript programming language.)

- * - *
    - *
  • - * {@link IComparable.hash_code} is called by {@link std.hash_code}. If you want to keep basically - * provided hash function, then returns {@link std.Hash.code}; return std.Hash.code(this); - *
  • - *
- * - * @return An hash code who represents the object. - */ - hash(): number; - } /** *

Default hash function for number.

* @@ -9530,6 +9557,106 @@ declare namespace std { swap(obj: base.IContainer): void; } } +declare namespace std { + /** + *

Comparable instance.

+ * + *

{@link IComparable} is a common interface for objects who can compare each other.

+ * + * @reference https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html + * @author Jeongho Nam + */ + interface IComparable extends Object { + /** + *

Indicates whether some other object is "equal to" this one.

+ * + *

The {@link equal_to} method implements an equivalence relation on non-null object references:

+ * + *
    + *
  • + * It is reflexive: for any non-null reference value x, x.equal_to(x) + * should return true. + *
  • + *
  • + * It is symmetric: for any non-null reference values x and y, + * x.equal_to(y) should return true if and only if y.equal_to(x) + * returns true.
  • + *
  • + * It is transitive: for any non-null reference values x, y, and + * z, if x.equal_to(y) returns true and y.equal_to(z) + * returns true, then x.equal_to(z) should return true. + *
  • + *
  • + * It is consistent: for any non-null reference values x and y, multiple + * invocations of x.equal_to(y) consistently return true or consistently return + * false, provided no information used in equal_to comparisons on the objects is modified. + *
  • + *
  • + * For any non-null reference value x, x.equal_to(null) should return + * false. + *
  • + *
+ * + *

The {@link equal_to} method for interface {@link IComparable} implements the most discriminating possible + * equivalence relation on objects; that is, for any non-null reference values x and + * y, this method returns true if and only if x and y + * refer to the same object (x == y has the value true).

+ * + *

Note that it is generally necessary to override the {@link hash_code} method whenever this method is + * overridden, so as to maintain the general contract for the {@link hash_code} method, which states that + * equal objects must have equal hash codes.

+ * + *
    + *
  • {@link IComparable.equal_to} is called by {@link std.equal_to}.
  • + *
+ * + * @param obj the reference object with which to compare. + * + * @return true if this object is the same as the obj argument; false otherwise. + */ + equals(obj: T): boolean; + /** + *

Less-than inequality comparison.

+ * + *

Binary method returns whether the the instance compares less than the obj.

+ * + *
    + *
  • + * {@link IComparable.less} is called by {@link std.less}. Also, this method can be used on standard + * algorithms such as {@link sort sort()}, {@link merge merge()} or + * {@link TreeMap.lower_bound lower_bound()}. + *
  • + *
+ * + * @param obj the reference object with which to compare. + * + * @return Whether the first parameter is less than the second. + */ + less(obj: T): boolean; + /** + *

Issue a hash code.

+ * + *

Returns a hash code value for the object. This method is supported for the benefit of hash tables such + * as those provided by hash containers; {@link HashSet}, {@link HashMap}, {@link MultiHashSet} and + * {@link MultiHashMap}.

+ * + *

As much as is reasonably practical, the {@link hash_code} method defined by interface + * {@link IComparable} does return distinct integers for distinct objects. (This is typically implemented by + * converting the internal address of the object into an integer, but this implementation technique is not + * required by the JavaScript programming language.)

+ * + *
    + *
  • + * {@link IComparable.hash_code} is called by {@link std.hash_code}. If you want to keep basically + * provided hash function, then returns {@link std.Hash.code}; return std.Hash.code(this); + *
  • + *
+ * + * @return An hash code who represents the object. + */ + hashCode?(): number; + } +} declare namespace std.List { type iterator = std.ListIterator; type reverse_iterator = std.ListReverseIterator; @@ -9577,6 +9704,7 @@ declare namespace std { * @author Jeongho Nam */ class List extends base.ListContainer> { + private rend_; /** *

Default Constructor.

* @@ -9620,7 +9748,14 @@ declare namespace std { * @param end Input interator of the final position in a sequence. */ constructor(begin: Iterator, end: Iterator); + /** + * @hidden + */ protected _Create_iterator(prev: ListIterator, next: ListIterator, val: T): ListIterator; + /** + * @hidden + */ + protected _Set_begin(it: ListIterator): void; /** * @inheritdoc */ @@ -10132,7 +10267,7 @@ declare namespace std { /** * @inheritdoc */ - equal_to(obj: ListIterator): boolean; + equals(obj: ListIterator): boolean; /** * @inheritdoc */ @@ -10234,6 +10369,14 @@ declare namespace std { * @author Jeongho Nam */ class Vector extends Array implements base.IContainer, base.IArrayContainer { + /** + * @hidden + */ + private end_; + /** + * @hidden + */ + private rend_; /** *

Default Constructor.

* @@ -10663,21 +10806,9 @@ declare namespace std { */ advance(n: number): VectorIterator; /** - *

Whether an iterator is equal with the iterator.

- * - *

Compare two iterators and returns whether they are equal or not.

- * - *

Note

- *

Iterator's equal_to() only compare souce container and index number.

- * - *

Although elements in a pair, key and value are equal_to, if the source map or - * index number is different, then the {@link equal_to equal_to()} will return false. If you want to - * compare the elements of a pair, compare them directly by yourself.

- * - * @param obj An iterator to compare - * @return Indicates whether equal or not. + * @inheritdoc */ - equal_to(obj: VectorIterator): boolean; + equals(obj: VectorIterator): boolean; /** * @inheritdoc */ @@ -12211,7 +12342,7 @@ declare namespace std { * @reference http://www.cplusplus.com/reference/utility/pair * @author Jeongho Nam */ - class Pair { + class Pair implements IComparable> { /** *

A first value in the Pair.

*/ @@ -12238,7 +12369,10 @@ declare namespace std { * @param obj A Map to compare * @return Indicates whether equal or not. */ - equal_to(pair: Pair): boolean; + equals(pair: Pair): boolean; + /** + * @inheritdoc + */ less(pair: Pair): boolean; } /**