collect-your-stuff 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -3241
- package/browser/collect-your-stuff.js +1585 -1193
- package/browser/collect-your-stuff.min.js +1 -1
- package/dist/collections/arrayable/ArrayElement.d.ts +33 -38
- package/dist/collections/arrayable/ArrayElement.js +64 -66
- package/dist/collections/arrayable/Arrayable.d.ts +107 -122
- package/dist/collections/arrayable/Arrayable.js +208 -223
- package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +45 -50
- package/dist/collections/doubly-linked-list/DoubleLinker.js +71 -73
- package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +108 -125
- package/dist/collections/doubly-linked-list/DoublyLinkedList.js +310 -327
- package/dist/collections/linked-list/LinkedList.d.ts +110 -126
- package/dist/collections/linked-list/LinkedList.js +283 -296
- package/dist/collections/linked-list/Linker.d.ts +41 -46
- package/dist/collections/linked-list/Linker.js +82 -84
- package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +140 -159
- package/dist/collections/linked-tree-list/LinkedTreeList.js +274 -294
- package/dist/collections/linked-tree-list/TreeLinker.d.ts +65 -71
- package/dist/collections/linked-tree-list/TreeLinker.js +91 -94
- package/dist/collections/queue/Queue.d.ts +55 -59
- package/dist/collections/queue/Queue.js +114 -119
- package/dist/collections/queue/Queueable.d.ts +74 -83
- package/dist/collections/queue/Queueable.js +142 -146
- package/dist/collections/queue/TaskQueue.d.ts +59 -68
- package/dist/collections/queue/TaskQueue.js +128 -137
- package/dist/collections/scoped-collection/ScopedCollection.d.ts +42 -0
- package/dist/collections/scoped-collection/ScopedCollection.js +81 -0
- package/dist/collections/scoped-collection/ScopedCollection.min.js +1 -0
- package/dist/collections/stack/Stack.d.ts +60 -64
- package/dist/collections/stack/Stack.js +122 -127
- package/dist/collections/stack/Stackable.d.ts +52 -59
- package/dist/collections/stack/Stackable.js +81 -85
- package/dist/collections/stack/TaskStack.d.ts +56 -65
- package/dist/collections/stack/TaskStack.js +98 -107
- package/dist/main.d.ts +4 -5
- package/dist/main.js +9 -5
- package/dist/main.min.js +1 -1
- package/dist/recipes/ArrayIterator.d.ts +20 -20
- package/dist/recipes/ArrayIterator.js +39 -39
- package/dist/recipes/DoubleLinkerIterator.d.ts +18 -18
- package/dist/recipes/DoubleLinkerIterator.js +33 -33
- package/dist/recipes/IsArrayable.d.ts +85 -105
- package/dist/recipes/IsArrayable.js +5 -5
- package/dist/recipes/IsDoubleLinker.d.ts +14 -14
- package/dist/recipes/IsDoubleLinker.js +5 -5
- package/dist/recipes/IsElement.d.ts +14 -14
- package/dist/recipes/IsElement.js +5 -5
- package/dist/recipes/IsLinker.d.ts +10 -10
- package/dist/recipes/IsLinker.js +5 -5
- package/dist/recipes/IsQueue.d.ts +32 -37
- package/dist/recipes/IsQueue.js +5 -5
- package/dist/recipes/IsScopedCollection.d.ts +27 -0
- package/dist/recipes/IsScopedCollection.js +5 -0
- package/dist/recipes/IsScopedCollection.min.js +1 -0
- package/dist/recipes/IsStack.d.ts +31 -36
- package/dist/recipes/IsStack.js +5 -5
- package/dist/recipes/IsTree.d.ts +11 -11
- package/dist/recipes/IsTree.js +5 -5
- package/dist/recipes/IsTreeNode.d.ts +29 -29
- package/dist/recipes/IsTreeNode.js +5 -5
- package/dist/recipes/LinkerIterator.d.ts +18 -18
- package/dist/recipes/LinkerIterator.js +33 -33
- package/dist/recipes/Runnable.d.ts +42 -55
- package/dist/recipes/Runnable.js +63 -69
- package/dist/recipes/TreeLinkerIterator.d.ts +20 -20
- package/dist/recipes/TreeLinkerIterator.js +36 -36
- package/dist/recipes/recipes.d.ts +12 -15
- package/dist/recipes/recipes.js +19 -22
- package/dist/services/parseTree.d.ts +8 -9
- package/dist/services/parseTree.js +23 -24
- package/dist/services/parseTreeNext.d.ts +16 -17
- package/dist/services/parseTreeNext.js +41 -42
- package/dist/services/services.d.ts +10 -13
- package/dist/services/services.js +19 -22
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,3254 +1,45 @@
|
|
|
1
1
|
# Collect your stuff (and go)!
|
|
2
2
|
|
|
3
|
-
Data allocation and manipulation
|
|
3
|
+
Data allocation and manipulation - a set of classic collection types (linked lists, doubly-linked lists, tree lists,
|
|
4
|
+
queues, stacks) built on a common `Linker`/`Arrayable` foundation.
|
|
4
5
|
|
|
5
|
-
##
|
|
6
|
+
## Install
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
</dd>
|
|
11
|
-
</dl>
|
|
8
|
+
```shell
|
|
9
|
+
npm install collect-your-stuff
|
|
10
|
+
```
|
|
12
11
|
|
|
13
|
-
##
|
|
12
|
+
## Example
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<dd><p>Class TreeLinkerIterator returns the next value taking a left-first approach down a tree.</p>
|
|
18
|
-
</dd>
|
|
19
|
-
<dt><a href="#Runnable">Runnable</a></dt>
|
|
20
|
-
<dd><p>Identify a class that can be run.</p>
|
|
21
|
-
</dd>
|
|
22
|
-
<dt><a href="#LinkerIterator">LinkerIterator</a></dt>
|
|
23
|
-
<dd><p>Class LinkerIterator returns the next value when using linkers of linked type lists.</p>
|
|
24
|
-
</dd>
|
|
25
|
-
<dt><a href="#DoubleLinkerIterator">DoubleLinkerIterator</a></dt>
|
|
26
|
-
<dd><p>Class DoubleLinkerIterator returns the next value when using linkers of linked type lists.</p>
|
|
27
|
-
</dd>
|
|
28
|
-
<dt><a href="#ArrayIterator">ArrayIterator</a></dt>
|
|
29
|
-
<dd><p>Class ArrayIterator returns the next value when using elements of array type list.</p>
|
|
30
|
-
</dd>
|
|
31
|
-
<dt><a href="#Stackable">Stackable</a> ⇐ <code><a href="#Linker">Linker</a></code></dt>
|
|
32
|
-
<dd><p>Stackable represents a runnable entry in stack.</p>
|
|
33
|
-
</dd>
|
|
34
|
-
<dt><a href="#Stack">Stack</a></dt>
|
|
35
|
-
<dd><p>Store a collection of items which can only be inserted and removed from the top.</p>
|
|
36
|
-
</dd>
|
|
37
|
-
<dt><a href="#Queueable">Queueable</a> ⇐ <code><a href="#Linker">Linker</a></code></dt>
|
|
38
|
-
<dd><p>Queueable represents a runnable entry in a queue.</p>
|
|
39
|
-
</dd>
|
|
40
|
-
<dt><a href="#Queue">Queue</a></dt>
|
|
41
|
-
<dd><p>Maintain a series of queued items.</p>
|
|
42
|
-
</dd>
|
|
43
|
-
<dt><a href="#TreeLinker">TreeLinker</a> ⇐ <code><a href="#DoubleLinker">DoubleLinker</a></code></dt>
|
|
44
|
-
<dd><p>TreeLinker represents a node in a LinkedTreeList having a parent (or root) and child nodes.</p>
|
|
45
|
-
</dd>
|
|
46
|
-
<dt><a href="#LinkedTreeList">LinkedTreeList</a> ⇐ <code><a href="#DoublyLinkedList">DoublyLinkedList</a></code></dt>
|
|
47
|
-
<dd><p>LinkedTreeList represents a collection stored with a root and spreading in branching (tree) formation.</p>
|
|
48
|
-
</dd>
|
|
49
|
-
<dt><a href="#Linker">Linker</a> ⇐ <code><a href="#ArrayElement">ArrayElement</a></code></dt>
|
|
50
|
-
<dd><p>Linker represents a node in a LinkedList.</p>
|
|
51
|
-
</dd>
|
|
52
|
-
<dt><a href="#LinkedList">LinkedList</a> ⇐ <code><a href="#Arrayable">Arrayable</a></code></dt>
|
|
53
|
-
<dd><p>LinkedList represents a collection stored as a LinkedList with next references.</p>
|
|
54
|
-
</dd>
|
|
55
|
-
<dt><a href="#DoublyLinkedList">DoublyLinkedList</a> ⇐ <code><a href="#LinkedList">LinkedList</a></code></dt>
|
|
56
|
-
<dd><p>DoublyLinkedList represents a collection stored as a LinkedList with prev and next references.</p>
|
|
57
|
-
</dd>
|
|
58
|
-
<dt><a href="#DoubleLinker">DoubleLinker</a> ⇐ <code><a href="#Linker">Linker</a></code></dt>
|
|
59
|
-
<dd><p>DoubleLinker represents a node in a DoublyLinkedList which is chained by next and prev.</p>
|
|
60
|
-
</dd>
|
|
61
|
-
<dt><a href="#Arrayable">Arrayable</a></dt>
|
|
62
|
-
<dd><p>Arrayable represents a collection stored as an array.</p>
|
|
63
|
-
</dd>
|
|
64
|
-
<dt><a href="#ArrayElement">ArrayElement</a></dt>
|
|
65
|
-
<dd><p>Element represents a node in an Arrayable.</p>
|
|
66
|
-
</dd>
|
|
67
|
-
</dl>
|
|
14
|
+
```js
|
|
15
|
+
const { LinkedList, Queue, Stack } = require('collect-your-stuff')
|
|
68
16
|
|
|
69
|
-
|
|
17
|
+
const list = LinkedList.fromArray(['a', 'b', 'c'])
|
|
18
|
+
list.length // 3
|
|
70
19
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<dd><p>Make a new Stackable from the data given if it is not already a valid Stackable.</p>
|
|
74
|
-
</dd>
|
|
75
|
-
<dt><a href="#Stack">Stack</a> ⇒ <code><a href="#Stack">Stack</a></code></dt>
|
|
76
|
-
<dd><p>Convert an array to a Stack.</p>
|
|
77
|
-
</dd>
|
|
78
|
-
<dt><a href="#Queueable">Queueable</a> ⇒ <code><a href="#Queueable">Queueable</a></code></dt>
|
|
79
|
-
<dd><p>Make a new Queueable from the data given if it is not already a valid Queueable.</p>
|
|
80
|
-
</dd>
|
|
81
|
-
<dt><a href="#Queue">Queue</a> ⇒ <code><a href="#Queue">Queue</a></code></dt>
|
|
82
|
-
<dd><p>Convert an array to a Queue.</p>
|
|
83
|
-
</dd>
|
|
84
|
-
<dt><a href="#TreeLinker">TreeLinker</a> ⇒ <code><a href="#TreeLinker">TreeLinker</a></code></dt>
|
|
85
|
-
<dd><p>Make a new DoubleLinker from the data given if it is not already a valid Linker.</p>
|
|
86
|
-
</dd>
|
|
87
|
-
<dt><a href="#LinkedTreeList">LinkedTreeList</a> ⇒ <code><a href="#LinkedTreeList">LinkedTreeList</a></code></dt>
|
|
88
|
-
<dd><p>Convert an array into a LinkedTreeList instance, return the new instance.</p>
|
|
89
|
-
</dd>
|
|
90
|
-
<dt><a href="#Linker">Linker</a> ⇒ <code><a href="#Linker">Linker</a></code></dt>
|
|
91
|
-
<dd><p>Make a new Linker from the data given if it is not already a valid Linker.</p>
|
|
92
|
-
</dd>
|
|
93
|
-
<dt><a href="#LinkedList">LinkedList</a> ⇒ <code><a href="#LinkedList">LinkedList</a></code></dt>
|
|
94
|
-
<dd><p>Convert an array to a LinkedList.</p>
|
|
95
|
-
</dd>
|
|
96
|
-
<dt><a href="#DoublyLinkedList">DoublyLinkedList</a> ⇒ <code><a href="#DoublyLinkedList">DoublyLinkedList</a></code></dt>
|
|
97
|
-
<dd><p>Convert an array into a DoublyLinkedList instance, return the new instance.</p>
|
|
98
|
-
</dd>
|
|
99
|
-
<dt><a href="#DoubleLinker">DoubleLinker</a> ⇒ <code><a href="#DoubleLinker">DoubleLinker</a></code></dt>
|
|
100
|
-
<dd><p>Make a new DoubleLinker from the data given if it is not already a valid Linker.</p>
|
|
101
|
-
</dd>
|
|
102
|
-
<dt><a href="#Arrayable">Arrayable</a> ⇒ <code><a href="#Arrayable">Arrayable</a></code></dt>
|
|
103
|
-
<dd><p>Convert an array to an Arrayable.</p>
|
|
104
|
-
</dd>
|
|
105
|
-
<dt><a href="#ArrayElement">ArrayElement</a> ⇒ <code><a href="#ArrayElement">ArrayElement</a></code></dt>
|
|
106
|
-
<dd><p>Make a new Element from the data given if it is not already a valid Element.</p>
|
|
107
|
-
</dd>
|
|
108
|
-
</dl>
|
|
20
|
+
const queue = Queue.fromArray([1, 2, 3])
|
|
21
|
+
queue.dequeue() // 1
|
|
109
22
|
|
|
110
|
-
|
|
23
|
+
const stack = Stack.fromArray([1, 2, 3])
|
|
24
|
+
stack.pop() // 3
|
|
25
|
+
```
|
|
111
26
|
|
|
112
|
-
|
|
113
|
-
<dt><a href="#services">services</a></dt>
|
|
114
|
-
<dd><p>List helpful functions when dealing with collections.</p>
|
|
115
|
-
</dd>
|
|
116
|
-
<dt><a href="#recipes">recipes</a></dt>
|
|
117
|
-
<dd><p>List of class declarations that can be used to specify attributes for a style of object / class.</p>
|
|
118
|
-
</dd>
|
|
119
|
-
</dl>
|
|
27
|
+
## Documentation
|
|
120
28
|
|
|
121
|
-
|
|
29
|
+
The reference for every class is in [`docs/`](https://joshuaheagle.com/projects/collect-your-stuff/docs/index.html) (or open `docs/index.html` locally). It is generated from the TypeScript source, and each module is a folder of `src/`:
|
|
122
30
|
|
|
123
|
-
|
|
124
|
-
<dt><a href="#parseTreeNext">parseTreeNext(treeNode)</a> ⇒ <code>IsTreeNode</code> | <code>null</code></dt>
|
|
125
|
-
<dd><p>Be able to parse over every node in a tree.</p>
|
|
126
|
-
<ol>
|
|
127
|
-
<li>Start at root (get root parent)</li>
|
|
128
|
-
<li>Get first child (repeat until no children)</li>
|
|
129
|
-
<li>Check next child</li>
|
|
130
|
-
<li>Repeat 2</li>
|
|
131
|
-
<li>Repeat 3</li>
|
|
132
|
-
<li>If no next child, return to parent and repeat 3</li>
|
|
133
|
-
<li>Stop at root (next is null and parent is null</li>
|
|
134
|
-
</ol>
|
|
135
|
-
</dd>
|
|
136
|
-
<dt><a href="#parseTree">parseTree(tree, callback)</a> ⇒ <code>IsArrayable.<IsTreeNode></code></dt>
|
|
137
|
-
<dd><p>Loop over all the nodes in a tree starting from left and apply a callback for each</p>
|
|
138
|
-
</dd>
|
|
139
|
-
</dl>
|
|
140
|
-
|
|
141
|
-
<a name="module_collect-your-stuff"></a>
|
|
142
|
-
|
|
143
|
-
## collect-your-stuff
|
|
144
|
-
All of the collections available.
|
|
145
|
-
|
|
146
|
-
**Version**: 1.0.0
|
|
147
|
-
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
148
|
-
<a name="module_collect-your-stuff..collectYourStuff"></a>
|
|
149
|
-
|
|
150
|
-
### collect-your-stuff~collectYourStuff
|
|
151
|
-
All methods exported from this module are encapsulated within collect-your-stuff (this default export is the same
|
|
152
|
-
set of classes as the named exports).
|
|
153
|
-
|
|
154
|
-
**Kind**: inner constant of [<code>collect-your-stuff</code>](#module_collect-your-stuff)
|
|
155
|
-
<a name="TreeLinkerIterator"></a>
|
|
156
|
-
|
|
157
|
-
## TreeLinkerIterator
|
|
158
|
-
Class TreeLinkerIterator returns the next value taking a left-first approach down a tree.
|
|
159
|
-
|
|
160
|
-
**Kind**: global class
|
|
161
|
-
|
|
162
|
-
* [TreeLinkerIterator](#TreeLinkerIterator)
|
|
163
|
-
* [new TreeLinkerIterator(current)](#new_TreeLinkerIterator_new)
|
|
164
|
-
* [.next([value])](#TreeLinkerIterator+next) ⇒ <code>IteratorResult.<IsTreeNode></code>
|
|
165
|
-
|
|
166
|
-
<a name="new_TreeLinkerIterator_new"></a>
|
|
167
|
-
|
|
168
|
-
### new TreeLinkerIterator(current)
|
|
169
|
-
Create an iterator starting at the given item.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
| Param | Type | Description |
|
|
173
|
-
| --- | --- | --- |
|
|
174
|
-
| current | <code>IsTreeNode</code> | The item to start from. |
|
|
175
|
-
|
|
176
|
-
<a name="TreeLinkerIterator+next"></a>
|
|
177
|
-
|
|
178
|
-
### treeLinkerIterator.next([value]) ⇒ <code>IteratorResult.<IsTreeNode></code>
|
|
179
|
-
Get the current item and move on to the following one (left-first, down each branch).
|
|
180
|
-
|
|
181
|
-
**Kind**: instance method of [<code>TreeLinkerIterator</code>](#TreeLinkerIterator)
|
|
182
|
-
**Returns**: <code>IteratorResult.<IsTreeNode></code> - The current item, or done when there are no more.
|
|
183
|
-
|
|
184
|
-
| Param | Type | Description |
|
|
185
|
-
| --- | --- | --- |
|
|
186
|
-
| [value] | <code>\*</code> | Not used, present to match the Iterator interface. |
|
|
187
|
-
|
|
188
|
-
<a name="Runnable"></a>
|
|
189
|
-
|
|
190
|
-
## Runnable
|
|
191
|
-
Identify a class that can be run.
|
|
192
|
-
|
|
193
|
-
**Kind**: global class
|
|
194
|
-
|
|
195
|
-
* [Runnable](#Runnable)
|
|
196
|
-
* [new Runnable([data])](#new_Runnable_new)
|
|
197
|
-
* _instance_
|
|
198
|
-
* [.data](#Runnable+data)
|
|
199
|
-
* [.task](#Runnable+task) ⇒ <code>function</code>
|
|
200
|
-
* [.run()](#Runnable+run) ⇒ <code>\*</code>
|
|
201
|
-
* _static_
|
|
202
|
-
* [.isRunnable(thing)](#Runnable.isRunnable) ⇒ <code>boolean</code>
|
|
203
|
-
|
|
204
|
-
<a name="new_Runnable_new"></a>
|
|
205
|
-
|
|
206
|
-
### new Runnable([data])
|
|
207
|
-
Instantiate a Runnable class.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
| Param | Type | Default | Description |
|
|
211
|
-
| --- | --- | --- | --- |
|
|
212
|
-
| [data] | <code>\*</code> | <code></code> | The task (a function) or the data which the task returns. |
|
|
213
|
-
|
|
214
|
-
<a name="Runnable+data"></a>
|
|
215
|
-
|
|
216
|
-
### runnable.data
|
|
217
|
-
The task (or data) this runnable holds.
|
|
218
|
-
|
|
219
|
-
**Kind**: instance property of [<code>Runnable</code>](#Runnable)
|
|
220
|
-
<a name="Runnable+task"></a>
|
|
221
|
-
|
|
222
|
-
### runnable.task ⇒ <code>function</code>
|
|
223
|
-
Retrieve the data which should be formed as a task.
|
|
224
|
-
|
|
225
|
-
**Kind**: instance property of [<code>Runnable</code>](#Runnable)
|
|
226
|
-
<a name="Runnable+run"></a>
|
|
227
|
-
|
|
228
|
-
### runnable.run() ⇒ <code>\*</code>
|
|
229
|
-
Run the runnable task.
|
|
230
|
-
|
|
231
|
-
**Kind**: instance method of [<code>Runnable</code>](#Runnable)
|
|
232
|
-
<a name="Runnable.isRunnable"></a>
|
|
233
|
-
|
|
234
|
-
### Runnable.isRunnable(thing) ⇒ <code>boolean</code>
|
|
235
|
-
Check if a given thing is Runnable
|
|
236
|
-
|
|
237
|
-
**Kind**: static method of [<code>Runnable</code>](#Runnable)
|
|
238
|
-
|
|
239
|
-
| Param | Type | Description |
|
|
240
|
-
| --- | --- | --- |
|
|
241
|
-
| thing | <code>\*</code> | The value to check, or nothing to check whether this class is Runnable. |
|
|
242
|
-
|
|
243
|
-
<a name="LinkerIterator"></a>
|
|
244
|
-
|
|
245
|
-
## LinkerIterator
|
|
246
|
-
Class LinkerIterator returns the next value when using linkers of linked type lists.
|
|
247
|
-
|
|
248
|
-
**Kind**: global class
|
|
249
|
-
|
|
250
|
-
* [LinkerIterator](#LinkerIterator)
|
|
251
|
-
* [new LinkerIterator(current)](#new_LinkerIterator_new)
|
|
252
|
-
* [.next([value])](#LinkerIterator+next) ⇒ <code>IteratorResult.<IsLinker></code>
|
|
253
|
-
|
|
254
|
-
<a name="new_LinkerIterator_new"></a>
|
|
255
|
-
|
|
256
|
-
### new LinkerIterator(current)
|
|
257
|
-
Create an iterator starting at the given item.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
| Param | Type | Description |
|
|
261
|
-
| --- | --- | --- |
|
|
262
|
-
| current | <code>IsLinker</code> | The item to start from. |
|
|
263
|
-
|
|
264
|
-
<a name="LinkerIterator+next"></a>
|
|
265
|
-
|
|
266
|
-
### linkerIterator.next([value]) ⇒ <code>IteratorResult.<IsLinker></code>
|
|
267
|
-
Get the current item and move on to the following one.
|
|
268
|
-
|
|
269
|
-
**Kind**: instance method of [<code>LinkerIterator</code>](#LinkerIterator)
|
|
270
|
-
**Returns**: <code>IteratorResult.<IsLinker></code> - The current item, or done when there are no more.
|
|
271
|
-
|
|
272
|
-
| Param | Type | Description |
|
|
273
|
-
| --- | --- | --- |
|
|
274
|
-
| [value] | <code>\*</code> | Not used, present to match the Iterator interface. |
|
|
275
|
-
|
|
276
|
-
<a name="DoubleLinkerIterator"></a>
|
|
277
|
-
|
|
278
|
-
## DoubleLinkerIterator
|
|
279
|
-
Class DoubleLinkerIterator returns the next value when using linkers of linked type lists.
|
|
280
|
-
|
|
281
|
-
**Kind**: global class
|
|
282
|
-
|
|
283
|
-
* [DoubleLinkerIterator](#DoubleLinkerIterator)
|
|
284
|
-
* [new DoubleLinkerIterator(current)](#new_DoubleLinkerIterator_new)
|
|
285
|
-
* [.next([value])](#DoubleLinkerIterator+next) ⇒ <code>IteratorResult.<IsDoubleLinker></code>
|
|
286
|
-
|
|
287
|
-
<a name="new_DoubleLinkerIterator_new"></a>
|
|
288
|
-
|
|
289
|
-
### new DoubleLinkerIterator(current)
|
|
290
|
-
Create an iterator starting at the given item.
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
| Param | Type | Description |
|
|
294
|
-
| --- | --- | --- |
|
|
295
|
-
| current | <code>IsDoubleLinker</code> | The item to start from. |
|
|
296
|
-
|
|
297
|
-
<a name="DoubleLinkerIterator+next"></a>
|
|
298
|
-
|
|
299
|
-
### doubleLinkerIterator.next([value]) ⇒ <code>IteratorResult.<IsDoubleLinker></code>
|
|
300
|
-
Get the current item and move on to the following one.
|
|
301
|
-
|
|
302
|
-
**Kind**: instance method of [<code>DoubleLinkerIterator</code>](#DoubleLinkerIterator)
|
|
303
|
-
**Returns**: <code>IteratorResult.<IsDoubleLinker></code> - The current item, or done when there are no more.
|
|
304
|
-
|
|
305
|
-
| Param | Type | Description |
|
|
306
|
-
| --- | --- | --- |
|
|
307
|
-
| [value] | <code>\*</code> | Not used, present to match the Iterator interface. |
|
|
308
|
-
|
|
309
|
-
<a name="ArrayIterator"></a>
|
|
310
|
-
|
|
311
|
-
## ArrayIterator
|
|
312
|
-
Class ArrayIterator returns the next value when using elements of array type list.
|
|
313
|
-
|
|
314
|
-
**Kind**: global class
|
|
315
|
-
|
|
316
|
-
* [ArrayIterator](#ArrayIterator)
|
|
317
|
-
* [new ArrayIterator(innerList, [index])](#new_ArrayIterator_new)
|
|
318
|
-
* [.next([value])](#ArrayIterator+next) ⇒ <code>IteratorResult.<IsElement></code>
|
|
319
|
-
|
|
320
|
-
<a name="new_ArrayIterator_new"></a>
|
|
321
|
-
|
|
322
|
-
### new ArrayIterator(innerList, [index])
|
|
323
|
-
Create an iterator over the given array.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
| Param | Type | Default | Description |
|
|
327
|
-
| --- | --- | --- | --- |
|
|
328
|
-
| innerList | <code>Array.<IsElement></code> | | The elements to iterate over. |
|
|
329
|
-
| [index] | <code>number</code> | <code>0</code> | The position to start from. |
|
|
330
|
-
|
|
331
|
-
<a name="ArrayIterator+next"></a>
|
|
332
|
-
|
|
333
|
-
### arrayIterator.next([value]) ⇒ <code>IteratorResult.<IsElement></code>
|
|
334
|
-
Get the next element, moving the iterator forward.
|
|
335
|
-
|
|
336
|
-
**Kind**: instance method of [<code>ArrayIterator</code>](#ArrayIterator)
|
|
337
|
-
**Returns**: <code>IteratorResult.<IsElement></code> - The next element, or done when there are no more.
|
|
338
|
-
|
|
339
|
-
| Param | Type | Description |
|
|
340
|
-
| --- | --- | --- |
|
|
341
|
-
| [value] | <code>\*</code> | Not used, present to match the Iterator interface. |
|
|
342
|
-
|
|
343
|
-
<a name="Stackable"></a>
|
|
344
|
-
|
|
345
|
-
## Stackable ⇐ [<code>Linker</code>](#Linker)
|
|
346
|
-
Stackable represents a runnable entry in stack.
|
|
347
|
-
|
|
348
|
-
**Kind**: global class
|
|
349
|
-
**Extends**: [<code>Linker</code>](#Linker)
|
|
350
|
-
|
|
351
|
-
* [Stackable](#Stackable) ⇐ [<code>Linker</code>](#Linker)
|
|
352
|
-
* [new Stackable([stackData])](#new_Stackable_new)
|
|
353
|
-
* _instance_
|
|
354
|
-
* [.data](#Stackable+data)
|
|
355
|
-
* [.next](#Stackable+next)
|
|
356
|
-
* [.task](#Stackable+task) ⇒ <code>\*</code>
|
|
357
|
-
* [.classType](#Linker+classType)
|
|
358
|
-
* [.run()](#Stackable+run) ⇒ <code>\*</code>
|
|
359
|
-
* _static_
|
|
360
|
-
* [.fromArray([values], [classType])](#Stackable.fromArray) ⇒ <code>Object</code>
|
|
361
|
-
|
|
362
|
-
<a name="new_Stackable_new"></a>
|
|
363
|
-
|
|
364
|
-
### new Stackable([stackData])
|
|
365
|
-
Create a stackable item that can be used in a stack.
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
| Param | Type | Default | Description |
|
|
369
|
-
| --- | --- | --- | --- |
|
|
370
|
-
| [stackData] | <code>Object</code> | <code>{}</code> | The settings for the new stackable. |
|
|
371
|
-
| [stackData.task] | <code>\*</code> | <code></code> | The data to be stored in this stackable |
|
|
372
|
-
| [stackData.next] | [<code>Stackable</code>](#Stackable) \| <code>null</code> | <code></code> | The reference to the next stackable if any |
|
|
373
|
-
| [stackData.ready] | <code>boolean</code> \| <code>function</code> | <code>false</code> | Indicate if the stackable is ready to run |
|
|
374
|
-
|
|
375
|
-
<a name="Stackable+data"></a>
|
|
376
|
-
|
|
377
|
-
### stackable.data
|
|
378
|
-
The task (or data) this stackable holds.
|
|
379
|
-
|
|
380
|
-
**Kind**: instance property of [<code>Stackable</code>](#Stackable)
|
|
381
|
-
**Overrides**: [<code>data</code>](#Linker+data)
|
|
382
|
-
<a name="Stackable+next"></a>
|
|
383
|
-
|
|
384
|
-
### stackable.next
|
|
385
|
-
The stackable below this one, or null when this is the bottom.
|
|
386
|
-
|
|
387
|
-
**Kind**: instance property of [<code>Stackable</code>](#Stackable)
|
|
388
|
-
**Overrides**: [<code>next</code>](#Linker+next)
|
|
389
|
-
<a name="Stackable+task"></a>
|
|
390
|
-
|
|
391
|
-
### stackable.task ⇒ <code>\*</code>
|
|
392
|
-
Retrieve the data which should be formed as a task.
|
|
393
|
-
|
|
394
|
-
**Kind**: instance property of [<code>Stackable</code>](#Stackable)
|
|
395
|
-
<a name="Linker+classType"></a>
|
|
396
|
-
|
|
397
|
-
### stackable.classType
|
|
398
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
399
|
-
|
|
400
|
-
**Kind**: instance property of [<code>Stackable</code>](#Stackable)
|
|
401
|
-
**Overrides**: [<code>classType</code>](#Linker+classType)
|
|
402
|
-
<a name="Stackable+run"></a>
|
|
403
|
-
|
|
404
|
-
### stackable.run() ⇒ <code>\*</code>
|
|
405
|
-
Run the stacked task.
|
|
406
|
-
|
|
407
|
-
**Kind**: instance method of [<code>Stackable</code>](#Stackable)
|
|
408
|
-
<a name="Stackable.fromArray"></a>
|
|
409
|
-
|
|
410
|
-
### Stackable.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
411
|
-
Convert an array into Stackable instances, return the head and tail Stackables.
|
|
412
|
-
|
|
413
|
-
**Kind**: static method of [<code>Stackable</code>](#Stackable)
|
|
414
|
-
|
|
415
|
-
| Param | Type | Default | Description |
|
|
416
|
-
| --- | --- | --- | --- |
|
|
417
|
-
| [values] | <code>Array</code> | <code>[]</code> | Provide an array of data that will be converted to a chain of stackable linkers. |
|
|
418
|
-
| [classType] | <code>IsLinker</code> | <code>Stackable</code> | Provide the type of IsLinker to use. |
|
|
419
|
-
|
|
420
|
-
<a name="Stack"></a>
|
|
421
|
-
|
|
422
|
-
## Stack
|
|
423
|
-
Store a collection of items which can only be inserted and removed from the top.
|
|
424
|
-
|
|
425
|
-
**Kind**: global class
|
|
426
|
-
|
|
427
|
-
* [Stack](#Stack)
|
|
428
|
-
* [new Stack([stackedList], [listClass], [stackableClass])](#new_Stack_new)
|
|
429
|
-
* [.empty()](#Stack+empty) ⇒ <code>boolean</code>
|
|
430
|
-
* [.top()](#Stack+top) ⇒ [<code>Stackable</code>](#Stackable)
|
|
431
|
-
* [.pop()](#Stack+pop) ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
|
|
432
|
-
* [.push(stackable)](#Stack+push)
|
|
433
|
-
* [.remove()](#Stack+remove) ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
|
|
434
|
-
* [.size()](#Stack+size) ⇒ <code>number</code>
|
|
435
|
-
|
|
436
|
-
<a name="new_Stack_new"></a>
|
|
437
|
-
|
|
438
|
-
### new Stack([stackedList], [listClass], [stackableClass])
|
|
439
|
-
Instantiate the state with the starter stacked list.
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
| Param | Type | Default | Description |
|
|
443
|
-
| --- | --- | --- | --- |
|
|
444
|
-
| [stackedList] | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) | <code></code> | The list of stackables to start in this stack. |
|
|
445
|
-
| [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no stacked list is given. |
|
|
446
|
-
| [stackableClass] | [<code>Stackable</code>](#Stackable) | <code>Stackable</code> | The class used to wrap stacked items. |
|
|
447
|
-
|
|
448
|
-
<a name="Stack+empty"></a>
|
|
449
|
-
|
|
450
|
-
### stack.empty() ⇒ <code>boolean</code>
|
|
451
|
-
Return true if the stack is empty (there are no tasks in the stacked list)
|
|
452
|
-
|
|
453
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
454
|
-
<a name="Stack+top"></a>
|
|
455
|
-
|
|
456
|
-
### stack.top() ⇒ [<code>Stackable</code>](#Stackable)
|
|
457
|
-
Take a look at the next stacked task
|
|
458
|
-
|
|
459
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
460
|
-
<a name="Stack+pop"></a>
|
|
461
|
-
|
|
462
|
-
### stack.pop() ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
|
|
463
|
-
Remove the next stacked task and return it.
|
|
464
|
-
|
|
465
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
466
|
-
<a name="Stack+push"></a>
|
|
467
|
-
|
|
468
|
-
### stack.push(stackable)
|
|
469
|
-
Push a stackable task to the top of the stack.
|
|
470
|
-
|
|
471
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
472
|
-
|
|
473
|
-
| Param | Type | Description |
|
|
474
|
-
| --- | --- | --- |
|
|
475
|
-
| stackable | [<code>Stackable</code>](#Stackable) \| <code>\*</code> | Add a new stackable to the top of the stack |
|
|
476
|
-
|
|
477
|
-
<a name="Stack+remove"></a>
|
|
478
|
-
|
|
479
|
-
### stack.remove() ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
|
|
480
|
-
Remove the next stacked task and return it.
|
|
481
|
-
|
|
482
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
483
|
-
<a name="Stack+size"></a>
|
|
484
|
-
|
|
485
|
-
### stack.size() ⇒ <code>number</code>
|
|
486
|
-
Get the size of the current stack.
|
|
487
|
-
|
|
488
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
489
|
-
<a name="Queueable"></a>
|
|
490
|
-
|
|
491
|
-
## Queueable ⇐ [<code>Linker</code>](#Linker)
|
|
492
|
-
Queueable represents a runnable entry in a queue.
|
|
493
|
-
|
|
494
|
-
**Kind**: global class
|
|
495
|
-
**Extends**: [<code>Linker</code>](#Linker)
|
|
496
|
-
|
|
497
|
-
* [Queueable](#Queueable) ⇐ [<code>Linker</code>](#Linker)
|
|
498
|
-
* [new Queueable([queueableData])](#new_Queueable_new)
|
|
499
|
-
* _instance_
|
|
500
|
-
* [.data](#Queueable+data)
|
|
501
|
-
* [.next](#Queueable+next)
|
|
502
|
-
* [.complete](#Queueable+complete)
|
|
503
|
-
* [.ready](#Queueable+ready)
|
|
504
|
-
* [.running](#Queueable+running)
|
|
505
|
-
* [.isReady](#Queueable+isReady) ⇒ <code>boolean</code>
|
|
506
|
-
* [.task](#Queueable+task) ⇒ <code>\*</code>
|
|
507
|
-
* [.classType](#Linker+classType)
|
|
508
|
-
* [.markCompleted([completeResponse])](#Queueable+markCompleted) ⇒ <code>completeResponse</code>
|
|
509
|
-
* [.run()](#Queueable+run) ⇒ <code>completeResponse</code>
|
|
510
|
-
* _static_
|
|
511
|
-
* [.fromArray(values, [classType])](#Queueable.fromArray) ⇒ <code>Object</code>
|
|
512
|
-
|
|
513
|
-
<a name="new_Queueable_new"></a>
|
|
514
|
-
|
|
515
|
-
### new Queueable([queueableData])
|
|
516
|
-
Create a queueable item that can be used in a queue.
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
| Param | Type | Default | Description |
|
|
520
|
-
| --- | --- | --- | --- |
|
|
521
|
-
| [queueableData] | <code>Object</code> | <code>{}</code> | The settings for the new queueable. |
|
|
522
|
-
| [queueableData.task] | <code>\*</code> | <code></code> | The data to be stored in this queueable |
|
|
523
|
-
| [queueableData.next] | [<code>Queueable</code>](#Queueable) \| <code>null</code> | <code></code> | The reference to the next queueable if any |
|
|
524
|
-
| [queueableData.ready] | <code>boolean</code> \| <code>function</code> | <code>false</code> | Indicate if the queueable is ready to run |
|
|
525
|
-
|
|
526
|
-
<a name="Queueable+data"></a>
|
|
527
|
-
|
|
528
|
-
### queueable.data
|
|
529
|
-
The task (or data) this queueable holds.
|
|
530
|
-
|
|
531
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
532
|
-
**Overrides**: [<code>data</code>](#Linker+data)
|
|
533
|
-
<a name="Queueable+next"></a>
|
|
534
|
-
|
|
535
|
-
### queueable.next
|
|
536
|
-
The queueable after this one, or null when this is the last.
|
|
537
|
-
|
|
538
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
539
|
-
**Overrides**: [<code>next</code>](#Linker+next)
|
|
540
|
-
<a name="Queueable+complete"></a>
|
|
541
|
-
|
|
542
|
-
### queueable.complete
|
|
543
|
-
Whether this queueable has been run to completion.
|
|
544
|
-
|
|
545
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
546
|
-
<a name="Queueable+ready"></a>
|
|
547
|
-
|
|
548
|
-
### queueable.ready
|
|
549
|
-
Whether this queueable may run, or a function which answers that when asked.
|
|
550
|
-
|
|
551
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
552
|
-
<a name="Queueable+running"></a>
|
|
553
|
-
|
|
554
|
-
### queueable.running
|
|
555
|
-
Whether this queueable is running right now.
|
|
556
|
-
|
|
557
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
558
|
-
<a name="Queueable+isReady"></a>
|
|
559
|
-
|
|
560
|
-
### queueable.isReady ⇒ <code>boolean</code>
|
|
561
|
-
Check ready state.
|
|
562
|
-
|
|
563
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
564
|
-
<a name="Queueable+task"></a>
|
|
565
|
-
|
|
566
|
-
### queueable.task ⇒ <code>\*</code>
|
|
567
|
-
Retrieve the data which should be formed as a task.
|
|
568
|
-
|
|
569
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
570
|
-
<a name="Linker+classType"></a>
|
|
571
|
-
|
|
572
|
-
### queueable.classType
|
|
573
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
574
|
-
|
|
575
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
576
|
-
**Overrides**: [<code>classType</code>](#Linker+classType)
|
|
577
|
-
<a name="Queueable+markCompleted"></a>
|
|
578
|
-
|
|
579
|
-
### queueable.markCompleted([completeResponse]) ⇒ <code>completeResponse</code>
|
|
580
|
-
Set this queueable as completed.
|
|
581
|
-
|
|
582
|
-
**Kind**: instance method of [<code>Queueable</code>](#Queueable)
|
|
583
|
-
|
|
584
|
-
| Param | Type | Default | Description |
|
|
585
|
-
| --- | --- | --- | --- |
|
|
586
|
-
| [completeResponse] | <code>Object</code> | <code>{}</code> | The result to report for the task. |
|
|
587
|
-
| [completeResponse.success] | <code>\*</code> | <code>true</code> | Indicate when the task failed (use false) or give a success message |
|
|
588
|
-
| [completeResponse.error] | <code>\*</code> | <code>false</code> | Indicate a task was error-free (use false) or give an error message |
|
|
589
|
-
| [completeResponse.context] | <code>\*</code> | <code></code> | Provide additional data in the response |
|
|
590
|
-
|
|
591
|
-
<a name="Queueable+run"></a>
|
|
592
|
-
|
|
593
|
-
### queueable.run() ⇒ <code>completeResponse</code>
|
|
594
|
-
Intend to run the queued task when it is ready. If ready, mark this task as running and run the task.
|
|
595
|
-
|
|
596
|
-
**Kind**: instance method of [<code>Queueable</code>](#Queueable)
|
|
597
|
-
<a name="Queueable.fromArray"></a>
|
|
598
|
-
|
|
599
|
-
### Queueable.fromArray(values, [classType]) ⇒ <code>Object</code>
|
|
600
|
-
Convert an array into Queueable instances, return the head and tail Queueables.
|
|
601
|
-
|
|
602
|
-
**Kind**: static method of [<code>Queueable</code>](#Queueable)
|
|
603
|
-
|
|
604
|
-
| Param | Type | Default | Description |
|
|
605
|
-
| --- | --- | --- | --- |
|
|
606
|
-
| values | <code>Array</code> | | Provide an array of data that will be converted to a chain of queueable linkers. |
|
|
607
|
-
| [classType] | <code>IsLinker</code> | <code>Queueable</code> | Provide the type of IsLinker to use. |
|
|
608
|
-
|
|
609
|
-
<a name="Queue"></a>
|
|
610
|
-
|
|
611
|
-
## Queue
|
|
612
|
-
Maintain a series of queued items.
|
|
613
|
-
|
|
614
|
-
**Kind**: global class
|
|
615
|
-
|
|
616
|
-
* [Queue](#Queue)
|
|
617
|
-
* [new Queue(queuedList, [listClass], [queueableClass])](#new_Queue_new)
|
|
618
|
-
* [.dequeue()](#Queue+dequeue) ⇒ <code>completeResponse</code> \| <code>\*</code>
|
|
619
|
-
* [.empty()](#Queue+empty) ⇒ <code>boolean</code>
|
|
620
|
-
* [.enqueue(queueable)](#Queue+enqueue)
|
|
621
|
-
* [.peek()](#Queue+peek) ⇒ [<code>Queueable</code>](#Queueable)
|
|
622
|
-
* [.remove()](#Queue+remove) ⇒ [<code>Queueable</code>](#Queueable) \| <code>null</code>
|
|
623
|
-
* [.size()](#Queue+size) ⇒ <code>number</code>
|
|
624
|
-
|
|
625
|
-
<a name="new_Queue_new"></a>
|
|
626
|
-
|
|
627
|
-
### new Queue(queuedList, [listClass], [queueableClass])
|
|
628
|
-
Instantiate the queue with the given queue list.
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
| Param | Type | Default | Description |
|
|
632
|
-
| --- | --- | --- | --- |
|
|
633
|
-
| queuedList | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) | <code></code> | Give the list of queueables to start in this queue. |
|
|
634
|
-
| [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no queued list is given. |
|
|
635
|
-
| [queueableClass] | [<code>Queueable</code>](#Queueable) | <code>Queueable</code> | The class used to wrap queued items. |
|
|
636
|
-
|
|
637
|
-
<a name="Queue+dequeue"></a>
|
|
638
|
-
|
|
639
|
-
### queue.dequeue() ⇒ <code>completeResponse</code> \| <code>\*</code>
|
|
640
|
-
Take a queued task from the front of the queue and run it if ready.
|
|
641
|
-
|
|
642
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
643
|
-
<a name="Queue+empty"></a>
|
|
644
|
-
|
|
645
|
-
### queue.empty() ⇒ <code>boolean</code>
|
|
646
|
-
Return true if the queue is empty (there are no tasks in the queue list)
|
|
647
|
-
|
|
648
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
649
|
-
<a name="Queue+enqueue"></a>
|
|
650
|
-
|
|
651
|
-
### queue.enqueue(queueable)
|
|
652
|
-
Add a queued task to the end of the queue
|
|
653
|
-
|
|
654
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
655
|
-
|
|
656
|
-
| Param | Type | Description |
|
|
657
|
-
| --- | --- | --- |
|
|
658
|
-
| queueable | [<code>Queueable</code>](#Queueable) | Add a new queueable to the end of the queue |
|
|
659
|
-
|
|
660
|
-
<a name="Queue+peek"></a>
|
|
661
|
-
|
|
662
|
-
### queue.peek() ⇒ [<code>Queueable</code>](#Queueable)
|
|
663
|
-
Take a look at the next queued task
|
|
664
|
-
|
|
665
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
666
|
-
<a name="Queue+remove"></a>
|
|
667
|
-
|
|
668
|
-
### queue.remove() ⇒ [<code>Queueable</code>](#Queueable) \| <code>null</code>
|
|
669
|
-
Remove the next queued item and return it.
|
|
670
|
-
|
|
671
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
672
|
-
<a name="Queue+size"></a>
|
|
673
|
-
|
|
674
|
-
### queue.size() ⇒ <code>number</code>
|
|
675
|
-
Get the length of the current queue.
|
|
676
|
-
|
|
677
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
678
|
-
<a name="TreeLinker"></a>
|
|
679
|
-
|
|
680
|
-
## TreeLinker ⇐ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
681
|
-
TreeLinker represents a node in a LinkedTreeList having a parent (or root) and child nodes.
|
|
682
|
-
|
|
683
|
-
**Kind**: global class
|
|
684
|
-
**Extends**: [<code>DoubleLinker</code>](#DoubleLinker)
|
|
685
|
-
|
|
686
|
-
* [TreeLinker](#TreeLinker) ⇐ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
687
|
-
* [new TreeLinker([settings], listClass)](#new_TreeLinker_new)
|
|
688
|
-
* _instance_
|
|
689
|
-
* [.classType](#TreeLinker+classType)
|
|
690
|
-
* [.data](#TreeLinker+data)
|
|
691
|
-
* [.next](#TreeLinker+next)
|
|
692
|
-
* [.prev](#TreeLinker+prev)
|
|
693
|
-
* [.parent](#TreeLinker+parent)
|
|
694
|
-
* [.children](#TreeLinker+children)
|
|
695
|
-
* [.childrenFromArray(children, listClass)](#TreeLinker+childrenFromArray) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
|
|
696
|
-
* _static_
|
|
697
|
-
* [.fromArray([values], [classType])](#TreeLinker.fromArray) ⇒ <code>Object</code>
|
|
698
|
-
|
|
699
|
-
<a name="new_TreeLinker_new"></a>
|
|
700
|
-
|
|
701
|
-
### new TreeLinker([settings], listClass)
|
|
702
|
-
Create the new TreeLinker instance, provide the data and optionally set references for next, prev, parent, or children.
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
| Param | Type | Default | Description |
|
|
706
|
-
| --- | --- | --- | --- |
|
|
707
|
-
| [settings] | <code>Object</code> | <code>{}</code> | The settings for the new tree node. |
|
|
708
|
-
| [settings.data] | <code>\*</code> | <code></code> | The data to be stored in this tree node |
|
|
709
|
-
| [settings.next] | [<code>TreeLinker</code>](#TreeLinker) | <code></code> | The reference to the next linker if any |
|
|
710
|
-
| [settings.prev] | [<code>TreeLinker</code>](#TreeLinker) | <code></code> | The reference to the previous linker if any |
|
|
711
|
-
| [settings.children] | [<code>LinkedTreeList</code>](#LinkedTreeList) | <code></code> | The references to child linkers if any |
|
|
712
|
-
| [settings.parent] | [<code>TreeLinker</code>](#TreeLinker) | <code></code> | The reference to a parent linker if any |
|
|
713
|
-
| listClass | <code>IsArrayable.<IsTreeNode></code> | | Give the type of list to use for storing the children |
|
|
714
|
-
|
|
715
|
-
<a name="TreeLinker+classType"></a>
|
|
716
|
-
|
|
717
|
-
### treeLinker.classType
|
|
718
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
719
|
-
|
|
720
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
721
|
-
**Overrides**: [<code>classType</code>](#DoubleLinker+classType)
|
|
722
|
-
<a name="TreeLinker+data"></a>
|
|
723
|
-
|
|
724
|
-
### treeLinker.data
|
|
725
|
-
The data stored in this tree node.
|
|
726
|
-
|
|
727
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
728
|
-
**Overrides**: [<code>data</code>](#DoubleLinker+data)
|
|
729
|
-
<a name="TreeLinker+next"></a>
|
|
730
|
-
|
|
731
|
-
### treeLinker.next
|
|
732
|
-
The sibling after this node, or null when this is the last child.
|
|
733
|
-
|
|
734
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
735
|
-
**Overrides**: [<code>next</code>](#DoubleLinker+next)
|
|
736
|
-
<a name="TreeLinker+prev"></a>
|
|
737
|
-
|
|
738
|
-
### treeLinker.prev
|
|
739
|
-
The sibling before this node, or null when this is the first child.
|
|
740
|
-
|
|
741
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
742
|
-
**Overrides**: [<code>prev</code>](#DoubleLinker+prev)
|
|
743
|
-
<a name="TreeLinker+parent"></a>
|
|
744
|
-
|
|
745
|
-
### treeLinker.parent
|
|
746
|
-
The node this node is a child of, or null for a root node.
|
|
747
|
-
|
|
748
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
749
|
-
<a name="TreeLinker+children"></a>
|
|
750
|
-
|
|
751
|
-
### treeLinker.children
|
|
752
|
-
The list of the children of this node, or null when it has none.
|
|
753
|
-
|
|
754
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
755
|
-
<a name="TreeLinker+childrenFromArray"></a>
|
|
756
|
-
|
|
757
|
-
### treeLinker.childrenFromArray(children, listClass) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
|
|
758
|
-
Create the children for this tree from an array.
|
|
759
|
-
|
|
760
|
-
**Kind**: instance method of [<code>TreeLinker</code>](#TreeLinker)
|
|
761
|
-
|
|
762
|
-
| Param | Type | Default | Description |
|
|
763
|
-
| --- | --- | --- | --- |
|
|
764
|
-
| children | <code>Array</code> \| <code>null</code> | <code></code> | Provide an array of data / linker references to be children of this tree node. |
|
|
765
|
-
| listClass | <code>IsArrayable.<IsTreeNode></code> | | Give the type of list to use for storing the children |
|
|
766
|
-
|
|
767
|
-
<a name="TreeLinker.fromArray"></a>
|
|
768
|
-
|
|
769
|
-
### TreeLinker.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
770
|
-
Convert an array into DoubleLinker instances, return the head and tail DoubleLinkers.
|
|
771
|
-
|
|
772
|
-
**Kind**: static method of [<code>TreeLinker</code>](#TreeLinker)
|
|
773
|
-
|
|
774
|
-
| Param | Type | Default | Description |
|
|
775
|
-
| --- | --- | --- | --- |
|
|
776
|
-
| [values] | <code>Array</code> | <code>[]</code> | Provide an array of data that will be converted to a chain of tree-linkers. |
|
|
777
|
-
| [classType] | <code>IsTreeNode</code> | <code>TreeLinker</code> | Provide the type of IsTreeNode to use. |
|
|
778
|
-
|
|
779
|
-
<a name="LinkedTreeList"></a>
|
|
780
|
-
|
|
781
|
-
## LinkedTreeList ⇐ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
782
|
-
LinkedTreeList represents a collection stored with a root and spreading in branching (tree) formation.
|
|
783
|
-
|
|
784
|
-
**Kind**: global class
|
|
785
|
-
**Extends**: [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
786
|
-
|
|
787
|
-
* [LinkedTreeList](#LinkedTreeList) ⇐ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
788
|
-
* [new LinkedTreeList([linkerClass])](#new_LinkedTreeList_new)
|
|
789
|
-
* [.classType](#LinkedTreeList+classType)
|
|
790
|
-
* [.innerList](#LinkedTreeList+innerList)
|
|
791
|
-
* [.initialized](#LinkedTreeList+initialized)
|
|
792
|
-
* [.list](#LinkedTreeList+list) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
793
|
-
* [.first](#LinkedTreeList+first) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
794
|
-
* [.last](#LinkedTreeList+last) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
795
|
-
* [.length](#LinkedTreeList+length) ⇒ <code>number</code>
|
|
796
|
-
* [.parent](#LinkedTreeList+parent) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
797
|
-
* [.parent](#LinkedTreeList+parent)
|
|
798
|
-
* [.rootParent](#LinkedTreeList+rootParent) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
799
|
-
* [.initialize(initialList)](#LinkedTreeList+initialize) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
800
|
-
* [.setChildren(item, children)](#LinkedTreeList+setChildren)
|
|
801
|
-
* [.insertAfter(node, newNode)](#LinkedTreeList+insertAfter) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
802
|
-
* [.insertBefore(node, newNode)](#LinkedTreeList+insertBefore) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
803
|
-
* [.append(node, after)](#LinkedTreeList+append) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
804
|
-
* [.prepend(node, before)](#LinkedTreeList+prepend) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
805
|
-
* [.remove(node)](#LinkedTreeList+remove) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
806
|
-
* [.reset()](#LinkedTreeList+reset) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
807
|
-
* [.item(index)](#LinkedTreeList+item) ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
|
|
808
|
-
* [.forEach(callback, thisArg)](#LinkedTreeList+forEach) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
809
|
-
|
|
810
|
-
<a name="new_LinkedTreeList_new"></a>
|
|
811
|
-
|
|
812
|
-
### new LinkedTreeList([linkerClass])
|
|
813
|
-
Create the new LinkedTreeList instance, configure the list class.
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
| Param | Type | Default | Description |
|
|
817
|
-
| --- | --- | --- | --- |
|
|
818
|
-
| [linkerClass] | [<code>TreeLinker</code>](#TreeLinker) | <code>TreeLinker</code> | The class used to wrap given data as tree linkers. |
|
|
819
|
-
|
|
820
|
-
<a name="LinkedTreeList+classType"></a>
|
|
821
|
-
|
|
822
|
-
### linkedTreeList.classType
|
|
823
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
824
|
-
|
|
825
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
826
|
-
**Overrides**: [<code>classType</code>](#DoublyLinkedList+classType)
|
|
827
|
-
<a name="LinkedTreeList+innerList"></a>
|
|
828
|
-
|
|
829
|
-
### linkedTreeList.innerList
|
|
830
|
-
A linker of the list (null when the list is empty); the head is found by walking back from it.
|
|
831
|
-
|
|
832
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
833
|
-
**Overrides**: [<code>innerList</code>](#DoublyLinkedList+innerList)
|
|
834
|
-
<a name="LinkedTreeList+initialized"></a>
|
|
835
|
-
|
|
836
|
-
### linkedTreeList.initialized
|
|
837
|
-
Whether the inner list has been initialized (it can only be initialized once).
|
|
838
|
-
|
|
839
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
840
|
-
**Overrides**: [<code>initialized</code>](#DoublyLinkedList+initialized)
|
|
841
|
-
<a name="LinkedTreeList+list"></a>
|
|
842
|
-
|
|
843
|
-
### linkedTreeList.list ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
844
|
-
Retrieve a copy of the innerList used.
|
|
845
|
-
|
|
846
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
847
|
-
**Overrides**: [<code>list</code>](#DoublyLinkedList+list)
|
|
848
|
-
<a name="LinkedTreeList+first"></a>
|
|
849
|
-
|
|
850
|
-
### linkedTreeList.first ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
851
|
-
Retrieve the first TreeLinker in the list.
|
|
852
|
-
|
|
853
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
854
|
-
**Overrides**: [<code>first</code>](#DoublyLinkedList+first)
|
|
855
|
-
<a name="LinkedTreeList+last"></a>
|
|
856
|
-
|
|
857
|
-
### linkedTreeList.last ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
858
|
-
Retrieve the last TreeLinker in the list.
|
|
859
|
-
|
|
860
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
861
|
-
**Overrides**: [<code>last</code>](#DoublyLinkedList+last)
|
|
862
|
-
<a name="LinkedTreeList+length"></a>
|
|
863
|
-
|
|
864
|
-
### linkedTreeList.length ⇒ <code>number</code>
|
|
865
|
-
Return the length of the list.
|
|
866
|
-
|
|
867
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
868
|
-
**Overrides**: [<code>length</code>](#DoublyLinkedList+length)
|
|
869
|
-
<a name="LinkedTreeList+parent"></a>
|
|
870
|
-
|
|
871
|
-
### linkedTreeList.parent ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
872
|
-
Get the parent of this tree list.
|
|
873
|
-
|
|
874
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
875
|
-
<a name="LinkedTreeList+parent"></a>
|
|
876
|
-
|
|
877
|
-
### linkedTreeList.parent
|
|
878
|
-
Set the parent of this tree list
|
|
879
|
-
|
|
880
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
881
|
-
|
|
882
|
-
| Param | Type | Description |
|
|
883
|
-
| --- | --- | --- |
|
|
884
|
-
| parent | [<code>TreeLinker</code>](#TreeLinker) | The new node to use as the parent for this group of children |
|
|
885
|
-
|
|
886
|
-
<a name="LinkedTreeList+rootParent"></a>
|
|
887
|
-
|
|
888
|
-
### linkedTreeList.rootParent ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
889
|
-
Return the root parent of the entire tree.
|
|
890
|
-
|
|
891
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
892
|
-
<a name="LinkedTreeList+initialize"></a>
|
|
893
|
-
|
|
894
|
-
### linkedTreeList.initialize(initialList) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
895
|
-
Initialize the inner list, should only run once.
|
|
896
|
-
|
|
897
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
898
|
-
**Overrides**: [<code>initialize</code>](#DoublyLinkedList+initialize)
|
|
899
|
-
|
|
900
|
-
| Param | Type | Description |
|
|
901
|
-
| --- | --- | --- |
|
|
902
|
-
| initialList | [<code>TreeLinker</code>](#TreeLinker) | Give the list of tree-linkers to start in this linked-tree-list. |
|
|
903
|
-
|
|
904
|
-
<a name="LinkedTreeList+setChildren"></a>
|
|
905
|
-
|
|
906
|
-
### linkedTreeList.setChildren(item, children)
|
|
907
|
-
Set the children on a parent item.
|
|
908
|
-
|
|
909
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
910
|
-
|
|
911
|
-
| Param | Type | Default | Description |
|
|
912
|
-
| --- | --- | --- | --- |
|
|
913
|
-
| item | [<code>TreeLinker</code>](#TreeLinker) | | The TreeLinker node that will be the parent of the children |
|
|
914
|
-
| children | [<code>LinkedTreeList</code>](#LinkedTreeList) | <code></code> | The LinkedTreeList which has the child nodes to use |
|
|
915
|
-
|
|
916
|
-
<a name="LinkedTreeList+insertAfter"></a>
|
|
917
|
-
|
|
918
|
-
### linkedTreeList.insertAfter(node, newNode) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
919
|
-
Insert a new node (or data) after a node.
|
|
920
|
-
|
|
921
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
922
|
-
**Overrides**: [<code>insertAfter</code>](#DoublyLinkedList+insertAfter)
|
|
923
|
-
|
|
924
|
-
| Param | Type | Description |
|
|
925
|
-
| --- | --- | --- |
|
|
926
|
-
| node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The existing node as reference |
|
|
927
|
-
| newNode | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to go after the existing node |
|
|
928
|
-
|
|
929
|
-
<a name="LinkedTreeList+insertBefore"></a>
|
|
930
|
-
|
|
931
|
-
### linkedTreeList.insertBefore(node, newNode) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
932
|
-
Insert a new node (or data) before a node.
|
|
933
|
-
|
|
934
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
935
|
-
**Overrides**: [<code>insertBefore</code>](#DoublyLinkedList+insertBefore)
|
|
936
|
-
|
|
937
|
-
| Param | Type | Description |
|
|
938
|
-
| --- | --- | --- |
|
|
939
|
-
| node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The existing node as reference |
|
|
940
|
-
| newNode | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to go before the existing node |
|
|
941
|
-
|
|
942
|
-
<a name="LinkedTreeList+append"></a>
|
|
943
|
-
|
|
944
|
-
### linkedTreeList.append(node, after) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
945
|
-
Add a node (or data) after the given (or last) node in the list.
|
|
946
|
-
|
|
947
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
948
|
-
**Overrides**: [<code>append</code>](#DoublyLinkedList+append)
|
|
949
|
-
|
|
950
|
-
| Param | Type | Description |
|
|
951
|
-
| --- | --- | --- |
|
|
952
|
-
| node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to add to the end of the list |
|
|
953
|
-
| after | [<code>TreeLinker</code>](#TreeLinker) | The existing last node |
|
|
954
|
-
|
|
955
|
-
<a name="LinkedTreeList+prepend"></a>
|
|
956
|
-
|
|
957
|
-
### linkedTreeList.prepend(node, before) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
958
|
-
Add a node (or data) before the given (or first) node in the list.
|
|
959
|
-
|
|
960
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
961
|
-
**Overrides**: [<code>prepend</code>](#DoublyLinkedList+prepend)
|
|
962
|
-
|
|
963
|
-
| Param | Type | Description |
|
|
964
|
-
| --- | --- | --- |
|
|
965
|
-
| node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to add to the start of the list |
|
|
966
|
-
| before | [<code>TreeLinker</code>](#TreeLinker) | The existing first node |
|
|
967
|
-
|
|
968
|
-
<a name="LinkedTreeList+remove"></a>
|
|
969
|
-
|
|
970
|
-
### linkedTreeList.remove(node) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
971
|
-
Remove a linker from this linked list.
|
|
972
|
-
|
|
973
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
974
|
-
**Overrides**: [<code>remove</code>](#DoublyLinkedList+remove)
|
|
975
|
-
|
|
976
|
-
| Param | Type | Description |
|
|
977
|
-
| --- | --- | --- |
|
|
978
|
-
| node | [<code>TreeLinker</code>](#TreeLinker) | The node we wish to remove (and it will be returned after removal) |
|
|
979
|
-
|
|
980
|
-
<a name="LinkedTreeList+reset"></a>
|
|
981
|
-
|
|
982
|
-
### linkedTreeList.reset() ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
983
|
-
Refresh all references and return head reference.
|
|
984
|
-
|
|
985
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
986
|
-
**Overrides**: [<code>reset</code>](#DoublyLinkedList+reset)
|
|
987
|
-
<a name="LinkedTreeList+item"></a>
|
|
988
|
-
|
|
989
|
-
### linkedTreeList.item(index) ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
|
|
990
|
-
Retrieve a TreeLinker item from this list by numeric index, otherwise return null.
|
|
991
|
-
|
|
992
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
993
|
-
**Overrides**: [<code>item</code>](#DoublyLinkedList+item)
|
|
994
|
-
|
|
995
|
-
| Param | Type | Description |
|
|
996
|
-
| --- | --- | --- |
|
|
997
|
-
| index | <code>number</code> | The integer number for retrieving a node by position. |
|
|
998
|
-
|
|
999
|
-
<a name="LinkedTreeList+forEach"></a>
|
|
1000
|
-
|
|
1001
|
-
### linkedTreeList.forEach(callback, thisArg) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
1002
|
-
Be able to run forEach on this LinkedTreeList to iterate over the TreeLinker Items.
|
|
1003
|
-
|
|
1004
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
1005
|
-
**Overrides**: [<code>forEach</code>](#DoublyLinkedList+forEach)
|
|
1006
|
-
**Returns**: [<code>LinkedTreeList</code>](#LinkedTreeList) - The list which was iterated.
|
|
1007
|
-
|
|
1008
|
-
| Param | Type | Description |
|
|
1009
|
-
| --- | --- | --- |
|
|
1010
|
-
| callback | <code>forEachCallback</code> | The function to call for-each tree node |
|
|
1011
|
-
| thisArg | [<code>LinkedTreeList</code>](#LinkedTreeList) | Optional, 'this' reference |
|
|
1012
|
-
|
|
1013
|
-
<a name="Linker"></a>
|
|
1014
|
-
|
|
1015
|
-
## Linker ⇐ [<code>ArrayElement</code>](#ArrayElement)
|
|
1016
|
-
Linker represents a node in a LinkedList.
|
|
1017
|
-
|
|
1018
|
-
**Kind**: global class
|
|
1019
|
-
**Extends**: [<code>ArrayElement</code>](#ArrayElement)
|
|
1020
|
-
|
|
1021
|
-
* [Linker](#Linker) ⇐ [<code>ArrayElement</code>](#ArrayElement)
|
|
1022
|
-
* [new Linker([nodeData])](#new_Linker_new)
|
|
1023
|
-
* _instance_
|
|
1024
|
-
* [.classType](#Linker+classType)
|
|
1025
|
-
* [.data](#Linker+data)
|
|
1026
|
-
* [.next](#Linker+next)
|
|
1027
|
-
* _static_
|
|
1028
|
-
* [.fromArray([values], [classType])](#Linker.fromArray) ⇒ <code>Object</code>
|
|
1029
|
-
|
|
1030
|
-
<a name="new_Linker_new"></a>
|
|
1031
|
-
|
|
1032
|
-
### new Linker([nodeData])
|
|
1033
|
-
Create the new Linker instance, provide the data and optionally give the next Linker.
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
| Param | Type | Default | Description |
|
|
1037
|
-
| --- | --- | --- | --- |
|
|
1038
|
-
| [nodeData] | <code>Object</code> | <code>{}</code> | The settings for the new linker. |
|
|
1039
|
-
| [nodeData.data] | <code>\*</code> | <code></code> | The data to be stored in this linker |
|
|
1040
|
-
| [nodeData.next] | [<code>Linker</code>](#Linker) \| <code>null</code> | <code></code> | The reference to the next linker if any |
|
|
1041
|
-
|
|
1042
|
-
<a name="Linker+classType"></a>
|
|
1043
|
-
|
|
1044
|
-
### linker.classType
|
|
1045
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
1046
|
-
|
|
1047
|
-
**Kind**: instance property of [<code>Linker</code>](#Linker)
|
|
1048
|
-
**Overrides**: [<code>classType</code>](#ArrayElement+classType)
|
|
1049
|
-
<a name="Linker+data"></a>
|
|
1050
|
-
|
|
1051
|
-
### linker.data
|
|
1052
|
-
The data stored in this linker.
|
|
1053
|
-
|
|
1054
|
-
**Kind**: instance property of [<code>Linker</code>](#Linker)
|
|
1055
|
-
**Overrides**: [<code>data</code>](#ArrayElement+data)
|
|
1056
|
-
<a name="Linker+next"></a>
|
|
1057
|
-
|
|
1058
|
-
### linker.next
|
|
1059
|
-
The linker after this one, or null when this is the last.
|
|
1060
|
-
|
|
1061
|
-
**Kind**: instance property of [<code>Linker</code>](#Linker)
|
|
1062
|
-
<a name="Linker.fromArray"></a>
|
|
1063
|
-
|
|
1064
|
-
### Linker.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
1065
|
-
Convert an array into Linker instances, return the head and tail Linkers.
|
|
1066
|
-
|
|
1067
|
-
**Kind**: static method of [<code>Linker</code>](#Linker)
|
|
1068
|
-
|
|
1069
|
-
| Param | Type | Default | Description |
|
|
1070
|
-
| --- | --- | --- | --- |
|
|
1071
|
-
| [values] | <code>Array</code> | <code>[]</code> | Provide an array of data that will be converted to a chain of linkers. |
|
|
1072
|
-
| [classType] | <code>IsLinker</code> | <code>Linker</code> | Provide the type of IsLinker to use. |
|
|
1073
|
-
|
|
1074
|
-
<a name="LinkedList"></a>
|
|
1075
|
-
|
|
1076
|
-
## LinkedList ⇐ [<code>Arrayable</code>](#Arrayable)
|
|
1077
|
-
LinkedList represents a collection stored as a LinkedList with next references.
|
|
1078
|
-
|
|
1079
|
-
**Kind**: global class
|
|
1080
|
-
**Extends**: [<code>Arrayable</code>](#Arrayable)
|
|
1081
|
-
|
|
1082
|
-
* [LinkedList](#LinkedList) ⇐ [<code>Arrayable</code>](#Arrayable)
|
|
1083
|
-
* [new LinkedList([linkerClass])](#new_LinkedList_new)
|
|
1084
|
-
* [.classType](#LinkedList+classType)
|
|
1085
|
-
* [.innerList](#LinkedList+innerList)
|
|
1086
|
-
* [.initialized](#LinkedList+initialized)
|
|
1087
|
-
* [.list](#LinkedList+list) ⇒ [<code>Linker</code>](#Linker)
|
|
1088
|
-
* [.first](#LinkedList+first) ⇒ [<code>Linker</code>](#Linker)
|
|
1089
|
-
* [.last](#LinkedList+last) ⇒ [<code>Linker</code>](#Linker)
|
|
1090
|
-
* [.length](#LinkedList+length) ⇒ <code>number</code>
|
|
1091
|
-
* [.initialize(initialList)](#LinkedList+initialize) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
1092
|
-
* [.insertAfter(node, newNode)](#LinkedList+insertAfter) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
1093
|
-
* [.insertBefore(node, newNode)](#LinkedList+insertBefore) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
1094
|
-
* [.append(node, after)](#LinkedList+append) ⇒ [<code>Linker</code>](#Linker)
|
|
1095
|
-
* [.prepend(node, before)](#LinkedList+prepend) ⇒ [<code>Linker</code>](#Linker)
|
|
1096
|
-
* [.remove(node)](#LinkedList+remove) ⇒ [<code>Linker</code>](#Linker)
|
|
1097
|
-
* [.item(index)](#LinkedList+item) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
|
|
1098
|
-
* [.forEach(callback, thisArg)](#LinkedList+forEach) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
1099
|
-
|
|
1100
|
-
<a name="new_LinkedList_new"></a>
|
|
1101
|
-
|
|
1102
|
-
### new LinkedList([linkerClass])
|
|
1103
|
-
Create the new LinkedList instance.
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
| Param | Type | Default | Description |
|
|
1107
|
-
| --- | --- | --- | --- |
|
|
1108
|
-
| [linkerClass] | [<code>Linker</code>](#Linker) | <code>Linker</code> | The class used to wrap given data as linkers. |
|
|
1109
|
-
|
|
1110
|
-
<a name="LinkedList+classType"></a>
|
|
1111
|
-
|
|
1112
|
-
### linkedList.classType
|
|
1113
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
1114
|
-
|
|
1115
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
1116
|
-
**Overrides**: [<code>classType</code>](#Arrayable+classType)
|
|
1117
|
-
<a name="LinkedList+innerList"></a>
|
|
1118
|
-
|
|
1119
|
-
### linkedList.innerList
|
|
1120
|
-
The first linker of the list (null when the list is empty), from which the whole list is reached.
|
|
1121
|
-
|
|
1122
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
1123
|
-
**Overrides**: [<code>innerList</code>](#Arrayable+innerList)
|
|
1124
|
-
<a name="LinkedList+initialized"></a>
|
|
1125
|
-
|
|
1126
|
-
### linkedList.initialized
|
|
1127
|
-
Whether the inner list has been initialized (it can only be initialized once).
|
|
1128
|
-
|
|
1129
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
1130
|
-
**Overrides**: [<code>initialized</code>](#Arrayable+initialized)
|
|
1131
|
-
<a name="LinkedList+list"></a>
|
|
1132
|
-
|
|
1133
|
-
### linkedList.list ⇒ [<code>Linker</code>](#Linker)
|
|
1134
|
-
Retrieve a copy of the innerList used.
|
|
1135
|
-
|
|
1136
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
1137
|
-
**Overrides**: [<code>list</code>](#Arrayable+list)
|
|
1138
|
-
<a name="LinkedList+first"></a>
|
|
1139
|
-
|
|
1140
|
-
### linkedList.first ⇒ [<code>Linker</code>](#Linker)
|
|
1141
|
-
Retrieve the first Linker in the list.
|
|
1142
|
-
|
|
1143
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
1144
|
-
**Overrides**: [<code>first</code>](#Arrayable+first)
|
|
1145
|
-
<a name="LinkedList+last"></a>
|
|
1146
|
-
|
|
1147
|
-
### linkedList.last ⇒ [<code>Linker</code>](#Linker)
|
|
1148
|
-
Retrieve the last Linker in the list.
|
|
1149
|
-
|
|
1150
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
1151
|
-
**Overrides**: [<code>last</code>](#Arrayable+last)
|
|
1152
|
-
<a name="LinkedList+length"></a>
|
|
1153
|
-
|
|
1154
|
-
### linkedList.length ⇒ <code>number</code>
|
|
1155
|
-
Return the length of the list.
|
|
1156
|
-
|
|
1157
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
1158
|
-
**Overrides**: [<code>length</code>](#Arrayable+length)
|
|
1159
|
-
<a name="LinkedList+initialize"></a>
|
|
1160
|
-
|
|
1161
|
-
### linkedList.initialize(initialList) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
1162
|
-
Initialize the inner list, should only run once.
|
|
1163
|
-
|
|
1164
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1165
|
-
**Overrides**: [<code>initialize</code>](#Arrayable+initialize)
|
|
1166
|
-
|
|
1167
|
-
| Param | Type | Description |
|
|
1168
|
-
| --- | --- | --- |
|
|
1169
|
-
| initialList | [<code>Linker</code>](#Linker) \| <code>Array</code> | Give the list of linkers to start in this linked-list. |
|
|
1170
|
-
|
|
1171
|
-
<a name="LinkedList+insertAfter"></a>
|
|
1172
|
-
|
|
1173
|
-
### linkedList.insertAfter(node, newNode) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
1174
|
-
Insert a new node (or data) after a node.
|
|
1175
|
-
|
|
1176
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1177
|
-
**Overrides**: [<code>insertAfter</code>](#Arrayable+insertAfter)
|
|
1178
|
-
|
|
1179
|
-
| Param | Type | Description |
|
|
1180
|
-
| --- | --- | --- |
|
|
1181
|
-
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The existing node as reference |
|
|
1182
|
-
| newNode | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to go after the existing node |
|
|
1183
|
-
|
|
1184
|
-
<a name="LinkedList+insertBefore"></a>
|
|
1185
|
-
|
|
1186
|
-
### linkedList.insertBefore(node, newNode) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
1187
|
-
Insert a new node (or data) before a node.
|
|
1188
|
-
|
|
1189
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1190
|
-
**Overrides**: [<code>insertBefore</code>](#Arrayable+insertBefore)
|
|
1191
|
-
|
|
1192
|
-
| Param | Type | Description |
|
|
1193
|
-
| --- | --- | --- |
|
|
1194
|
-
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The existing node as reference |
|
|
1195
|
-
| newNode | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to go before the existing node |
|
|
1196
|
-
|
|
1197
|
-
<a name="LinkedList+append"></a>
|
|
1198
|
-
|
|
1199
|
-
### linkedList.append(node, after) ⇒ [<code>Linker</code>](#Linker)
|
|
1200
|
-
Add a node (or data) after the given (or last) node in the list.
|
|
1201
|
-
|
|
1202
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1203
|
-
**Overrides**: [<code>append</code>](#Arrayable+append)
|
|
1204
|
-
|
|
1205
|
-
| Param | Type | Description |
|
|
1206
|
-
| --- | --- | --- |
|
|
1207
|
-
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to add to the end of the list |
|
|
1208
|
-
| after | [<code>Linker</code>](#Linker) | The existing last node |
|
|
1209
|
-
|
|
1210
|
-
<a name="LinkedList+prepend"></a>
|
|
1211
|
-
|
|
1212
|
-
### linkedList.prepend(node, before) ⇒ [<code>Linker</code>](#Linker)
|
|
1213
|
-
Add a node (or data) before the given (or first) node in the list.
|
|
1214
|
-
|
|
1215
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1216
|
-
**Overrides**: [<code>prepend</code>](#Arrayable+prepend)
|
|
1217
|
-
|
|
1218
|
-
| Param | Type | Description |
|
|
1219
|
-
| --- | --- | --- |
|
|
1220
|
-
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to add to the start of the list |
|
|
1221
|
-
| before | [<code>Linker</code>](#Linker) | The existing first node |
|
|
1222
|
-
|
|
1223
|
-
<a name="LinkedList+remove"></a>
|
|
1224
|
-
|
|
1225
|
-
### linkedList.remove(node) ⇒ [<code>Linker</code>](#Linker)
|
|
1226
|
-
Remove a linker from this linked list.
|
|
1227
|
-
|
|
1228
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1229
|
-
**Overrides**: [<code>remove</code>](#Arrayable+remove)
|
|
1230
|
-
|
|
1231
|
-
| Param | Type | Description |
|
|
1232
|
-
| --- | --- | --- |
|
|
1233
|
-
| node | [<code>Linker</code>](#Linker) | The node we wish to remove (and it will be returned after removal) |
|
|
1234
|
-
|
|
1235
|
-
<a name="LinkedList+item"></a>
|
|
1236
|
-
|
|
1237
|
-
### linkedList.item(index) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
|
|
1238
|
-
Retrieve a Linker item from this list by numeric index, otherwise return null.
|
|
1239
|
-
|
|
1240
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1241
|
-
**Overrides**: [<code>item</code>](#Arrayable+item)
|
|
1242
|
-
|
|
1243
|
-
| Param | Type | Description |
|
|
1244
|
-
| --- | --- | --- |
|
|
1245
|
-
| index | <code>number</code> | The integer number for retrieving a node by position. |
|
|
1246
|
-
|
|
1247
|
-
<a name="LinkedList+forEach"></a>
|
|
1248
|
-
|
|
1249
|
-
### linkedList.forEach(callback, thisArg) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
1250
|
-
Be able to run forEach on this LinkedList to iterate over the linkers.
|
|
1251
|
-
|
|
1252
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1253
|
-
**Overrides**: [<code>forEach</code>](#Arrayable+forEach)
|
|
1254
|
-
|
|
1255
|
-
| Param | Type | Description |
|
|
1256
|
-
| --- | --- | --- |
|
|
1257
|
-
| callback | <code>forEachCallback</code> | The function to call for-each linker |
|
|
1258
|
-
| thisArg | [<code>LinkedList</code>](#LinkedList) | Optional, 'this' reference |
|
|
1259
|
-
|
|
1260
|
-
<a name="DoublyLinkedList"></a>
|
|
1261
|
-
|
|
1262
|
-
## DoublyLinkedList ⇐ [<code>LinkedList</code>](#LinkedList)
|
|
1263
|
-
DoublyLinkedList represents a collection stored as a LinkedList with prev and next references.
|
|
1264
|
-
|
|
1265
|
-
**Kind**: global class
|
|
1266
|
-
**Extends**: [<code>LinkedList</code>](#LinkedList)
|
|
1267
|
-
|
|
1268
|
-
* [DoublyLinkedList](#DoublyLinkedList) ⇐ [<code>LinkedList</code>](#LinkedList)
|
|
1269
|
-
* [new DoublyLinkedList([linkerClass])](#new_DoublyLinkedList_new)
|
|
1270
|
-
* [.classType](#DoublyLinkedList+classType)
|
|
1271
|
-
* [.innerList](#DoublyLinkedList+innerList)
|
|
1272
|
-
* [.initialized](#DoublyLinkedList+initialized)
|
|
1273
|
-
* [.list](#DoublyLinkedList+list) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1274
|
-
* [.first](#DoublyLinkedList+first) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1275
|
-
* [.last](#DoublyLinkedList+last) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1276
|
-
* [.length](#DoublyLinkedList+length) ⇒ <code>number</code>
|
|
1277
|
-
* [.initialize(initialList)](#DoublyLinkedList+initialize) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1278
|
-
* [.insertAfter(node, newNode)](#DoublyLinkedList+insertAfter) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1279
|
-
* [.insertBefore(node, newNode)](#DoublyLinkedList+insertBefore) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1280
|
-
* [.append(node, after)](#DoublyLinkedList+append) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1281
|
-
* [.prepend(node, before)](#DoublyLinkedList+prepend) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1282
|
-
* [.remove(node)](#DoublyLinkedList+remove) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1283
|
-
* [.reset()](#DoublyLinkedList+reset) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1284
|
-
* [.item(index)](#DoublyLinkedList+item) ⇒ [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code>
|
|
1285
|
-
* [.forEach(callback, thisArg)](#DoublyLinkedList+forEach) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1286
|
-
|
|
1287
|
-
<a name="new_DoublyLinkedList_new"></a>
|
|
1288
|
-
|
|
1289
|
-
### new DoublyLinkedList([linkerClass])
|
|
1290
|
-
Create the new DoublyLinkedList instance.
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
| Param | Type | Default | Description |
|
|
1294
|
-
| --- | --- | --- | --- |
|
|
1295
|
-
| [linkerClass] | [<code>DoubleLinker</code>](#DoubleLinker) | <code>DoubleLinker</code> | The class used to wrap given data as linkers. |
|
|
1296
|
-
|
|
1297
|
-
<a name="DoublyLinkedList+classType"></a>
|
|
1298
|
-
|
|
1299
|
-
### doublyLinkedList.classType
|
|
1300
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
1301
|
-
|
|
1302
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1303
|
-
**Overrides**: [<code>classType</code>](#LinkedList+classType)
|
|
1304
|
-
<a name="DoublyLinkedList+innerList"></a>
|
|
1305
|
-
|
|
1306
|
-
### doublyLinkedList.innerList
|
|
1307
|
-
A linker of the list (null when the list is empty); the head is found by walking back from it.
|
|
1308
|
-
|
|
1309
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1310
|
-
**Overrides**: [<code>innerList</code>](#LinkedList+innerList)
|
|
1311
|
-
<a name="DoublyLinkedList+initialized"></a>
|
|
1312
|
-
|
|
1313
|
-
### doublyLinkedList.initialized
|
|
1314
|
-
Whether the inner list has been initialized (it can only be initialized once).
|
|
1315
|
-
|
|
1316
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1317
|
-
**Overrides**: [<code>initialized</code>](#LinkedList+initialized)
|
|
1318
|
-
<a name="DoublyLinkedList+list"></a>
|
|
1319
|
-
|
|
1320
|
-
### doublyLinkedList.list ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1321
|
-
Retrieve a copy of the innerList used.
|
|
1322
|
-
|
|
1323
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1324
|
-
**Overrides**: [<code>list</code>](#LinkedList+list)
|
|
1325
|
-
<a name="DoublyLinkedList+first"></a>
|
|
1326
|
-
|
|
1327
|
-
### doublyLinkedList.first ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1328
|
-
Retrieve the first DoubleLinker in the list.
|
|
1329
|
-
|
|
1330
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1331
|
-
**Overrides**: [<code>first</code>](#LinkedList+first)
|
|
1332
|
-
<a name="DoublyLinkedList+last"></a>
|
|
1333
|
-
|
|
1334
|
-
### doublyLinkedList.last ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1335
|
-
Retrieve the last DoubleLinker in the list.
|
|
1336
|
-
|
|
1337
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1338
|
-
**Overrides**: [<code>last</code>](#LinkedList+last)
|
|
1339
|
-
<a name="DoublyLinkedList+length"></a>
|
|
1340
|
-
|
|
1341
|
-
### doublyLinkedList.length ⇒ <code>number</code>
|
|
1342
|
-
Return the length of the list.
|
|
1343
|
-
|
|
1344
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1345
|
-
**Overrides**: [<code>length</code>](#LinkedList+length)
|
|
1346
|
-
<a name="DoublyLinkedList+initialize"></a>
|
|
1347
|
-
|
|
1348
|
-
### doublyLinkedList.initialize(initialList) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1349
|
-
Initialize the inner list, should only run once.
|
|
1350
|
-
|
|
1351
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1352
|
-
**Overrides**: [<code>initialize</code>](#LinkedList+initialize)
|
|
1353
|
-
|
|
1354
|
-
| Param | Type | Description |
|
|
1355
|
-
| --- | --- | --- |
|
|
1356
|
-
| initialList | [<code>DoubleLinker</code>](#DoubleLinker) | Give the list of double-linkers to start in this doubly linked-list. |
|
|
1357
|
-
|
|
1358
|
-
<a name="DoublyLinkedList+insertAfter"></a>
|
|
1359
|
-
|
|
1360
|
-
### doublyLinkedList.insertAfter(node, newNode) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1361
|
-
Insert a new node (or data) after a node.
|
|
1362
|
-
|
|
1363
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1364
|
-
**Overrides**: [<code>insertAfter</code>](#LinkedList+insertAfter)
|
|
1365
|
-
|
|
1366
|
-
| Param | Type | Description |
|
|
1367
|
-
| --- | --- | --- |
|
|
1368
|
-
| node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The existing node as reference |
|
|
1369
|
-
| newNode | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to go after the existing node |
|
|
1370
|
-
|
|
1371
|
-
<a name="DoublyLinkedList+insertBefore"></a>
|
|
1372
|
-
|
|
1373
|
-
### doublyLinkedList.insertBefore(node, newNode) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1374
|
-
Insert a new node (or data) before a node.
|
|
1375
|
-
|
|
1376
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1377
|
-
**Overrides**: [<code>insertBefore</code>](#LinkedList+insertBefore)
|
|
1378
|
-
|
|
1379
|
-
| Param | Type | Description |
|
|
1380
|
-
| --- | --- | --- |
|
|
1381
|
-
| node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The existing node as reference |
|
|
1382
|
-
| newNode | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to go before the existing node |
|
|
1383
|
-
|
|
1384
|
-
<a name="DoublyLinkedList+append"></a>
|
|
1385
|
-
|
|
1386
|
-
### doublyLinkedList.append(node, after) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1387
|
-
Add a node (or data) after the given (or last) node in the list.
|
|
1388
|
-
|
|
1389
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1390
|
-
**Overrides**: [<code>append</code>](#LinkedList+append)
|
|
1391
|
-
|
|
1392
|
-
| Param | Type | Description |
|
|
1393
|
-
| --- | --- | --- |
|
|
1394
|
-
| node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to add to the end of the list |
|
|
1395
|
-
| after | [<code>DoubleLinker</code>](#DoubleLinker) | The existing last node |
|
|
1396
|
-
|
|
1397
|
-
<a name="DoublyLinkedList+prepend"></a>
|
|
1398
|
-
|
|
1399
|
-
### doublyLinkedList.prepend(node, before) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1400
|
-
Add a node (or data) before the given (or first) node in the list.
|
|
1401
|
-
|
|
1402
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1403
|
-
**Overrides**: [<code>prepend</code>](#LinkedList+prepend)
|
|
1404
|
-
|
|
1405
|
-
| Param | Type | Description |
|
|
1406
|
-
| --- | --- | --- |
|
|
1407
|
-
| node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to add to the start of the list |
|
|
1408
|
-
| before | [<code>DoubleLinker</code>](#DoubleLinker) | The existing first node |
|
|
1409
|
-
|
|
1410
|
-
<a name="DoublyLinkedList+remove"></a>
|
|
1411
|
-
|
|
1412
|
-
### doublyLinkedList.remove(node) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1413
|
-
Remove a linker from this linked list.
|
|
1414
|
-
|
|
1415
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1416
|
-
**Overrides**: [<code>remove</code>](#LinkedList+remove)
|
|
1417
|
-
|
|
1418
|
-
| Param | Type | Description |
|
|
1419
|
-
| --- | --- | --- |
|
|
1420
|
-
| node | [<code>DoubleLinker</code>](#DoubleLinker) | The node we wish to remove (and it will be returned after removal) |
|
|
1421
|
-
|
|
1422
|
-
<a name="DoublyLinkedList+reset"></a>
|
|
1423
|
-
|
|
1424
|
-
### doublyLinkedList.reset() ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1425
|
-
Refresh all references and return head reference.
|
|
1426
|
-
|
|
1427
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1428
|
-
<a name="DoublyLinkedList+item"></a>
|
|
1429
|
-
|
|
1430
|
-
### doublyLinkedList.item(index) ⇒ [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code>
|
|
1431
|
-
Retrieve a DoubleLinker item from this list by numeric index, otherwise return null.
|
|
1432
|
-
|
|
1433
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1434
|
-
**Overrides**: [<code>item</code>](#LinkedList+item)
|
|
1435
|
-
|
|
1436
|
-
| Param | Type | Description |
|
|
1437
|
-
| --- | --- | --- |
|
|
1438
|
-
| index | <code>number</code> | The integer number for retrieving a node by position. |
|
|
1439
|
-
|
|
1440
|
-
<a name="DoublyLinkedList+forEach"></a>
|
|
1441
|
-
|
|
1442
|
-
### doublyLinkedList.forEach(callback, thisArg) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1443
|
-
Be able to run forEach on this DoublyLinkedList to iterate over the DoubleLinker Items.
|
|
1444
|
-
|
|
1445
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1446
|
-
**Overrides**: [<code>forEach</code>](#LinkedList+forEach)
|
|
1447
|
-
**Returns**: [<code>DoublyLinkedList</code>](#DoublyLinkedList) - The list which was iterated.
|
|
1448
|
-
|
|
1449
|
-
| Param | Type | Description |
|
|
1450
|
-
| --- | --- | --- |
|
|
1451
|
-
| callback | <code>forEachCallback</code> | The function to call for-each double linker |
|
|
1452
|
-
| thisArg | [<code>DoublyLinkedList</code>](#DoublyLinkedList) | Optional, 'this' reference |
|
|
1453
|
-
|
|
1454
|
-
<a name="DoubleLinker"></a>
|
|
1455
|
-
|
|
1456
|
-
## DoubleLinker ⇐ [<code>Linker</code>](#Linker)
|
|
1457
|
-
DoubleLinker represents a node in a DoublyLinkedList which is chained by next and prev.
|
|
1458
|
-
|
|
1459
|
-
**Kind**: global class
|
|
1460
|
-
**Extends**: [<code>Linker</code>](#Linker)
|
|
1461
|
-
|
|
1462
|
-
* [DoubleLinker](#DoubleLinker) ⇐ [<code>Linker</code>](#Linker)
|
|
1463
|
-
* [new DoubleLinker([nodeData])](#new_DoubleLinker_new)
|
|
1464
|
-
* _instance_
|
|
1465
|
-
* [.classType](#DoubleLinker+classType)
|
|
1466
|
-
* [.data](#DoubleLinker+data)
|
|
1467
|
-
* [.next](#DoubleLinker+next)
|
|
1468
|
-
* [.prev](#DoubleLinker+prev)
|
|
1469
|
-
* _static_
|
|
1470
|
-
* [.fromArray([values], [classType])](#DoubleLinker.fromArray) ⇒ <code>Object</code>
|
|
1471
|
-
|
|
1472
|
-
<a name="new_DoubleLinker_new"></a>
|
|
1473
|
-
|
|
1474
|
-
### new DoubleLinker([nodeData])
|
|
1475
|
-
Create the new DoubleLinker instance, provide the data and optionally the next and prev references.
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
| Param | Type | Default | Description |
|
|
1479
|
-
| --- | --- | --- | --- |
|
|
1480
|
-
| [nodeData] | <code>Object</code> | <code>{}</code> | The settings for the new linker. |
|
|
1481
|
-
| [nodeData.data] | <code>\*</code> | <code></code> | The data to be stored in this linker |
|
|
1482
|
-
| [nodeData.next] | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code> | <code></code> | The reference to the next linker if any |
|
|
1483
|
-
| [nodeData.prev] | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code> | <code></code> | The reference to the previous linker if any |
|
|
1484
|
-
|
|
1485
|
-
<a name="DoubleLinker+classType"></a>
|
|
1486
|
-
|
|
1487
|
-
### doubleLinker.classType
|
|
1488
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
1489
|
-
|
|
1490
|
-
**Kind**: instance property of [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1491
|
-
**Overrides**: [<code>classType</code>](#Linker+classType)
|
|
1492
|
-
<a name="DoubleLinker+data"></a>
|
|
1493
|
-
|
|
1494
|
-
### doubleLinker.data
|
|
1495
|
-
The data stored in this linker.
|
|
1496
|
-
|
|
1497
|
-
**Kind**: instance property of [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1498
|
-
**Overrides**: [<code>data</code>](#Linker+data)
|
|
1499
|
-
<a name="DoubleLinker+next"></a>
|
|
1500
|
-
|
|
1501
|
-
### doubleLinker.next
|
|
1502
|
-
The linker after this one, or null when this is the last.
|
|
1503
|
-
|
|
1504
|
-
**Kind**: instance property of [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1505
|
-
**Overrides**: [<code>next</code>](#Linker+next)
|
|
1506
|
-
<a name="DoubleLinker+prev"></a>
|
|
1507
|
-
|
|
1508
|
-
### doubleLinker.prev
|
|
1509
|
-
The linker before this one, or null when this is the first.
|
|
1510
|
-
|
|
1511
|
-
**Kind**: instance property of [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1512
|
-
<a name="DoubleLinker.fromArray"></a>
|
|
1513
|
-
|
|
1514
|
-
### DoubleLinker.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
1515
|
-
Convert an array into DoubleLinker instances, return the head and tail DoubleLinkers.
|
|
1516
|
-
|
|
1517
|
-
**Kind**: static method of [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1518
|
-
|
|
1519
|
-
| Param | Type | Default | Description |
|
|
1520
|
-
| --- | --- | --- | --- |
|
|
1521
|
-
| [values] | <code>Array</code> | <code>[]</code> | Provide an array of data that will be converted to a chain of linkers. |
|
|
1522
|
-
| [classType] | <code>IsDoubleLinker</code> | <code>DoubleLinker</code> | Provide the type of IsDoubleLinker to use. |
|
|
1523
|
-
|
|
1524
|
-
<a name="Arrayable"></a>
|
|
1525
|
-
|
|
1526
|
-
## Arrayable
|
|
1527
|
-
Arrayable represents a collection stored as an array.
|
|
1528
|
-
|
|
1529
|
-
**Kind**: global class
|
|
1530
|
-
|
|
1531
|
-
* [Arrayable](#Arrayable)
|
|
1532
|
-
* [new Arrayable([elementClass])](#new_Arrayable_new)
|
|
1533
|
-
* [.classType](#Arrayable+classType)
|
|
1534
|
-
* [.innerList](#Arrayable+innerList)
|
|
1535
|
-
* [.initialized](#Arrayable+initialized)
|
|
1536
|
-
* [.list](#Arrayable+list) ⇒ [<code>Array.<ArrayElement></code>](#ArrayElement)
|
|
1537
|
-
* [.first](#Arrayable+first) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
1538
|
-
* [.last](#Arrayable+last) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
1539
|
-
* [.length](#Arrayable+length) ⇒ <code>number</code>
|
|
1540
|
-
* [.initialize(initialList)](#Arrayable+initialize) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1541
|
-
* [.insertAfter(node, newNode)](#Arrayable+insertAfter) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1542
|
-
* [.insertBefore(node, newNode)](#Arrayable+insertBefore) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1543
|
-
* [.append(node, after)](#Arrayable+append) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1544
|
-
* [.prepend(node, before)](#Arrayable+prepend) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1545
|
-
* [.remove(node)](#Arrayable+remove) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
1546
|
-
* [.item(index)](#Arrayable+item) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
|
|
1547
|
-
* [.forEach(callback, thisArg)](#Arrayable+forEach) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1548
|
-
|
|
1549
|
-
<a name="new_Arrayable_new"></a>
|
|
1550
|
-
|
|
1551
|
-
### new Arrayable([elementClass])
|
|
1552
|
-
Create the new Arrayable instance, configure the Arrayable class.
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
| Param | Type | Default | Description |
|
|
1556
|
-
| --- | --- | --- | --- |
|
|
1557
|
-
| [elementClass] | [<code>ArrayElement</code>](#ArrayElement) | <code>ArrayElement</code> | The class used to wrap given data as elements. |
|
|
1558
|
-
|
|
1559
|
-
<a name="Arrayable+classType"></a>
|
|
1560
|
-
|
|
1561
|
-
### arrayable.classType
|
|
1562
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
1563
|
-
|
|
1564
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
1565
|
-
<a name="Arrayable+innerList"></a>
|
|
1566
|
-
|
|
1567
|
-
### arrayable.innerList
|
|
1568
|
-
The array which stores the elements of this Arrayable.
|
|
1569
|
-
|
|
1570
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
1571
|
-
<a name="Arrayable+initialized"></a>
|
|
1572
|
-
|
|
1573
|
-
### arrayable.initialized
|
|
1574
|
-
Whether the inner list has been initialized (it can only be initialized once).
|
|
1575
|
-
|
|
1576
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
1577
|
-
<a name="Arrayable+list"></a>
|
|
1578
|
-
|
|
1579
|
-
### arrayable.list ⇒ [<code>Array.<ArrayElement></code>](#ArrayElement)
|
|
1580
|
-
Retrieve a copy of the innerList used.
|
|
1581
|
-
|
|
1582
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
1583
|
-
<a name="Arrayable+first"></a>
|
|
1584
|
-
|
|
1585
|
-
### arrayable.first ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
1586
|
-
Retrieve the first Element from the Arrayable
|
|
1587
|
-
|
|
1588
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
1589
|
-
<a name="Arrayable+last"></a>
|
|
1590
|
-
|
|
1591
|
-
### arrayable.last ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
1592
|
-
Retrieve the last Element from the Arrayable
|
|
1593
|
-
|
|
1594
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
1595
|
-
<a name="Arrayable+length"></a>
|
|
1596
|
-
|
|
1597
|
-
### arrayable.length ⇒ <code>number</code>
|
|
1598
|
-
Return the length of the list.
|
|
1599
|
-
|
|
1600
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
1601
|
-
<a name="Arrayable+initialize"></a>
|
|
1602
|
-
|
|
1603
|
-
### arrayable.initialize(initialList) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1604
|
-
Initialize the inner list, should only run once.
|
|
1605
|
-
|
|
1606
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1607
|
-
|
|
1608
|
-
| Param | Type | Description |
|
|
1609
|
-
| --- | --- | --- |
|
|
1610
|
-
| initialList | [<code>Array.<ArrayElement></code>](#ArrayElement) | Give the array of elements to start in this Arrayable. |
|
|
1611
|
-
|
|
1612
|
-
<a name="Arrayable+insertAfter"></a>
|
|
1613
|
-
|
|
1614
|
-
### arrayable.insertAfter(node, newNode) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1615
|
-
Insert a new node (or data) after a node.
|
|
1616
|
-
|
|
1617
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1618
|
-
|
|
1619
|
-
| Param | Type | Description |
|
|
1620
|
-
| --- | --- | --- |
|
|
1621
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The existing node as reference |
|
|
1622
|
-
| newNode | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to go after the existing node |
|
|
1623
|
-
|
|
1624
|
-
<a name="Arrayable+insertBefore"></a>
|
|
1625
|
-
|
|
1626
|
-
### arrayable.insertBefore(node, newNode) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1627
|
-
Insert a new node (or data) before a node.
|
|
1628
|
-
|
|
1629
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1630
|
-
|
|
1631
|
-
| Param | Type | Description |
|
|
1632
|
-
| --- | --- | --- |
|
|
1633
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The existing node as reference |
|
|
1634
|
-
| newNode | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to go before the existing node |
|
|
1635
|
-
|
|
1636
|
-
<a name="Arrayable+append"></a>
|
|
1637
|
-
|
|
1638
|
-
### arrayable.append(node, after) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1639
|
-
Add a node (or data) after the given (or last) node in the list.
|
|
1640
|
-
|
|
1641
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1642
|
-
|
|
1643
|
-
| Param | Type | Description |
|
|
1644
|
-
| --- | --- | --- |
|
|
1645
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to add to the end of the list |
|
|
1646
|
-
| after | [<code>ArrayElement</code>](#ArrayElement) | The existing last node |
|
|
1647
|
-
|
|
1648
|
-
<a name="Arrayable+prepend"></a>
|
|
1649
|
-
|
|
1650
|
-
### arrayable.prepend(node, before) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1651
|
-
Add a node (or data) before the given (or first) node in the list.
|
|
1652
|
-
|
|
1653
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1654
|
-
|
|
1655
|
-
| Param | Type | Description |
|
|
1656
|
-
| --- | --- | --- |
|
|
1657
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to add to the start of the list |
|
|
1658
|
-
| before | [<code>ArrayElement</code>](#ArrayElement) | The existing first node |
|
|
1659
|
-
|
|
1660
|
-
<a name="Arrayable+remove"></a>
|
|
1661
|
-
|
|
1662
|
-
### arrayable.remove(node) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
1663
|
-
Remove an element from this arrayable.
|
|
1664
|
-
|
|
1665
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1666
|
-
|
|
1667
|
-
| Param | Type | Description |
|
|
1668
|
-
| --- | --- | --- |
|
|
1669
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) | The node we wish to remove (and it will be returned after removal) |
|
|
1670
|
-
|
|
1671
|
-
<a name="Arrayable+item"></a>
|
|
1672
|
-
|
|
1673
|
-
### arrayable.item(index) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
|
|
1674
|
-
Retrieve an ArrayElement item from this list by numeric index, otherwise return null.
|
|
1675
|
-
|
|
1676
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1677
|
-
|
|
1678
|
-
| Param | Type | Description |
|
|
1679
|
-
| --- | --- | --- |
|
|
1680
|
-
| index | <code>number</code> | The integer number for retrieving a node by position. |
|
|
1681
|
-
|
|
1682
|
-
<a name="Arrayable+forEach"></a>
|
|
1683
|
-
|
|
1684
|
-
### arrayable.forEach(callback, thisArg) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1685
|
-
Be able to run forEach on this Arrayable to iterate over the elements.
|
|
1686
|
-
|
|
1687
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1688
|
-
|
|
1689
|
-
| Param | Type | Description |
|
|
1690
|
-
| --- | --- | --- |
|
|
1691
|
-
| callback | <code>forEachCallback</code> | The function to call for-each element |
|
|
1692
|
-
| thisArg | [<code>Arrayable</code>](#Arrayable) | Optional, 'this' reference |
|
|
1693
|
-
|
|
1694
|
-
<a name="ArrayElement"></a>
|
|
1695
|
-
|
|
1696
|
-
## ArrayElement
|
|
1697
|
-
Element represents a node in an Arrayable.
|
|
1698
|
-
|
|
1699
|
-
**Kind**: global class
|
|
1700
|
-
|
|
1701
|
-
* [ArrayElement](#ArrayElement)
|
|
1702
|
-
* [new ArrayElement([data])](#new_ArrayElement_new)
|
|
1703
|
-
* _instance_
|
|
1704
|
-
* [.classType](#ArrayElement+classType)
|
|
1705
|
-
* [.data](#ArrayElement+data)
|
|
1706
|
-
* _static_
|
|
1707
|
-
* [.fromArray([values], [classType])](#ArrayElement.fromArray) ⇒ <code>Object</code>
|
|
1708
|
-
|
|
1709
|
-
<a name="new_ArrayElement_new"></a>
|
|
1710
|
-
|
|
1711
|
-
### new ArrayElement([data])
|
|
1712
|
-
Create the new Element instance, provide the data and optionally configure the type of Element.
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
| Param | Type | Default | Description |
|
|
1716
|
-
| --- | --- | --- | --- |
|
|
1717
|
-
| [data] | <code>\*</code> | <code></code> | The data to be stored in this element. |
|
|
1718
|
-
|
|
1719
|
-
<a name="ArrayElement+classType"></a>
|
|
1720
|
-
|
|
1721
|
-
### arrayElement.classType
|
|
1722
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
1723
|
-
|
|
1724
|
-
**Kind**: instance property of [<code>ArrayElement</code>](#ArrayElement)
|
|
1725
|
-
<a name="ArrayElement+data"></a>
|
|
1726
|
-
|
|
1727
|
-
### arrayElement.data
|
|
1728
|
-
The data stored in this element.
|
|
1729
|
-
|
|
1730
|
-
**Kind**: instance property of [<code>ArrayElement</code>](#ArrayElement)
|
|
1731
|
-
<a name="ArrayElement.fromArray"></a>
|
|
1732
|
-
|
|
1733
|
-
### ArrayElement.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
1734
|
-
Convert an array into Element instances, return the head and tail Elements.
|
|
1735
|
-
|
|
1736
|
-
**Kind**: static method of [<code>ArrayElement</code>](#ArrayElement)
|
|
1737
|
-
|
|
1738
|
-
| Param | Type | Default | Description |
|
|
1739
|
-
| --- | --- | --- | --- |
|
|
1740
|
-
| [values] | <code>Array.<IsElement></code> | <code>[]</code> | Provide an array of data that will be converted to array of elements. |
|
|
1741
|
-
| [classType] | <code>IsElement</code> | <code>ArrayElement</code> | Provide the type of IsElement to use. |
|
|
1742
|
-
|
|
1743
|
-
<a name="Stackable"></a>
|
|
1744
|
-
|
|
1745
|
-
## Stackable ⇒ [<code>Stackable</code>](#Stackable)
|
|
1746
|
-
Make a new Stackable from the data given if it is not already a valid Stackable.
|
|
1747
|
-
|
|
1748
|
-
**Kind**: global variable
|
|
1749
|
-
|
|
1750
|
-
| Param | Type | Default | Description |
|
|
1751
|
-
| --- | --- | --- | --- |
|
|
1752
|
-
| stackable | [<code>Stackable</code>](#Stackable) \| <code>\*</code> | | Return a valid Stackable instance from given data, or even an already valid one. |
|
|
1753
|
-
| [classType] | <code>IsLinker</code> | <code>Stackable</code> | Provide the type of IsLinker to use. |
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
* [Stackable](#Stackable) ⇒ [<code>Stackable</code>](#Stackable)
|
|
1757
|
-
* [new Stackable([stackData])](#new_Stackable_new)
|
|
1758
|
-
* _instance_
|
|
1759
|
-
* [.data](#Stackable+data)
|
|
1760
|
-
* [.next](#Stackable+next)
|
|
1761
|
-
* [.task](#Stackable+task) ⇒ <code>\*</code>
|
|
1762
|
-
* [.classType](#Linker+classType)
|
|
1763
|
-
* [.run()](#Stackable+run) ⇒ <code>\*</code>
|
|
1764
|
-
* _static_
|
|
1765
|
-
* [.fromArray([values], [classType])](#Stackable.fromArray) ⇒ <code>Object</code>
|
|
1766
|
-
|
|
1767
|
-
<a name="new_Stackable_new"></a>
|
|
1768
|
-
|
|
1769
|
-
### new Stackable([stackData])
|
|
1770
|
-
Create a stackable item that can be used in a stack.
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
| Param | Type | Default | Description |
|
|
1774
|
-
| --- | --- | --- | --- |
|
|
1775
|
-
| [stackData] | <code>Object</code> | <code>{}</code> | The settings for the new stackable. |
|
|
1776
|
-
| [stackData.task] | <code>\*</code> | <code></code> | The data to be stored in this stackable |
|
|
1777
|
-
| [stackData.next] | [<code>Stackable</code>](#Stackable) \| <code>null</code> | <code></code> | The reference to the next stackable if any |
|
|
1778
|
-
| [stackData.ready] | <code>boolean</code> \| <code>function</code> | <code>false</code> | Indicate if the stackable is ready to run |
|
|
1779
|
-
|
|
1780
|
-
<a name="Stackable+data"></a>
|
|
1781
|
-
|
|
1782
|
-
### stackable.data
|
|
1783
|
-
The task (or data) this stackable holds.
|
|
1784
|
-
|
|
1785
|
-
**Kind**: instance property of [<code>Stackable</code>](#Stackable)
|
|
1786
|
-
**Overrides**: [<code>data</code>](#Linker+data)
|
|
1787
|
-
<a name="Stackable+next"></a>
|
|
1788
|
-
|
|
1789
|
-
### stackable.next
|
|
1790
|
-
The stackable below this one, or null when this is the bottom.
|
|
1791
|
-
|
|
1792
|
-
**Kind**: instance property of [<code>Stackable</code>](#Stackable)
|
|
1793
|
-
**Overrides**: [<code>next</code>](#Linker+next)
|
|
1794
|
-
<a name="Stackable+task"></a>
|
|
1795
|
-
|
|
1796
|
-
### stackable.task ⇒ <code>\*</code>
|
|
1797
|
-
Retrieve the data which should be formed as a task.
|
|
1798
|
-
|
|
1799
|
-
**Kind**: instance property of [<code>Stackable</code>](#Stackable)
|
|
1800
|
-
<a name="Linker+classType"></a>
|
|
1801
|
-
|
|
1802
|
-
### stackable.classType
|
|
1803
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
1804
|
-
|
|
1805
|
-
**Kind**: instance property of [<code>Stackable</code>](#Stackable)
|
|
1806
|
-
**Overrides**: [<code>classType</code>](#Linker+classType)
|
|
1807
|
-
<a name="Stackable+run"></a>
|
|
1808
|
-
|
|
1809
|
-
### stackable.run() ⇒ <code>\*</code>
|
|
1810
|
-
Run the stacked task.
|
|
1811
|
-
|
|
1812
|
-
**Kind**: instance method of [<code>Stackable</code>](#Stackable)
|
|
1813
|
-
<a name="Stackable.fromArray"></a>
|
|
1814
|
-
|
|
1815
|
-
### Stackable.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
1816
|
-
Convert an array into Stackable instances, return the head and tail Stackables.
|
|
1817
|
-
|
|
1818
|
-
**Kind**: static method of [<code>Stackable</code>](#Stackable)
|
|
1819
|
-
|
|
1820
|
-
| Param | Type | Default | Description |
|
|
1821
|
-
| --- | --- | --- | --- |
|
|
1822
|
-
| [values] | <code>Array</code> | <code>[]</code> | Provide an array of data that will be converted to a chain of stackable linkers. |
|
|
1823
|
-
| [classType] | <code>IsLinker</code> | <code>Stackable</code> | Provide the type of IsLinker to use. |
|
|
1824
|
-
|
|
1825
|
-
<a name="Stack"></a>
|
|
1826
|
-
|
|
1827
|
-
## Stack ⇒ [<code>Stack</code>](#Stack)
|
|
1828
|
-
Convert an array to a Stack.
|
|
1829
|
-
|
|
1830
|
-
**Kind**: global variable
|
|
1831
|
-
|
|
1832
|
-
| Param | Type | Description |
|
|
1833
|
-
| --- | --- | --- |
|
|
1834
|
-
| values | <code>Array</code> | An array of values which will be converted to stackables in this queue |
|
|
1835
|
-
| stackableClass | [<code>Stackable</code>](#Stackable) | The class to use for each stackable |
|
|
1836
|
-
| listClass | [<code>Stack</code>](#Stack) \| <code>Iterable</code> | The class to use to manage the stackables |
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
* [Stack](#Stack) ⇒ [<code>Stack</code>](#Stack)
|
|
1840
|
-
* [new Stack([stackedList], [listClass], [stackableClass])](#new_Stack_new)
|
|
1841
|
-
* [.empty()](#Stack+empty) ⇒ <code>boolean</code>
|
|
1842
|
-
* [.top()](#Stack+top) ⇒ [<code>Stackable</code>](#Stackable)
|
|
1843
|
-
* [.pop()](#Stack+pop) ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
|
|
1844
|
-
* [.push(stackable)](#Stack+push)
|
|
1845
|
-
* [.remove()](#Stack+remove) ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
|
|
1846
|
-
* [.size()](#Stack+size) ⇒ <code>number</code>
|
|
1847
|
-
|
|
1848
|
-
<a name="new_Stack_new"></a>
|
|
1849
|
-
|
|
1850
|
-
### new Stack([stackedList], [listClass], [stackableClass])
|
|
1851
|
-
Instantiate the state with the starter stacked list.
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
| Param | Type | Default | Description |
|
|
1855
|
-
| --- | --- | --- | --- |
|
|
1856
|
-
| [stackedList] | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) | <code></code> | The list of stackables to start in this stack. |
|
|
1857
|
-
| [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no stacked list is given. |
|
|
1858
|
-
| [stackableClass] | [<code>Stackable</code>](#Stackable) | <code>Stackable</code> | The class used to wrap stacked items. |
|
|
1859
|
-
|
|
1860
|
-
<a name="Stack+empty"></a>
|
|
1861
|
-
|
|
1862
|
-
### stack.empty() ⇒ <code>boolean</code>
|
|
1863
|
-
Return true if the stack is empty (there are no tasks in the stacked list)
|
|
1864
|
-
|
|
1865
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
1866
|
-
<a name="Stack+top"></a>
|
|
1867
|
-
|
|
1868
|
-
### stack.top() ⇒ [<code>Stackable</code>](#Stackable)
|
|
1869
|
-
Take a look at the next stacked task
|
|
1870
|
-
|
|
1871
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
1872
|
-
<a name="Stack+pop"></a>
|
|
1873
|
-
|
|
1874
|
-
### stack.pop() ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
|
|
1875
|
-
Remove the next stacked task and return it.
|
|
1876
|
-
|
|
1877
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
1878
|
-
<a name="Stack+push"></a>
|
|
1879
|
-
|
|
1880
|
-
### stack.push(stackable)
|
|
1881
|
-
Push a stackable task to the top of the stack.
|
|
1882
|
-
|
|
1883
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
1884
|
-
|
|
1885
|
-
| Param | Type | Description |
|
|
1886
|
-
| --- | --- | --- |
|
|
1887
|
-
| stackable | [<code>Stackable</code>](#Stackable) \| <code>\*</code> | Add a new stackable to the top of the stack |
|
|
1888
|
-
|
|
1889
|
-
<a name="Stack+remove"></a>
|
|
1890
|
-
|
|
1891
|
-
### stack.remove() ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
|
|
1892
|
-
Remove the next stacked task and return it.
|
|
1893
|
-
|
|
1894
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
1895
|
-
<a name="Stack+size"></a>
|
|
1896
|
-
|
|
1897
|
-
### stack.size() ⇒ <code>number</code>
|
|
1898
|
-
Get the size of the current stack.
|
|
1899
|
-
|
|
1900
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
1901
|
-
<a name="Queueable"></a>
|
|
1902
|
-
|
|
1903
|
-
## Queueable ⇒ [<code>Queueable</code>](#Queueable)
|
|
1904
|
-
Make a new Queueable from the data given if it is not already a valid Queueable.
|
|
1905
|
-
|
|
1906
|
-
**Kind**: global variable
|
|
1907
|
-
|
|
1908
|
-
| Param | Type | Default | Description |
|
|
1909
|
-
| --- | --- | --- | --- |
|
|
1910
|
-
| queueable | [<code>Queueable</code>](#Queueable) \| <code>\*</code> | | Return a valid Queueable instance from given data, or even an already valid one. |
|
|
1911
|
-
| [classType] | <code>IsLinker</code> | <code>Queueable</code> | Provide the type of IsLinker to use. |
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
* [Queueable](#Queueable) ⇒ [<code>Queueable</code>](#Queueable)
|
|
1915
|
-
* [new Queueable([queueableData])](#new_Queueable_new)
|
|
1916
|
-
* _instance_
|
|
1917
|
-
* [.data](#Queueable+data)
|
|
1918
|
-
* [.next](#Queueable+next)
|
|
1919
|
-
* [.complete](#Queueable+complete)
|
|
1920
|
-
* [.ready](#Queueable+ready)
|
|
1921
|
-
* [.running](#Queueable+running)
|
|
1922
|
-
* [.isReady](#Queueable+isReady) ⇒ <code>boolean</code>
|
|
1923
|
-
* [.task](#Queueable+task) ⇒ <code>\*</code>
|
|
1924
|
-
* [.classType](#Linker+classType)
|
|
1925
|
-
* [.markCompleted([completeResponse])](#Queueable+markCompleted) ⇒ <code>completeResponse</code>
|
|
1926
|
-
* [.run()](#Queueable+run) ⇒ <code>completeResponse</code>
|
|
1927
|
-
* _static_
|
|
1928
|
-
* [.fromArray(values, [classType])](#Queueable.fromArray) ⇒ <code>Object</code>
|
|
1929
|
-
|
|
1930
|
-
<a name="new_Queueable_new"></a>
|
|
1931
|
-
|
|
1932
|
-
### new Queueable([queueableData])
|
|
1933
|
-
Create a queueable item that can be used in a queue.
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
| Param | Type | Default | Description |
|
|
1937
|
-
| --- | --- | --- | --- |
|
|
1938
|
-
| [queueableData] | <code>Object</code> | <code>{}</code> | The settings for the new queueable. |
|
|
1939
|
-
| [queueableData.task] | <code>\*</code> | <code></code> | The data to be stored in this queueable |
|
|
1940
|
-
| [queueableData.next] | [<code>Queueable</code>](#Queueable) \| <code>null</code> | <code></code> | The reference to the next queueable if any |
|
|
1941
|
-
| [queueableData.ready] | <code>boolean</code> \| <code>function</code> | <code>false</code> | Indicate if the queueable is ready to run |
|
|
1942
|
-
|
|
1943
|
-
<a name="Queueable+data"></a>
|
|
1944
|
-
|
|
1945
|
-
### queueable.data
|
|
1946
|
-
The task (or data) this queueable holds.
|
|
1947
|
-
|
|
1948
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
1949
|
-
**Overrides**: [<code>data</code>](#Linker+data)
|
|
1950
|
-
<a name="Queueable+next"></a>
|
|
1951
|
-
|
|
1952
|
-
### queueable.next
|
|
1953
|
-
The queueable after this one, or null when this is the last.
|
|
1954
|
-
|
|
1955
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
1956
|
-
**Overrides**: [<code>next</code>](#Linker+next)
|
|
1957
|
-
<a name="Queueable+complete"></a>
|
|
1958
|
-
|
|
1959
|
-
### queueable.complete
|
|
1960
|
-
Whether this queueable has been run to completion.
|
|
1961
|
-
|
|
1962
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
1963
|
-
<a name="Queueable+ready"></a>
|
|
1964
|
-
|
|
1965
|
-
### queueable.ready
|
|
1966
|
-
Whether this queueable may run, or a function which answers that when asked.
|
|
1967
|
-
|
|
1968
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
1969
|
-
<a name="Queueable+running"></a>
|
|
1970
|
-
|
|
1971
|
-
### queueable.running
|
|
1972
|
-
Whether this queueable is running right now.
|
|
1973
|
-
|
|
1974
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
1975
|
-
<a name="Queueable+isReady"></a>
|
|
1976
|
-
|
|
1977
|
-
### queueable.isReady ⇒ <code>boolean</code>
|
|
1978
|
-
Check ready state.
|
|
1979
|
-
|
|
1980
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
1981
|
-
<a name="Queueable+task"></a>
|
|
1982
|
-
|
|
1983
|
-
### queueable.task ⇒ <code>\*</code>
|
|
1984
|
-
Retrieve the data which should be formed as a task.
|
|
1985
|
-
|
|
1986
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
1987
|
-
<a name="Linker+classType"></a>
|
|
1988
|
-
|
|
1989
|
-
### queueable.classType
|
|
1990
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
1991
|
-
|
|
1992
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
1993
|
-
**Overrides**: [<code>classType</code>](#Linker+classType)
|
|
1994
|
-
<a name="Queueable+markCompleted"></a>
|
|
1995
|
-
|
|
1996
|
-
### queueable.markCompleted([completeResponse]) ⇒ <code>completeResponse</code>
|
|
1997
|
-
Set this queueable as completed.
|
|
1998
|
-
|
|
1999
|
-
**Kind**: instance method of [<code>Queueable</code>](#Queueable)
|
|
2000
|
-
|
|
2001
|
-
| Param | Type | Default | Description |
|
|
2002
|
-
| --- | --- | --- | --- |
|
|
2003
|
-
| [completeResponse] | <code>Object</code> | <code>{}</code> | The result to report for the task. |
|
|
2004
|
-
| [completeResponse.success] | <code>\*</code> | <code>true</code> | Indicate when the task failed (use false) or give a success message |
|
|
2005
|
-
| [completeResponse.error] | <code>\*</code> | <code>false</code> | Indicate a task was error-free (use false) or give an error message |
|
|
2006
|
-
| [completeResponse.context] | <code>\*</code> | <code></code> | Provide additional data in the response |
|
|
2007
|
-
|
|
2008
|
-
<a name="Queueable+run"></a>
|
|
2009
|
-
|
|
2010
|
-
### queueable.run() ⇒ <code>completeResponse</code>
|
|
2011
|
-
Intend to run the queued task when it is ready. If ready, mark this task as running and run the task.
|
|
2012
|
-
|
|
2013
|
-
**Kind**: instance method of [<code>Queueable</code>](#Queueable)
|
|
2014
|
-
<a name="Queueable.fromArray"></a>
|
|
2015
|
-
|
|
2016
|
-
### Queueable.fromArray(values, [classType]) ⇒ <code>Object</code>
|
|
2017
|
-
Convert an array into Queueable instances, return the head and tail Queueables.
|
|
2018
|
-
|
|
2019
|
-
**Kind**: static method of [<code>Queueable</code>](#Queueable)
|
|
2020
|
-
|
|
2021
|
-
| Param | Type | Default | Description |
|
|
2022
|
-
| --- | --- | --- | --- |
|
|
2023
|
-
| values | <code>Array</code> | | Provide an array of data that will be converted to a chain of queueable linkers. |
|
|
2024
|
-
| [classType] | <code>IsLinker</code> | <code>Queueable</code> | Provide the type of IsLinker to use. |
|
|
2025
|
-
|
|
2026
|
-
<a name="Queue"></a>
|
|
2027
|
-
|
|
2028
|
-
## Queue ⇒ [<code>Queue</code>](#Queue)
|
|
2029
|
-
Convert an array to a Queue.
|
|
2030
|
-
|
|
2031
|
-
**Kind**: global variable
|
|
2032
|
-
|
|
2033
|
-
| Param | Type | Description |
|
|
2034
|
-
| --- | --- | --- |
|
|
2035
|
-
| values | <code>Array</code> | An array of values which will be converted to queueables in this queue |
|
|
2036
|
-
| queueableClass | [<code>Queueable</code>](#Queueable) | The class to use for each queueable |
|
|
2037
|
-
| listClass | [<code>Queue</code>](#Queue) \| <code>Iterable</code> | The class to use to manage the queueables |
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
* [Queue](#Queue) ⇒ [<code>Queue</code>](#Queue)
|
|
2041
|
-
* [new Queue(queuedList, [listClass], [queueableClass])](#new_Queue_new)
|
|
2042
|
-
* [.dequeue()](#Queue+dequeue) ⇒ <code>completeResponse</code> \| <code>\*</code>
|
|
2043
|
-
* [.empty()](#Queue+empty) ⇒ <code>boolean</code>
|
|
2044
|
-
* [.enqueue(queueable)](#Queue+enqueue)
|
|
2045
|
-
* [.peek()](#Queue+peek) ⇒ [<code>Queueable</code>](#Queueable)
|
|
2046
|
-
* [.remove()](#Queue+remove) ⇒ [<code>Queueable</code>](#Queueable) \| <code>null</code>
|
|
2047
|
-
* [.size()](#Queue+size) ⇒ <code>number</code>
|
|
2048
|
-
|
|
2049
|
-
<a name="new_Queue_new"></a>
|
|
2050
|
-
|
|
2051
|
-
### new Queue(queuedList, [listClass], [queueableClass])
|
|
2052
|
-
Instantiate the queue with the given queue list.
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
| Param | Type | Default | Description |
|
|
2056
|
-
| --- | --- | --- | --- |
|
|
2057
|
-
| queuedList | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) | <code></code> | Give the list of queueables to start in this queue. |
|
|
2058
|
-
| [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no queued list is given. |
|
|
2059
|
-
| [queueableClass] | [<code>Queueable</code>](#Queueable) | <code>Queueable</code> | The class used to wrap queued items. |
|
|
2060
|
-
|
|
2061
|
-
<a name="Queue+dequeue"></a>
|
|
2062
|
-
|
|
2063
|
-
### queue.dequeue() ⇒ <code>completeResponse</code> \| <code>\*</code>
|
|
2064
|
-
Take a queued task from the front of the queue and run it if ready.
|
|
2065
|
-
|
|
2066
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
2067
|
-
<a name="Queue+empty"></a>
|
|
2068
|
-
|
|
2069
|
-
### queue.empty() ⇒ <code>boolean</code>
|
|
2070
|
-
Return true if the queue is empty (there are no tasks in the queue list)
|
|
2071
|
-
|
|
2072
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
2073
|
-
<a name="Queue+enqueue"></a>
|
|
2074
|
-
|
|
2075
|
-
### queue.enqueue(queueable)
|
|
2076
|
-
Add a queued task to the end of the queue
|
|
2077
|
-
|
|
2078
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
2079
|
-
|
|
2080
|
-
| Param | Type | Description |
|
|
2081
|
-
| --- | --- | --- |
|
|
2082
|
-
| queueable | [<code>Queueable</code>](#Queueable) | Add a new queueable to the end of the queue |
|
|
2083
|
-
|
|
2084
|
-
<a name="Queue+peek"></a>
|
|
2085
|
-
|
|
2086
|
-
### queue.peek() ⇒ [<code>Queueable</code>](#Queueable)
|
|
2087
|
-
Take a look at the next queued task
|
|
2088
|
-
|
|
2089
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
2090
|
-
<a name="Queue+remove"></a>
|
|
2091
|
-
|
|
2092
|
-
### queue.remove() ⇒ [<code>Queueable</code>](#Queueable) \| <code>null</code>
|
|
2093
|
-
Remove the next queued item and return it.
|
|
2094
|
-
|
|
2095
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
2096
|
-
<a name="Queue+size"></a>
|
|
2097
|
-
|
|
2098
|
-
### queue.size() ⇒ <code>number</code>
|
|
2099
|
-
Get the length of the current queue.
|
|
2100
|
-
|
|
2101
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
2102
|
-
<a name="TreeLinker"></a>
|
|
2103
|
-
|
|
2104
|
-
## TreeLinker ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2105
|
-
Make a new DoubleLinker from the data given if it is not already a valid Linker.
|
|
2106
|
-
|
|
2107
|
-
**Kind**: global variable
|
|
2108
|
-
|
|
2109
|
-
| Param | Type | Default | Description |
|
|
2110
|
-
| --- | --- | --- | --- |
|
|
2111
|
-
| linker | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | | Return a valid TreeLinker instance from given data, or even an already valid one. |
|
|
2112
|
-
| [classType] | <code>IsTreeNode</code> | <code>TreeLinker</code> | Provide the type of IsTreeNode to use. |
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
* [TreeLinker](#TreeLinker) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2116
|
-
* [new TreeLinker([settings], listClass)](#new_TreeLinker_new)
|
|
2117
|
-
* _instance_
|
|
2118
|
-
* [.classType](#TreeLinker+classType)
|
|
2119
|
-
* [.data](#TreeLinker+data)
|
|
2120
|
-
* [.next](#TreeLinker+next)
|
|
2121
|
-
* [.prev](#TreeLinker+prev)
|
|
2122
|
-
* [.parent](#TreeLinker+parent)
|
|
2123
|
-
* [.children](#TreeLinker+children)
|
|
2124
|
-
* [.childrenFromArray(children, listClass)](#TreeLinker+childrenFromArray) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
|
|
2125
|
-
* _static_
|
|
2126
|
-
* [.fromArray([values], [classType])](#TreeLinker.fromArray) ⇒ <code>Object</code>
|
|
2127
|
-
|
|
2128
|
-
<a name="new_TreeLinker_new"></a>
|
|
2129
|
-
|
|
2130
|
-
### new TreeLinker([settings], listClass)
|
|
2131
|
-
Create the new TreeLinker instance, provide the data and optionally set references for next, prev, parent, or children.
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
| Param | Type | Default | Description |
|
|
2135
|
-
| --- | --- | --- | --- |
|
|
2136
|
-
| [settings] | <code>Object</code> | <code>{}</code> | The settings for the new tree node. |
|
|
2137
|
-
| [settings.data] | <code>\*</code> | <code></code> | The data to be stored in this tree node |
|
|
2138
|
-
| [settings.next] | [<code>TreeLinker</code>](#TreeLinker) | <code></code> | The reference to the next linker if any |
|
|
2139
|
-
| [settings.prev] | [<code>TreeLinker</code>](#TreeLinker) | <code></code> | The reference to the previous linker if any |
|
|
2140
|
-
| [settings.children] | [<code>LinkedTreeList</code>](#LinkedTreeList) | <code></code> | The references to child linkers if any |
|
|
2141
|
-
| [settings.parent] | [<code>TreeLinker</code>](#TreeLinker) | <code></code> | The reference to a parent linker if any |
|
|
2142
|
-
| listClass | <code>IsArrayable.<IsTreeNode></code> | | Give the type of list to use for storing the children |
|
|
2143
|
-
|
|
2144
|
-
<a name="TreeLinker+classType"></a>
|
|
2145
|
-
|
|
2146
|
-
### treeLinker.classType
|
|
2147
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
2148
|
-
|
|
2149
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
2150
|
-
**Overrides**: [<code>classType</code>](#DoubleLinker+classType)
|
|
2151
|
-
<a name="TreeLinker+data"></a>
|
|
2152
|
-
|
|
2153
|
-
### treeLinker.data
|
|
2154
|
-
The data stored in this tree node.
|
|
2155
|
-
|
|
2156
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
2157
|
-
**Overrides**: [<code>data</code>](#DoubleLinker+data)
|
|
2158
|
-
<a name="TreeLinker+next"></a>
|
|
2159
|
-
|
|
2160
|
-
### treeLinker.next
|
|
2161
|
-
The sibling after this node, or null when this is the last child.
|
|
2162
|
-
|
|
2163
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
2164
|
-
**Overrides**: [<code>next</code>](#DoubleLinker+next)
|
|
2165
|
-
<a name="TreeLinker+prev"></a>
|
|
2166
|
-
|
|
2167
|
-
### treeLinker.prev
|
|
2168
|
-
The sibling before this node, or null when this is the first child.
|
|
2169
|
-
|
|
2170
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
2171
|
-
**Overrides**: [<code>prev</code>](#DoubleLinker+prev)
|
|
2172
|
-
<a name="TreeLinker+parent"></a>
|
|
2173
|
-
|
|
2174
|
-
### treeLinker.parent
|
|
2175
|
-
The node this node is a child of, or null for a root node.
|
|
2176
|
-
|
|
2177
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
2178
|
-
<a name="TreeLinker+children"></a>
|
|
2179
|
-
|
|
2180
|
-
### treeLinker.children
|
|
2181
|
-
The list of the children of this node, or null when it has none.
|
|
2182
|
-
|
|
2183
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
2184
|
-
<a name="TreeLinker+childrenFromArray"></a>
|
|
2185
|
-
|
|
2186
|
-
### treeLinker.childrenFromArray(children, listClass) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
|
|
2187
|
-
Create the children for this tree from an array.
|
|
2188
|
-
|
|
2189
|
-
**Kind**: instance method of [<code>TreeLinker</code>](#TreeLinker)
|
|
2190
|
-
|
|
2191
|
-
| Param | Type | Default | Description |
|
|
2192
|
-
| --- | --- | --- | --- |
|
|
2193
|
-
| children | <code>Array</code> \| <code>null</code> | <code></code> | Provide an array of data / linker references to be children of this tree node. |
|
|
2194
|
-
| listClass | <code>IsArrayable.<IsTreeNode></code> | | Give the type of list to use for storing the children |
|
|
2195
|
-
|
|
2196
|
-
<a name="TreeLinker.fromArray"></a>
|
|
2197
|
-
|
|
2198
|
-
### TreeLinker.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
2199
|
-
Convert an array into DoubleLinker instances, return the head and tail DoubleLinkers.
|
|
2200
|
-
|
|
2201
|
-
**Kind**: static method of [<code>TreeLinker</code>](#TreeLinker)
|
|
2202
|
-
|
|
2203
|
-
| Param | Type | Default | Description |
|
|
2204
|
-
| --- | --- | --- | --- |
|
|
2205
|
-
| [values] | <code>Array</code> | <code>[]</code> | Provide an array of data that will be converted to a chain of tree-linkers. |
|
|
2206
|
-
| [classType] | <code>IsTreeNode</code> | <code>TreeLinker</code> | Provide the type of IsTreeNode to use. |
|
|
2207
|
-
|
|
2208
|
-
<a name="LinkedTreeList"></a>
|
|
2209
|
-
|
|
2210
|
-
## LinkedTreeList ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2211
|
-
Convert an array into a LinkedTreeList instance, return the new instance.
|
|
2212
|
-
|
|
2213
|
-
**Kind**: global variable
|
|
2214
|
-
|
|
2215
|
-
| Param | Type | Default | Description |
|
|
2216
|
-
| --- | --- | --- | --- |
|
|
2217
|
-
| [values] | <code>Array</code> | <code>[]</code> | An array of values which will be converted to nodes in this tree-list |
|
|
2218
|
-
| [linkerClass] | [<code>TreeLinker</code>](#TreeLinker) | <code>TreeLinker</code> | The class to use for each node |
|
|
2219
|
-
| [classType] | [<code>IsArrayable.<TreeLinker></code>](#TreeLinker) | <code>LinkedTreeList</code> | Provide the type of IsArrayable to use. |
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
* [LinkedTreeList](#LinkedTreeList) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2223
|
-
* [new LinkedTreeList([linkerClass])](#new_LinkedTreeList_new)
|
|
2224
|
-
* [.classType](#LinkedTreeList+classType)
|
|
2225
|
-
* [.innerList](#LinkedTreeList+innerList)
|
|
2226
|
-
* [.initialized](#LinkedTreeList+initialized)
|
|
2227
|
-
* [.list](#LinkedTreeList+list) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2228
|
-
* [.first](#LinkedTreeList+first) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2229
|
-
* [.last](#LinkedTreeList+last) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2230
|
-
* [.length](#LinkedTreeList+length) ⇒ <code>number</code>
|
|
2231
|
-
* [.parent](#LinkedTreeList+parent) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2232
|
-
* [.parent](#LinkedTreeList+parent)
|
|
2233
|
-
* [.rootParent](#LinkedTreeList+rootParent) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2234
|
-
* [.initialize(initialList)](#LinkedTreeList+initialize) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2235
|
-
* [.setChildren(item, children)](#LinkedTreeList+setChildren)
|
|
2236
|
-
* [.insertAfter(node, newNode)](#LinkedTreeList+insertAfter) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2237
|
-
* [.insertBefore(node, newNode)](#LinkedTreeList+insertBefore) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2238
|
-
* [.append(node, after)](#LinkedTreeList+append) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2239
|
-
* [.prepend(node, before)](#LinkedTreeList+prepend) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2240
|
-
* [.remove(node)](#LinkedTreeList+remove) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2241
|
-
* [.reset()](#LinkedTreeList+reset) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2242
|
-
* [.item(index)](#LinkedTreeList+item) ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
|
|
2243
|
-
* [.forEach(callback, thisArg)](#LinkedTreeList+forEach) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2244
|
-
|
|
2245
|
-
<a name="new_LinkedTreeList_new"></a>
|
|
2246
|
-
|
|
2247
|
-
### new LinkedTreeList([linkerClass])
|
|
2248
|
-
Create the new LinkedTreeList instance, configure the list class.
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
| Param | Type | Default | Description |
|
|
2252
|
-
| --- | --- | --- | --- |
|
|
2253
|
-
| [linkerClass] | [<code>TreeLinker</code>](#TreeLinker) | <code>TreeLinker</code> | The class used to wrap given data as tree linkers. |
|
|
2254
|
-
|
|
2255
|
-
<a name="LinkedTreeList+classType"></a>
|
|
2256
|
-
|
|
2257
|
-
### linkedTreeList.classType
|
|
2258
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
2259
|
-
|
|
2260
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2261
|
-
**Overrides**: [<code>classType</code>](#DoublyLinkedList+classType)
|
|
2262
|
-
<a name="LinkedTreeList+innerList"></a>
|
|
2263
|
-
|
|
2264
|
-
### linkedTreeList.innerList
|
|
2265
|
-
A linker of the list (null when the list is empty); the head is found by walking back from it.
|
|
2266
|
-
|
|
2267
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2268
|
-
**Overrides**: [<code>innerList</code>](#DoublyLinkedList+innerList)
|
|
2269
|
-
<a name="LinkedTreeList+initialized"></a>
|
|
2270
|
-
|
|
2271
|
-
### linkedTreeList.initialized
|
|
2272
|
-
Whether the inner list has been initialized (it can only be initialized once).
|
|
2273
|
-
|
|
2274
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2275
|
-
**Overrides**: [<code>initialized</code>](#DoublyLinkedList+initialized)
|
|
2276
|
-
<a name="LinkedTreeList+list"></a>
|
|
2277
|
-
|
|
2278
|
-
### linkedTreeList.list ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2279
|
-
Retrieve a copy of the innerList used.
|
|
2280
|
-
|
|
2281
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2282
|
-
**Overrides**: [<code>list</code>](#DoublyLinkedList+list)
|
|
2283
|
-
<a name="LinkedTreeList+first"></a>
|
|
2284
|
-
|
|
2285
|
-
### linkedTreeList.first ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2286
|
-
Retrieve the first TreeLinker in the list.
|
|
2287
|
-
|
|
2288
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2289
|
-
**Overrides**: [<code>first</code>](#DoublyLinkedList+first)
|
|
2290
|
-
<a name="LinkedTreeList+last"></a>
|
|
2291
|
-
|
|
2292
|
-
### linkedTreeList.last ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2293
|
-
Retrieve the last TreeLinker in the list.
|
|
2294
|
-
|
|
2295
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2296
|
-
**Overrides**: [<code>last</code>](#DoublyLinkedList+last)
|
|
2297
|
-
<a name="LinkedTreeList+length"></a>
|
|
2298
|
-
|
|
2299
|
-
### linkedTreeList.length ⇒ <code>number</code>
|
|
2300
|
-
Return the length of the list.
|
|
2301
|
-
|
|
2302
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2303
|
-
**Overrides**: [<code>length</code>](#DoublyLinkedList+length)
|
|
2304
|
-
<a name="LinkedTreeList+parent"></a>
|
|
2305
|
-
|
|
2306
|
-
### linkedTreeList.parent ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2307
|
-
Get the parent of this tree list.
|
|
2308
|
-
|
|
2309
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2310
|
-
<a name="LinkedTreeList+parent"></a>
|
|
2311
|
-
|
|
2312
|
-
### linkedTreeList.parent
|
|
2313
|
-
Set the parent of this tree list
|
|
2314
|
-
|
|
2315
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2316
|
-
|
|
2317
|
-
| Param | Type | Description |
|
|
2318
|
-
| --- | --- | --- |
|
|
2319
|
-
| parent | [<code>TreeLinker</code>](#TreeLinker) | The new node to use as the parent for this group of children |
|
|
2320
|
-
|
|
2321
|
-
<a name="LinkedTreeList+rootParent"></a>
|
|
2322
|
-
|
|
2323
|
-
### linkedTreeList.rootParent ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2324
|
-
Return the root parent of the entire tree.
|
|
2325
|
-
|
|
2326
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2327
|
-
<a name="LinkedTreeList+initialize"></a>
|
|
2328
|
-
|
|
2329
|
-
### linkedTreeList.initialize(initialList) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2330
|
-
Initialize the inner list, should only run once.
|
|
2331
|
-
|
|
2332
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2333
|
-
**Overrides**: [<code>initialize</code>](#DoublyLinkedList+initialize)
|
|
2334
|
-
|
|
2335
|
-
| Param | Type | Description |
|
|
2336
|
-
| --- | --- | --- |
|
|
2337
|
-
| initialList | [<code>TreeLinker</code>](#TreeLinker) | Give the list of tree-linkers to start in this linked-tree-list. |
|
|
2338
|
-
|
|
2339
|
-
<a name="LinkedTreeList+setChildren"></a>
|
|
2340
|
-
|
|
2341
|
-
### linkedTreeList.setChildren(item, children)
|
|
2342
|
-
Set the children on a parent item.
|
|
2343
|
-
|
|
2344
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2345
|
-
|
|
2346
|
-
| Param | Type | Default | Description |
|
|
2347
|
-
| --- | --- | --- | --- |
|
|
2348
|
-
| item | [<code>TreeLinker</code>](#TreeLinker) | | The TreeLinker node that will be the parent of the children |
|
|
2349
|
-
| children | [<code>LinkedTreeList</code>](#LinkedTreeList) | <code></code> | The LinkedTreeList which has the child nodes to use |
|
|
2350
|
-
|
|
2351
|
-
<a name="LinkedTreeList+insertAfter"></a>
|
|
2352
|
-
|
|
2353
|
-
### linkedTreeList.insertAfter(node, newNode) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2354
|
-
Insert a new node (or data) after a node.
|
|
2355
|
-
|
|
2356
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2357
|
-
**Overrides**: [<code>insertAfter</code>](#DoublyLinkedList+insertAfter)
|
|
2358
|
-
|
|
2359
|
-
| Param | Type | Description |
|
|
2360
|
-
| --- | --- | --- |
|
|
2361
|
-
| node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The existing node as reference |
|
|
2362
|
-
| newNode | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to go after the existing node |
|
|
2363
|
-
|
|
2364
|
-
<a name="LinkedTreeList+insertBefore"></a>
|
|
2365
|
-
|
|
2366
|
-
### linkedTreeList.insertBefore(node, newNode) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2367
|
-
Insert a new node (or data) before a node.
|
|
2368
|
-
|
|
2369
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2370
|
-
**Overrides**: [<code>insertBefore</code>](#DoublyLinkedList+insertBefore)
|
|
2371
|
-
|
|
2372
|
-
| Param | Type | Description |
|
|
2373
|
-
| --- | --- | --- |
|
|
2374
|
-
| node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The existing node as reference |
|
|
2375
|
-
| newNode | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to go before the existing node |
|
|
2376
|
-
|
|
2377
|
-
<a name="LinkedTreeList+append"></a>
|
|
2378
|
-
|
|
2379
|
-
### linkedTreeList.append(node, after) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2380
|
-
Add a node (or data) after the given (or last) node in the list.
|
|
2381
|
-
|
|
2382
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2383
|
-
**Overrides**: [<code>append</code>](#DoublyLinkedList+append)
|
|
2384
|
-
|
|
2385
|
-
| Param | Type | Description |
|
|
2386
|
-
| --- | --- | --- |
|
|
2387
|
-
| node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to add to the end of the list |
|
|
2388
|
-
| after | [<code>TreeLinker</code>](#TreeLinker) | The existing last node |
|
|
2389
|
-
|
|
2390
|
-
<a name="LinkedTreeList+prepend"></a>
|
|
2391
|
-
|
|
2392
|
-
### linkedTreeList.prepend(node, before) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2393
|
-
Add a node (or data) before the given (or first) node in the list.
|
|
2394
|
-
|
|
2395
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2396
|
-
**Overrides**: [<code>prepend</code>](#DoublyLinkedList+prepend)
|
|
2397
|
-
|
|
2398
|
-
| Param | Type | Description |
|
|
2399
|
-
| --- | --- | --- |
|
|
2400
|
-
| node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to add to the start of the list |
|
|
2401
|
-
| before | [<code>TreeLinker</code>](#TreeLinker) | The existing first node |
|
|
2402
|
-
|
|
2403
|
-
<a name="LinkedTreeList+remove"></a>
|
|
2404
|
-
|
|
2405
|
-
### linkedTreeList.remove(node) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2406
|
-
Remove a linker from this linked list.
|
|
2407
|
-
|
|
2408
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2409
|
-
**Overrides**: [<code>remove</code>](#DoublyLinkedList+remove)
|
|
2410
|
-
|
|
2411
|
-
| Param | Type | Description |
|
|
2412
|
-
| --- | --- | --- |
|
|
2413
|
-
| node | [<code>TreeLinker</code>](#TreeLinker) | The node we wish to remove (and it will be returned after removal) |
|
|
2414
|
-
|
|
2415
|
-
<a name="LinkedTreeList+reset"></a>
|
|
2416
|
-
|
|
2417
|
-
### linkedTreeList.reset() ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
2418
|
-
Refresh all references and return head reference.
|
|
2419
|
-
|
|
2420
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2421
|
-
**Overrides**: [<code>reset</code>](#DoublyLinkedList+reset)
|
|
2422
|
-
<a name="LinkedTreeList+item"></a>
|
|
2423
|
-
|
|
2424
|
-
### linkedTreeList.item(index) ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
|
|
2425
|
-
Retrieve a TreeLinker item from this list by numeric index, otherwise return null.
|
|
2426
|
-
|
|
2427
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2428
|
-
**Overrides**: [<code>item</code>](#DoublyLinkedList+item)
|
|
2429
|
-
|
|
2430
|
-
| Param | Type | Description |
|
|
2431
|
-
| --- | --- | --- |
|
|
2432
|
-
| index | <code>number</code> | The integer number for retrieving a node by position. |
|
|
2433
|
-
|
|
2434
|
-
<a name="LinkedTreeList+forEach"></a>
|
|
2435
|
-
|
|
2436
|
-
### linkedTreeList.forEach(callback, thisArg) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2437
|
-
Be able to run forEach on this LinkedTreeList to iterate over the TreeLinker Items.
|
|
2438
|
-
|
|
2439
|
-
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
2440
|
-
**Overrides**: [<code>forEach</code>](#DoublyLinkedList+forEach)
|
|
2441
|
-
**Returns**: [<code>LinkedTreeList</code>](#LinkedTreeList) - The list which was iterated.
|
|
2442
|
-
|
|
2443
|
-
| Param | Type | Description |
|
|
2444
|
-
| --- | --- | --- |
|
|
2445
|
-
| callback | <code>forEachCallback</code> | The function to call for-each tree node |
|
|
2446
|
-
| thisArg | [<code>LinkedTreeList</code>](#LinkedTreeList) | Optional, 'this' reference |
|
|
2447
|
-
|
|
2448
|
-
<a name="Linker"></a>
|
|
2449
|
-
|
|
2450
|
-
## Linker ⇒ [<code>Linker</code>](#Linker)
|
|
2451
|
-
Make a new Linker from the data given if it is not already a valid Linker.
|
|
2452
|
-
|
|
2453
|
-
**Kind**: global variable
|
|
2454
|
-
|
|
2455
|
-
| Param | Type | Default | Description |
|
|
2456
|
-
| --- | --- | --- | --- |
|
|
2457
|
-
| linker | [<code>Linker</code>](#Linker) \| <code>\*</code> | | Return a valid Linker instance from given data, or even an already valid one. |
|
|
2458
|
-
| [classType] | <code>IsLinker</code> | <code>Linker</code> | Provide the type of IsLinker to use. |
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
* [Linker](#Linker) ⇒ [<code>Linker</code>](#Linker)
|
|
2462
|
-
* [new Linker([nodeData])](#new_Linker_new)
|
|
2463
|
-
* _instance_
|
|
2464
|
-
* [.classType](#Linker+classType)
|
|
2465
|
-
* [.data](#Linker+data)
|
|
2466
|
-
* [.next](#Linker+next)
|
|
2467
|
-
* _static_
|
|
2468
|
-
* [.fromArray([values], [classType])](#Linker.fromArray) ⇒ <code>Object</code>
|
|
2469
|
-
|
|
2470
|
-
<a name="new_Linker_new"></a>
|
|
2471
|
-
|
|
2472
|
-
### new Linker([nodeData])
|
|
2473
|
-
Create the new Linker instance, provide the data and optionally give the next Linker.
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
| Param | Type | Default | Description |
|
|
2477
|
-
| --- | --- | --- | --- |
|
|
2478
|
-
| [nodeData] | <code>Object</code> | <code>{}</code> | The settings for the new linker. |
|
|
2479
|
-
| [nodeData.data] | <code>\*</code> | <code></code> | The data to be stored in this linker |
|
|
2480
|
-
| [nodeData.next] | [<code>Linker</code>](#Linker) \| <code>null</code> | <code></code> | The reference to the next linker if any |
|
|
2481
|
-
|
|
2482
|
-
<a name="Linker+classType"></a>
|
|
2483
|
-
|
|
2484
|
-
### linker.classType
|
|
2485
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
2486
|
-
|
|
2487
|
-
**Kind**: instance property of [<code>Linker</code>](#Linker)
|
|
2488
|
-
**Overrides**: [<code>classType</code>](#ArrayElement+classType)
|
|
2489
|
-
<a name="Linker+data"></a>
|
|
2490
|
-
|
|
2491
|
-
### linker.data
|
|
2492
|
-
The data stored in this linker.
|
|
2493
|
-
|
|
2494
|
-
**Kind**: instance property of [<code>Linker</code>](#Linker)
|
|
2495
|
-
**Overrides**: [<code>data</code>](#ArrayElement+data)
|
|
2496
|
-
<a name="Linker+next"></a>
|
|
2497
|
-
|
|
2498
|
-
### linker.next
|
|
2499
|
-
The linker after this one, or null when this is the last.
|
|
2500
|
-
|
|
2501
|
-
**Kind**: instance property of [<code>Linker</code>](#Linker)
|
|
2502
|
-
<a name="Linker.fromArray"></a>
|
|
2503
|
-
|
|
2504
|
-
### Linker.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
2505
|
-
Convert an array into Linker instances, return the head and tail Linkers.
|
|
2506
|
-
|
|
2507
|
-
**Kind**: static method of [<code>Linker</code>](#Linker)
|
|
2508
|
-
|
|
2509
|
-
| Param | Type | Default | Description |
|
|
2510
|
-
| --- | --- | --- | --- |
|
|
2511
|
-
| [values] | <code>Array</code> | <code>[]</code> | Provide an array of data that will be converted to a chain of linkers. |
|
|
2512
|
-
| [classType] | <code>IsLinker</code> | <code>Linker</code> | Provide the type of IsLinker to use. |
|
|
2513
|
-
|
|
2514
|
-
<a name="LinkedList"></a>
|
|
2515
|
-
|
|
2516
|
-
## LinkedList ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
2517
|
-
Convert an array to a LinkedList.
|
|
2518
|
-
|
|
2519
|
-
**Kind**: global variable
|
|
2520
|
-
|
|
2521
|
-
| Param | Type | Default | Description |
|
|
2522
|
-
| --- | --- | --- | --- |
|
|
2523
|
-
| values | <code>Array</code> | | An array of values which will be converted to linkers in this linked-list |
|
|
2524
|
-
| linkerClass | <code>IsLinker</code> | | The class to use for each linker |
|
|
2525
|
-
| [classType] | [<code>IsArrayable.<Linker></code>](#Linker) | <code>LinkedList</code> | Provide the type of IsArrayable to use. |
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
* [LinkedList](#LinkedList) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
2529
|
-
* [new LinkedList([linkerClass])](#new_LinkedList_new)
|
|
2530
|
-
* [.classType](#LinkedList+classType)
|
|
2531
|
-
* [.innerList](#LinkedList+innerList)
|
|
2532
|
-
* [.initialized](#LinkedList+initialized)
|
|
2533
|
-
* [.list](#LinkedList+list) ⇒ [<code>Linker</code>](#Linker)
|
|
2534
|
-
* [.first](#LinkedList+first) ⇒ [<code>Linker</code>](#Linker)
|
|
2535
|
-
* [.last](#LinkedList+last) ⇒ [<code>Linker</code>](#Linker)
|
|
2536
|
-
* [.length](#LinkedList+length) ⇒ <code>number</code>
|
|
2537
|
-
* [.initialize(initialList)](#LinkedList+initialize) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
2538
|
-
* [.insertAfter(node, newNode)](#LinkedList+insertAfter) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
2539
|
-
* [.insertBefore(node, newNode)](#LinkedList+insertBefore) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
2540
|
-
* [.append(node, after)](#LinkedList+append) ⇒ [<code>Linker</code>](#Linker)
|
|
2541
|
-
* [.prepend(node, before)](#LinkedList+prepend) ⇒ [<code>Linker</code>](#Linker)
|
|
2542
|
-
* [.remove(node)](#LinkedList+remove) ⇒ [<code>Linker</code>](#Linker)
|
|
2543
|
-
* [.item(index)](#LinkedList+item) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
|
|
2544
|
-
* [.forEach(callback, thisArg)](#LinkedList+forEach) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
2545
|
-
|
|
2546
|
-
<a name="new_LinkedList_new"></a>
|
|
2547
|
-
|
|
2548
|
-
### new LinkedList([linkerClass])
|
|
2549
|
-
Create the new LinkedList instance.
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
| Param | Type | Default | Description |
|
|
2553
|
-
| --- | --- | --- | --- |
|
|
2554
|
-
| [linkerClass] | [<code>Linker</code>](#Linker) | <code>Linker</code> | The class used to wrap given data as linkers. |
|
|
2555
|
-
|
|
2556
|
-
<a name="LinkedList+classType"></a>
|
|
2557
|
-
|
|
2558
|
-
### linkedList.classType
|
|
2559
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
2560
|
-
|
|
2561
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
2562
|
-
**Overrides**: [<code>classType</code>](#Arrayable+classType)
|
|
2563
|
-
<a name="LinkedList+innerList"></a>
|
|
2564
|
-
|
|
2565
|
-
### linkedList.innerList
|
|
2566
|
-
The first linker of the list (null when the list is empty), from which the whole list is reached.
|
|
2567
|
-
|
|
2568
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
2569
|
-
**Overrides**: [<code>innerList</code>](#Arrayable+innerList)
|
|
2570
|
-
<a name="LinkedList+initialized"></a>
|
|
2571
|
-
|
|
2572
|
-
### linkedList.initialized
|
|
2573
|
-
Whether the inner list has been initialized (it can only be initialized once).
|
|
2574
|
-
|
|
2575
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
2576
|
-
**Overrides**: [<code>initialized</code>](#Arrayable+initialized)
|
|
2577
|
-
<a name="LinkedList+list"></a>
|
|
2578
|
-
|
|
2579
|
-
### linkedList.list ⇒ [<code>Linker</code>](#Linker)
|
|
2580
|
-
Retrieve a copy of the innerList used.
|
|
2581
|
-
|
|
2582
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
2583
|
-
**Overrides**: [<code>list</code>](#Arrayable+list)
|
|
2584
|
-
<a name="LinkedList+first"></a>
|
|
2585
|
-
|
|
2586
|
-
### linkedList.first ⇒ [<code>Linker</code>](#Linker)
|
|
2587
|
-
Retrieve the first Linker in the list.
|
|
2588
|
-
|
|
2589
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
2590
|
-
**Overrides**: [<code>first</code>](#Arrayable+first)
|
|
2591
|
-
<a name="LinkedList+last"></a>
|
|
2592
|
-
|
|
2593
|
-
### linkedList.last ⇒ [<code>Linker</code>](#Linker)
|
|
2594
|
-
Retrieve the last Linker in the list.
|
|
2595
|
-
|
|
2596
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
2597
|
-
**Overrides**: [<code>last</code>](#Arrayable+last)
|
|
2598
|
-
<a name="LinkedList+length"></a>
|
|
2599
|
-
|
|
2600
|
-
### linkedList.length ⇒ <code>number</code>
|
|
2601
|
-
Return the length of the list.
|
|
2602
|
-
|
|
2603
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
2604
|
-
**Overrides**: [<code>length</code>](#Arrayable+length)
|
|
2605
|
-
<a name="LinkedList+initialize"></a>
|
|
2606
|
-
|
|
2607
|
-
### linkedList.initialize(initialList) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
2608
|
-
Initialize the inner list, should only run once.
|
|
2609
|
-
|
|
2610
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
2611
|
-
**Overrides**: [<code>initialize</code>](#Arrayable+initialize)
|
|
2612
|
-
|
|
2613
|
-
| Param | Type | Description |
|
|
2614
|
-
| --- | --- | --- |
|
|
2615
|
-
| initialList | [<code>Linker</code>](#Linker) \| <code>Array</code> | Give the list of linkers to start in this linked-list. |
|
|
2616
|
-
|
|
2617
|
-
<a name="LinkedList+insertAfter"></a>
|
|
2618
|
-
|
|
2619
|
-
### linkedList.insertAfter(node, newNode) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
2620
|
-
Insert a new node (or data) after a node.
|
|
2621
|
-
|
|
2622
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
2623
|
-
**Overrides**: [<code>insertAfter</code>](#Arrayable+insertAfter)
|
|
2624
|
-
|
|
2625
|
-
| Param | Type | Description |
|
|
2626
|
-
| --- | --- | --- |
|
|
2627
|
-
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The existing node as reference |
|
|
2628
|
-
| newNode | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to go after the existing node |
|
|
2629
|
-
|
|
2630
|
-
<a name="LinkedList+insertBefore"></a>
|
|
2631
|
-
|
|
2632
|
-
### linkedList.insertBefore(node, newNode) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
2633
|
-
Insert a new node (or data) before a node.
|
|
2634
|
-
|
|
2635
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
2636
|
-
**Overrides**: [<code>insertBefore</code>](#Arrayable+insertBefore)
|
|
2637
|
-
|
|
2638
|
-
| Param | Type | Description |
|
|
2639
|
-
| --- | --- | --- |
|
|
2640
|
-
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The existing node as reference |
|
|
2641
|
-
| newNode | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to go before the existing node |
|
|
2642
|
-
|
|
2643
|
-
<a name="LinkedList+append"></a>
|
|
2644
|
-
|
|
2645
|
-
### linkedList.append(node, after) ⇒ [<code>Linker</code>](#Linker)
|
|
2646
|
-
Add a node (or data) after the given (or last) node in the list.
|
|
2647
|
-
|
|
2648
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
2649
|
-
**Overrides**: [<code>append</code>](#Arrayable+append)
|
|
2650
|
-
|
|
2651
|
-
| Param | Type | Description |
|
|
2652
|
-
| --- | --- | --- |
|
|
2653
|
-
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to add to the end of the list |
|
|
2654
|
-
| after | [<code>Linker</code>](#Linker) | The existing last node |
|
|
2655
|
-
|
|
2656
|
-
<a name="LinkedList+prepend"></a>
|
|
2657
|
-
|
|
2658
|
-
### linkedList.prepend(node, before) ⇒ [<code>Linker</code>](#Linker)
|
|
2659
|
-
Add a node (or data) before the given (or first) node in the list.
|
|
2660
|
-
|
|
2661
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
2662
|
-
**Overrides**: [<code>prepend</code>](#Arrayable+prepend)
|
|
2663
|
-
|
|
2664
|
-
| Param | Type | Description |
|
|
2665
|
-
| --- | --- | --- |
|
|
2666
|
-
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to add to the start of the list |
|
|
2667
|
-
| before | [<code>Linker</code>](#Linker) | The existing first node |
|
|
2668
|
-
|
|
2669
|
-
<a name="LinkedList+remove"></a>
|
|
2670
|
-
|
|
2671
|
-
### linkedList.remove(node) ⇒ [<code>Linker</code>](#Linker)
|
|
2672
|
-
Remove a linker from this linked list.
|
|
2673
|
-
|
|
2674
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
2675
|
-
**Overrides**: [<code>remove</code>](#Arrayable+remove)
|
|
2676
|
-
|
|
2677
|
-
| Param | Type | Description |
|
|
2678
|
-
| --- | --- | --- |
|
|
2679
|
-
| node | [<code>Linker</code>](#Linker) | The node we wish to remove (and it will be returned after removal) |
|
|
2680
|
-
|
|
2681
|
-
<a name="LinkedList+item"></a>
|
|
2682
|
-
|
|
2683
|
-
### linkedList.item(index) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
|
|
2684
|
-
Retrieve a Linker item from this list by numeric index, otherwise return null.
|
|
2685
|
-
|
|
2686
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
2687
|
-
**Overrides**: [<code>item</code>](#Arrayable+item)
|
|
2688
|
-
|
|
2689
|
-
| Param | Type | Description |
|
|
2690
|
-
| --- | --- | --- |
|
|
2691
|
-
| index | <code>number</code> | The integer number for retrieving a node by position. |
|
|
2692
|
-
|
|
2693
|
-
<a name="LinkedList+forEach"></a>
|
|
2694
|
-
|
|
2695
|
-
### linkedList.forEach(callback, thisArg) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
2696
|
-
Be able to run forEach on this LinkedList to iterate over the linkers.
|
|
2697
|
-
|
|
2698
|
-
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
2699
|
-
**Overrides**: [<code>forEach</code>](#Arrayable+forEach)
|
|
2700
|
-
|
|
2701
|
-
| Param | Type | Description |
|
|
2702
|
-
| --- | --- | --- |
|
|
2703
|
-
| callback | <code>forEachCallback</code> | The function to call for-each linker |
|
|
2704
|
-
| thisArg | [<code>LinkedList</code>](#LinkedList) | Optional, 'this' reference |
|
|
2705
|
-
|
|
2706
|
-
<a name="DoublyLinkedList"></a>
|
|
2707
|
-
|
|
2708
|
-
## DoublyLinkedList ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2709
|
-
Convert an array into a DoublyLinkedList instance, return the new instance.
|
|
2710
|
-
|
|
2711
|
-
**Kind**: global variable
|
|
2712
|
-
|
|
2713
|
-
| Param | Type | Default | Description |
|
|
2714
|
-
| --- | --- | --- | --- |
|
|
2715
|
-
| [values] | <code>Array</code> | <code>[]</code> | An array of values which will be converted to linkers in this doubly-linked-list |
|
|
2716
|
-
| [linkerClass] | <code>IsDoubleLinker</code> | <code>DoubleLinker</code> | The class to use for each linker |
|
|
2717
|
-
| [classType] | <code>IsArrayable.<IsDoubleLinker></code> | <code>LinkedList</code> | Provide the type of IsArrayable to use. |
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
* [DoublyLinkedList](#DoublyLinkedList) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2721
|
-
* [new DoublyLinkedList([linkerClass])](#new_DoublyLinkedList_new)
|
|
2722
|
-
* [.classType](#DoublyLinkedList+classType)
|
|
2723
|
-
* [.innerList](#DoublyLinkedList+innerList)
|
|
2724
|
-
* [.initialized](#DoublyLinkedList+initialized)
|
|
2725
|
-
* [.list](#DoublyLinkedList+list) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2726
|
-
* [.first](#DoublyLinkedList+first) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2727
|
-
* [.last](#DoublyLinkedList+last) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2728
|
-
* [.length](#DoublyLinkedList+length) ⇒ <code>number</code>
|
|
2729
|
-
* [.initialize(initialList)](#DoublyLinkedList+initialize) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2730
|
-
* [.insertAfter(node, newNode)](#DoublyLinkedList+insertAfter) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2731
|
-
* [.insertBefore(node, newNode)](#DoublyLinkedList+insertBefore) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2732
|
-
* [.append(node, after)](#DoublyLinkedList+append) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2733
|
-
* [.prepend(node, before)](#DoublyLinkedList+prepend) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2734
|
-
* [.remove(node)](#DoublyLinkedList+remove) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2735
|
-
* [.reset()](#DoublyLinkedList+reset) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2736
|
-
* [.item(index)](#DoublyLinkedList+item) ⇒ [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code>
|
|
2737
|
-
* [.forEach(callback, thisArg)](#DoublyLinkedList+forEach) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2738
|
-
|
|
2739
|
-
<a name="new_DoublyLinkedList_new"></a>
|
|
2740
|
-
|
|
2741
|
-
### new DoublyLinkedList([linkerClass])
|
|
2742
|
-
Create the new DoublyLinkedList instance.
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
| Param | Type | Default | Description |
|
|
2746
|
-
| --- | --- | --- | --- |
|
|
2747
|
-
| [linkerClass] | [<code>DoubleLinker</code>](#DoubleLinker) | <code>DoubleLinker</code> | The class used to wrap given data as linkers. |
|
|
2748
|
-
|
|
2749
|
-
<a name="DoublyLinkedList+classType"></a>
|
|
2750
|
-
|
|
2751
|
-
### doublyLinkedList.classType
|
|
2752
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
2753
|
-
|
|
2754
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2755
|
-
**Overrides**: [<code>classType</code>](#LinkedList+classType)
|
|
2756
|
-
<a name="DoublyLinkedList+innerList"></a>
|
|
2757
|
-
|
|
2758
|
-
### doublyLinkedList.innerList
|
|
2759
|
-
A linker of the list (null when the list is empty); the head is found by walking back from it.
|
|
2760
|
-
|
|
2761
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2762
|
-
**Overrides**: [<code>innerList</code>](#LinkedList+innerList)
|
|
2763
|
-
<a name="DoublyLinkedList+initialized"></a>
|
|
2764
|
-
|
|
2765
|
-
### doublyLinkedList.initialized
|
|
2766
|
-
Whether the inner list has been initialized (it can only be initialized once).
|
|
2767
|
-
|
|
2768
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2769
|
-
**Overrides**: [<code>initialized</code>](#LinkedList+initialized)
|
|
2770
|
-
<a name="DoublyLinkedList+list"></a>
|
|
2771
|
-
|
|
2772
|
-
### doublyLinkedList.list ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2773
|
-
Retrieve a copy of the innerList used.
|
|
2774
|
-
|
|
2775
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2776
|
-
**Overrides**: [<code>list</code>](#LinkedList+list)
|
|
2777
|
-
<a name="DoublyLinkedList+first"></a>
|
|
2778
|
-
|
|
2779
|
-
### doublyLinkedList.first ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2780
|
-
Retrieve the first DoubleLinker in the list.
|
|
2781
|
-
|
|
2782
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2783
|
-
**Overrides**: [<code>first</code>](#LinkedList+first)
|
|
2784
|
-
<a name="DoublyLinkedList+last"></a>
|
|
2785
|
-
|
|
2786
|
-
### doublyLinkedList.last ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2787
|
-
Retrieve the last DoubleLinker in the list.
|
|
2788
|
-
|
|
2789
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2790
|
-
**Overrides**: [<code>last</code>](#LinkedList+last)
|
|
2791
|
-
<a name="DoublyLinkedList+length"></a>
|
|
2792
|
-
|
|
2793
|
-
### doublyLinkedList.length ⇒ <code>number</code>
|
|
2794
|
-
Return the length of the list.
|
|
2795
|
-
|
|
2796
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2797
|
-
**Overrides**: [<code>length</code>](#LinkedList+length)
|
|
2798
|
-
<a name="DoublyLinkedList+initialize"></a>
|
|
2799
|
-
|
|
2800
|
-
### doublyLinkedList.initialize(initialList) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2801
|
-
Initialize the inner list, should only run once.
|
|
2802
|
-
|
|
2803
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2804
|
-
**Overrides**: [<code>initialize</code>](#LinkedList+initialize)
|
|
2805
|
-
|
|
2806
|
-
| Param | Type | Description |
|
|
2807
|
-
| --- | --- | --- |
|
|
2808
|
-
| initialList | [<code>DoubleLinker</code>](#DoubleLinker) | Give the list of double-linkers to start in this doubly linked-list. |
|
|
2809
|
-
|
|
2810
|
-
<a name="DoublyLinkedList+insertAfter"></a>
|
|
2811
|
-
|
|
2812
|
-
### doublyLinkedList.insertAfter(node, newNode) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2813
|
-
Insert a new node (or data) after a node.
|
|
2814
|
-
|
|
2815
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2816
|
-
**Overrides**: [<code>insertAfter</code>](#LinkedList+insertAfter)
|
|
2817
|
-
|
|
2818
|
-
| Param | Type | Description |
|
|
2819
|
-
| --- | --- | --- |
|
|
2820
|
-
| node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The existing node as reference |
|
|
2821
|
-
| newNode | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to go after the existing node |
|
|
2822
|
-
|
|
2823
|
-
<a name="DoublyLinkedList+insertBefore"></a>
|
|
2824
|
-
|
|
2825
|
-
### doublyLinkedList.insertBefore(node, newNode) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2826
|
-
Insert a new node (or data) before a node.
|
|
2827
|
-
|
|
2828
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2829
|
-
**Overrides**: [<code>insertBefore</code>](#LinkedList+insertBefore)
|
|
2830
|
-
|
|
2831
|
-
| Param | Type | Description |
|
|
2832
|
-
| --- | --- | --- |
|
|
2833
|
-
| node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The existing node as reference |
|
|
2834
|
-
| newNode | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to go before the existing node |
|
|
2835
|
-
|
|
2836
|
-
<a name="DoublyLinkedList+append"></a>
|
|
2837
|
-
|
|
2838
|
-
### doublyLinkedList.append(node, after) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2839
|
-
Add a node (or data) after the given (or last) node in the list.
|
|
2840
|
-
|
|
2841
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2842
|
-
**Overrides**: [<code>append</code>](#LinkedList+append)
|
|
2843
|
-
|
|
2844
|
-
| Param | Type | Description |
|
|
2845
|
-
| --- | --- | --- |
|
|
2846
|
-
| node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to add to the end of the list |
|
|
2847
|
-
| after | [<code>DoubleLinker</code>](#DoubleLinker) | The existing last node |
|
|
2848
|
-
|
|
2849
|
-
<a name="DoublyLinkedList+prepend"></a>
|
|
2850
|
-
|
|
2851
|
-
### doublyLinkedList.prepend(node, before) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2852
|
-
Add a node (or data) before the given (or first) node in the list.
|
|
2853
|
-
|
|
2854
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2855
|
-
**Overrides**: [<code>prepend</code>](#LinkedList+prepend)
|
|
2856
|
-
|
|
2857
|
-
| Param | Type | Description |
|
|
2858
|
-
| --- | --- | --- |
|
|
2859
|
-
| node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to add to the start of the list |
|
|
2860
|
-
| before | [<code>DoubleLinker</code>](#DoubleLinker) | The existing first node |
|
|
2861
|
-
|
|
2862
|
-
<a name="DoublyLinkedList+remove"></a>
|
|
2863
|
-
|
|
2864
|
-
### doublyLinkedList.remove(node) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2865
|
-
Remove a linker from this linked list.
|
|
2866
|
-
|
|
2867
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2868
|
-
**Overrides**: [<code>remove</code>](#LinkedList+remove)
|
|
2869
|
-
|
|
2870
|
-
| Param | Type | Description |
|
|
2871
|
-
| --- | --- | --- |
|
|
2872
|
-
| node | [<code>DoubleLinker</code>](#DoubleLinker) | The node we wish to remove (and it will be returned after removal) |
|
|
2873
|
-
|
|
2874
|
-
<a name="DoublyLinkedList+reset"></a>
|
|
2875
|
-
|
|
2876
|
-
### doublyLinkedList.reset() ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2877
|
-
Refresh all references and return head reference.
|
|
2878
|
-
|
|
2879
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2880
|
-
<a name="DoublyLinkedList+item"></a>
|
|
2881
|
-
|
|
2882
|
-
### doublyLinkedList.item(index) ⇒ [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code>
|
|
2883
|
-
Retrieve a DoubleLinker item from this list by numeric index, otherwise return null.
|
|
2884
|
-
|
|
2885
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2886
|
-
**Overrides**: [<code>item</code>](#LinkedList+item)
|
|
2887
|
-
|
|
2888
|
-
| Param | Type | Description |
|
|
2889
|
-
| --- | --- | --- |
|
|
2890
|
-
| index | <code>number</code> | The integer number for retrieving a node by position. |
|
|
2891
|
-
|
|
2892
|
-
<a name="DoublyLinkedList+forEach"></a>
|
|
2893
|
-
|
|
2894
|
-
### doublyLinkedList.forEach(callback, thisArg) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2895
|
-
Be able to run forEach on this DoublyLinkedList to iterate over the DoubleLinker Items.
|
|
2896
|
-
|
|
2897
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
2898
|
-
**Overrides**: [<code>forEach</code>](#LinkedList+forEach)
|
|
2899
|
-
**Returns**: [<code>DoublyLinkedList</code>](#DoublyLinkedList) - The list which was iterated.
|
|
2900
|
-
|
|
2901
|
-
| Param | Type | Description |
|
|
2902
|
-
| --- | --- | --- |
|
|
2903
|
-
| callback | <code>forEachCallback</code> | The function to call for-each double linker |
|
|
2904
|
-
| thisArg | [<code>DoublyLinkedList</code>](#DoublyLinkedList) | Optional, 'this' reference |
|
|
2905
|
-
|
|
2906
|
-
<a name="DoubleLinker"></a>
|
|
2907
|
-
|
|
2908
|
-
## DoubleLinker ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2909
|
-
Make a new DoubleLinker from the data given if it is not already a valid Linker.
|
|
2910
|
-
|
|
2911
|
-
**Kind**: global variable
|
|
2912
|
-
|
|
2913
|
-
| Param | Type | Default | Description |
|
|
2914
|
-
| --- | --- | --- | --- |
|
|
2915
|
-
| linker | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | | Return a valid Linker instance from given data, or even an already valid one. |
|
|
2916
|
-
| [classType] | <code>IsDoubleLinker</code> | <code>DoubleLinker</code> | Provide the type of IsDoubleLinker to use. |
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
* [DoubleLinker](#DoubleLinker) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2920
|
-
* [new DoubleLinker([nodeData])](#new_DoubleLinker_new)
|
|
2921
|
-
* _instance_
|
|
2922
|
-
* [.classType](#DoubleLinker+classType)
|
|
2923
|
-
* [.data](#DoubleLinker+data)
|
|
2924
|
-
* [.next](#DoubleLinker+next)
|
|
2925
|
-
* [.prev](#DoubleLinker+prev)
|
|
2926
|
-
* _static_
|
|
2927
|
-
* [.fromArray([values], [classType])](#DoubleLinker.fromArray) ⇒ <code>Object</code>
|
|
2928
|
-
|
|
2929
|
-
<a name="new_DoubleLinker_new"></a>
|
|
2930
|
-
|
|
2931
|
-
### new DoubleLinker([nodeData])
|
|
2932
|
-
Create the new DoubleLinker instance, provide the data and optionally the next and prev references.
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
| Param | Type | Default | Description |
|
|
2936
|
-
| --- | --- | --- | --- |
|
|
2937
|
-
| [nodeData] | <code>Object</code> | <code>{}</code> | The settings for the new linker. |
|
|
2938
|
-
| [nodeData.data] | <code>\*</code> | <code></code> | The data to be stored in this linker |
|
|
2939
|
-
| [nodeData.next] | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code> | <code></code> | The reference to the next linker if any |
|
|
2940
|
-
| [nodeData.prev] | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code> | <code></code> | The reference to the previous linker if any |
|
|
2941
|
-
|
|
2942
|
-
<a name="DoubleLinker+classType"></a>
|
|
2943
|
-
|
|
2944
|
-
### doubleLinker.classType
|
|
2945
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
2946
|
-
|
|
2947
|
-
**Kind**: instance property of [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2948
|
-
**Overrides**: [<code>classType</code>](#Linker+classType)
|
|
2949
|
-
<a name="DoubleLinker+data"></a>
|
|
2950
|
-
|
|
2951
|
-
### doubleLinker.data
|
|
2952
|
-
The data stored in this linker.
|
|
2953
|
-
|
|
2954
|
-
**Kind**: instance property of [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2955
|
-
**Overrides**: [<code>data</code>](#Linker+data)
|
|
2956
|
-
<a name="DoubleLinker+next"></a>
|
|
2957
|
-
|
|
2958
|
-
### doubleLinker.next
|
|
2959
|
-
The linker after this one, or null when this is the last.
|
|
2960
|
-
|
|
2961
|
-
**Kind**: instance property of [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2962
|
-
**Overrides**: [<code>next</code>](#Linker+next)
|
|
2963
|
-
<a name="DoubleLinker+prev"></a>
|
|
2964
|
-
|
|
2965
|
-
### doubleLinker.prev
|
|
2966
|
-
The linker before this one, or null when this is the first.
|
|
2967
|
-
|
|
2968
|
-
**Kind**: instance property of [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2969
|
-
<a name="DoubleLinker.fromArray"></a>
|
|
2970
|
-
|
|
2971
|
-
### DoubleLinker.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
2972
|
-
Convert an array into DoubleLinker instances, return the head and tail DoubleLinkers.
|
|
2973
|
-
|
|
2974
|
-
**Kind**: static method of [<code>DoubleLinker</code>](#DoubleLinker)
|
|
2975
|
-
|
|
2976
|
-
| Param | Type | Default | Description |
|
|
2977
|
-
| --- | --- | --- | --- |
|
|
2978
|
-
| [values] | <code>Array</code> | <code>[]</code> | Provide an array of data that will be converted to a chain of linkers. |
|
|
2979
|
-
| [classType] | <code>IsDoubleLinker</code> | <code>DoubleLinker</code> | Provide the type of IsDoubleLinker to use. |
|
|
2980
|
-
|
|
2981
|
-
<a name="Arrayable"></a>
|
|
2982
|
-
|
|
2983
|
-
## Arrayable ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
2984
|
-
Convert an array to an Arrayable.
|
|
2985
|
-
|
|
2986
|
-
**Kind**: global variable
|
|
2987
|
-
|
|
2988
|
-
| Param | Type | Default | Description |
|
|
2989
|
-
| --- | --- | --- | --- |
|
|
2990
|
-
| values | <code>Array</code> | | An array of values which will be converted to elements in this arrayable |
|
|
2991
|
-
| [elementClass] | <code>IsElement</code> | <code>ArrayElement</code> | The class to use for each element |
|
|
2992
|
-
| [classType] | [<code>IsArrayable.<ArrayElement></code>](#ArrayElement) | <code>Arrayable</code> | Provide the type of IsArrayable to use. |
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
* [Arrayable](#Arrayable) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
2996
|
-
* [new Arrayable([elementClass])](#new_Arrayable_new)
|
|
2997
|
-
* [.classType](#Arrayable+classType)
|
|
2998
|
-
* [.innerList](#Arrayable+innerList)
|
|
2999
|
-
* [.initialized](#Arrayable+initialized)
|
|
3000
|
-
* [.list](#Arrayable+list) ⇒ [<code>Array.<ArrayElement></code>](#ArrayElement)
|
|
3001
|
-
* [.first](#Arrayable+first) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
3002
|
-
* [.last](#Arrayable+last) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
3003
|
-
* [.length](#Arrayable+length) ⇒ <code>number</code>
|
|
3004
|
-
* [.initialize(initialList)](#Arrayable+initialize) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
3005
|
-
* [.insertAfter(node, newNode)](#Arrayable+insertAfter) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
3006
|
-
* [.insertBefore(node, newNode)](#Arrayable+insertBefore) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
3007
|
-
* [.append(node, after)](#Arrayable+append) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
3008
|
-
* [.prepend(node, before)](#Arrayable+prepend) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
3009
|
-
* [.remove(node)](#Arrayable+remove) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
3010
|
-
* [.item(index)](#Arrayable+item) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
|
|
3011
|
-
* [.forEach(callback, thisArg)](#Arrayable+forEach) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
3012
|
-
|
|
3013
|
-
<a name="new_Arrayable_new"></a>
|
|
3014
|
-
|
|
3015
|
-
### new Arrayable([elementClass])
|
|
3016
|
-
Create the new Arrayable instance, configure the Arrayable class.
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
| Param | Type | Default | Description |
|
|
3020
|
-
| --- | --- | --- | --- |
|
|
3021
|
-
| [elementClass] | [<code>ArrayElement</code>](#ArrayElement) | <code>ArrayElement</code> | The class used to wrap given data as elements. |
|
|
3022
|
-
|
|
3023
|
-
<a name="Arrayable+classType"></a>
|
|
3024
|
-
|
|
3025
|
-
### arrayable.classType
|
|
3026
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
3027
|
-
|
|
3028
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
3029
|
-
<a name="Arrayable+innerList"></a>
|
|
3030
|
-
|
|
3031
|
-
### arrayable.innerList
|
|
3032
|
-
The array which stores the elements of this Arrayable.
|
|
3033
|
-
|
|
3034
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
3035
|
-
<a name="Arrayable+initialized"></a>
|
|
3036
|
-
|
|
3037
|
-
### arrayable.initialized
|
|
3038
|
-
Whether the inner list has been initialized (it can only be initialized once).
|
|
3039
|
-
|
|
3040
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
3041
|
-
<a name="Arrayable+list"></a>
|
|
3042
|
-
|
|
3043
|
-
### arrayable.list ⇒ [<code>Array.<ArrayElement></code>](#ArrayElement)
|
|
3044
|
-
Retrieve a copy of the innerList used.
|
|
3045
|
-
|
|
3046
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
3047
|
-
<a name="Arrayable+first"></a>
|
|
3048
|
-
|
|
3049
|
-
### arrayable.first ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
3050
|
-
Retrieve the first Element from the Arrayable
|
|
3051
|
-
|
|
3052
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
3053
|
-
<a name="Arrayable+last"></a>
|
|
3054
|
-
|
|
3055
|
-
### arrayable.last ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
3056
|
-
Retrieve the last Element from the Arrayable
|
|
3057
|
-
|
|
3058
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
3059
|
-
<a name="Arrayable+length"></a>
|
|
3060
|
-
|
|
3061
|
-
### arrayable.length ⇒ <code>number</code>
|
|
3062
|
-
Return the length of the list.
|
|
3063
|
-
|
|
3064
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
3065
|
-
<a name="Arrayable+initialize"></a>
|
|
3066
|
-
|
|
3067
|
-
### arrayable.initialize(initialList) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
3068
|
-
Initialize the inner list, should only run once.
|
|
3069
|
-
|
|
3070
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
3071
|
-
|
|
3072
|
-
| Param | Type | Description |
|
|
3073
|
-
| --- | --- | --- |
|
|
3074
|
-
| initialList | [<code>Array.<ArrayElement></code>](#ArrayElement) | Give the array of elements to start in this Arrayable. |
|
|
3075
|
-
|
|
3076
|
-
<a name="Arrayable+insertAfter"></a>
|
|
3077
|
-
|
|
3078
|
-
### arrayable.insertAfter(node, newNode) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
3079
|
-
Insert a new node (or data) after a node.
|
|
3080
|
-
|
|
3081
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
3082
|
-
|
|
3083
|
-
| Param | Type | Description |
|
|
3084
|
-
| --- | --- | --- |
|
|
3085
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The existing node as reference |
|
|
3086
|
-
| newNode | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to go after the existing node |
|
|
3087
|
-
|
|
3088
|
-
<a name="Arrayable+insertBefore"></a>
|
|
3089
|
-
|
|
3090
|
-
### arrayable.insertBefore(node, newNode) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
3091
|
-
Insert a new node (or data) before a node.
|
|
3092
|
-
|
|
3093
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
3094
|
-
|
|
3095
|
-
| Param | Type | Description |
|
|
3096
|
-
| --- | --- | --- |
|
|
3097
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The existing node as reference |
|
|
3098
|
-
| newNode | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to go before the existing node |
|
|
3099
|
-
|
|
3100
|
-
<a name="Arrayable+append"></a>
|
|
3101
|
-
|
|
3102
|
-
### arrayable.append(node, after) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
3103
|
-
Add a node (or data) after the given (or last) node in the list.
|
|
3104
|
-
|
|
3105
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
3106
|
-
|
|
3107
|
-
| Param | Type | Description |
|
|
3108
|
-
| --- | --- | --- |
|
|
3109
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to add to the end of the list |
|
|
3110
|
-
| after | [<code>ArrayElement</code>](#ArrayElement) | The existing last node |
|
|
3111
|
-
|
|
3112
|
-
<a name="Arrayable+prepend"></a>
|
|
3113
|
-
|
|
3114
|
-
### arrayable.prepend(node, before) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
3115
|
-
Add a node (or data) before the given (or first) node in the list.
|
|
3116
|
-
|
|
3117
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
3118
|
-
|
|
3119
|
-
| Param | Type | Description |
|
|
3120
|
-
| --- | --- | --- |
|
|
3121
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to add to the start of the list |
|
|
3122
|
-
| before | [<code>ArrayElement</code>](#ArrayElement) | The existing first node |
|
|
3123
|
-
|
|
3124
|
-
<a name="Arrayable+remove"></a>
|
|
3125
|
-
|
|
3126
|
-
### arrayable.remove(node) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
3127
|
-
Remove an element from this arrayable.
|
|
3128
|
-
|
|
3129
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
3130
|
-
|
|
3131
|
-
| Param | Type | Description |
|
|
3132
|
-
| --- | --- | --- |
|
|
3133
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) | The node we wish to remove (and it will be returned after removal) |
|
|
3134
|
-
|
|
3135
|
-
<a name="Arrayable+item"></a>
|
|
3136
|
-
|
|
3137
|
-
### arrayable.item(index) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
|
|
3138
|
-
Retrieve an ArrayElement item from this list by numeric index, otherwise return null.
|
|
3139
|
-
|
|
3140
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
3141
|
-
|
|
3142
|
-
| Param | Type | Description |
|
|
3143
|
-
| --- | --- | --- |
|
|
3144
|
-
| index | <code>number</code> | The integer number for retrieving a node by position. |
|
|
3145
|
-
|
|
3146
|
-
<a name="Arrayable+forEach"></a>
|
|
3147
|
-
|
|
3148
|
-
### arrayable.forEach(callback, thisArg) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
3149
|
-
Be able to run forEach on this Arrayable to iterate over the elements.
|
|
3150
|
-
|
|
3151
|
-
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
3152
|
-
|
|
3153
|
-
| Param | Type | Description |
|
|
3154
|
-
| --- | --- | --- |
|
|
3155
|
-
| callback | <code>forEachCallback</code> | The function to call for-each element |
|
|
3156
|
-
| thisArg | [<code>Arrayable</code>](#Arrayable) | Optional, 'this' reference |
|
|
3157
|
-
|
|
3158
|
-
<a name="ArrayElement"></a>
|
|
3159
|
-
|
|
3160
|
-
## ArrayElement ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
3161
|
-
Make a new Element from the data given if it is not already a valid Element.
|
|
3162
|
-
|
|
3163
|
-
**Kind**: global variable
|
|
3164
|
-
|
|
3165
|
-
| Param | Type | Default | Description |
|
|
3166
|
-
| --- | --- | --- | --- |
|
|
3167
|
-
| element | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | | Return a valid ArrayElement instance from given data, or even an already valid one. |
|
|
3168
|
-
| [classType] | <code>IsElement</code> | <code>ArrayElement</code> | Provide the type of IsElement to use. |
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
* [ArrayElement](#ArrayElement) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
3172
|
-
* [new ArrayElement([data])](#new_ArrayElement_new)
|
|
3173
|
-
* _instance_
|
|
3174
|
-
* [.classType](#ArrayElement+classType)
|
|
3175
|
-
* [.data](#ArrayElement+data)
|
|
3176
|
-
* _static_
|
|
3177
|
-
* [.fromArray([values], [classType])](#ArrayElement.fromArray) ⇒ <code>Object</code>
|
|
3178
|
-
|
|
3179
|
-
<a name="new_ArrayElement_new"></a>
|
|
3180
|
-
|
|
3181
|
-
### new ArrayElement([data])
|
|
3182
|
-
Create the new Element instance, provide the data and optionally configure the type of Element.
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
| Param | Type | Default | Description |
|
|
3186
|
-
| --- | --- | --- | --- |
|
|
3187
|
-
| [data] | <code>\*</code> | <code></code> | The data to be stored in this element. |
|
|
3188
|
-
|
|
3189
|
-
<a name="ArrayElement+classType"></a>
|
|
3190
|
-
|
|
3191
|
-
### arrayElement.classType
|
|
3192
|
-
The class used to create this instance, so that it can be recognized as valid without an instanceof check.
|
|
3193
|
-
|
|
3194
|
-
**Kind**: instance property of [<code>ArrayElement</code>](#ArrayElement)
|
|
3195
|
-
<a name="ArrayElement+data"></a>
|
|
3196
|
-
|
|
3197
|
-
### arrayElement.data
|
|
3198
|
-
The data stored in this element.
|
|
3199
|
-
|
|
3200
|
-
**Kind**: instance property of [<code>ArrayElement</code>](#ArrayElement)
|
|
3201
|
-
<a name="ArrayElement.fromArray"></a>
|
|
3202
|
-
|
|
3203
|
-
### ArrayElement.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
3204
|
-
Convert an array into Element instances, return the head and tail Elements.
|
|
3205
|
-
|
|
3206
|
-
**Kind**: static method of [<code>ArrayElement</code>](#ArrayElement)
|
|
3207
|
-
|
|
3208
|
-
| Param | Type | Default | Description |
|
|
3209
|
-
| --- | --- | --- | --- |
|
|
3210
|
-
| [values] | <code>Array.<IsElement></code> | <code>[]</code> | Provide an array of data that will be converted to array of elements. |
|
|
3211
|
-
| [classType] | <code>IsElement</code> | <code>ArrayElement</code> | Provide the type of IsElement to use. |
|
|
3212
|
-
|
|
3213
|
-
<a name="services"></a>
|
|
3214
|
-
|
|
3215
|
-
## services
|
|
3216
|
-
List helpful functions when dealing with collections.
|
|
3217
|
-
|
|
3218
|
-
**Kind**: global constant
|
|
3219
|
-
<a name="recipes"></a>
|
|
3220
|
-
|
|
3221
|
-
## recipes
|
|
3222
|
-
List of class declarations that can be used to specify attributes for a style of object / class.
|
|
3223
|
-
|
|
3224
|
-
**Kind**: global constant
|
|
3225
|
-
<a name="parseTreeNext"></a>
|
|
3226
|
-
|
|
3227
|
-
## parseTreeNext(treeNode) ⇒ <code>IsTreeNode</code> \| <code>null</code>
|
|
3228
|
-
Be able to parse over every node in a tree.
|
|
3229
|
-
1. Start at root (get root parent)
|
|
3230
|
-
2. Get first child (repeat until no children)
|
|
3231
|
-
3. Check next child
|
|
3232
|
-
4. Repeat 2
|
|
3233
|
-
5. Repeat 3
|
|
3234
|
-
6. If no next child, return to parent and repeat 3
|
|
3235
|
-
7. Stop at root (next is null and parent is null
|
|
3236
|
-
|
|
3237
|
-
**Kind**: global function
|
|
3238
|
-
|
|
3239
|
-
| Param | Type | Description |
|
|
3240
|
-
| --- | --- | --- |
|
|
3241
|
-
| treeNode | <code>IsTreeNode</code> | Provide a node in a tree and get the next node (left-first approach) |
|
|
3242
|
-
|
|
3243
|
-
<a name="parseTree"></a>
|
|
3244
|
-
|
|
3245
|
-
## parseTree(tree, callback) ⇒ <code>IsArrayable.<IsTreeNode></code>
|
|
3246
|
-
Loop over all the nodes in a tree starting from left and apply a callback for each
|
|
3247
|
-
|
|
3248
|
-
**Kind**: global function
|
|
3249
|
-
|
|
3250
|
-
| Param | Type |
|
|
31
|
+
| Module | What it holds |
|
|
3251
32
|
| --- | --- |
|
|
3252
|
-
|
|
|
3253
|
-
|
|
|
3254
|
-
|
|
33
|
+
| `collections` | The collection classes: `Arrayable`/`ArrayElement`, `LinkedList`/`Linker`, `DoublyLinkedList`/`DoubleLinker`, `LinkedTreeList`/`TreeLinker`, `Queue`/`Queueable`/`TaskQueue`, `Stack`/`Stackable`/`TaskStack`, `ScopedCollection` |
|
|
34
|
+
| `recipes` | The `Is*` interfaces each collection implements (including `IsScopedCollection`), their iterators, and `Runnable` |
|
|
35
|
+
| `services` | Tree-walking helpers (`parseTree`, `parseTreeNext`) and other collection-agnostic utilities |
|
|
36
|
+
|
|
37
|
+
## Development
|
|
38
|
+
|
|
39
|
+
```shell
|
|
40
|
+
npm install
|
|
41
|
+
npm test # the tests
|
|
42
|
+
npm run typecheck # the types
|
|
43
|
+
npm run build # dist/, browser/ and docs/
|
|
44
|
+
npm run docs # only the documentation
|
|
45
|
+
```
|