From d42f38751c577d10d5e26320a735971bbb42f8c9 Mon Sep 17 00:00:00 2001 From: wangyong1995626wywz Date: Wed, 2 Mar 2022 17:59:47 +0800 Subject: [PATCH] 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 --- api/@ohos.util.ArrayList.d.ts | 9 ++++---- api/@ohos.util.HashMap.d.ts | 2 +- api/@ohos.util.LightWeightMap.d.ts | 6 +++--- api/@ohos.util.LightWeightSet.d.ts | 16 +++++++++----- api/@ohos.util.LinkedList.d.ts | 34 ++++++++++++------------------ api/@ohos.util.List.d.ts | 14 ++++-------- api/@ohos.util.PlainArray.d.ts | 12 +++++------ api/@ohos.util.Queue.d.ts | 4 ++-- api/@ohos.util.Stack.d.ts | 5 +++-- api/@ohos.util.TreeMap.d.ts | 5 +++-- api/@ohos.util.Vector.d.ts | 3 ++- 11 files changed, 54 insertions(+), 56 deletions(-) diff --git a/api/@ohos.util.ArrayList.d.ts b/api/@ohos.util.ArrayList.d.ts index af4b694e8..ac7174e49 100644 --- a/api/@ohos.util.ArrayList.d.ts +++ b/api/@ohos.util.ArrayList.d.ts @@ -106,13 +106,13 @@ declare class ArrayList { * 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, + replaceAllElements(callbackfn: (value: T, index?: number, arrlist?: ArrayList) => T, thisArg?: Object): void; /** * Executes a provided function once for each value in the arraylist object. @@ -120,13 +120,13 @@ declare class ArrayList { * 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) => void, + forEach(callbackfn: (value: T, index?: number, arrlist?: ArrayList) => 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 { * returns the capacity of this arraylist * @return the number type * @since 8 + * @syscap SystemCapability.Utils.Lang */ getCapacity(): number; /** diff --git a/api/@ohos.util.HashMap.d.ts b/api/@ohos.util.HashMap.d.ts index 0b014d6c0..db6a86247 100644 --- a/api/@ohos.util.HashMap.d.ts +++ b/api/@ohos.util.HashMap.d.ts @@ -101,7 +101,7 @@ declare class HashMap { /** * 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 diff --git a/api/@ohos.util.LightWeightMap.d.ts b/api/@ohos.util.LightWeightMap.d.ts index afff2630d..cc34b5dfb 100644 --- a/api/@ohos.util.LightWeightMap.d.ts +++ b/api/@ohos.util.LightWeightMap.d.ts @@ -64,9 +64,9 @@ declare class LightWeightMap { */ 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 { * @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 diff --git a/api/@ohos.util.LightWeightSet.d.ts b/api/@ohos.util.LightWeightSet.d.ts index 27f078499..e882104ee 100644 --- a/api/@ohos.util.LightWeightSet.d.ts +++ b/api/@ohos.util.LightWeightSet.d.ts @@ -32,15 +32,15 @@ declare class LightWeightSet { * @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): boolean; + addAll(set: LightWeightSet): 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 { * @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 { * @since 8 * @syscap SystemCapability.Utils.Lang */ - forEach(callbackfn: (value?: T, key?: T, map?: LightWeightSet) => void, + forEach(callbackfn: (value?: T, key?: T, set?: LightWeightSet) => void, thisArg?: Object): void; /** * returns an ES6 iterator.Each item of the iterator is a Javascript Object @@ -150,6 +150,12 @@ declare class LightWeightSet { * @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; diff --git a/api/@ohos.util.LinkedList.d.ts b/api/@ohos.util.LinkedList.d.ts index 14333ffb6..e81ef5c4d 100644 --- a/api/@ohos.util.LinkedList.d.ts +++ b/api/@ohos.util.LinkedList.d.ts @@ -13,6 +13,12 @@ * limitations under the License. */ declare class LinkedList { + /** + * 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 { * @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 { /** * 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 { /** * 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 { /** * 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 { * 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) => void, + forEach(callbackfn: (value: T, index?: number, LinkedList?: LinkedList) => 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 diff --git a/api/@ohos.util.List.d.ts b/api/@ohos.util.List.d.ts index 89d90ba06..fa79586ec 100644 --- a/api/@ohos.util.List.d.ts +++ b/api/@ohos.util.List.d.ts @@ -116,10 +116,11 @@ declare class List { * 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 { * 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) => void, + forEach(callbackfn: (value: T, index?: number, List?: List) => void, thisArg?: Object): void; /** * Sorts this list according to the order induced by the specified comparator @@ -186,13 +187,6 @@ declare class List { */ replaceAllElements(callbackfn: (value: T, index?: number, list?: List) => 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; /** * convert list to array * @return the Array type diff --git a/api/@ohos.util.PlainArray.d.ts b/api/@ohos.util.PlainArray.d.ts index 55495dd9c..37012f6ad 100644 --- a/api/@ohos.util.PlainArray.d.ts +++ b/api/@ohos.util.PlainArray.d.ts @@ -29,11 +29,11 @@ declare class PlainArray { * 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 { /** * 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 { * @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 { * @since 8 * @syscap SystemCapability.Utils.Lang */ - forEach(callbackfn: (value?: V, key?: K, map?: LightWeightMap) => void, + forEach(callbackfn: (value: T, index?: number, PlainArray?: PlainArray) => void, thisArg?: Object): void; /** * returns an iterator.Each item of the iterator is a Javascript Object diff --git a/api/@ohos.util.Queue.d.ts b/api/@ohos.util.Queue.d.ts index c28ca9ebb..69c2762bd 100644 --- a/api/@ohos.util.Queue.d.ts +++ b/api/@ohos.util.Queue.d.ts @@ -56,13 +56,13 @@ declare class Queue { * 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) => void, + forEach(callbackfn: (value: T, index?: number, Queue?: Queue) => void, thisArg?: Object): void; /** * returns an iterator.Each item of the iterator is a Javascript Object diff --git a/api/@ohos.util.Stack.d.ts b/api/@ohos.util.Stack.d.ts index 6eea500a8..59ef60e5d 100644 --- a/api/@ohos.util.Stack.d.ts +++ b/api/@ohos.util.Stack.d.ts @@ -16,6 +16,7 @@ declare class Stack { /** * A constructor used to create a Stack object. * @since 8 + * @syscap SystemCapability.Utils.Lang */ constructor(); /** @@ -42,11 +43,11 @@ declare class Stack { /** * 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 diff --git a/api/@ohos.util.TreeMap.d.ts b/api/@ohos.util.TreeMap.d.ts index 125b149ce..2b4647f18 100644 --- a/api/@ohos.util.TreeMap.d.ts +++ b/api/@ohos.util.TreeMap.d.ts @@ -19,6 +19,7 @@ declare class TreeMap { * @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 { * @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 { * @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 diff --git a/api/@ohos.util.Vector.d.ts b/api/@ohos.util.Vector.d.ts index bf061e7f4..67d310c7b 100644 --- a/api/@ohos.util.Vector.d.ts +++ b/api/@ohos.util.Vector.d.ts @@ -109,10 +109,11 @@ declare class Vector { * 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.