add crossplatform tag for utils and worker

Signed-off-by: tanglizhen <tanglizhen2@huawei.com>
This commit is contained in:
tanglizhen 2023-06-07 15:38:05 +08:00
parent 32e551ed73
commit 4e37732f4e
15 changed files with 3940 additions and 401 deletions

View File

@ -19,26 +19,47 @@
*
* @namespace ArrayList
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* ArrayList is a linear data structure that is implemented based on arrays.
* ArrayList can dynamically adjust the capacity based on project requirements. It increases the capacity by 50% each time.
*
* @namespace ArrayList
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare class ArrayList<T> {
/**
* A constructor used to create a ArrayList object.
*
* @throws { BusinessError } 10200012 - The ArrayList's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* A constructor used to create a ArrayList object.
*
* @throws { BusinessError } 10200012 - The ArrayList's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
constructor();
/**
* Gets the element number of the ArrayList.This is a number one higher than the highest index in the arraylist.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the element number of the ArrayList.This is a number one higher than the highest index in the arraylist.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
length: number;
/**
* Appends the specified element to the end of this arraylist.
@ -47,9 +68,18 @@ declare class ArrayList<T> {
* @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails.
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Appends the specified element to the end of this arraylist.
*
* @param { T } element - element element to be appended to this arraylist
* @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails.
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
add(element: T): boolean;
/**
* Inserts the specified element at the specified position in this
@ -62,9 +92,22 @@ declare class ArrayList<T> {
* @throws { BusinessError } 10200011 - The insert method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Inserts the specified element at the specified position in this
* arraylist. Shifts the element currently at that position (if any) and
* any subsequent elements to the right (adds one to their index).
*
* @param { T } element - element element element to be inserted
* @param { number } index - index index at which the specified element is to be inserted
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 10200011 - The insert method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
insert(element: T, index: number): void;
/**
* Check if arraylist contains the specified element
@ -73,9 +116,18 @@ declare class ArrayList<T> {
* @returns { boolean } the boolean type,if arraylist contains the specified element,return true,else return false
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Check if arraylist contains the specified element
*
* @param { T } element - element element element to be contained
* @returns { boolean } the boolean type,if arraylist contains the specified element,return true,else return false
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
has(element: T): boolean;
/**
* Returns the index of the first occurrence of the specified element
@ -85,9 +137,19 @@ declare class ArrayList<T> {
* @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index.
* @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the index of the first occurrence of the specified element
* in this arraylist, or -1 if this arraylist does not contain the element.
*
* @param { T } element - element element element to be contained
* @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index.
* @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getIndexOf(element: T): number;
/**
* Find the corresponding element according to the index,
@ -99,9 +161,21 @@ declare class ArrayList<T> {
* @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Find the corresponding element according to the index,
* delete the element, and move the index of all elements to the right of the element forward by one.
*
* @param { number } index - index index the index in the arraylist
* @returns { T } the T type ,returns undefined if arraylist is empty,If the index is
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeByIndex(index: number): T;
/**
* Removes the first occurrence of the specified element from this arraylist,
@ -112,9 +186,20 @@ declare class ArrayList<T> {
* @returns { boolean } the boolean type ,If there is no such element, return false
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Removes the first occurrence of the specified element from this arraylist,
* if it is present. If the arraylist does not contain the element, it is
* unchanged. More formally, removes the element with the lowest index
*
* @param { T } element - element element element to remove
* @returns { boolean } the boolean type ,If there is no such element, return false
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
remove(element: T): boolean;
/**
* Returns in the index of the last occurrence of the specified element in this arraylist ,
@ -124,9 +209,19 @@ declare class ArrayList<T> {
* @returns { number } the number type
* @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns in the index of the last occurrence of the specified element in this arraylist ,
* or -1 if the arraylist does not contain the element.
*
* @param { T } element - element element element to find
* @returns { number } the number type
* @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getLastIndexOf(element: T): number;
/**
* Removes from this arraylist all of the elements whose index is between fromIndex,inclusive,and toIndex ,exclusive.
@ -137,9 +232,20 @@ declare class ArrayList<T> {
* @throws { BusinessError } 10200011 - The removeByRange method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Removes from this arraylist all of the elements whose index is between fromIndex,inclusive,and toIndex ,exclusive.
*
* @param { number } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position
* @param { number } toIndex - toIndex toIndex the end of the index, excluding the value at that index
* @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range.
* @throws { BusinessError } 10200011 - The removeByRange method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeByRange(fromIndex: number, toIndex: number): void;
/**
* Replaces each element of this arraylist with the result of applying the operator to that element.
@ -152,9 +258,22 @@ declare class ArrayList<T> {
* @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Replaces each element of this arraylist with the result of applying the operator to that element.
*
* @param { (value: T, index?: number, arrlist?: ArrayList<T>) => T } callbackFn - callbackFn
* callbackFn (required) A function that accepts up to four arguments.The function to be called for
* each element in the arraylist,Returns the result of an operation
* @param { Object } thisArg - thisArg thisArg (Optional) The value passed to the function generally uses the "this" value.
* If this parameter is empty, "undefined" will be passed to the "this" value
* @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
replaceAllElements(callbackFn: (value: T, index?: number, arrlist?: ArrayList<T>) => T, thisArg?: Object): void;
/**
* Executes a provided function once for each value in the arraylist object.
@ -167,9 +286,22 @@ declare class ArrayList<T> {
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Executes a provided function once for each value in the arraylist object.
*
* @param { (value: T, index?: number, arrlist?: ArrayList<T>) => void } callbackFn - callbackFn
* callbackFn (required) A function that accepts up to four arguments.The function to
* be called for each element in the arraylist
* @param { Object } thisArg - thisArg thisArg (Optional) The value passed to the function generally uses the "this" value.
* If this parameter is empty, "undefined" will be passed to the "this" value
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
forEach(callbackFn: (value: T, index?: number, arrlist?: ArrayList<T>) => void, thisArg?: Object): void;
/**
* Sorts this arraylist according to the order induced by the specified comparator,without comparator this parameter,
@ -183,9 +315,23 @@ declare class ArrayList<T> {
* @throws { BusinessError } 10200011 - The sort method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Sorts this arraylist according to the order induced by the specified comparator,without comparator this parameter,
* it will default to ASCII sorting
*
* @param { (firstValue: T, secondValue: T) => number } comparator - comparator
* comparator (Optional) A function that accepts up to two arguments.Specifies the sort order.
* Must be a function,return number type,If it returns firstValue minus secondValue, it returns an arraylist
* sorted in ascending order;If it returns secondValue minus firstValue, it returns an arraylist sorted in descending order;
* If this parameter is empty, it will default to ASCII sorting
* @throws { BusinessError } 10200011 - The sort method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
sort(comparator?: (firstValue: T, secondValue: T) => number): void;
/**
* Returns a view of the portion of this arraylist between the specified fromIndex,inclusive,and toIndex,exclusive
@ -197,9 +343,21 @@ declare class ArrayList<T> {
* @throws { BusinessError } 10200011 - The subArrayList method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a view of the portion of this arraylist between the specified fromIndex,inclusive,and toIndex,exclusive
*
* @param { number } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position
* @param { number } toIndex - toIndex toIndex the end of the index, excluding the value at that index
* @returns { ArrayList<T> }
* @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range.
* @throws { BusinessError } 10200011 - The subArrayList method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
subArrayList(fromIndex: number, toIndex: number): ArrayList<T>;
/**
* Removes all of the elements from this arraylist.The arraylist will
@ -207,9 +365,17 @@ declare class ArrayList<T> {
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Removes all of the elements from this arraylist.The arraylist will
* be empty after this call returns.length becomes 0
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
clear(): void;
/**
* Returns a shallow copy of this instance. (The elements themselves are not copied.)
@ -217,9 +383,17 @@ declare class ArrayList<T> {
* @returns { ArrayList<T> } this arraylist instance
* @throws { BusinessError } 10200011 - The clone method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a shallow copy of this instance. (The elements themselves are not copied.)
*
* @returns { ArrayList<T> } this arraylist instance
* @throws { BusinessError } 10200011 - The clone method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
clone(): ArrayList<T>;
/**
* returns the capacity of this arraylist
@ -227,9 +401,17 @@ declare class ArrayList<T> {
* @returns { number } the number type
* @throws { BusinessError } 10200011 - The getCapacity method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* returns the capacity of this arraylist
*
* @returns { number } the number type
* @throws { BusinessError } 10200011 - The getCapacity method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getCapacity(): number;
/**
* convert arraylist to array
@ -237,9 +419,17 @@ declare class ArrayList<T> {
* @returns { Array<T> } the Array type
* @throws { BusinessError } 10200011 - The convertToArray method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* convert arraylist to array
*
* @returns { Array<T> } the Array type
* @throws { BusinessError } 10200011 - The convertToArray method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
convertToArray(): Array<T>;
/**
* Determine whether arraylist is empty and whether there is an element
@ -247,9 +437,17 @@ declare class ArrayList<T> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Determine whether arraylist is empty and whether there is an element
*
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
isEmpty(): boolean;
/**
* If the newCapacity provided by the user is greater than or equal to length,
@ -259,18 +457,35 @@ declare class ArrayList<T> {
* @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* If the newCapacity provided by the user is greater than or equal to length,
* change the capacity of the arraylist to newCapacity, otherwise the capacity will not be changed
*
* @param { number } newCapacity - newCapacity newCapacity
* @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
increaseCapacityTo(newCapacity: number): void;
/**
* Limit the capacity to the current length
*
* @throws { BusinessError } 10200011 - The trimToCurrentLength method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Limit the capacity to the current length
*
* @throws { BusinessError } 10200011 - The trimToCurrentLength method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
trimToCurrentLength(): void;
/**
* returns an iterator.Each item of the iterator is a Javascript Object
@ -278,9 +493,17 @@ declare class ArrayList<T> {
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* returns an iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
[Symbol.iterator](): IterableIterator<T>;
}

View File

@ -20,26 +20,48 @@
*
* @namespace Deque
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Double-ended queue (deque) is a sequence container implemented based on the queue data structure that
* follows the principles of First In First Out (FIFO) and Last In First Out (LIFO).
* It allows insertion and removal of elements at both the ends.
*
* @namespace Deque
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare class Deque<T> {
/**
* A constructor used to create a Deque object.
*
* @throws { BusinessError } 10200012 - The Deque's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* A constructor used to create a Deque object.
*
* @throws { BusinessError } 10200012 - The Deque's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
constructor();
/**
* Gets the element number of the Deque.This is a number one higher than the highest index in the deque.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the element number of the Deque.This is a number one higher than the highest index in the deque.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
length: number;
/**
* Inserts an element into the deque header.
@ -47,9 +69,17 @@ declare class Deque<T> {
* @param { T } element - element element to be appended to this deque
* @throws { BusinessError } 10200011 - The insertFront method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Inserts an element into the deque header.
*
* @param { T } element - element element to be appended to this deque
* @throws { BusinessError } 10200011 - The insertFront method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
insertFront(element: T): void;
/**
* Inserting an element at the end of a deque
@ -57,9 +87,17 @@ declare class Deque<T> {
* @param { T } element - element element to be appended to this deque
* @throws { BusinessError } 10200011 - The insertEnd method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Inserting an element at the end of a deque
*
* @param { T } element - element element to be appended to this deque
* @throws { BusinessError } 10200011 - The insertEnd method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
insertEnd(element: T): void;
/**
* Check if deque contains the specified element
@ -68,9 +106,18 @@ declare class Deque<T> {
* @returns { boolean } the boolean type,if deque contains the specified element,return true,else return false
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Check if deque contains the specified element
*
* @param { T } element - element element to be contained
* @returns { boolean } the boolean type,if deque contains the specified element,return true,else return false
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
has(element: T): boolean;
/**
* Obtains the header element of a deque.
@ -78,9 +125,17 @@ declare class Deque<T> {
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains the header element of a deque.
*
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getFirst(): T;
/**
* Obtains the end element of a deque.
@ -88,9 +143,17 @@ declare class Deque<T> {
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The getLast method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains the end element of a deque.
*
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The getLast method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getLast(): T;
/**
* Obtains the header element of a deque and delete the element.
@ -98,9 +161,17 @@ declare class Deque<T> {
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The popFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains the header element of a deque and delete the element.
*
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The popFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
popFirst(): T;
/**
* Obtains the end element of a deque and delete the element.
@ -108,9 +179,17 @@ declare class Deque<T> {
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The popLast method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains the end element of a deque and delete the element.
*
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The popLast method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
popLast(): T;
/**
* Executes a provided function once for each value in the deque object.
@ -122,9 +201,21 @@ declare class Deque<T> {
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Executes a provided function once for each value in the deque object.
*
* @param { (value: T, index?: number, deque?: Deque<T>) => void } callbackFn - callbackFn
* callbackFn (required) A function that accepts up to four arguments.The function to be called for each element in the deque
* @param { Object } thisArg - thisArg thisArg (Optional) The value passed to the function generally uses the "this" value.
* If this parameter is empty, "undefined" will be passed to the "this" value
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
forEach(callbackFn: (value: T, index?: number, deque?: Deque<T>) => void, thisArg?: Object): void;
/**
* returns an iterator.Each item of the iterator is a Javascript Object
@ -132,9 +223,17 @@ declare class Deque<T> {
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* returns an iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
[Symbol.iterator](): IterableIterator<T>;
}

View File

@ -19,26 +19,47 @@
*
* @namespace HashMap
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* HashMap is a map implemented based on the array, linked list, and red-black tree. It provides efficient data query, insertion,
* and removal. The elements in a HashMap instance are mappings of key-value pairs. Each key must be unique and have only one value.
*
* @namespace HashMap
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare class HashMap<K, V> {
/**
* A constructor used to create a HashMap object.
*
* @throws { BusinessError } 10200012 - The HashMap's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* A constructor used to create a HashMap object.
*
* @throws { BusinessError } 10200012 - The HashMap's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
constructor();
/**
* Gets the element number of the hashmap.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the element number of the hashmap.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
length: number;
/**
* Returns whether the Map object contains elements
@ -46,9 +67,17 @@ declare class HashMap<K, V> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether the Map object contains elements
*
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
isEmpty(): boolean;
/**
* Returns whether a key is contained in this map
@ -57,9 +86,18 @@ declare class HashMap<K, V> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The hasKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether a key is contained in this map
*
* @param { K } key - key key need to determine whether to include the key
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The hasKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
hasKey(key: K): boolean;
/**
* Returns whether a value is contained in this map
@ -68,9 +106,18 @@ declare class HashMap<K, V> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The hasValue method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether a value is contained in this map
*
* @param { V } value - value value need to determine whether to include the value
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The hasValue method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
hasValue(value: V): boolean;
/**
* Returns a specified element in a Map object, or null if there is no corresponding element
@ -79,9 +126,18 @@ declare class HashMap<K, V> {
* @returns { V } value or null
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a specified element in a Map object, or null if there is no corresponding element
*
* @param { K } key - key key the index in HashMap
* @returns { V } value or null
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
get(key: K): V;
/**
* Adds all element groups in one map to another map
@ -90,9 +146,18 @@ declare class HashMap<K, V> {
* @throws { BusinessError } 10200011 - The setAll method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Adds all element groups in one map to another map
*
* @param { HashMap<K, V> } map - map map the Map object to add members
* @throws { BusinessError } 10200011 - The setAll method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
setAll(map: HashMap<K, V>): void;
/**
* Adds or updates a(new) key-value pair with a key and value specified for the Map object
@ -103,9 +168,20 @@ declare class HashMap<K, V> {
* @throws { BusinessError } 10200011 - The set method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Adds or updates a(new) key-value pair with a key and value specified for the Map object
*
* @param { K } key - key key Added or updated targets
* @param { V } value - value value Added or updated value
* @returns { Object } the map object after set
* @throws { BusinessError } 10200011 - The set method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
set(key: K, value: V): Object;
/**
* Remove a specified element from a Map object
@ -114,18 +190,34 @@ declare class HashMap<K, V> {
* @returns { V } Target mapped value
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Remove a specified element from a Map object
*
* @param { K } key - key key Target to be deleted
* @returns { V } Target mapped value
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
remove(key: K): V;
/**
* Clear all element groups in the map
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Clear all element groups in the map
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
clear(): void;
/**
* Returns a new Iterator object that contains the keys contained in this map
@ -133,9 +225,17 @@ declare class HashMap<K, V> {
* @returns { IterableIterator<K> }
* @throws { BusinessError } 10200011 - The keys method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a new Iterator object that contains the keys contained in this map
*
* @returns { IterableIterator<K> }
* @throws { BusinessError } 10200011 - The keys method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
keys(): IterableIterator<K>;
/**
* Returns a new Iterator object that contains the values contained in this map
@ -143,9 +243,17 @@ declare class HashMap<K, V> {
* @returns { IterableIterator<V> }
* @throws { BusinessError } 10200011 - The values method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a new Iterator object that contains the values contained in this map
*
* @returns { IterableIterator<V> }
* @throws { BusinessError } 10200011 - The values method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
values(): IterableIterator<V>;
/**
* Replace the old value by new value corresponding to the specified key
@ -155,9 +263,19 @@ declare class HashMap<K, V> {
* @returns { boolean } the boolean type(Is there a target pointed to by the key)
* @throws { BusinessError } 10200011 - The replace method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Replace the old value by new value corresponding to the specified key
*
* @param { K } key - key key Updated targets
* @param { V } newValue - newValue newValue Updated the target mapped value
* @returns { boolean } the boolean type(Is there a target pointed to by the key)
* @throws { BusinessError } 10200011 - The replace method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
replace(key: K, newValue: V): boolean;
/**
* Executes the given callback function once for each real key in the map.
@ -168,9 +286,20 @@ declare class HashMap<K, V> {
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Executes the given callback function once for each real key in the map.
* It does not perform functions on deleted keys
*
* @param { (value?: V, key?: K, map?: HashMap<K, V>) => void } callbackFn - callbackFn callbackFn
* @param { Object } thisArg - thisArg thisArg
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
forEach(callbackFn: (value?: V, key?: K, map?: HashMap<K, V>) => void, thisArg?: Object): void;
/**
* Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order
@ -178,9 +307,17 @@ declare class HashMap<K, V> {
* @returns { IterableIterator<[K, V]> }
* @throws { BusinessError } 10200011 - The entries method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order
*
* @returns { IterableIterator<[K, V]> }
* @throws { BusinessError } 10200011 - The entries method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
entries(): IterableIterator<[K, V]>;
/**
* returns an iterator.Each item of the iterator is a Javascript Object
@ -188,9 +325,17 @@ declare class HashMap<K, V> {
* @returns { IterableIterator<[K, V]> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* returns an iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<[K, V]> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
[Symbol.iterator](): IterableIterator<[K, V]>;
}

View File

@ -18,26 +18,46 @@
*
* @namespace HashSet
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* HashSet is implemented based on HashMap. In HashSet, only the value object is processed.
*
* @namespace HashSet
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare class HashSet<T> {
/**
* A constructor used to create a HashSet object.
*
* @throws { BusinessError } 10200012 - The HashSet's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* A constructor used to create a HashSet object.
*
* @throws { BusinessError } 10200012 - The HashSet's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
constructor();
/**
* Gets the element number of the hashset.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the element number of the hashset.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
length: number;
/**
* Returns whether the Set object contains elements
@ -45,9 +65,17 @@ declare class HashSet<T> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether the Set object contains elements
*
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
isEmpty(): boolean;
/**
* Returns whether the Set object contain s the elements
@ -57,9 +85,19 @@ declare class HashSet<T> {
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether the Set object contain s the elements
*
* @param { T } value - value value need to determine whether to include the element
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
has(value: T): boolean;
/**
* If the set does not contain the element, the specified element is added
@ -69,9 +107,19 @@ declare class HashSet<T> {
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* If the set does not contain the element, the specified element is added
*
* @param { T } value - value value Added element
* @returns { boolean } the boolean type(Is there contain this element)
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
add(value: T): boolean;
/**
* Remove a specified element from a Set object
@ -81,18 +129,35 @@ declare class HashSet<T> {
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Remove a specified element from a Set object
*
* @param { T } value - value value Target to be deleted
* @returns { boolean } the boolean type(Is there contain this element)
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
remove(value: T): boolean;
/**
* Clears all element groups in a set
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Clears all element groups in a set
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
clear(): void;
/**
* Executes a provided function once for each value in the Set object.
@ -102,9 +167,19 @@ declare class HashSet<T> {
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Executes a provided function once for each value in the Set object.
*
* @param { (value?: T, key?: T, set?: HashSet<T>) => void } callbackFn - callbackFn callbackFn
* @param { Object } thisArg
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
forEach(callbackFn: (value?: T, key?: T, set?: HashSet<T>) => void, thisArg?: Object): void;
/**
* Returns a new Iterator object that contains the values contained in this set
@ -112,9 +187,17 @@ declare class HashSet<T> {
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The values method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a new Iterator object that contains the values contained in this set
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The values method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
values(): IterableIterator<T>;
/**
* Returns a new Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order
@ -122,9 +205,17 @@ declare class HashSet<T> {
* @returns { IterableIterator<[T, T]> }
* @throws { BusinessError } 10200011 - The entries method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a new Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order
*
* @returns { IterableIterator<[T, T]> }
* @throws { BusinessError } 10200011 - The entries method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
entries(): IterableIterator<[T, T]>;
/**
* returns an iterator.Each item of the iterator is a Javascript Object
@ -132,9 +223,17 @@ declare class HashSet<T> {
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* returns an iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
[Symbol.iterator](): IterableIterator<T>;
}

View File

@ -18,26 +18,46 @@
*
* @namespace LightWeightMap
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* LightWeightMap stores key-value (KV) pairs. Each key must be unique and have only one value.
*
* @namespace LightWeightMap
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare class LightWeightMap<K, V> {
/**
* A constructor used to create a LightWeightMap object.
*
* @throws { BusinessError } 10200012 - The LightWeightMap's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* A constructor used to create a LightWeightMap object.
*
* @throws { BusinessError } 10200012 - The LightWeightMap's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
constructor();
/**
* Gets the element number of the LightWeightMap.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the element number of the LightWeightMap.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
length: number;
/**
* Returns whether this map has all the object in a specified map
@ -47,9 +67,19 @@ declare class LightWeightMap<K, V> {
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @throws { BusinessError } 10200011 - The hasAll method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether this map has all the object in a specified map
*
* @param { LightWeightMap<K, V> } map - map map the Map object to compare
* @returns { boolean } the boolean type
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @throws { BusinessError } 10200011 - The hasAll method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
hasAll(map: LightWeightMap<K, V>): boolean;
/**
* Returns whether a key is contained in this map
@ -58,9 +88,18 @@ declare class LightWeightMap<K, V> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The hasKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether a key is contained in this map
*
* @param { K } key - key key need to determine whether to include the key
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The hasKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
hasKey(key: K): boolean;
/**
* Returns whether a value is contained in this map
@ -69,9 +108,18 @@ declare class LightWeightMap<K, V> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The hasValue method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether a value is contained in this map
*
* @param { V } value - value value need to determine whether to include the value
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The hasValue method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
hasValue(value: V): boolean;
/**
* Ensures that the capacity of an LightWeightMap container is greater than or equal to a specified value,
@ -81,9 +129,19 @@ declare class LightWeightMap<K, V> {
* @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Ensures that the capacity of an LightWeightMap container is greater than or equal to a specified value,
* and that the container has all the original objects after capacity expansion
*
* @param { number } minimumCapacity - minimumCapacity minimumCapacity Minimum capacity to be reserved
* @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
increaseCapacityTo(minimumCapacity: number): void;
/**
* Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order
@ -91,9 +149,17 @@ declare class LightWeightMap<K, V> {
* @returns { IterableIterator<[K, V]> }
* @throws { BusinessError } 10200011 - The entries method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order
*
* @returns { IterableIterator<[K, V]> }
* @throws { BusinessError } 10200011 - The entries method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
entries(): IterableIterator<[K, V]>;
/**
* Returns the value to which the specified key is mapped, or undefined if this map contains no mapping for the key
@ -102,9 +168,18 @@ declare class LightWeightMap<K, V> {
* @returns { V } value or undefined
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the value to which the specified key is mapped, or undefined if this map contains no mapping for the key
*
* @param { K } key - key key the index in LightWeightMap
* @returns { V } value or undefined
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
get(key: K): V;
/**
* Obtains the index of the key equal to a specified key in an LightWeightMap container
@ -113,9 +188,18 @@ declare class LightWeightMap<K, V> {
* @returns { number } Subscript corresponding to target
* @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains the index of the key equal to a specified key in an LightWeightMap container
*
* @param { K } key - key key Looking for goals
* @returns { number } Subscript corresponding to target
* @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getIndexOfKey(key: K): number;
/**
* Obtains the index of the value equal to a specified value in an LightWeightMap container
@ -124,9 +208,18 @@ declare class LightWeightMap<K, V> {
* @returns { number } Subscript corresponding to target
* @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains the index of the value equal to a specified value in an LightWeightMap container
*
* @param { V } value - value value Looking for goals
* @returns { number } Subscript corresponding to target
* @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getIndexOfValue(value: V): number;
/**
* Returns whether the Map object contains elements
@ -134,9 +227,17 @@ declare class LightWeightMap<K, V> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether the Map object contains elements
*
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
isEmpty(): boolean;
/**
* Obtains the key at the location identified by index in an LightWeightMap container
@ -147,9 +248,20 @@ declare class LightWeightMap<K, V> {
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains the key at the location identified by index in an LightWeightMap container
*
* @param { number } index - index index Target subscript for search
* @returns { K } the key of key-value pairs
* @throws { BusinessError } 10200011 - The getKeyAt method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getKeyAt(index: number): K;
/**
* Obtains a ES6 iterator that contains all the keys of an LightWeightMap container
@ -157,9 +269,17 @@ declare class LightWeightMap<K, V> {
* @returns { IterableIterator<K> }
* @throws { BusinessError } 10200011 - The keys method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains a ES6 iterator that contains all the keys of an LightWeightMap container
*
* @returns { IterableIterator<K> }
* @throws { BusinessError } 10200011 - The keys method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
keys(): IterableIterator<K>;
/**
* Adds all element groups in one map to another map
@ -168,9 +288,18 @@ declare class LightWeightMap<K, V> {
* @throws { BusinessError } 10200011 - The setAll method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Adds all element groups in one map to another map
*
* @param { LightWeightMap<K, V> } map - map map the Map object to add members
* @throws { BusinessError } 10200011 - The setAll method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
setAll(map: LightWeightMap<K, V>): void;
/**
* Adds or updates a(new) key-value pair with a key and value specified for the Map object
@ -180,9 +309,19 @@ declare class LightWeightMap<K, V> {
* @returns { Object } the map object after set
* @throws { BusinessError } 10200011 - The set method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Adds or updates a(new) key-value pair with a key and value specified for the Map object
*
* @param { K } key - key key Added or updated targets
* @param { V } value - value Added or updated value
* @returns { Object } the map object after set
* @throws { BusinessError } 10200011 - The set method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
set(key: K, value: V): Object;
/**
* Remove the mapping for this key from this map if present
@ -191,9 +330,18 @@ declare class LightWeightMap<K, V> {
* @returns { V } Target mapped value
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Remove the mapping for this key from this map if present
*
* @param { K } key - key key Target to be deleted
* @returns { V } Target mapped value
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
remove(key: K): V;
/**
* Deletes a key-value pair at the location identified by index from an LightWeightMap container
@ -203,9 +351,19 @@ declare class LightWeightMap<K, V> {
* @throws { BusinessError } 10200011 - The removeAt method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Deletes a key-value pair at the location identified by index from an LightWeightMap container
*
* @param { number } index - index index Target subscript for search
* @returns { boolean } the boolean type(Is there a delete value)
* @throws { BusinessError } 10200011 - The removeAt method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeAt(index: number): boolean;
/**
* Removes all of the mapping from this map
@ -213,9 +371,17 @@ declare class LightWeightMap<K, V> {
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Removes all of the mapping from this map
* The map will be empty after this call returns
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
clear(): void;
/**
* Sets the value identified by index in an LightWeightMap container to a specified value
@ -227,9 +393,21 @@ declare class LightWeightMap<K, V> {
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Sets the value identified by index in an LightWeightMap container to a specified value
*
* @param { number } index - index index Target subscript for search
* @param { V } newValue - newValue value Updated the target mapped value
* @returns { boolean } the boolean type(Is there a value corresponding to the subscript)
* @throws { BusinessError } 10200011 - The setValueAt method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
setValueAt(index: number, newValue: V): boolean;
/**
* Executes the given callback function once for each real key in the map.
@ -240,9 +418,20 @@ declare class LightWeightMap<K, V> {
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Executes the given callback function once for each real key in the map.
* It does not perform functions on deleted keys
*
* @param { (value?: V, key?: K, map?: LightWeightMap<K, V>) => void } callbackFn - callbackFn callbackFn
* @param { Object } thisArg - thisArg thisArg
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
forEach(callbackFn: (value?: V, key?: K, map?: LightWeightMap<K, V>) => void, thisArg?: Object): void;
/**
* returns an ES6 iterator.Each item of the iterator is a Javascript Object
@ -250,9 +439,17 @@ declare class LightWeightMap<K, V> {
* @returns { IterableIterator<[K, V]> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* returns an ES6 iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<[K, V]> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
[Symbol.iterator](): IterableIterator<[K, V]>;
/**
* Obtains a string that contains all the keys and values in an LightWeightMap container
@ -260,9 +457,17 @@ declare class LightWeightMap<K, V> {
* @returns { String }
* @throws { BusinessError } 10200011 - The toString method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains a string that contains all the keys and values in an LightWeightMap container
*
* @returns { String }
* @throws { BusinessError } 10200011 - The toString method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
toString(): String;
/**
* Obtains the value identified by index in an LightWeightMap container
@ -273,9 +478,20 @@ declare class LightWeightMap<K, V> {
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains the value identified by index in an LightWeightMap container
*
* @param { number } index - index index Target subscript for search
* @returns { V } the value of key-value pairs
* @throws { BusinessError } 10200011 - The getValueAt method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getValueAt(index: number): V;
/**
* Returns an iterator of the values contained in this map
@ -283,9 +499,17 @@ declare class LightWeightMap<K, V> {
* @returns { IterableIterator<V> }
* @throws { BusinessError } 10200011 - The values method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns an iterator of the values contained in this map
*
* @returns { IterableIterator<V> }
* @throws { BusinessError } 10200011 - The values method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
values(): IterableIterator<V>;
}

View File

@ -18,26 +18,46 @@
*
* @namespace LightWeightSet
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* LightWeightSet stores a set of values, each of which must be unique.
*
* @namespace LightWeightSet
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare class LightWeightSet<T> {
/**
* A constructor used to create a LightWeightSet object.
*
* @throws { BusinessError } 10200012 - The LightWeightSet's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* A constructor used to create a LightWeightSet object.
*
* @throws { BusinessError } 10200012 - The LightWeightSet's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
constructor();
/**
* Gets the element number of the LightWeightSet.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the element number of the LightWeightSet.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
length: number;
/**
* If the set does not contain the element, the specified element is added
@ -46,9 +66,18 @@ declare class LightWeightSet<T> {
* @returns { boolean } the boolean type(Is there contain this element)
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* If the set does not contain the element, the specified element is added
*
* @param { T } obj - obj obj Added element
* @returns { boolean } the boolean type(Is there contain this element)
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
add(obj: T): boolean;
/**
* Adds all the objects in a specified LightWeightSet container to the current LightWeightSet container
@ -58,9 +87,19 @@ declare class LightWeightSet<T> {
* @throws { BusinessError } 10200011 - The addAll method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Adds all the objects in a specified LightWeightSet container to the current LightWeightSet container
*
* @param { LightWeightSet<T> } set - set set the Set object to provide the added element
* @returns { boolean } the boolean type(Is there any new data added successfully)
* @throws { BusinessError } 10200011 - The addAll method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
addAll(set: LightWeightSet<T>): boolean;
/**
* Returns whether this set has all the object in a specified set
@ -70,9 +109,19 @@ declare class LightWeightSet<T> {
* @throws { BusinessError } 10200011 - The hasAll method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether this set has all the object in a specified set
*
* @param { LightWeightSet<T> } set - set set the Set object to compare
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The hasAll method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
hasAll(set: LightWeightSet<T>): boolean;
/**
* Checks whether an LightWeightSet container has a specified key
@ -81,9 +130,18 @@ declare class LightWeightSet<T> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Checks whether an LightWeightSet container has a specified key
*
* @param { T } key - key key need to determine whether to include the key
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
has(key: T): boolean;
/**
* Checks whether an the objects of an LightWeighSet container are of the same type as a specified Object LightWeightSet
@ -92,9 +150,18 @@ declare class LightWeightSet<T> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The equal method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Checks whether an the objects of an LightWeighSet container are of the same type as a specified Object LightWeightSet
*
* @param { Object } obj - obj obj need to determine whether to include the obj
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The equal method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
equal(obj: Object): boolean;
/**
* Ensures that the capacity of an LightWeightSet container is greater than or equal to a specified value,
@ -105,9 +172,20 @@ declare class LightWeightSet<T> {
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @throws { BusinessError } 10200001 - The value of minimumCapacity is out of range.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Ensures that the capacity of an LightWeightSet container is greater than or equal to a specified value,
* and that the container has all the original objects after capacity expansion
*
* @param { number } minimumCapacity Minimum capacity to be reserved
* @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @throws { BusinessError } 10200001 - The value of minimumCapacity is out of range.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
increaseCapacityTo(minimumCapacity: number): void;
/**
* Obtains the index of s key of a specified Object type in an LightWeightSet container
@ -116,9 +194,18 @@ declare class LightWeightSet<T> {
* @returns { number } Subscript corresponding to target
* @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains the index of s key of a specified Object type in an LightWeightSet container
*
* @param { T } key - key key Looking for goals
* @returns { number } Subscript corresponding to target
* @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getIndexOf(key: T): number;
/**
* Deletes an object of a specified Object type from an LightWeightSet container
@ -127,9 +214,18 @@ declare class LightWeightSet<T> {
* @returns { T } Target element
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Deletes an object of a specified Object type from an LightWeightSet container
*
* @param { T } key - key key Target to be deleted
* @returns { T } Target element
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
remove(key: T): T;
/**
* Deletes an object at the location identified by index from an LightWeightSet container
@ -139,9 +235,19 @@ declare class LightWeightSet<T> {
* @throws { BusinessError } 10200011 - The removeAt method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Deletes an object at the location identified by index from an LightWeightSet container
*
* @param { number } index - index index Target subscript for search
* @returns { boolean } the boolean type(Is there a delete value)
* @throws { BusinessError } 10200011 - The removeAt method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeAt(index: number): boolean;
/**
* Removes all of the mapping from this map
@ -149,9 +255,17 @@ declare class LightWeightSet<T> {
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Removes all of the mapping from this map
* The map will be empty after this call returns
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
clear(): void;
/**
* Executes the given callback function once for each real key in the map.
@ -162,9 +276,20 @@ declare class LightWeightSet<T> {
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Executes the given callback function once for each real key in the map.
* It does not perform functions on deleted keys
*
* @param { (value?: T, key?: T, set?: LightWeightSet<T>) => void } callbackFn - callbackFn callbackFn
* @param { Object } thisArg - thisArg thisArg
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
forEach(callbackFn: (value?: T, key?: T, set?: LightWeightSet<T>) => void, thisArg?: Object): void;
/**
* returns an ES6 iterator.Each item of the iterator is a Javascript Object
@ -172,18 +297,33 @@ declare class LightWeightSet<T> {
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* returns an ES6 iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
[Symbol.iterator](): IterableIterator<T>;
/**
* Obtains a string that contains all the keys and values in an LightWeightSet container
*
* @returns { String }
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains a string that contains all the keys and values in an LightWeightSet container
*
* @returns { String }
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
toString(): String;
/**
* Obtains an Array that contains all the objects of an LightWeightSet container.
@ -191,9 +331,17 @@ declare class LightWeightSet<T> {
* @returns { Array<T> }
* @throws { BusinessError } 10200011 - The toArray method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains an Array that contains all the objects of an LightWeightSet container.
*
* @returns { Array<T> }
* @throws { BusinessError } 10200011 - The toArray method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
toArray(): Array<T>;
/**
* Obtains the object at the location identified by index in an LightWeightSet container
@ -203,9 +351,19 @@ declare class LightWeightSet<T> {
* @throws { BusinessError } 10200011 - The getValueAt method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains the object at the location identified by index in an LightWeightSet container
*
* @param { number } index - index index Target subscript for search
* @returns { T } the value of key-value pairs
* @throws { BusinessError } 10200011 - The getValueAt method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getValueAt(index: number): T;
/**
* Returns a ES6 iterator of the values contained in this Set
@ -213,9 +371,17 @@ declare class LightWeightSet<T> {
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The values method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a ES6 iterator of the values contained in this Set
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The values method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
values(): IterableIterator<T>;
/**
* Returns a Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order
@ -223,9 +389,17 @@ declare class LightWeightSet<T> {
* @returns { IterableIterator<[T, T]> }
* @throws { BusinessError } 10200011 - The entries method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order
*
* @returns { IterableIterator<[T, T]> }
* @throws { BusinessError } 10200011 - The entries method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
entries(): IterableIterator<[T, T]>;
/**
* Returns whether the set object contains elements
@ -233,9 +407,17 @@ declare class LightWeightSet<T> {
* @returns { boolean }
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether the set object contains elements
*
* @returns { boolean }
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
isEmpty(): boolean;
}

View File

@ -20,26 +20,48 @@
*
* @namespace LinkedList
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* LinkedList is implemented based on the doubly linked list. Each node of the doubly linked list has
* references pointing to the previous element and the next element. When querying an element,
* the system traverses the list from the beginning or end.
*
* @namespace LinkedList
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare class LinkedList<T>{
/**
* A constructor used to create a LinkedList object.
*
* @throws { BusinessError } 10200012 - The LinkedList's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* A constructor used to create a LinkedList object.
*
* @throws { BusinessError } 10200012 - The LinkedList's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
constructor();
/**
* Gets the element number of the LinkedList. This is a number one higher than the highest index in the linkedlist.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the element number of the LinkedList. This is a number one higher than the highest index in the linkedlist.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
length: number;
/**
* Appends the specified element to the end of this linkedlist.
@ -48,9 +70,18 @@ declare class LinkedList<T>{
* @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails.
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Appends the specified element to the end of this linkedlist.
*
* @param { T } element - element element to be appended to this linkedlist
* @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails.
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
add(element: T): boolean;
/**
* Inserts the specified element at the specified position in this linkedlist.
@ -61,9 +92,20 @@ declare class LinkedList<T>{
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Inserts the specified element at the specified position in this linkedlist.
*
* @param { number } index - index index index at which the specified element is to be inserted
* @param { T } element - element element element to be inserted
* @throws { BusinessError } 10200011 - The insert method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
insert(index: number, element: T): void;
/**
* Returns the element at the specified position in this linkedlist,
@ -74,9 +116,20 @@ declare class LinkedList<T>{
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the element at the specified position in this linkedlist,
* or returns undefined if this linkedlist is empty
*
* @param { number } index - index index specified position
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
get(index: number): T;
/**
* Inserts the specified element at the beginning of this LinkedList.
@ -84,9 +137,17 @@ declare class LinkedList<T>{
* @param { T } element - element element the element to add
* @throws { BusinessError } 10200011 - The addFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Inserts the specified element at the beginning of this LinkedList.
*
* @param { T } element - element element the element to add
* @throws { BusinessError } 10200011 - The addFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
addFirst(element: T): void;
/**
* Retrieves and removes the head (first element) of this linkedlist.
@ -95,9 +156,18 @@ declare class LinkedList<T>{
* @throws { BusinessError } 10200011 - The removeFirst method cannot be bound.
* @throws { BusinessError } 10200010 - Container is empty.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Retrieves and removes the head (first element) of this linkedlist.
*
* @returns { T } the head of this list
* @throws { BusinessError } 10200011 - The removeFirst method cannot be bound.
* @throws { BusinessError } 10200010 - Container is empty.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeFirst(): T;
/**
* Removes and returns the last element from this linkedlist.
@ -106,9 +176,18 @@ declare class LinkedList<T>{
* @throws { BusinessError } 10200011 - The removeLast method cannot be bound.
* @throws { BusinessError } 10200010 - Container is empty.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Removes and returns the last element from this linkedlist.
*
* @returns { T } the head of this list
* @throws { BusinessError } 10200011 - The removeLast method cannot be bound.
* @throws { BusinessError } 10200010 - Container is empty.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeLast(): T;
/**
* Check if linkedlist contains the specified element
@ -117,9 +196,18 @@ declare class LinkedList<T>{
* @returns { boolean } the boolean type,if linkedList contains the specified element,return true,else return false
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Check if linkedlist contains the specified element
*
* @param { T } element - element element element to be contained
* @returns { boolean } the boolean type,if linkedList contains the specified element,return true,else return false
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
has(element: T): boolean;
/**
* Returns the index of the first occurrence of the specified element
@ -129,9 +217,19 @@ declare class LinkedList<T>{
* @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index.
* @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the index of the first occurrence of the specified element
* in this linkedlist, or -1 if this linkedlist does not contain the element.
*
* @param { T } element - element element element to be contained
* @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index.
* @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getIndexOf(element: T): number;
/**
* Find the corresponding element according to the index,
@ -143,9 +241,21 @@ declare class LinkedList<T>{
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Find the corresponding element according to the index,
*
* @param { number } index - index index the index in the linkedlist
* @returns { T } the T type ,returns undefined if linkedlist is empty,If the index is
* out of bounds (greater than or equal to length or less than 0), throw an exception
* @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeByIndex(index: number): T;
/**
* Removes the first occurrence of the specified element from this linkedlist,
@ -156,9 +266,20 @@ declare class LinkedList<T>{
* @returns { boolean } the boolean type ,If there is no such element, return false
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Removes the first occurrence of the specified element from this linkedlist,
* if it is present. If the linkedlist does not contain the element, it is
* unchanged. More formally, removes the element with the lowest index
*
* @param { T } element - element element element to remove
* @returns { boolean } the boolean type ,If there is no such element, return false
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
remove(element: T): boolean;
/**
* Removes the first occurrence of the specified element from this linkedlist,
@ -171,9 +292,22 @@ declare class LinkedList<T>{
* @throws { BusinessError } 10200010 - Container is empty.
* @throws { BusinessError } 10200017 - The element does not exist in this container.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Removes the first occurrence of the specified element from this linkedlist,
* if it is present. If the linkedlist does not contain the element, it is
* unchanged. More formally, removes the element with the lowest index
*
* @param { T } element - element element element to remove
* @returns { boolean } the boolean type ,If there is no such element, return false
* @throws { BusinessError } 10200011 - The removeFirstFound method cannot be bound.
* @throws { BusinessError } 10200010 - Container is empty.
* @throws { BusinessError } 10200017 - The element does not exist in this container.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeFirstFound(element: T): boolean;
/**
* Removes the last occurrence of the specified element from this linkedlist,
@ -186,9 +320,22 @@ declare class LinkedList<T>{
* @throws { BusinessError } 10200010 - Container is empty.
* @throws { BusinessError } 10200017 - The element does not exist in this container.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Removes the last occurrence of the specified element from this linkedlist,
* if it is present. If the linkedlist does not contain the element, it is
* unchanged. More formally, removes the element with the lowest index
*
* @param { T } element - element element element to remove
* @returns { boolean } the boolean type ,If there is no such element, return false
* @throws { BusinessError } 10200011 - The removeLastFound method cannot be bound.
* @throws { BusinessError } 10200010 - Container is empty.
* @throws { BusinessError } 10200017 - The element does not exist in this container.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeLastFound(element: T): boolean;
/**
* Returns in the index of the last occurrence of the specified element in this linkedlist ,
@ -198,9 +345,19 @@ declare class LinkedList<T>{
* @returns { number } the number type
* @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns in the index of the last occurrence of the specified element in this linkedlist ,
* or -1 if the linkedlist does not contain the element.
*
* @param { T } element - element element element to find
* @returns { number } the number type
* @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getLastIndexOf(element: T): number;
/**
* Returns the first element (the item at index 0) of this linkedlist.
@ -209,9 +366,18 @@ declare class LinkedList<T>{
* @returns { T } the T type ,returns undefined if linkedList is empty
* @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the first element (the item at index 0) of this linkedlist.
* or returns undefined if linkedlist is empty
*
* @returns { T } the T type ,returns undefined if linkedList is empty
* @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getFirst(): T;
/**
* Returns the Last element (the item at index length-1) of this linkedlist.
@ -220,9 +386,18 @@ declare class LinkedList<T>{
* @returns { T } the T type ,returns undefined if linkedList is empty
* @throws { BusinessError } 10200011 - The getLast method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the Last element (the item at index length-1) of this linkedlist.
* or returns undefined if linkedlist is empty
*
* @returns { T } the T type ,returns undefined if linkedList is empty
* @throws { BusinessError } 10200011 - The getLast method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getLast(): T;
/**
* Replaces the element at the specified position in this Vector with the specified element
@ -234,9 +409,21 @@ declare class LinkedList<T>{
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Replaces the element at the specified position in this Vector with the specified element
*
* @param { number } index - index index index to find
* @param { T } element - element element replaced element
* @returns { T } the T type ,returns undefined if linkedList is empty
* @throws { BusinessError } 10200011 - The set method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
set(index: number, element: T): T;
/**
* Replaces each element of this linkedlist with the result of applying the operator to that element.
@ -252,9 +439,25 @@ declare class LinkedList<T>{
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Replaces each element of this linkedlist with the result of applying the operator to that element.
*
* @param { (value: T, index?: number, LinkedList?: LinkedList<T>) => void } callbackFn - callbackFn callbackFn
* (required) A function that accepts up to four arguments.
* The function to be called for each element in the linkedlist,Returns the result of an operation
* Value (required) current element
* Index (Optional) The index value of the current element.
* LinkedList (Optional) The linkedlist object to which the current element belongs.
* @param { Object } thisArg - thisArg thisArg (Optional) The value passed to the function generally uses the "this" value.
* If this parameter is empty, "undefined" will be passed to the "this" value
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
forEach(callbackFn: (value: T, index?: number, LinkedList?: LinkedList<T>) => void, thisArg?: Object): void;
/**
* Removes all of the elements from this linkedlist.The linkedlist will
@ -262,9 +465,17 @@ declare class LinkedList<T>{
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Removes all of the elements from this linkedlist.The linkedlist will
* be empty after this call returns.length becomes 0
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
clear(): void;
/**
* Returns a shallow copy of this instance. (The elements themselves are not copied.)
@ -272,9 +483,17 @@ declare class LinkedList<T>{
* @returns { LinkedList<T> } this linkedlist instance
* @throws { BusinessError } 10200011 - The clone method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a shallow copy of this instance. (The elements themselves are not copied.)
*
* @returns { LinkedList<T> } this linkedlist instance
* @throws { BusinessError } 10200011 - The clone method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
clone(): LinkedList<T>;
/**
* convert linkedlist to array
@ -282,9 +501,17 @@ declare class LinkedList<T>{
* @returns { Array<T> } the Array type
* @throws { BusinessError } 10200011 - The convertToArray method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* convert linkedlist to array
*
* @returns { Array<T> } the Array type
* @throws { BusinessError } 10200011 - The convertToArray method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
convertToArray(): Array<T>;
/**
* returns an iterator.Each item of the iterator is a Javascript Object
@ -292,9 +519,17 @@ declare class LinkedList<T>{
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* returns an iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
[Symbol.iterator](): IterableIterator<T>;
}

View File

@ -19,26 +19,47 @@
*
* @namespace List
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* List is implemented based on the singly linked list. Each node has a reference pointing to the next element.
* When querying an element, the system traverses the list from the beginning.
*
* @namespace List
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare class List<T>{
/**
* A constructor used to create a List object.
*
* @throws { BusinessError } 10200012 - The List's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* A constructor used to create a List object.
*
* @throws { BusinessError } 10200012 - The List's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
constructor();
/**
* Gets the element number of the List. This is a number one higher than the highest index in the list.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the element number of the List. This is a number one higher than the highest index in the list.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
length: number;
/**
* Appends the specified element to the end of this list.
@ -47,9 +68,18 @@ declare class List<T>{
* @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails.
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Appends the specified element to the end of this list.
*
* @param { T } element - element element to be appended to this list
* @returns { boolean } the boolean type, returns true if the addition is successful, and returns false if it fails.
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
add(element: T): boolean;
/**
* Inserts the specified element at the specified position in this list.
@ -60,9 +90,20 @@ declare class List<T>{
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Inserts the specified element at the specified position in this list.
*
* @param { T } element - element element element to be inserted
* @param { number } index - index index index at which the specified element is to be inserted
* @throws { BusinessError } 10200011 - The insert method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
insert(element: T, index: number): void;
/**
* Returns the element at the specified position in this list,
@ -73,9 +114,20 @@ declare class List<T>{
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the element at the specified position in this list,
* or returns undefined if this list is empty
*
* @param { number } index - index index specified position
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
get(index: number): T;
/**
* Check if list contains the specified element
@ -84,9 +136,18 @@ declare class List<T>{
* @returns { boolean } the boolean type,if list contains the specified element,return true,else return false
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Check if list contains the specified element
*
* @param { T } element - element element element to be contained
* @returns { boolean } the boolean type,if list contains the specified element,return true,else return false
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
has(element: T): boolean;
/**
* Returns the index of the first occurrence of the specified element
@ -96,9 +157,19 @@ declare class List<T>{
* @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index.
* @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the index of the first occurrence of the specified element
* in this list, or -1 if this list does not contain the element.
*
* @param { T } element - element element element to be contained
* @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index.
* @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getIndexOf(element: T): number;
/**
* Find the corresponding element according to the index,
@ -110,9 +181,21 @@ declare class List<T>{
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Find the corresponding element according to the index,
*
* @param { number } index - index index the index in the list
* @returns { T } the T type ,returns undefined if list is empty,If the index is
* out of bounds (greater than or equal to length or less than 0), throw an exception
* @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeByIndex(index: number): T;
/**
* Removes the first occurrence of the specified element from this list,
@ -123,9 +206,20 @@ declare class List<T>{
* @returns { boolean } the boolean type ,If there is no such element, return false
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Removes the first occurrence of the specified element from this list,
* if it is present. If the list does not contain the element, it is
* unchanged. More formally, removes the element with the lowest index
*
* @param { T } element - element element element to remove
* @returns { boolean } the boolean type ,If there is no such element, return false
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
remove(element: T): boolean;
/**
* Returns in the index of the last occurrence of the specified element in this list ,
@ -135,9 +229,19 @@ declare class List<T>{
* @returns { number } the number type
* @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns in the index of the last occurrence of the specified element in this list ,
* or -1 if the list does not contain the element.
*
* @param { T } element - element element element to find
* @returns { number } the number type
* @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getLastIndexOf(element: T): number;
/**
* Returns the first element (the item at index 0) of this list.
@ -146,9 +250,18 @@ declare class List<T>{
* @returns { T } the T type ,returns undefined if list is empty
* @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the first element (the item at index 0) of this list.
* or returns undefined if list is empty
*
* @returns { T } the T type ,returns undefined if list is empty
* @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getFirst(): T;
/**
* Returns the Last element (the item at index length-1) of this list.
@ -157,9 +270,18 @@ declare class List<T>{
* @returns { T } the T type ,returns undefined if list is empty
* @throws { BusinessError } 10200011 - The getLast method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the Last element (the item at index length-1) of this list.
* or returns undefined if list is empty
*
* @returns { T } the T type ,returns undefined if list is empty
* @throws { BusinessError } 10200011 - The getLast method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getLast(): T;
/**
* Replaces the element at the specified position in this List with the specified element
@ -171,9 +293,21 @@ declare class List<T>{
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Replaces the element at the specified position in this List with the specified element
*
* @param { number } index - index index index to find
* @param { T } element - element element replaced element
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The set method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
set(index: number, element: T): T;
/**
* Compares the specified object with this list for equality.if the object are the same as this list
@ -183,9 +317,19 @@ declare class List<T>{
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The equal method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Compares the specified object with this list for equality.if the object are the same as this list
* return true, otherwise return false.
*
* @param { Object } obj - obj obj Compare objects
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The equal method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
equal(obj: Object): boolean;
/**
* Replaces each element of this list with the result of applying the operator to that element.
@ -198,9 +342,22 @@ declare class List<T>{
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Replaces each element of this list with the result of applying the operator to that element.
*
* @param { (value: T, index?: number, List?: List<T>) => void } callbackFn - callbackFn
* callbackFn (required) A function that accepts up to four arguments.
* The function to be called for each element in the list,Returns the result of an operation
* @param { Object } thisArg - thisArg thisArg (Optional) The value passed to the function generally uses the "this" value.
* If this parameter is empty, "undefined" will be passed to the "this" value
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
forEach(callbackFn: (value: T, index?: number, List?: List<T>) => void, thisArg?: Object): void;
/**
* Sorts this list according to the order induced by the specified comparator
@ -213,9 +370,22 @@ declare class List<T>{
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @throws { BusinessError } 10200011 - The sort method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Sorts this list according to the order induced by the specified comparator
*
* @param { (firstValue: T, secondValue: T) => number } comparator - comparator
* comparator (required) A function that accepts up to two arguments.
* Specifies the sort order. Must be a function,return number type,If it returns firstValue
* minus secondValue, it returns an list sorted in ascending order;If it returns secondValue
* minus firstValue, it returns an list sorted in descending order;
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @throws { BusinessError } 10200011 - The sort method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
sort(comparator: (firstValue: T, secondValue: T) => number): void;
/**
* Removes all of the elements from this list.The list will
@ -223,9 +393,17 @@ declare class List<T>{
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Removes all of the elements from this list.The list will
* be empty after this call returns.length becomes 0
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
clear(): void;
/**
* Returns a view of the portion of this list between the specified fromIndex,inclusive,and toIndex,exclusive
@ -237,9 +415,21 @@ declare class List<T>{
* @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a view of the portion of this list between the specified fromIndex,inclusive,and toIndex,exclusive
*
* @param { number } fromIndex - fromIndex fromIndex The starting position of the index, containing the value at that index position
* @param { number } toIndex - toIndex toIndex the end of the index, excluding the value at that index
* @returns { List<T> }
* @throws { BusinessError } 10200011 - The getSubList method cannot be bound.
* @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getSubList(fromIndex: number, toIndex: number): List<T>;
/**
* Replaces each element of this list with the result of applying the operator to that element.
@ -252,9 +442,22 @@ declare class List<T>{
* @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Replaces each element of this list with the result of applying the operator to that element.
*
* @param { (value: T, index?: number, list?: List<T>) => T } callbackFn - callbackFn
* callbackFn (required) A function that accepts up to four arguments.
* The function to be called for each element in the list,Returns the result of an operation
* @param { Object } thisArg - thisArg thisArg (Optional) The value passed to the function generally uses the "this" value.
* If this parameter is empty, "undefined" will be passed to the "this" value
* @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
replaceAllElements(callbackFn: (value: T, index?: number, list?: List<T>) => T, thisArg?: Object): void;
/**
* convert list to array
@ -262,9 +465,17 @@ declare class List<T>{
* @returns { Array<T> } the Array type
* @throws { BusinessError } 10200011 - The convertToArray method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* convert list to array
*
* @returns { Array<T> } the Array type
* @throws { BusinessError } 10200011 - The convertToArray method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
convertToArray(): Array<T>;
/**
* Determine whether list is empty and whether there is an element
@ -272,9 +483,17 @@ declare class List<T>{
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Determine whether list is empty and whether there is an element
*
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
isEmpty(): boolean;
/**
* returns an iterator.Each item of the iterator is a Javascript Object
@ -282,9 +501,17 @@ declare class List<T>{
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* returns an iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
[Symbol.iterator](): IterableIterator<T>;
}

View File

@ -19,26 +19,47 @@
*
* @namespace PlainArray
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* PlainArray stores key-value (KV) pairs. Each key must be unique, be of the number type, and have only one value.
* PlainArray is based on generics and uses a lightweight structure.
*
* @namespace PlainArray
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare class PlainArray<T> {
/**
* A constructor used to create a PlainArray object.
*
* @throws { BusinessError } 10200012 - The PlainArray's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* A constructor used to create a PlainArray object.
*
* @throws { BusinessError } 10200012 - The PlainArray's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
constructor();
/**
* Gets the element number of the PlainArray.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the element number of the PlainArray.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
length: number;
/**
* Appends a key-value pair to PlainArray
@ -48,18 +69,35 @@ declare class PlainArray<T> {
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Appends a key-value pair to PlainArray
*
* @param { number } key - key key Added the key of key-value
* @param { T } value - value value Added the value of key-value
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
add(key: number, value: T): void;
/**
* Clears the current PlainArray object
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Clears the current PlainArray object
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
clear(): void;
/**
* Obtains a clone of the current PlainArray object
@ -67,9 +105,17 @@ declare class PlainArray<T> {
* @returns { PlainArray<T> }
* @throws { BusinessError } 10200011 - The clone method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains a clone of the current PlainArray object
*
* @returns { PlainArray<T> }
* @throws { BusinessError } 10200011 - The clone method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
clone(): PlainArray<T>;
/**
* Checks whether the current PlainArray object contains the specified key
@ -79,9 +125,19 @@ declare class PlainArray<T> {
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Checks whether the current PlainArray object contains the specified key
*
* @param { number } key - key key need to determine whether to include the key
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
has(key: number): boolean;
/**
* Queries the value associated with the specified key
@ -91,9 +147,19 @@ declare class PlainArray<T> {
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Queries the value associated with the specified key
*
* @param { number } key - key key Looking for goals
* @returns { T } the value of key-value pairs
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
get(key: number): T;
/**
* Queries the index for a specified key
@ -103,9 +169,19 @@ declare class PlainArray<T> {
* @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Queries the index for a specified key
*
* @param { number } key - key key Looking for goals
* @returns { number } Subscript corresponding to target
* @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getIndexOfKey(key: number): number;
/**
* Queries the index for a specified value
@ -114,9 +190,18 @@ declare class PlainArray<T> {
* @returns { number } Subscript corresponding to target
* @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Queries the index for a specified value
*
* @param { T } value - value value Looking for goals
* @returns { number } Subscript corresponding to target
* @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getIndexOfValue(value: T): number;
/**
* Checks whether the current PlainArray object is empty
@ -124,9 +209,17 @@ declare class PlainArray<T> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Checks whether the current PlainArray object is empty
*
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
isEmpty(): boolean;
/**
* Queries the key at a specified index
@ -136,9 +229,19 @@ declare class PlainArray<T> {
* @throws { BusinessError } 10200011 - The getKeyAt method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Queries the key at a specified index
*
* @param { number } index - index index Target subscript for search
* @returns { number } the key of key-value pairs
* @throws { BusinessError } 10200011 - The getKeyAt method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getKeyAt(index: number): number;
/**
* Remove the key-value pair based on a specified key if it exists and return the value
@ -148,9 +251,19 @@ declare class PlainArray<T> {
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Remove the key-value pair based on a specified key if it exists and return the value
*
* @param { number } key - key key Target to be deleted
* @returns { T } Target mapped value
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
remove(key: number): T;
/**
* Remove the key-value pair at a specified index if it exists and return the value
@ -160,9 +273,19 @@ declare class PlainArray<T> {
* @throws { BusinessError } 10200011 - The removeAt method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Remove the key-value pair at a specified index if it exists and return the value
*
* @param { number } index - index index Target subscript for search
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The removeAt method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeAt(index: number): T;
/**
* Remove a group of key-value pairs from a specified index
@ -174,9 +297,21 @@ declare class PlainArray<T> {
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Remove a group of key-value pairs from a specified index
*
* @param { number } index - index index remove start index
* @param { number } size - size size Expected deletion quantity
* @returns { number } Actual deleted quantity
* @throws { BusinessError } 10200011 - The removeRangeFrom method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeRangeFrom(index: number, size: number): number;
/**
* Update value on specified index
@ -187,9 +322,20 @@ declare class PlainArray<T> {
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Update value on specified index
*
* @param { number } index - index index Target subscript for search
* @param { T } value - value value Updated the target mapped value
* @throws { BusinessError } 10200011 - The setValueAt method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
setValueAt(index: number, value: T): void;
/**
* Obtains the string representation of the PlainArray object
@ -197,9 +343,17 @@ declare class PlainArray<T> {
* @returns { String }
* @throws { BusinessError } 10200011 - The toString method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains the string representation of the PlainArray object
*
* @returns { String }
* @throws { BusinessError } 10200011 - The toString method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
toString(): String;
/**
* Queries the value at a specified index
@ -210,9 +364,20 @@ declare class PlainArray<T> {
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Queries the value at a specified index
*
* @param { number } index - index index Target subscript for search
* @returns { T } the value of key-value pairs
* @throws { BusinessError } 10200011 - The getValueAt method cannot be bound.
* @throws { BusinessError } 10200001 - The value of index is out of range.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getValueAt(index: number): T;
/**
* Executes a provided function once for each value in the PlainArray object.
@ -222,9 +387,19 @@ declare class PlainArray<T> {
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Executes a provided function once for each value in the PlainArray object.
*
* @param { (value: T, index?: number, PlainArray?: PlainArray<T>) => void } callbackFn - callbackFn callbackFn
* @param { Object } thisArg - thisArg thisArg
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
forEach(callbackFn: (value: T, index?: number, PlainArray?: PlainArray<T>) => void, thisArg?: Object): void;
/**
* returns an iterator.Each item of the iterator is a Javascript Object
@ -232,9 +407,17 @@ declare class PlainArray<T> {
* @returns { IterableIterator<[number, T]> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* returns an iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<[number, T]> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
[Symbol.iterator](): IterableIterator<[number, T]>;
}

View File

@ -20,26 +20,48 @@
*
* @namespace Queue
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Queue follows the principle of First In First Out (FIFO).
* It supports insertion of elements at the end and removal from the front of the queue.
* Queue is implemented based on the queue data structure.
*
* @namespace Queue
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare class Queue<T> {
/**
* A constructor used to create a Queue object.
*
* @throws { BusinessError } 10200012 - The Queue's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* A constructor used to create a Queue object.
*
* @throws { BusinessError } 10200012 - The Queue's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
constructor();
/**
* Gets the element number of the Queue.This is a number one higher than the highest index in the queue.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the element number of the Queue.This is a number one higher than the highest index in the queue.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
length: number;
/**
* Inserting specified element at the end of a queue if it is possible to do
@ -49,9 +71,19 @@ declare class Queue<T> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Inserting specified element at the end of a queue if it is possible to do
* so immediately without violating capacity restrictions.
*
* @param { T } element - element element to be appended to this queue
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
add(element: T): boolean;
/**
* Obtains the header element of a queue.
@ -59,9 +91,17 @@ declare class Queue<T> {
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains the header element of a queue.
*
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getFirst(): T;
/**
* Retrieves and removes the head of this queue
@ -69,9 +109,17 @@ declare class Queue<T> {
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The pop method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Retrieves and removes the head of this queue
*
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The pop method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
pop(): T;
/**
* Executes a provided function once for each value in the queue object.
@ -84,9 +132,22 @@ declare class Queue<T> {
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Executes a provided function once for each value in the queue object.
*
* @param { (value: T, index?: number, Queue?: Queue<T>) => void } callbackFn - callbackFn
* callbackFn (required) A function that accepts up to four arguments.The function to
* be called for each element in the queue
* @param { Object } thisArg - thisArg thisArg (Optional) The value passed to the function generally uses the "this" value.
* If this parameter is empty, "undefined" will be passed to the "this" value
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
forEach(callbackFn: (value: T, index?: number, Queue?: Queue<T>) => void, thisArg?: Object): void;
/**
* returns an iterator.Each item of the iterator is a Javascript Object
@ -94,9 +155,17 @@ declare class Queue<T> {
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* returns an iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
[Symbol.iterator](): IterableIterator<T>;
}

View File

@ -19,26 +19,47 @@
*
* @namespace Stack
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Stack is implemented based on the array data structure.
* It follows the principle Last Out First In (LOFI) and supports data insertion and removal at one end.
*
* @namespace Stack
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare class Stack<T> {
/**
* A constructor used to create a Stack object.
*
* @throws { BusinessError } 10200012 - The Stack's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* A constructor used to create a Stack object.
*
* @throws { BusinessError } 10200012 - The Stack's constructor cannot be directly invoked.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
constructor();
/**
* Gets the element number of the Stack. This is a number one higher than the highest index in the Stack.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the element number of the Stack. This is a number one higher than the highest index in the Stack.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
length: number;
/**
* Tests if this stack is empty
@ -46,9 +67,17 @@ declare class Stack<T> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Tests if this stack is empty
*
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
isEmpty(): boolean;
/**
* Looks at the object at the top of this stack without removing it from the stack
@ -57,9 +86,18 @@ declare class Stack<T> {
* @returns { T } the top value or undefined
* @throws { BusinessError } 10200011 - The peek method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Looks at the object at the top of this stack without removing it from the stack
* Return undefined if this stack is empty
*
* @returns { T } the top value or undefined
* @throws { BusinessError } 10200011 - The peek method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
peek(): T;
/**
* Removes the object at the top of this stack and returns that object as the value of this function
@ -68,9 +106,18 @@ declare class Stack<T> {
* @returns { T } Stack top value or undefined
* @throws { BusinessError } 10200011 - The pop method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Removes the object at the top of this stack and returns that object as the value of this function
* an exception if the stack is empty
*
* @returns { T } Stack top value or undefined
* @throws { BusinessError } 10200011 - The pop method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
pop(): T;
/**
* Pushes an item onto the top of this stack
@ -79,9 +126,18 @@ declare class Stack<T> {
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The push method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Pushes an item onto the top of this stack
*
* @param { T } item - item item to be appended to this Stack
* @returns { T } the T type
* @throws { BusinessError } 10200011 - The push method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
push(item: T): T;
/**
* Returns the 1-based position where an object is on this stack
@ -90,9 +146,18 @@ declare class Stack<T> {
* @returns { number } the T type,If there is no such element, return -1
* @throws { BusinessError } 10200011 - The locate method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the 1-based position where an object is on this stack
*
* @param { T } element - element element Target to be deleted
* @returns { number } the T type,If there is no such element, return -1
* @throws { BusinessError } 10200011 - The locate method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
locate(element: T): number;
/**
* Executes a provided function once for each value in the Stack object.
@ -105,9 +170,22 @@ declare class Stack<T> {
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Executes a provided function once for each value in the Stack object.
*
* @param { (value: T, index?: number, stack?: Stack<T>) => void } callbackFn - callbackFn
* callbackFn (required) A function that accepts up to four arguments.The function
* to be called for each element in the Stack
* @param { Object } thisArg - thisArg thisArg (Optional) The value passed to the function generally uses the "this" value.
* If this parameter is empty, "undefined" will be passed to the "this" value
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
forEach(callbackFn: (value: T, index?: number, stack?: Stack<T>) => void, thisArg?: Object): void;
/**
* returns an ES6 iterator.Each item of the iterator is a Javascript Object
@ -115,9 +193,17 @@ declare class Stack<T> {
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* returns an ES6 iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
[Symbol.iterator](): IterableIterator<T>;
}

View File

@ -20,9 +20,18 @@
*
* @namespace TreeMap
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* TreeMap stores key-value (KV) pairs. Each key must be unique and have only one value.
* TreeMap is implemented using a red-black tree, which is a binary search tree where keys
* are stored in sorted order for efficient insertion and removal.
*
* @namespace TreeMap
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare class TreeMap<K, V> {
/**
* A constructor used to create a TreeMap object.
@ -34,17 +43,35 @@ declare class TreeMap<K, V> {
* @throws { BusinessError } 10200012 - The TreeMap's constructor cannot be directly invoked.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* A constructor used to create a TreeMap object.
*
* @param { (firstValue: K, secondValue: K) => boolean } comparator - comparator comparator
*(Optional) User-defined comparison functions
* firstValue (Optional) previous element
* secondValue (Optional) next element
* @throws { BusinessError } 10200012 - The TreeMap's constructor cannot be directly invoked.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
constructor(comparator?: (firstValue: K, secondValue: K) => boolean);
/**
* Gets the element number of the hashmap.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the element number of the hashmap.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
length: number;
/**
* Returns whether the Map object contains elements
@ -52,9 +79,17 @@ declare class TreeMap<K, V> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether the Map object contains elements
*
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
isEmpty(): boolean;
/**
* Returns whether a key is contained in this map
@ -63,9 +98,18 @@ declare class TreeMap<K, V> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The hasKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether a key is contained in this map
*
* @param { K } key - key key need to determine whether to include the key
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The hasKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
hasKey(key: K): boolean;
/**
* Returns whether a value is contained in this map
@ -74,9 +118,18 @@ declare class TreeMap<K, V> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The hasValue method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether a value is contained in this map
*
* @param { V } value - value value value need to determine whether to include the value
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The hasValue method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
hasValue(value: V): boolean;
/**
* Returns a specified element in a Map object, or null if there is no corresponding element
@ -85,9 +138,18 @@ declare class TreeMap<K, V> {
* @returns { V } value or null
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a specified element in a Map object, or null if there is no corresponding element
*
* @param { K } key - key key the index in TreeMap
* @returns { V } value or null
* @throws { BusinessError } 10200011 - The get method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
get(key: K): V;
/**
* Obtains the first sorted key in the treemap.
@ -96,9 +158,18 @@ declare class TreeMap<K, V> {
* @returns { K } value or undefined
* @throws { BusinessError } 10200011 - The getFirstKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains the first sorted key in the treemap.
* Or returns undefined if tree map is empty
*
* @returns { K } value or undefined
* @throws { BusinessError } 10200011 - The getFirstKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getFirstKey(): K;
/**
* Obtains the last sorted key in the treemap.
@ -107,9 +178,18 @@ declare class TreeMap<K, V> {
* @returns { K } value or undefined
* @throws { BusinessError } 10200011 - The getLastKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Obtains the last sorted key in the treemap.
* Or returns undefined if tree map is empty
*
* @returns { K } value or undefined
* @throws { BusinessError } 10200011 - The getLastKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getLastKey(): K;
/**
* Adds all element groups in one map to another map
@ -118,9 +198,18 @@ declare class TreeMap<K, V> {
* @throws { BusinessError } 10200011 - The setAll method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Adds all element groups in one map to another map
*
* @param { TreeMap<K, V> } map - map map the Map object to add members
* @throws { BusinessError } 10200011 - The setAll method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
setAll(map: TreeMap<K, V>): void;
/**
* Adds or updates a(new) key-value pair with a key and value specified for the Map object
@ -131,9 +220,20 @@ declare class TreeMap<K, V> {
* @throws { BusinessError } 10200011 - The set method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Adds or updates a(new) key-value pair with a key and value specified for the Map object
*
* @param { K } key - key key Added or updated targets
* @param { V } value - value value Added or updated value
* @returns { Object } the map object after set
* @throws { BusinessError } 10200011 - The set method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
set(key: K, value: V): Object;
/**
* Remove a specified element from a Map object
@ -142,18 +242,34 @@ declare class TreeMap<K, V> {
* @returns { V } Target mapped value
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Remove a specified element from a Map object
*
* @param { K } key - key key Target to be deleted
* @returns { V } Target mapped value
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
remove(key: K): V;
/**
* Clear all element groups in the map
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Clear all element groups in the map
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
clear(): void;
/**
* Returns the greatest element smaller than or equal to the specified key
@ -163,9 +279,19 @@ declare class TreeMap<K, V> {
* @returns { K } key or undefined
* @throws { BusinessError } 10200011 - The getLowerKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the greatest element smaller than or equal to the specified key
* if the key does not exist, undefined is returned
*
* @param { K } key - key key Objective of comparison
* @returns { K } key or undefined
* @throws { BusinessError } 10200011 - The getLowerKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getLowerKey(key: K): K;
/**
* Returns the least element greater than or equal to the specified key
@ -175,9 +301,19 @@ declare class TreeMap<K, V> {
* @returns { K } key or undefined
* @throws { BusinessError } 10200011 - The getHigherKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the least element greater than or equal to the specified key
* if the key does not exist, undefined is returned
*
* @param { K } key - key key Objective of comparison
* @returns { K } key or undefined
* @throws { BusinessError } 10200011 - The getHigherKey method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getHigherKey(key: K): K;
/**
* Returns a new Iterator object that contains the keys contained in this map
@ -185,9 +321,17 @@ declare class TreeMap<K, V> {
* @returns { IterableIterator<K> }
* @throws { BusinessError } 10200011 - The keys method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a new Iterator object that contains the keys contained in this map
*
* @returns { IterableIterator<K> }
* @throws { BusinessError } 10200011 - The keys method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
keys(): IterableIterator<K>;
/**
* Returns a new Iterator object that contains the values contained in this map
@ -195,9 +339,17 @@ declare class TreeMap<K, V> {
* @returns { IterableIterator<V> }
* @throws { BusinessError } 10200011 - The values method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a new Iterator object that contains the values contained in this map
*
* @returns { IterableIterator<V> }
* @throws { BusinessError } 10200011 - The values method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
values(): IterableIterator<V>;
/**
* Replace the old value by new value corresponding to the specified key
@ -207,9 +359,19 @@ declare class TreeMap<K, V> {
* @returns { boolean } the boolean type(Is there a target pointed to by the key)
* @throws { BusinessError } 10200011 - The replace method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Replace the old value by new value corresponding to the specified key
*
* @param { K } key - key key Updated targets
* @param { V } newValue - newValue newValue Updated the target mapped value
* @returns { boolean } the boolean type(Is there a target pointed to by the key)
* @throws { BusinessError } 10200011 - The replace method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
replace(key: K, newValue: V): boolean;
/**
* Executes the given callback function once for each real key in the map.
@ -220,9 +382,20 @@ declare class TreeMap<K, V> {
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Executes the given callback function once for each real key in the map.
* It does not perform functions on deleted keys
*
* @param { (value?: V, key?: K, map?: TreeMap<K, V>) => void } callbackFn - callbackFn callbackFn
* @param { Object } thisArg - callbackFn callbackFn
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
forEach(callbackFn: (value?: V, key?: K, map?: TreeMap<K, V>) => void, thisArg?: Object): void;
/**
* Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order
@ -230,9 +403,17 @@ declare class TreeMap<K, V> {
* @returns { IterableIterator<[K, V]> }
* @throws { BusinessError } 10200011 - The entries method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order
*
* @returns { IterableIterator<[K, V]> }
* @throws { BusinessError } 10200011 - The entries method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
entries(): IterableIterator<[K, V]>;
/**
* returns an ES6 iterator.Each item of the iterator is a Javascript Object
@ -240,9 +421,17 @@ declare class TreeMap<K, V> {
* @returns { IterableIterator<[K, V]> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* returns an ES6 iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<[K, V]> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
[Symbol.iterator](): IterableIterator<[K, V]>;
}

View File

@ -19,9 +19,17 @@
*
* @namespace TreeSet
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* TreeSet is implemented based on TreeMap. In TreeSet, only value objects are processed.
* TreeSet can be used to store values, each of which must be unique.
*
* @namespace TreeSet
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare class TreeSet<T> {
/**
* A constructor used to create a TreeSet object.
@ -33,17 +41,35 @@ declare class TreeSet<T> {
* @throws { BusinessError } 10200012 - The TreeSet's constructor cannot be directly invoked.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* A constructor used to create a TreeSet object.
*
* @param { (firstValue: T, secondValue: T) => boolean } comparator - comparison comparison
* (Optional) User-defined comparison functions
* firstValue (Optional) previous element
* secondValue (Optional) next element
* @throws { BusinessError } 10200012 - The TreeSet's constructor cannot be directly invoked.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
constructor(comparator?: (firstValue: T, secondValue: T) => boolean);
/**
* Gets the element number of the TreeSet.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the element number of the TreeSet.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
length: number;
/**
* Returns whether the Set object contains elements
@ -51,9 +77,17 @@ declare class TreeSet<T> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether the Set object contains elements
*
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The isEmpty method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
isEmpty(): boolean;
/**
* Returns whether the Set object contain s the elements
@ -62,9 +96,18 @@ declare class TreeSet<T> {
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns whether the Set object contain s the elements
*
* @param { T } value - value value need to determine whether to include the element
* @returns { boolean } the boolean type
* @throws { BusinessError } 10200011 - The has method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
has(value: T): boolean;
/**
* If the set does not contain the element, the specified element is added
@ -74,9 +117,19 @@ declare class TreeSet<T> {
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* If the set does not contain the element, the specified element is added
*
* @param { T } value - value value Added element
* @returns { boolean } the boolean type(Is there contain this element)
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @throws { BusinessError } 10200011 - The add method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
add(value: T): boolean;
/**
* Remove a specified element from a Set object
@ -85,18 +138,34 @@ declare class TreeSet<T> {
* @returns { boolean } the boolean type(Is there contain this element)
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Remove a specified element from a Set object
*
* @param { T } value - value value Target to be deleted
* @returns { boolean } the boolean type(Is there contain this element)
* @throws { BusinessError } 10200011 - The remove method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
remove(value: T): boolean;
/**
* Clears all element groups in a set
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Clears all element groups in a set
*
* @throws { BusinessError } 10200011 - The clear method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
clear(): void;
/**
* Gets the first elements in a set
@ -104,9 +173,17 @@ declare class TreeSet<T> {
* @returns { T } value or undefined
* @throws { BusinessError } 10200011 - The getFirstValue method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the first elements in a set
*
* @returns { T } value or undefined
* @throws { BusinessError } 10200011 - The getFirstValue method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getFirstValue(): T;
/**
* Gets the last elements in a set
@ -114,9 +191,17 @@ declare class TreeSet<T> {
* @returns { T } value or undefined
* @throws { BusinessError } 10200011 - The getLastValue method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Gets the last elements in a set
*
* @returns { T } value or undefined
* @throws { BusinessError } 10200011 - The getLastValue method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getLastValue(): T;
/**
* Returns the greatest element smaller than or equal to the specified key
@ -127,9 +212,20 @@ declare class TreeSet<T> {
* @throws { BusinessError } 10200011 - The getLowerValue method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the greatest element smaller than or equal to the specified key
* if the key does not exist, undefined is returned
*
* @param { T } key - key key Objective of comparison
* @returns { T } key or undefined
* @throws { BusinessError } 10200011 - The getLowerValue method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getLowerValue(key: T): T;
/**
* Returns the least element greater than or equal to the specified key
@ -140,9 +236,20 @@ declare class TreeSet<T> {
* @throws { BusinessError } 10200011 - The getHigherValue method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns the least element greater than or equal to the specified key
* if the key does not exist, undefined is returned
*
* @param { T } key - key key Objective of comparison
* @returns { T } key or undefined
* @throws { BusinessError } 10200011 - The getHigherValue method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
getHigherValue(key: T): T;
/**
* Return and delete the first element, returns undefined if tree set is empty
@ -150,9 +257,17 @@ declare class TreeSet<T> {
* @returns { T } first value or undefined
* @throws { BusinessError } 10200011 - The popFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Return and delete the first element, returns undefined if tree set is empty
*
* @returns { T } first value or undefined
* @throws { BusinessError } 10200011 - The popFirst method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
popFirst(): T;
/**
* Return and delete the last element, returns undefined if tree set is empty
@ -160,9 +275,17 @@ declare class TreeSet<T> {
* @returns { T } last value or undefined
* @throws { BusinessError } 10200011 - The popLast method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Return and delete the last element, returns undefined if tree set is empty
*
* @returns { T } last value or undefined
* @throws { BusinessError } 10200011 - The popLast method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
popLast(): T;
/**
* Executes a provided function once for each value in the Set object.
@ -172,9 +295,19 @@ declare class TreeSet<T> {
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Executes a provided function once for each value in the Set object.
*
* @param { (value?: T, key?: T, set?: TreeSet<T>) => void } callbackFn - callbackFn callbackFn
* @param { Object } thisArg - thisArg thisArg
* @throws { BusinessError } 10200011 - The forEach method cannot be bound.
* @throws { BusinessError } 401 - The type of parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
forEach(callbackFn: (value?: T, key?: T, set?: TreeSet<T>) => void, thisArg?: Object): void;
/**
* Returns a new Iterator object that contains the values contained in this set
@ -182,9 +315,17 @@ declare class TreeSet<T> {
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The values method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a new Iterator object that contains the values contained in this set
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The values method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
values(): IterableIterator<T>;
/**
* Returns a new Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order
@ -192,9 +333,17 @@ declare class TreeSet<T> {
* @returns { IterableIterator<[T, T]> }
* @throws { BusinessError } 10200011 - The entries method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* Returns a new Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order
*
* @returns { IterableIterator<[T, T]> }
* @throws { BusinessError } 10200011 - The entries method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
entries(): IterableIterator<[T, T]>;
/**
* returns an ES6 iterator.Each item of the iterator is a Javascript Object
@ -202,9 +351,17 @@ declare class TreeSet<T> {
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 8
*/
/**
* returns an ES6 iterator.Each item of the iterator is a Javascript Object
*
* @returns { IterableIterator<T> }
* @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
[Symbol.iterator](): IterableIterator<T>;
}

1326
api/@ohos.util.d.ts vendored

File diff suppressed because it is too large Load Diff

429
api/@ohos.worker.d.ts vendored
View File

@ -17,35 +17,59 @@
* @typedef WorkerOptions
* Provides options that can be set for the worker to create.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* @typedef WorkerOptions
* Provides options that can be set for the worker to create.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
export interface WorkerOptions {
/**
* Mode in which the worker executes the script.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* Mode in which the worker executes the script.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
type?: 'classic' | 'module';
/**
* Name of the worker.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* Name of the worker.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
name?: string;
/**
* Whether the worker is shared.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* Whether the worker is shared.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
shared?: boolean;
}
@ -53,26 +77,44 @@ export interface WorkerOptions {
* @typedef Event
* Defines the event.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* @typedef Event
* Defines the event.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
export interface Event {
/**
* Type of the Event.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* Type of the Event.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
readonly type: string;
/**
* Timestamp(accurate to millisecond) when the event is created.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* Timestamp(accurate to millisecond) when the event is created.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
readonly timeStamp: number;
}
@ -80,53 +122,89 @@ export interface Event {
* @typedef ErrorEvent
* Provides detailed information about the exception occurred during worker execution.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* @typedef ErrorEvent
* Provides detailed information about the exception occurred during worker execution.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
export interface ErrorEvent extends Event {
/**
* Information about the exception.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* Information about the exception.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
readonly message: string;
/**
* File where the exception is located.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* File where the exception is located.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
readonly filename: string;
/**
* Number of the line where the exception is located.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* Number of the line where the exception is located.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
readonly lineno: number;
/**
* Number of the column where the exception is located.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* Number of the column where the exception is located.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
readonly colno: number;
/**
* Type of the exception.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* Type of the exception.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
readonly error: Object;
}
@ -134,17 +212,29 @@ export interface ErrorEvent extends Event {
* @typedef MessageEvent
* Holds the data transferred between worker threads.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* @typedef MessageEvent
* Holds the data transferred between worker threads.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
export interface MessageEvent<T> extends Event {
/**
* Data transferred when an exception occurs.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* Data transferred when an exception occurs.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
readonly data: T;
}
@ -152,17 +242,29 @@ export interface MessageEvent<T> extends Event {
* @typedef MessageEvents
* Saves the data transferred between worker thread and host thread.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* @typedef MessageEvents
* Saves the data transferred between worker thread and host thread.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
export interface MessageEvents extends Event {
/**
* Data transferred when an exception occurs.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Data transferred when an exception occurs.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
readonly data;
}
@ -171,17 +273,30 @@ export interface MessageEvents extends Event {
* Specifies the object whose ownership need to be transferred during data transfer.
* The object must be ArrayBuffer.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* @typedef PostMessageOptions
* Specifies the object whose ownership need to be transferred during data transfer.
* The object must be ArrayBuffer.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
export interface PostMessageOptions {
/**
* ArrayBuffer array used to transfer the ownership.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* ArrayBuffer array used to transfer the ownership.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
transfer?: Object[];
}
@ -209,9 +324,15 @@ export interface EventListener {
* @typedef WorkerEventListener
* Implements event listening.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* @typedef WorkerEventListener
* Implements event listening.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
export interface WorkerEventListener {
/**
* Specifies the callback function to be invoked.
@ -222,7 +343,6 @@ export interface WorkerEventListener {
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200005 - The invoked API is not supported in workers.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
@ -230,6 +350,9 @@ export interface WorkerEventListener {
*
* @param { Event } event - event Event class for the callback to invoke.
* @returns { void | Promise<void> }
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200005 - The invoked API is not supported in workers.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
@ -241,9 +364,15 @@ export interface WorkerEventListener {
* Type of message, only "message" and "messageerror".
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* Type of message, only "message" and "messageerror".
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
type MessageType = 'message' | 'messageerror';
/**
@ -306,9 +435,15 @@ export interface EventTarget {
* @typedef WorkerEventTarget
* Specific worker event features.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* @typedef WorkerEventTarget
* Specific worker event features.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
export interface WorkerEventTarget {
/**
* Adds an event listener to the worker.
@ -324,12 +459,12 @@ export interface WorkerEventTarget {
/**
* Adds an event listener to the worker.
*
* @param { string } type - type Type Type of the event to listen for.
* @param { string } type - type Type of the event to listen for.
* @param { WorkerEventListener } listener - listener Callback to invoke when an event of the specified type occurs.
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200005 - The invoked API is not supported in workers.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
addEventListener(type: string, listener: WorkerEventListener): void;
@ -341,9 +476,19 @@ export interface WorkerEventTarget {
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Handle the event defined for the worker.
*
* @param { Event } event - event Event to dispatch.
* @returns { boolean }
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
dispatchEvent(event: Event): boolean;
/**
* Remove an event defined for the worker.
@ -353,18 +498,35 @@ export interface WorkerEventTarget {
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Remove an event defined for the worker.
*
* @param { string } type - type Type of the event for which the event listener is cancelled.
* @param { WorkerEventListener } callback - callback Callback of the event listener to remove.
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeEventListener(type: string, callback?: WorkerEventListener): void;
/**
* Remove all event listeners for the worker.
*
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Remove all event listeners for the worker.
*
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeAllListener(): void;
}
@ -405,17 +567,29 @@ declare interface WorkerGlobalScope extends EventTarget {
* @typedef GlobalScope
* The environment Specified in which worker threads run, which is isolated from the host thread environment.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* @typedef GlobalScope
* The environment Specified in which worker threads run, which is isolated from the host thread environment.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare interface GlobalScope extends WorkerEventTarget {
/**
* Name of Worker specified when there is a new worker.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Name of Worker specified when there is a new worker.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
readonly name: string;
/**
@ -424,17 +598,31 @@ declare interface GlobalScope extends WorkerEventTarget {
* The event handler is executed in the worker thread.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* The onerror attribute of parentPort specified.
* the event handler to be called when an exception occurs during worker execution.
* The event handler is executed in the worker thread.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
onerror?: (ev: ErrorEvent) => void;
/**
* Specify the type attribute for self.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Specify the type attribute for self.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
readonly self: GlobalScope & typeof globalThis;
}
@ -511,9 +699,15 @@ export interface DedicatedWorkerGlobalScope extends WorkerGlobalScope {
* @typedef ThreadWorkerGlobalScope
* Specifies the thread-worker running environment, which is isolated from the host-thread environment
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* @typedef ThreadWorkerGlobalScope
* Specifies the thread-worker running environment, which is isolated from the host-thread environment
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
export interface ThreadWorkerGlobalScope extends GlobalScope {
/**
* The onmessage attribute of parentPort specifies the event handler
@ -533,6 +727,9 @@ export interface ThreadWorkerGlobalScope extends GlobalScope {
* the host thread through worker postMessage.
* The event handler is executed in the worker thread.
*
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200005 - The invoked API is not supported in workers.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
@ -555,6 +752,9 @@ export interface ThreadWorkerGlobalScope extends GlobalScope {
* to be called then the worker receives a message that cannot be deserialized.
* The event handler is executed in the worker thread.
*
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200005 - The invoked API is not supported in workers.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
@ -566,9 +766,16 @@ export interface ThreadWorkerGlobalScope extends GlobalScope {
*
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Close the worker thread to stop the worker from receiving messages
*
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
close(): void;
/**
@ -580,9 +787,20 @@ export interface ThreadWorkerGlobalScope extends GlobalScope {
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200006 - Serializing an uncaught exception failed.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Send a message to host thread from the worker
*
* @param { Object } messageObject - messageObject Data to be sent to the worker
* @param { ArrayBuffer[] } transfer - transfer array cannot contain null.
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200006 - Serializing an uncaught exception failed.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
postMessage(messageObject: Object, transfer: ArrayBuffer[]): void;
/**
@ -594,9 +812,20 @@ export interface ThreadWorkerGlobalScope extends GlobalScope {
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200006 - Serializing an uncaught exception failed.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Send a message to be host thread from the worker
*
* @param { Object } messageObject - messageObject Data to be sent to the worker
* @param { PostMessageOptions } options - options Option can be set for postmessage.
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200006 - Serializing an uncaught exception failed.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
postMessage(messageObject: Object, options?: PostMessageOptions): void;
}
@ -605,17 +834,30 @@ export interface ThreadWorkerGlobalScope extends GlobalScope {
*
* @namespace worker
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 7
*/
/**
* JS cross-thread communication tool
*
* @namespace worker
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
declare namespace worker {
/**
* The ThreadWorker class contains all Worker functions.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* The ThreadWorker class contains all Worker functions.
*
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
class ThreadWorker implements WorkerEventTarget {
/**
* Creates a worker instance
@ -626,9 +868,20 @@ declare namespace worker {
* @throws { BusinessError } 10200003 - Worker initialization failure.
* @throws { BusinessError } 10200007 - The worker file patch is invalid path.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Creates a worker instance
*
* @param { string } scriptURL - scriptURL URL of the script to be executed by the worker
* @param { WorkerOptions } options - options Options that can be set for the worker
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200003 - Worker initialization failure.
* @throws { BusinessError } 10200007 - The worker file patch is invalid path.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
constructor(scriptURL: string, options?: WorkerOptions);
/**
* The onexit attribute of the worker specifies the event handler to be called
@ -644,6 +897,9 @@ declare namespace worker {
* The onexit attribute of the worker specifies the event handler to be called
* when the worker exits. The handler is executed in the host thread.
*
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200005 - The invoked API is not supported in workers.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
@ -665,6 +921,9 @@ declare namespace worker {
* when an exception occurs during worker execution.
* The event handler is executed in the host thread.
*
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200005 - The invoked API is not supported in workers.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
@ -688,6 +947,9 @@ declare namespace worker {
* and sent by the worker through the parentPort.postMessage.
* The event handler is executed in the host thread.
*
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200005 - The invoked API is not supported in workers.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
@ -709,6 +971,9 @@ declare namespace worker {
* when the worker receives a message that cannot be serialized.
* The event handler is executed in the host thread.
*
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200005 - The invoked API is not supported in workers.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
@ -725,9 +990,22 @@ declare namespace worker {
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200006 - Serializing an uncaught exception failed.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Sends a message to the worker thread.
* The data is transferred using the structured clone algorithm.
*
* @param { Object } message - message Data to be sent to the worker
* @param { ArrayBuffer[] } transfer - transfer ArrayBuffer instance that can be transferred.
* The transferList array cannot contain null.
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200006 - Serializing an uncaught exception failed.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
postMessage(message: Object, transfer: ArrayBuffer[]): void;
/**
* Sends a message to the worker thread.
@ -739,9 +1017,21 @@ declare namespace worker {
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200006 - Serializing an uncaught exception failed.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Sends a message to the worker thread.
* The data is transferred using the structured clone algorithm.
*
* @param { Object } message - message Data to be sent to the worker
* @param { PostMessageOptions } options - options
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200006 - Serializing an uncaught exception failed.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
postMessage(message: Object, options?: PostMessageOptions): void;
/**
* Adds an event listener to the worker.
@ -761,6 +1051,7 @@ declare namespace worker {
* @param { WorkerEventListener } listener - listener Callback to invoke when an event of the specified type occurs.
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200005 - The invoked API is not supported in workers.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
@ -786,6 +1077,7 @@ declare namespace worker {
* @param { WorkerEventListener } listener - listener Callback to invoke when an event of the specified type occurs
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200005 - The invoked API is not supported in workers.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
@ -809,6 +1101,7 @@ declare namespace worker {
* @param { WorkerEventListener } listener - listener Callback of the event listener to remove.
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200005 - The invoked API is not supported in workers.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
@ -819,9 +1112,16 @@ declare namespace worker {
*
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Terminates the worker thread to stop the worker from receiving messages
*
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
terminate(): void;
/**
* Adds an event listener to the worker.
@ -838,9 +1138,10 @@ declare namespace worker {
* Adds an event listener to the worker.
*
* @param { string } type - type Type of the event to listen for.
* @param { WorkerEventListener } listener - listener Callback to invoke when an event of the specified type occurs.
* @param { WorkerEventListener } listener Callback to invoke when an event of the specified type occurs.
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @throws { BusinessError } 10200005 - The invoked API is not supported in workers.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
@ -854,9 +1155,19 @@ declare namespace worker {
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Handle the event defined for the worker.
*
* @param { Event } event - event Event to dispatch.
* @returns { boolean }
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
dispatchEvent(event: Event): boolean;
/**
* Remove an event defined for the worker.
@ -866,18 +1177,35 @@ declare namespace worker {
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Remove an event defined for the worker.
*
* @param { string } type - type Type of the event for which the event listener is cancelled.
* @param { WorkerEventListener } callback - callback Callback of the event listener to remove.
* @throws { BusinessError } 401 - if the input parameters are invalid.
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeEventListener(type: string, callback?: WorkerEventListener): void;
/**
* Remove all event listeners for the worker.
*
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* Remove all event listeners for the worker.
*
* @throws { BusinessError } 10200004 - Worker instance is not running.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
removeAllListener(): void;
}
@ -1029,9 +1357,16 @@ declare namespace worker {
*
* @constant
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 9
*/
/**
* The object used by the worker thread to communicate with the host thread.
*
* @constant
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @since 10
*/
const workerPort: ThreadWorkerGlobalScope;
}
export default worker;