• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 */
38/**
39 * Double-ended queue (deque) is a sequence container implemented based on the queue data structure that
40 * follows the principles of First In First Out (FIFO) and Last In First Out (LIFO).
41 * It allows insertion and removal of elements at both the ends.
42 *
43 * @syscap SystemCapability.Utils.Lang
44 * @crossplatform
45 * @atomicservice
46 * @since 12
47 */
48declare class Deque<T> {
49  /**
50   * A constructor used to create a Deque object.
51   *
52   * @throws { BusinessError } 10200012 - The Deque's constructor cannot be directly invoked.
53   * @syscap SystemCapability.Utils.Lang
54   * @since 8
55   */
56  /**
57   * A constructor used to create a Deque object.
58   *
59   * @throws { BusinessError } 10200012 - The Deque's constructor cannot be directly invoked.
60   * @syscap SystemCapability.Utils.Lang
61   * @crossplatform
62   * @since 10
63   */
64  /**
65   * A constructor used to create a Deque object.
66   *
67   * @throws { BusinessError } 10200012 - The Deque's constructor cannot be directly invoked.
68   * @syscap SystemCapability.Utils.Lang
69   * @crossplatform
70   * @atomicservice
71   * @since 12
72   */
73  constructor();
74  /**
75   * Gets the element number of the Deque.This is a number one higher than the highest index in the deque.
76   *
77   * @type { number }
78   * @syscap SystemCapability.Utils.Lang
79   * @since 8
80   */
81  /**
82   * Gets the element number of the Deque.This is a number one higher than the highest index in the deque.
83   *
84   * @type { number }
85   * @syscap SystemCapability.Utils.Lang
86   * @crossplatform
87   * @since 10
88   */
89  /**
90   * Gets the element number of the Deque.This is a number one higher than the highest index in the deque.
91   *
92   * @type { number }
93   * @syscap SystemCapability.Utils.Lang
94   * @crossplatform
95   * @atomicservice
96   * @since 12
97   */
98  length: number;
99  /**
100   * Inserts an element into the deque header.
101   *
102   * @param { T } element - element element to be appended to this deque
103   * @throws { BusinessError } 10200011 - The insertFront method cannot be bound.
104   * @syscap SystemCapability.Utils.Lang
105   * @since 8
106   */
107  /**
108   * Inserts an element into the deque header.
109   *
110   * @param { T } element - element element to be appended to this deque
111   * @throws { BusinessError } 10200011 - The insertFront method cannot be bound.
112   * @syscap SystemCapability.Utils.Lang
113   * @crossplatform
114   * @since 10
115   */
116  /**
117   * Inserts an element into the deque header.
118   *
119   * @param { T } element - element element to be appended to this deque
120   * @throws { BusinessError } 10200011 - The insertFront method cannot be bound.
121   * @syscap SystemCapability.Utils.Lang
122   * @crossplatform
123   * @atomicservice
124   * @since 12
125   */
126  insertFront(element: T): void;
127  /**
128   * Inserting an element at the end of a deque
129   *
130   * @param { T } element - element element to be appended to this deque
131   * @throws { BusinessError } 10200011 - The insertEnd method cannot be bound.
132   * @syscap SystemCapability.Utils.Lang
133   * @since 8
134   */
135  /**
136   * Inserting an element at the end of a deque
137   *
138   * @param { T } element - element element to be appended to this deque
139   * @throws { BusinessError } 10200011 - The insertEnd method cannot be bound.
140   * @syscap SystemCapability.Utils.Lang
141   * @crossplatform
142   * @since 10
143   */
144  /**
145   * Inserting an element at the end of a deque
146   *
147   * @param { T } element - element element to be appended to this deque
148   * @throws { BusinessError } 10200011 - The insertEnd method cannot be bound.
149   * @syscap SystemCapability.Utils.Lang
150   * @crossplatform
151   * @atomicservice
152   * @since 12
153   */
154  insertEnd(element: T): void;
155  /**
156   * Check if deque contains the specified element
157   *
158   * @param { T } element - element element to be contained
159   * @returns { boolean } the boolean type,if deque contains the specified element,return true,else return false
160   * @throws { BusinessError } 10200011 - The has method cannot be bound.
161   * @syscap SystemCapability.Utils.Lang
162   * @since 8
163   */
164  /**
165   * Check if deque contains the specified element
166   *
167   * @param { T } element - element element to be contained
168   * @returns { boolean } the boolean type,if deque contains the specified element,return true,else return false
169   * @throws { BusinessError } 10200011 - The has method cannot be bound.
170   * @syscap SystemCapability.Utils.Lang
171   * @crossplatform
172   * @since 10
173   */
174  /**
175   * Check if deque contains the specified element
176   *
177   * @param { T } element - element element to be contained
178   * @returns { boolean } the boolean type,if deque contains the specified element,return true,else return false
179   * @throws { BusinessError } 10200011 - The has method cannot be bound.
180   * @syscap SystemCapability.Utils.Lang
181   * @crossplatform
182   * @atomicservice
183   * @since 12
184   */
185  has(element: T): boolean;
186  /**
187   * Obtains the header element of a deque.
188   *
189   * @returns { T } the T type
190   * @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
191   * @syscap SystemCapability.Utils.Lang
192   * @since 8
193   */
194  /**
195   * Obtains the header element of a deque.
196   *
197   * @returns { T } the T type
198   * @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
199   * @syscap SystemCapability.Utils.Lang
200   * @crossplatform
201   * @since 10
202   */
203  /**
204   * Obtains the header element of a deque.
205   *
206   * @returns { T } the T type
207   * @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
208   * @syscap SystemCapability.Utils.Lang
209   * @crossplatform
210   * @atomicservice
211   * @since 12
212   */
213  getFirst(): T;
214  /**
215   * Obtains the end element of a deque.
216   *
217   * @returns { T } the T type
218   * @throws { BusinessError } 10200011 - The getLast method cannot be bound.
219   * @syscap SystemCapability.Utils.Lang
220   * @since 8
221   */
222  /**
223   * Obtains the end element of a deque.
224   *
225   * @returns { T } the T type
226   * @throws { BusinessError } 10200011 - The getLast method cannot be bound.
227   * @syscap SystemCapability.Utils.Lang
228   * @crossplatform
229   * @since 10
230   */
231  /**
232   * Obtains the end element of a deque.
233   *
234   * @returns { T } the T type
235   * @throws { BusinessError } 10200011 - The getLast method cannot be bound.
236   * @syscap SystemCapability.Utils.Lang
237   * @crossplatform
238   * @atomicservice
239   * @since 12
240   */
241  getLast(): T;
242  /**
243   * Obtains the header element of a deque and delete the element.
244   *
245   * @returns { T } the T type
246   * @throws { BusinessError } 10200011 - The popFirst method cannot be bound.
247   * @syscap SystemCapability.Utils.Lang
248   * @since 8
249   */
250  /**
251   * Obtains the header element of a deque and delete the element.
252   *
253   * @returns { T } the T type
254   * @throws { BusinessError } 10200011 - The popFirst method cannot be bound.
255   * @syscap SystemCapability.Utils.Lang
256   * @crossplatform
257   * @since 10
258   */
259  /**
260   * Obtains the header element of a deque and delete the element.
261   *
262   * @returns { T } the T type
263   * @throws { BusinessError } 10200011 - The popFirst method cannot be bound.
264   * @syscap SystemCapability.Utils.Lang
265   * @crossplatform
266   * @atomicservice
267   * @since 12
268   */
269  popFirst(): T;
270  /**
271   * Obtains the end element of a deque and delete the element.
272   *
273   * @returns { T } the T type
274   * @throws { BusinessError } 10200011 - The popLast method cannot be bound.
275   * @syscap SystemCapability.Utils.Lang
276   * @since 8
277   */
278  /**
279   * Obtains the end element of a deque and delete the element.
280   *
281   * @returns { T } the T type
282   * @throws { BusinessError } 10200011 - The popLast method cannot be bound.
283   * @syscap SystemCapability.Utils.Lang
284   * @crossplatform
285   * @since 10
286   */
287  /**
288   * Obtains the end element of a deque and delete the element.
289   *
290   * @returns { T } the T type
291   * @throws { BusinessError } 10200011 - The popLast method cannot be bound.
292   * @syscap SystemCapability.Utils.Lang
293   * @crossplatform
294   * @atomicservice
295   * @since 12
296   */
297  popLast(): T;
298  /**
299   * Executes a provided function once for each value in the deque object.
300   *
301   * @param { function } callbackFn - callbackFn
302   * callbackFn (required) A function that accepts up to three arguments.
303   * The function to be called for each element.
304   * @param { Object } [thisArg] - thisArg
305   * thisArg (Optional) The value to be used as this value for when callbackFn is called.
306   * If thisArg is omitted, undefined is used as the this value.
307   * @throws { BusinessError } 401 - Parameter error. Possible causes:
308   * 1.Mandatory parameters are left unspecified;
309   * 2.Incorrect parameter types.
310   * @throws { BusinessError } 10200011 - The forEach method cannot be bound.
311   * @syscap SystemCapability.Utils.Lang
312   * @since 8
313   */
314  /**
315   * Executes a provided function once for each value in the deque object.
316   *
317   * @param { function } callbackFn - callbackFn
318   * callbackFn (required) A function that accepts up to three arguments.
319   * The function to be called for each element.
320   * @param { Object } [thisArg] - thisArg
321   * thisArg (Optional) The value to be used as this value for when callbackFn is called.
322   * If thisArg is omitted, undefined is used as the this value.
323   * @throws { BusinessError } 401 - Parameter error. Possible causes:
324   * 1.Mandatory parameters are left unspecified;
325   * 2.Incorrect parameter types.
326   * @throws { BusinessError } 10200011 - The forEach method cannot be bound.
327   * @syscap SystemCapability.Utils.Lang
328   * @crossplatform
329   * @since 10
330   */
331  /**
332   * Executes a provided function once for each value in the deque object.
333   *
334   * @param { function } callbackFn - callbackFn
335   * callbackFn (required) A function that accepts up to three arguments.
336   * The function to be called for each element.
337   * @param { Object } [thisArg] - thisArg
338   * thisArg (Optional) The value to be used as this value for when callbackFn is called.
339   * If thisArg is omitted, undefined is used as the this value.
340   * @throws { BusinessError } 401 - Parameter error. Possible causes:
341   * 1.Mandatory parameters are left unspecified;
342   * 2.Incorrect parameter types.
343   * @throws { BusinessError } 10200011 - The forEach method cannot be bound.
344   * @syscap SystemCapability.Utils.Lang
345   * @crossplatform
346   * @atomicservice
347   * @since 12
348   */
349  forEach(callbackFn: (value: T, index?: number, deque?: Deque<T>) => void, thisArg?: Object): void;
350  /**
351   * returns an iterator.Each item of the iterator is a Javascript Object
352   *
353   * @returns { IterableIterator<T> }
354   * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
355   * @syscap SystemCapability.Utils.Lang
356   * @since 8
357   */
358  /**
359   * returns an iterator.Each item of the iterator is a Javascript Object
360   *
361   * @returns { IterableIterator<T> }
362   * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
363   * @syscap SystemCapability.Utils.Lang
364   * @crossplatform
365   * @since 10
366   */
367  /**
368   * returns an iterator.Each item of the iterator is a Javascript Object
369   *
370   * @returns { IterableIterator<T> }
371   * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
372   * @syscap SystemCapability.Utils.Lang
373   * @crossplatform
374   * @atomicservice
375   * @since 12
376   */
377  [Symbol.iterator](): IterableIterator<T>;
378}
379
380export default Deque;
381