1/* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16declare class Queue<T> { 17 /** 18 * A constructor used to create a Queue object. 19 * @throws { BusinessError } 10200012 - The Queue's constructor cannot be directly invoked. 20 * @since 8 21 * @syscap SystemCapability.Utils.Lang 22 */ 23 constructor(); 24 /** 25 * Gets the element number of the Queue.This is a number one higher than the highest index in the queue. 26 * @since 8 27 * @syscap SystemCapability.Utils.Lang 28 */ 29 length: number; 30 /** 31 * Inserting specified element at the end of a queue if it is possible to do 32 * so immediately without violating capacity restrictions. 33 * @param element to be appended to this queue 34 * @returns the boolean type 35 * @throws { BusinessError } 10200011 - The add method cannot be bound. 36 * @since 8 37 * @syscap SystemCapability.Utils.Lang 38 */ 39 add(element: T): boolean; 40 /** 41 * Obtains the header element of a queue. 42 * @returns the T type 43 * @throws { BusinessError } 10200011 - The getFirst method cannot be bound. 44 * @since 8 45 * @syscap SystemCapability.Utils.Lang 46 */ 47 getFirst(): T; 48 /** 49 * Retrieves and removes the head of this queue 50 * @returns the T type 51 * @throws { BusinessError } 10200011 - The pop method cannot be bound. 52 * @since 8 53 * @syscap SystemCapability.Utils.Lang 54 */ 55 pop(): T; 56 /** 57 * Executes a provided function once for each value in the queue object. 58 * @param callbackFn (required) A function that accepts up to four arguments.The function to 59 * be called for each element in the queue 60 * @param Value (required) current element 61 * @param Index (Optional) The index value of the current element. 62 * @param Queue (Optional) The queue object to which the current element belongs. 63 * @param thisArg (Optional) The value passed to the function generally uses the "this" value. 64 * If this parameter is empty, "undefined" will be passed to the "this" value 65 * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 66 * @throws { BusinessError } 401 - The type of parameters are invalid. 67 * @since 8 68 * @syscap SystemCapability.Utils.Lang 69 */ 70 forEach(callbackFn: (value: T, index?: number, Queue?: Queue<T>) => void, 71 thisArg?: Object): void; 72 /** 73 * returns an iterator.Each item of the iterator is a Javascript Object 74 * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 75 * @since 8 76 * @syscap SystemCapability.Utils.Lang 77 */ 78 [Symbol.iterator](): IterableIterator<T>; 79} 80 81export default Queue; 82