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 16/** 17 * @file 18 * @kit ArkTS 19 */ 20 21/** 22 * Double-ended queue (deque) is a sequence container implemented based on the queue data structure that 23 * follows the principles of First In First Out (FIFO) and Last In First Out (LIFO). 24 * It allows insertion and removal of elements at both the ends. 25 * 26 * @syscap SystemCapability.Utils.Lang 27 * @since 8 28 */ 29/** 30 * Double-ended queue (deque) is a sequence container implemented based on the queue data structure that 31 * follows the principles of First In First Out (FIFO) and Last In First Out (LIFO). 32 * It allows insertion and removal of elements at both the ends. 33 * 34 * @syscap SystemCapability.Utils.Lang 35 * @crossplatform 36 * @since 10 37 */ 38declare class Deque<T> { 39 /** 40 * A constructor used to create a Deque object. 41 * 42 * @throws { BusinessError } 10200012 - The Deque's constructor cannot be directly invoked. 43 * @syscap SystemCapability.Utils.Lang 44 * @since 8 45 */ 46 /** 47 * A constructor used to create a Deque object. 48 * 49 * @throws { BusinessError } 10200012 - The Deque's constructor cannot be directly invoked. 50 * @syscap SystemCapability.Utils.Lang 51 * @crossplatform 52 * @since 10 53 */ 54 constructor(); 55 /** 56 * Gets the element number of the Deque.This is a number one higher than the highest index in the deque. 57 * 58 * @syscap SystemCapability.Utils.Lang 59 * @since 8 60 */ 61 /** 62 * Gets the element number of the Deque.This is a number one higher than the highest index in the deque. 63 * 64 * @syscap SystemCapability.Utils.Lang 65 * @crossplatform 66 * @since 10 67 */ 68 length: number; 69 /** 70 * Inserts an element into the deque header. 71 * 72 * @param { T } element - element element to be appended to this deque 73 * @throws { BusinessError } 10200011 - The insertFront method cannot be bound. 74 * @syscap SystemCapability.Utils.Lang 75 * @since 8 76 */ 77 /** 78 * Inserts an element into the deque header. 79 * 80 * @param { T } element - element element to be appended to this deque 81 * @throws { BusinessError } 10200011 - The insertFront method cannot be bound. 82 * @syscap SystemCapability.Utils.Lang 83 * @crossplatform 84 * @since 10 85 */ 86 insertFront(element: T): void; 87 /** 88 * Inserting an element at the end of a deque 89 * 90 * @param { T } element - element element to be appended to this deque 91 * @throws { BusinessError } 10200011 - The insertEnd method cannot be bound. 92 * @syscap SystemCapability.Utils.Lang 93 * @since 8 94 */ 95 /** 96 * Inserting an element at the end of a deque 97 * 98 * @param { T } element - element element to be appended to this deque 99 * @throws { BusinessError } 10200011 - The insertEnd method cannot be bound. 100 * @syscap SystemCapability.Utils.Lang 101 * @crossplatform 102 * @since 10 103 */ 104 insertEnd(element: T): void; 105 /** 106 * Check if deque contains the specified element 107 * 108 * @param { T } element - element element to be contained 109 * @returns { boolean } the boolean type,if deque contains the specified element,return true,else return false 110 * @throws { BusinessError } 10200011 - The has method cannot be bound. 111 * @syscap SystemCapability.Utils.Lang 112 * @since 8 113 */ 114 /** 115 * Check if deque contains the specified element 116 * 117 * @param { T } element - element element to be contained 118 * @returns { boolean } the boolean type,if deque contains the specified element,return true,else return false 119 * @throws { BusinessError } 10200011 - The has method cannot be bound. 120 * @syscap SystemCapability.Utils.Lang 121 * @crossplatform 122 * @since 10 123 */ 124 has(element: T): boolean; 125 /** 126 * Obtains the header element of a deque. 127 * 128 * @returns { T } the T type 129 * @throws { BusinessError } 10200011 - The getFirst method cannot be bound. 130 * @syscap SystemCapability.Utils.Lang 131 * @since 8 132 */ 133 /** 134 * Obtains the header element of a deque. 135 * 136 * @returns { T } the T type 137 * @throws { BusinessError } 10200011 - The getFirst method cannot be bound. 138 * @syscap SystemCapability.Utils.Lang 139 * @crossplatform 140 * @since 10 141 */ 142 getFirst(): T; 143 /** 144 * Obtains the end element of a deque. 145 * 146 * @returns { T } the T type 147 * @throws { BusinessError } 10200011 - The getLast method cannot be bound. 148 * @syscap SystemCapability.Utils.Lang 149 * @since 8 150 */ 151 /** 152 * Obtains the end element of a deque. 153 * 154 * @returns { T } the T type 155 * @throws { BusinessError } 10200011 - The getLast method cannot be bound. 156 * @syscap SystemCapability.Utils.Lang 157 * @crossplatform 158 * @since 10 159 */ 160 getLast(): T; 161 /** 162 * Obtains the header element of a deque and delete the element. 163 * 164 * @returns { T } the T type 165 * @throws { BusinessError } 10200011 - The popFirst method cannot be bound. 166 * @syscap SystemCapability.Utils.Lang 167 * @since 8 168 */ 169 /** 170 * Obtains the header element of a deque and delete the element. 171 * 172 * @returns { T } the T type 173 * @throws { BusinessError } 10200011 - The popFirst method cannot be bound. 174 * @syscap SystemCapability.Utils.Lang 175 * @crossplatform 176 * @since 10 177 */ 178 popFirst(): T; 179 /** 180 * Obtains the end element of a deque and delete the element. 181 * 182 * @returns { T } the T type 183 * @throws { BusinessError } 10200011 - The popLast method cannot be bound. 184 * @syscap SystemCapability.Utils.Lang 185 * @since 8 186 */ 187 /** 188 * Obtains the end element of a deque and delete the element. 189 * 190 * @returns { T } the T type 191 * @throws { BusinessError } 10200011 - The popLast method cannot be bound. 192 * @syscap SystemCapability.Utils.Lang 193 * @crossplatform 194 * @since 10 195 */ 196 popLast(): T; 197 /** 198 * Executes a provided function once for each value in the deque object. 199 * 200 * @param { function } callbackFn - callbackFn 201 * callbackFn (required) A function that accepts up to three arguments. 202 * The function to be called for each element. 203 * @param { Object } [thisArg] - thisArg 204 * thisArg (Optional) The value to be used as this value for when callbackFn is called. 205 * If thisArg is omitted, undefined is used as the this value. 206 * @throws { BusinessError } 401 - Parameter error. Possible causes: 207 * 1.Mandatory parameters are left unspecified; 208 * 2.Incorrect parameter types. 209 * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 210 * @syscap SystemCapability.Utils.Lang 211 * @since 8 212 */ 213 /** 214 * Executes a provided function once for each value in the deque object. 215 * 216 * @param { function } callbackFn - callbackFn 217 * callbackFn (required) A function that accepts up to three arguments. 218 * The function to be called for each element. 219 * @param { Object } [thisArg] - thisArg 220 * thisArg (Optional) The value to be used as this value for when callbackFn is called. 221 * If thisArg is omitted, undefined is used as the this value. 222 * @throws { BusinessError } 401 - Parameter error. Possible causes: 223 * 1.Mandatory parameters are left unspecified; 224 * 2.Incorrect parameter types. 225 * @throws { BusinessError } 10200011 - The forEach method cannot be bound. 226 * @syscap SystemCapability.Utils.Lang 227 * @crossplatform 228 * @since 10 229 */ 230 forEach(callbackFn: (value: T, index?: number, deque?: Deque<T>) => void, thisArg?: Object): void; 231 /** 232 * returns an iterator.Each item of the iterator is a Javascript Object 233 * 234 * @returns { IterableIterator<T> } 235 * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 236 * @syscap SystemCapability.Utils.Lang 237 * @since 8 238 */ 239 /** 240 * returns an iterator.Each item of the iterator is a Javascript Object 241 * 242 * @returns { IterableIterator<T> } 243 * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. 244 * @syscap SystemCapability.Utils.Lang 245 * @crossplatform 246 * @since 10 247 */ 248 [Symbol.iterator](): IterableIterator<T>; 249} 250 251export default Deque; 252