Correct the interface of the D.T file of the container class

Description
    1. Correct some interface errors
    2. Description of relevant errors
    3. Complete the missing systemcapability Utils. Lang description
    #I4W0R:Correct the interface of the D.T file of the container class

Signed-off-by: wangyong1995626wywz <wangyong237@huawei.com>
This commit is contained in:
wangyong1995626wywz 2022-03-02 17:59:47 +08:00
parent b0924b6a00
commit d42f38751c
11 changed files with 54 additions and 56 deletions

View File

@ -106,13 +106,13 @@ declare class ArrayList<T> {
* each element in the arraylist,Returns the result of an operation
* @param Value (required) current element
* @param Index (Optional) The index value of the current element.
* @param arraylist (Optional) The arraylist object to which the current element belongs.
* @param arrlist (Optional) The arraylist object to which the current element belongs.
* @param 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
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
replaceAllElements(callbackfn: (value: T, index?: number, arraylist?: ArrayList<T>) => T,
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.
@ -120,13 +120,13 @@ declare class ArrayList<T> {
* be called for each element in the arraylist
* @param Value (required) current element
* @param Index (Optional) The index value of the current element.
* @param arraylist (Optional) The arraylist object to which the current element belongs.
* @param arrlist (Optional) The arraylist object to which the current element belongs.
* @param 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
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
forEach(callbackfn: (value: T, index?: number, arraylist?: ArrayList<T>) => void,
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,
@ -169,6 +169,7 @@ declare class ArrayList<T> {
* returns the capacity of this arraylist
* @return the number type
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
getCapacity(): number;
/**

View File

@ -101,7 +101,7 @@ declare class HashMap<K, V> {
/**
* Replace the old value by new value corresponding to the specified key
* @param key Updated targets
* @param value Updated the target mapped value
* @param newValue Updated the target mapped value
* @returns the boolean type(Is there a target pointed to by the key)
* @since 8
* @syscap SystemCapability.Utils.Lang

View File

@ -64,9 +64,9 @@ declare class LightWeightMap<K, V> {
*/
entries(): IterableIterator<[K, V]>;
/**
* Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key
* Returns the value to which the specified key is mapped, or undefined if this map contains no mapping for the key
* @param key the index in LightWeightMap
* @return value or null
* @return value or undefined
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
@ -86,7 +86,7 @@ declare class LightWeightMap<K, V> {
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
getIndexOfValue(value: K): number;
getIndexOfValue(value: V): number;
/**
* Returns whether the Map object contains elements
* @return the boolean type

View File

@ -32,15 +32,15 @@ declare class LightWeightSet<T> {
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
add(value: T): boolean;
add(obj: T): boolean;
/**
* Adds all the objects in a specified LightWeightSet container to the current LightWeightSet container
* @param set the Map object to provide the added element
* @param set the Set object to provide the added element
* @returns the boolean type(Is there any new data added successfully)
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
addAll(set: LightWeightMap<T>): boolean;
addAll(set: LightWeightSet<T>): boolean;
/**
* Returns whether this set has all the object in a specified set
* @param set the Set object to compare
@ -72,7 +72,7 @@ declare class LightWeightSet<T> {
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
ensureCapacityTo(minimumCapacity: number): void;
increaseCapacityTo(minimumCapacity: number): void;
/**
* Obtains the index of s key of a specified Object type in an LightWeightSet container
* @param key Looking for goals
@ -110,7 +110,7 @@ declare class LightWeightSet<T> {
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
forEach(callbackfn: (value?: T, key?: T, map?: LightWeightSet<T>) => void,
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
@ -150,6 +150,12 @@ declare class LightWeightSet<T> {
* @syscap SystemCapability.Utils.Lang
*/
entries(): IterableIterator<[T, T]>;
/**
* Returns whether the set object contains elements
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
isEmpty(): boolean;
}
export default LightWeightSet;

View File

@ -13,6 +13,12 @@
* limitations under the License.
*/
declare class LinkedList<T> {
/**
* A constructor used to create a LinkedList object.
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
constructor();
/**
* Gets the element number of the LinkedList. This is a number one higher than the highest index in the linkedlist.
* @since 8
@ -35,7 +41,7 @@ declare class LinkedList<T> {
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
insert(element: T, index: number): void;
insert(index: number, element: T): void;
/**
* Returns the element at the specified position in this linkedlist,
* or returns undefined if this linkedlist is empty
@ -72,7 +78,7 @@ declare class LinkedList<T> {
/**
* Check if linkedlist contains the specified element
* @param element element to be contained
* @return the boolean type,if vector contains the specified element,return true,else return false
* @return the boolean type,if linkedList contains the specified element,return true,else return false
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
@ -137,7 +143,7 @@ declare class LinkedList<T> {
/**
* Returns the first element (the item at index 0) of this linkedlist.
* or returns undefined if linkedlist is empty
* @return the T type ,returns undefined if vector is empty
* @return the T type ,returns undefined if linkedList is empty
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
@ -145,7 +151,7 @@ declare class LinkedList<T> {
/**
* Returns the Last element (the item at index length-1) of this linkedlist.
* or returns undefined if linkedlist is empty
* @return the T type ,returns undefined if vector is empty
* @return the T type ,returns undefined if linkedList is empty
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
@ -154,37 +160,25 @@ declare class LinkedList<T> {
* Replaces the element at the specified position in this Vector with the specified element
* @param element replaced element
* @param index index to find
* @return the T type ,returns undefined if linkedList is empty
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
set(index: number, element: T): void;
set(index: number, element: T): T;
/**
* Replaces each element of this linkedlist with the result of applying the operator to that element.
* @param 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
* @param Value (required) current element
* @param Index (Optional) The index value of the current element.
* @param linkedlist (Optional) The linkedlist object to which the current element belongs.
* @param LinkedList (Optional) The linkedlist object to which the current element belongs.
* @param 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
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
forEach(callbackfn: (value: T, index?: number, linkedlist?: ArrayList<T>) => void,
forEach(callbackfn: (value: T, index?: number, LinkedList?: LinkedList<T>) => void,
thisArg?: Object): void;
/**
* Sorts this linkedlist according to the order induced by the specified comparator,without comparator this parameter,
* it will default to ASCII sorting
* @param 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 linkedlist
* sorted in ascending order;If it returns secondValue minus firstValue, it returns an linkedlist sorted in descending order;
* @param firstValue (Optional) previous element
* @param secondValue (Optional) next elements
* If this parameter is empty, it will default to ASCII sorting
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
sort(comparator?: (firstValue: T, secondValue: T) => number): void;
/**
* Removes all of the elements from this linkedlist.The linkedlist will
* be empty after this call returns.length becomes 0

View File

@ -116,10 +116,11 @@ declare class List<T> {
* Replaces the element at the specified position in this List with the specified element
* @param element replaced element
* @param index index to find
* @return the T type
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
set(index: number, element: T): void;
set(index: number, element: T): T;
/**
* Compares the specified object with this list for equality.if the object are the same as this list
* return true, otherwise return false.
@ -135,13 +136,13 @@ declare class List<T> {
* The function to be called for each element in the list,Returns the result of an operation
* @param Value (required) current element
* @param Index (Optional) The index value of the current element.
* @param list (Optional) The list object to which the current element belongs.
* @param List (Optional) The list object to which the current element belongs.
* @param 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
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
forEach(callbackfn: (value: T, index?: number, list?: ArrayList<T>) => void,
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
@ -186,13 +187,6 @@ declare class List<T> {
*/
replaceAllElements(callbackfn: (value: T, index?: number, list?: List<T>) => T,
thisArg?: Object): void;
/**
* Returns a shallow copy of this instance. (The elements themselves are not copied.)
* @return this list instance
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
clone(): List<T>;
/**
* convert list to array
* @return the Array type

View File

@ -29,11 +29,11 @@ declare class PlainArray<T> {
* Appends a key-value pair to PlainArray
* @param key Added the key of key-value
* @param value Added the value of key-value
* @returns the boolean type(Is there contain this element)
* @throws Throws this exception if input is invaild
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
add(key: number, value: T): boolean;
add(key: number, value: T): void;
/**
* Clears the current PlainArray object
* @since 8
@ -104,11 +104,11 @@ declare class PlainArray<T> {
/**
* Remove the key-value pair at a specified index if it exists and return the value
* @param index Target subscript for search
* @return the boolean type(Is there a delete value)
* @return the T type
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
removeAt(index: number): boolean;
removeAt(index: number): T;
/**
* Remove a group of key-value pairs from a specified index
* @param index remove start index
@ -125,7 +125,7 @@ declare class PlainArray<T> {
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
setValueAt(index: number, newValue: T): void;
setValueAt(index: number, value: T): void;
/**
* Obtains the string representation of the PlainArray object
* @since 8
@ -145,7 +145,7 @@ declare class PlainArray<T> {
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
forEach(callbackfn: (value?: V, key?: K, map?: LightWeightMap<K, V>) => void,
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

View File

@ -56,13 +56,13 @@ declare class Queue<T> {
* be called for each element in the queue
* @param Value (required) current element
* @param Index (Optional) The index value of the current element.
* @param queue (Optional) The queue object to which the current element belongs.
* @param Queue (Optional) The queue object to which the current element belongs.
* @param 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
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
forEach(callbackfn: (value: T, index?: number, queue?: Queue<T>) => void,
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

View File

@ -16,6 +16,7 @@ declare class Stack<T> {
/**
* A constructor used to create a Stack object.
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
constructor();
/**
@ -42,11 +43,11 @@ declare class Stack<T> {
/**
* 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 Stack top value
* @returns Stack top value or undefined
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
pop(): boolean;
pop(): T;
/**
* Pushes an item onto the top of this stack
* @param item to be appended to this Stack

View File

@ -19,6 +19,7 @@ declare class TreeMap<K, V> {
* @param firstValue (Optional) previous element
* @param secondValue (Optional) next element
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
constructor(comparator?: (firstValue: K, secondValue: K) => boolean);
/**
@ -112,7 +113,7 @@ declare class TreeMap<K, V> {
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
getLowerByKey(key: K): K;
getLowerKey(key: K): K;
/**
* Returns the least element greater than or equal to the specified key
* if the key does not exist, undefied is returned
@ -121,7 +122,7 @@ declare class TreeMap<K, V> {
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
getHigherByKey(key: K): K;
getHigherKey(key: K): K;
/**
* Returns a new Iterator object that contains the keys contained in this map
* @since 8

View File

@ -109,10 +109,11 @@ declare class Vector<T> {
* Replaces the element at the specified position in this Vector with the specified element
* @param element replaced element
* @param index index to find
* @return the T type
* @since 8
* @syscap SystemCapability.Utils.Lang
*/
set(index: number, element: T): void;
set(index: number, element: T): T;
/**
* Returns in the index of the last occurrence of the specified element in this vector ,
* or -1 if the vector does not contain the element.