• 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
16declare class Deque<T> {
17  /**
18   * A constructor used to create a Deque object.
19   * @throws { BusinessError } 10200012 - The Deque'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 Deque.This is a number one higher than the highest index in the deque.
26   * @since 8
27   * @syscap SystemCapability.Utils.Lang
28   */
29  length: number;
30  /**
31   * Inserts an element into the deque header.
32   * @param element to be appended to this deque
33   * @throws { BusinessError } 10200011 - The insertFront method cannot be bound.
34   * @since 8
35   * @syscap SystemCapability.Utils.Lang
36   */
37  insertFront(element: T): void;
38  /**
39   * Inserting an element at the end of a deque
40   * @param element to be appended to this deque
41   * @throws { BusinessError } 10200011 - The insertEnd method cannot be bound.
42   * @since 8
43   * @syscap SystemCapability.Utils.Lang
44   */
45  insertEnd(element: T): void;
46  /**
47   * Check if deque contains the specified element
48   * @param element element to be contained
49   * @returns the boolean type,if deque contains the specified element,return true,else return false
50   * @throws { BusinessError } 10200011 - The has method cannot be bound.
51   * @since 8
52   * @syscap SystemCapability.Utils.Lang
53   */
54  has(element: T): boolean;
55  /**
56   * Obtains the header element of a deque.
57   * @returns the T type
58   * @throws { BusinessError } 10200011 - The getFirst method cannot be bound.
59   * @since 8
60   * @syscap SystemCapability.Utils.Lang
61   */
62  getFirst(): T;
63  /**
64   * Obtains the end element of a deque.
65   * @returns the T type
66   * @throws { BusinessError } 10200011 - The getLast method cannot be bound.
67   * @since 8
68   * @syscap SystemCapability.Utils.Lang
69   */
70  getLast(): T;
71  /**
72   * Obtains the header element of a deque and delete the element.
73   * @returns the T type
74   * @throws { BusinessError } 10200011 - The popFirst method cannot be bound.
75   * @since 8
76   * @syscap SystemCapability.Utils.Lang
77   */
78  popFirst(): T;
79  /**
80   * Obtains the end element of a deque and delete the element.
81   * @returns the T type
82   * @throws { BusinessError } 10200011 - The popLast method cannot be bound.
83   * @since 8
84   * @syscap SystemCapability.Utils.Lang
85   */
86  popLast(): T;
87  /**
88   * Executes a provided function once for each value in the deque object.
89   * @param callbackFn (required) A function that accepts up to four arguments.The function to be called for each element in the deque
90   * @param Value (required) current element
91   * @param Index (Optional) The index value of the current element.
92   * @param deque (Optional) The deque object to which the current element belongs.
93   * @param thisArg (Optional) The value passed to the function generally uses the "this" value.
94   * If this parameter is empty, "undefined" will be passed to the "this" value
95   * @throws { BusinessError } 401 - The type of parameters are invalid.
96   * @throws { BusinessError } 10200011 - The forEach method cannot be bound.
97   * @since 8
98   * @syscap SystemCapability.Utils.Lang
99   */
100  forEach(callbackFn: (value: T, index?: number, deque?: Deque<T>) => void,
101  thisArg?: Object): void;
102  /**
103   * returns an iterator.Each item of the iterator is a Javascript Object
104   * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound.
105   * @since 8
106   * @syscap SystemCapability.Utils.Lang
107   */
108  [Symbol.iterator](): IterableIterator<T>;
109}
110
111export default Deque;