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