collect-your-stuff 1.0.0 → 1.1.1
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 +557 -738
- package/browser/collect-your-stuff.js +19009 -18671
- package/browser/collect-your-stuff.min.js +1 -1
- package/dist/collections/arrayable/ArrayElement.d.ts +37 -0
- package/dist/collections/arrayable/ArrayElement.js +42 -66
- package/dist/collections/arrayable/ArrayElement.min.js +1 -1
- package/dist/collections/arrayable/Arrayable.d.ts +109 -0
- package/dist/collections/arrayable/Arrayable.js +133 -190
- package/dist/collections/arrayable/Arrayable.min.js +1 -1
- package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +47 -0
- package/dist/collections/doubly-linked-list/DoubleLinker.js +77 -0
- package/dist/collections/doubly-linked-list/DoubleLinker.min.js +1 -0
- package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +114 -0
- package/dist/collections/doubly-linked-list/DoublyLinkedList.js +275 -0
- package/dist/collections/doubly-linked-list/DoublyLinkedList.min.js +1 -0
- package/dist/collections/linked-list/LinkedList.d.ts +110 -0
- package/dist/collections/linked-list/LinkedList.js +99 -114
- package/dist/collections/linked-list/LinkedList.min.js +1 -1
- package/dist/collections/linked-list/Linker.d.ts +44 -0
- package/dist/collections/linked-list/Linker.js +55 -68
- package/dist/collections/linked-list/Linker.min.js +1 -1
- package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +136 -0
- package/dist/collections/linked-tree-list/LinkedTreeList.js +203 -38
- package/dist/collections/linked-tree-list/LinkedTreeList.min.js +1 -1
- package/dist/collections/linked-tree-list/TreeLinker.d.ts +62 -0
- package/dist/collections/linked-tree-list/TreeLinker.js +65 -92
- package/dist/collections/linked-tree-list/TreeLinker.min.js +1 -1
- package/dist/collections/queue/Queue.d.ts +64 -0
- package/dist/collections/queue/Queue.js +57 -83
- package/dist/collections/queue/Queue.min.js +1 -1
- package/dist/collections/queue/Queueable.d.ts +78 -0
- package/dist/collections/queue/Queueable.js +69 -98
- package/dist/collections/queue/Queueable.min.js +1 -1
- package/dist/collections/stack/Stack.d.ts +64 -0
- package/dist/collections/stack/Stack.js +48 -76
- package/dist/collections/stack/Stack.min.js +1 -1
- package/dist/collections/stack/Stackable.d.ts +57 -0
- package/dist/collections/stack/Stackable.js +34 -29
- package/dist/collections/stack/Stackable.min.js +1 -1
- package/dist/main.d.ts +40 -0
- package/dist/main.js +18 -11
- package/dist/main.min.js +1 -1
- package/dist/recipes/ArrayIterator.d.ts +11 -0
- package/dist/recipes/ArrayIterator.js +30 -0
- package/dist/recipes/ArrayIterator.min.js +1 -0
- package/dist/recipes/DoubleLinkerIterator.d.ts +10 -0
- package/dist/recipes/DoubleLinkerIterator.js +24 -0
- package/dist/recipes/DoubleLinkerIterator.min.js +1 -0
- package/dist/recipes/IsArrayable.d.ts +105 -0
- package/dist/recipes/IsArrayable.js +5 -0
- package/dist/recipes/IsArrayable.min.js +1 -0
- package/dist/recipes/IsDoubleLinker.d.ts +14 -0
- package/dist/recipes/IsDoubleLinker.js +5 -0
- package/dist/recipes/IsDoubleLinker.min.js +1 -0
- package/dist/recipes/IsElement.d.ts +14 -0
- package/dist/recipes/IsElement.js +5 -0
- package/dist/recipes/IsElement.min.js +1 -0
- package/dist/recipes/IsLinker.d.ts +10 -0
- package/dist/recipes/IsLinker.js +5 -0
- package/dist/recipes/IsLinker.min.js +1 -0
- package/dist/recipes/IsTree.d.ts +11 -0
- package/dist/recipes/IsTree.js +5 -0
- package/dist/recipes/IsTree.min.js +1 -0
- package/dist/recipes/IsTreeNode.d.ts +29 -0
- package/dist/recipes/IsTreeNode.js +5 -0
- package/dist/recipes/IsTreeNode.min.js +1 -0
- package/dist/recipes/LinkerIterator.d.ts +10 -0
- package/dist/recipes/LinkerIterator.js +24 -0
- package/dist/recipes/LinkerIterator.min.js +1 -0
- package/dist/recipes/Runnable.d.ts +54 -0
- package/dist/recipes/Runnable.js +40 -38
- package/dist/recipes/Runnable.min.js +1 -1
- package/dist/recipes/TreeLinkerIterator.d.ts +10 -0
- package/dist/recipes/TreeLinkerIterator.js +26 -0
- package/dist/recipes/TreeLinkerIterator.min.js +1 -0
- package/dist/recipes/recipes.d.ts +16 -0
- package/dist/recipes/recipes.js +2 -1
- package/dist/recipes/recipes.min.js +1 -1
- package/dist/services/parseTree.d.ts +10 -0
- package/dist/services/parseTree.js +25 -0
- package/dist/services/parseTree.min.js +1 -0
- package/dist/services/parseTreeNext.d.ts +15 -0
- package/dist/services/parseTreeNext.js +47 -0
- package/dist/services/parseTreeNext.min.js +1 -0
- package/dist/services/services.d.ts +14 -0
- package/dist/services/services.js +24 -0
- package/dist/services/services.min.js +1 -0
- package/package.json +3 -2
- package/dist/collections/doubly-linked-llist/DoubleLinker.js +0 -90
- package/dist/collections/doubly-linked-llist/DoubleLinker.min.js +0 -1
- package/dist/collections/doubly-linked-llist/DoublyLinkedList.js +0 -234
- package/dist/collections/doubly-linked-llist/DoublyLinkedList.min.js +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Collect your stuff (and go)
|
|
1
|
+
# Collect your stuff (and go)!
|
|
2
2
|
|
|
3
3
|
Data allocation and manipulation.
|
|
4
4
|
|
|
@@ -13,10 +13,22 @@ Data allocation and manipulation.
|
|
|
13
13
|
## Classes
|
|
14
14
|
|
|
15
15
|
<dl>
|
|
16
|
+
<dt><a href="#TreeLinkerIterator">TreeLinkerIterator</a></dt>
|
|
17
|
+
<dd><p>Class TreeLinkerIterator returns the next value taking a left-first approach down a tree.</p>
|
|
18
|
+
</dd>
|
|
16
19
|
<dt><a href="#Runnable">Runnable</a></dt>
|
|
17
20
|
<dd><p>Identify a class that can be run.</p>
|
|
18
21
|
</dd>
|
|
19
|
-
<dt><a href="#
|
|
22
|
+
<dt><a href="#LinkerIterator">LinkerIterator</a></dt>
|
|
23
|
+
<dd><p>Class LinkerIterator returns the next value when using linkers of linked type lists.</p>
|
|
24
|
+
</dd>
|
|
25
|
+
<dt><a href="#DoubleLinkerIterator">DoubleLinkerIterator</a></dt>
|
|
26
|
+
<dd><p>Class DoubleLinkerIterator returns the next value when using linkers of linked type lists.</p>
|
|
27
|
+
</dd>
|
|
28
|
+
<dt><a href="#ArrayIterator">ArrayIterator</a></dt>
|
|
29
|
+
<dd><p>Class ArrayIterator returns the next value when using elements of array type list.</p>
|
|
30
|
+
</dd>
|
|
31
|
+
<dt><a href="#Stackable">Stackable</a> ⇐ <code><a href="#Linker">Linker</a></code></dt>
|
|
20
32
|
<dd><p>Stackable represents a runnable entry in stack.</p>
|
|
21
33
|
</dd>
|
|
22
34
|
<dt><a href="#Stack">Stack</a></dt>
|
|
@@ -29,10 +41,10 @@ Data allocation and manipulation.
|
|
|
29
41
|
<dd><p>Maintain a series of queued items.</p>
|
|
30
42
|
</dd>
|
|
31
43
|
<dt><a href="#TreeLinker">TreeLinker</a> ⇐ <code><a href="#DoubleLinker">DoubleLinker</a></code></dt>
|
|
32
|
-
<dd><p>TreeLinker represents a node in a LinkedTreeList.</p>
|
|
44
|
+
<dd><p>TreeLinker represents a node in a LinkedTreeList having a parent (or root) and child nodes.</p>
|
|
33
45
|
</dd>
|
|
34
46
|
<dt><a href="#LinkedTreeList">LinkedTreeList</a> ⇐ <code><a href="#DoublyLinkedList">DoublyLinkedList</a></code></dt>
|
|
35
|
-
<dd><p>LinkedTreeList represents a collection stored with a root and spreading in branching (tree) formation
|
|
47
|
+
<dd><p>LinkedTreeList represents a collection stored with a root and spreading in branching (tree) formation.</p>
|
|
36
48
|
</dd>
|
|
37
49
|
<dt><a href="#Linker">Linker</a> ⇐ <code><a href="#ArrayElement">ArrayElement</a></code></dt>
|
|
38
50
|
<dd><p>Linker represents a node in a LinkedList.</p>
|
|
@@ -44,10 +56,10 @@ Data allocation and manipulation.
|
|
|
44
56
|
<dd><p>DoublyLinkedList represents a collection stored as a LinkedList with prev and next references.</p>
|
|
45
57
|
</dd>
|
|
46
58
|
<dt><a href="#DoubleLinker">DoubleLinker</a> ⇐ <code><a href="#Linker">Linker</a></code></dt>
|
|
47
|
-
<dd><p>DoubleLinker represents a node in a DoublyLinkedList.</p>
|
|
59
|
+
<dd><p>DoubleLinker represents a node in a DoublyLinkedList which is chained by next and prev.</p>
|
|
48
60
|
</dd>
|
|
49
61
|
<dt><a href="#Arrayable">Arrayable</a></dt>
|
|
50
|
-
<dd><p>
|
|
62
|
+
<dd><p>Arrayable represents a collection stored as an array.</p>
|
|
51
63
|
</dd>
|
|
52
64
|
<dt><a href="#ArrayElement">ArrayElement</a></dt>
|
|
53
65
|
<dd><p>Element represents a node in an Arrayable.</p>
|
|
@@ -57,19 +69,31 @@ Data allocation and manipulation.
|
|
|
57
69
|
## Constants
|
|
58
70
|
|
|
59
71
|
<dl>
|
|
60
|
-
<dt><a href="#
|
|
72
|
+
<dt><a href="#services">services</a></dt>
|
|
73
|
+
<dd><p>List helpful functions when dealing with collections.</p>
|
|
74
|
+
</dd>
|
|
75
|
+
<dt><a href="#recipes">recipes</a></dt>
|
|
61
76
|
<dd><p>List of class declarations that can be used to specify attributes for a style of object / class.</p>
|
|
62
77
|
</dd>
|
|
63
78
|
</dl>
|
|
64
79
|
|
|
65
|
-
##
|
|
80
|
+
## Functions
|
|
66
81
|
|
|
67
82
|
<dl>
|
|
68
|
-
<dt><a href="#
|
|
69
|
-
<dd><p>
|
|
83
|
+
<dt><a href="#parseTreeNext">parseTreeNext(treeNode)</a> ⇒ <code>IsTreeNode</code> | <code>null</code></dt>
|
|
84
|
+
<dd><p>Be able to parse over every node in a tree.</p>
|
|
85
|
+
<ol>
|
|
86
|
+
<li>Start at root (get root parent)</li>
|
|
87
|
+
<li>Get first child (repeat until no children)</li>
|
|
88
|
+
<li>Check next child</li>
|
|
89
|
+
<li>Repeat 2</li>
|
|
90
|
+
<li>Repeat 3</li>
|
|
91
|
+
<li>If no next child, return to parent and repeat 3</li>
|
|
92
|
+
<li>Stop at root (next is null and parent is null</li>
|
|
93
|
+
</ol>
|
|
70
94
|
</dd>
|
|
71
|
-
<dt><a href="#
|
|
72
|
-
<dd><p>
|
|
95
|
+
<dt><a href="#parseTree">parseTree(tree, callback)</a> ⇒ <code>IsArrayable.<IsTreeNode></code></dt>
|
|
96
|
+
<dd><p>Loop over all the nodes in a tree starting from left and apply a callback for each</p>
|
|
73
97
|
</dd>
|
|
74
98
|
</dl>
|
|
75
99
|
|
|
@@ -82,10 +106,16 @@ All of the collections available.
|
|
|
82
106
|
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
83
107
|
<a name="module_collect-your-stuff..collectYourStuff"></a>
|
|
84
108
|
|
|
85
|
-
### collect-your-stuff~collectYourStuff
|
|
109
|
+
### collect-your-stuff~collectYourStuff
|
|
86
110
|
All methods exported from this module are encapsulated within collect-your-stuff.
|
|
87
111
|
|
|
88
|
-
**Kind**: inner
|
|
112
|
+
**Kind**: inner constant of [<code>collect-your-stuff</code>](#module_collect-your-stuff)
|
|
113
|
+
<a name="TreeLinkerIterator"></a>
|
|
114
|
+
|
|
115
|
+
## TreeLinkerIterator
|
|
116
|
+
Class TreeLinkerIterator returns the next value taking a left-first approach down a tree.
|
|
117
|
+
|
|
118
|
+
**Kind**: global class
|
|
89
119
|
<a name="Runnable"></a>
|
|
90
120
|
|
|
91
121
|
## Runnable
|
|
@@ -94,12 +124,23 @@ Identify a class that can be run.
|
|
|
94
124
|
**Kind**: global class
|
|
95
125
|
|
|
96
126
|
* [Runnable](#Runnable)
|
|
127
|
+
* [new Runnable(data)](#new_Runnable_new)
|
|
97
128
|
* _instance_
|
|
98
129
|
* [.task](#Runnable+task) ⇒ <code>function</code>
|
|
99
130
|
* [.run()](#Runnable+run) ⇒ <code>\*</code>
|
|
100
131
|
* _static_
|
|
101
132
|
* [.isRunnable(thing)](#Runnable.isRunnable) ⇒ <code>boolean</code>
|
|
102
133
|
|
|
134
|
+
<a name="new_Runnable_new"></a>
|
|
135
|
+
|
|
136
|
+
### new Runnable(data)
|
|
137
|
+
Instantiate a Runnable class.
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
| Param | Type |
|
|
141
|
+
| --- | --- |
|
|
142
|
+
| data | <code>\*</code> |
|
|
143
|
+
|
|
103
144
|
<a name="Runnable+task"></a>
|
|
104
145
|
|
|
105
146
|
### runnable.task ⇒ <code>function</code>
|
|
@@ -123,34 +164,53 @@ Check if a given thing is Runnable
|
|
|
123
164
|
| --- | --- |
|
|
124
165
|
| thing | <code>\*</code> |
|
|
125
166
|
|
|
167
|
+
<a name="LinkerIterator"></a>
|
|
168
|
+
|
|
169
|
+
## LinkerIterator
|
|
170
|
+
Class LinkerIterator returns the next value when using linkers of linked type lists.
|
|
171
|
+
|
|
172
|
+
**Kind**: global class
|
|
173
|
+
<a name="DoubleLinkerIterator"></a>
|
|
174
|
+
|
|
175
|
+
## DoubleLinkerIterator
|
|
176
|
+
Class DoubleLinkerIterator returns the next value when using linkers of linked type lists.
|
|
177
|
+
|
|
178
|
+
**Kind**: global class
|
|
179
|
+
<a name="ArrayIterator"></a>
|
|
180
|
+
|
|
181
|
+
## ArrayIterator
|
|
182
|
+
Class ArrayIterator returns the next value when using elements of array type list.
|
|
183
|
+
|
|
184
|
+
**Kind**: global class
|
|
126
185
|
<a name="Stackable"></a>
|
|
127
186
|
|
|
128
|
-
## Stackable ⇐ [<code>
|
|
187
|
+
## Stackable ⇐ [<code>Linker</code>](#Linker)
|
|
129
188
|
Stackable represents a runnable entry in stack.
|
|
130
189
|
|
|
131
190
|
**Kind**: global class
|
|
132
|
-
**Extends**: [<code>
|
|
191
|
+
**Extends**: [<code>Linker</code>](#Linker)
|
|
133
192
|
|
|
134
|
-
* [Stackable](#Stackable) ⇐ [<code>
|
|
135
|
-
* [new Stackable([
|
|
193
|
+
* [Stackable](#Stackable) ⇐ [<code>Linker</code>](#Linker)
|
|
194
|
+
* [new Stackable([stackData])](#new_Stackable_new)
|
|
136
195
|
* _instance_
|
|
137
196
|
* [.task](#Stackable+task) ⇒ <code>\*</code>
|
|
138
|
-
* [.classType](#ArrayElement+classType) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
139
197
|
* [.run()](#Stackable+run) ⇒ <code>\*</code>
|
|
140
198
|
* _static_
|
|
141
|
-
* [.make(stackable, [
|
|
142
|
-
* [.fromArray([values], [
|
|
199
|
+
* [.make(stackable, [classType])](#Stackable.make) ⇒ [<code>Stackable</code>](#Stackable)
|
|
200
|
+
* [.fromArray([values], [classType])](#Stackable.fromArray) ⇒ <code>Object</code>
|
|
143
201
|
|
|
144
202
|
<a name="new_Stackable_new"></a>
|
|
145
203
|
|
|
146
|
-
### new Stackable([
|
|
147
|
-
|
|
204
|
+
### new Stackable([stackData])
|
|
205
|
+
Create a stackable item that can be used in a stack.
|
|
148
206
|
|
|
149
207
|
|
|
150
|
-
| Param | Type | Default |
|
|
151
|
-
| --- | --- | --- |
|
|
152
|
-
| [
|
|
153
|
-
|
|
|
208
|
+
| Param | Type | Default | Description |
|
|
209
|
+
| --- | --- | --- | --- |
|
|
210
|
+
| [stackData] | <code>Object</code> | <code>{}</code> | |
|
|
211
|
+
| [stackData.task] | <code>\*</code> | <code></code> | The data to be stored in this stackable |
|
|
212
|
+
| [stackData.next] | [<code>Stackable</code>](#Stackable) \| <code>null</code> | <code></code> | The reference to the next stackable if any |
|
|
213
|
+
| [stackData.ready] | <code>boolean</code> \| <code>function</code> | <code>false</code> | Indicate if the stackable is ready to run |
|
|
154
214
|
|
|
155
215
|
<a name="Stackable+task"></a>
|
|
156
216
|
|
|
@@ -158,45 +218,35 @@ Instantiate the Stackable which is used in a stack.
|
|
|
158
218
|
Retrieve the data which should be formed as a task.
|
|
159
219
|
|
|
160
220
|
**Kind**: instance property of [<code>Stackable</code>](#Stackable)
|
|
161
|
-
**Overrides**: [<code>task</code>](#Runnable+task)
|
|
162
|
-
<a name="ArrayElement+classType"></a>
|
|
163
|
-
|
|
164
|
-
### stackable.classType ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
165
|
-
Return the type of class used for Element.
|
|
166
|
-
|
|
167
|
-
**Kind**: instance property of [<code>Stackable</code>](#Stackable)
|
|
168
|
-
**Overrides**: [<code>classType</code>](#ArrayElement+classType)
|
|
169
221
|
<a name="Stackable+run"></a>
|
|
170
222
|
|
|
171
223
|
### stackable.run() ⇒ <code>\*</code>
|
|
172
224
|
Run the stacked task.
|
|
173
225
|
|
|
174
226
|
**Kind**: instance method of [<code>Stackable</code>](#Stackable)
|
|
175
|
-
**Overrides**: [<code>run</code>](#Runnable+run)
|
|
176
227
|
<a name="Stackable.make"></a>
|
|
177
228
|
|
|
178
|
-
### Stackable.make(stackable, [
|
|
229
|
+
### Stackable.make(stackable, [classType]) ⇒ [<code>Stackable</code>](#Stackable)
|
|
179
230
|
Make a new Stackable from the data given if it is not already a valid Stackable.
|
|
180
231
|
|
|
181
232
|
**Kind**: static method of [<code>Stackable</code>](#Stackable)
|
|
182
|
-
**Methodof**: Stackable
|
|
183
233
|
|
|
184
|
-
| Param | Type | Default |
|
|
185
|
-
| --- | --- | --- |
|
|
186
|
-
| stackable | [<code>Stackable</code>](#Stackable) \| <code>\*</code> | |
|
|
187
|
-
| [
|
|
234
|
+
| Param | Type | Default | Description |
|
|
235
|
+
| --- | --- | --- | --- |
|
|
236
|
+
| stackable | [<code>Stackable</code>](#Stackable) \| <code>\*</code> | | Return a valid Stackable instance from given data, or even an already valid one. |
|
|
237
|
+
| [classType] | <code>IsLinker</code> | <code>Stackable</code> | Provide the type of IsLinker to use. |
|
|
188
238
|
|
|
189
239
|
<a name="Stackable.fromArray"></a>
|
|
190
240
|
|
|
191
|
-
### Stackable.fromArray([values], [
|
|
241
|
+
### Stackable.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
192
242
|
Convert an array into Stackable instances, return the head and tail Stackables.
|
|
193
243
|
|
|
194
244
|
**Kind**: static method of [<code>Stackable</code>](#Stackable)
|
|
195
245
|
|
|
196
|
-
| Param | Type | Default |
|
|
197
|
-
| --- | --- | --- |
|
|
198
|
-
| [values] | <code>Array</code> | <code>[]</code> |
|
|
199
|
-
| [
|
|
246
|
+
| Param | Type | Default | Description |
|
|
247
|
+
| --- | --- | --- | --- |
|
|
248
|
+
| [values] | <code>Array</code> | <code>[]</code> | Provide an array of data that will be converted to a chain of stackable linkers. |
|
|
249
|
+
| [classType] | <code>IsLinker</code> | <code>Stackable</code> | Provide the type of IsLinker to use. |
|
|
200
250
|
|
|
201
251
|
<a name="Stack"></a>
|
|
202
252
|
|
|
@@ -204,17 +254,12 @@ Convert an array into Stackable instances, return the head and tail Stackables.
|
|
|
204
254
|
Store a collection of items which can only be inserted and removed from the top.
|
|
205
255
|
|
|
206
256
|
**Kind**: global class
|
|
207
|
-
**See**: [Java Stack Interface](http://www.cs.williams.edu/~freund/cs136-073/javadoc/structure5/structure5/Stack.html)
|
|
208
257
|
|
|
209
258
|
* [Stack](#Stack)
|
|
210
|
-
* [new Stack(stackedList)](#new_Stack_new)
|
|
259
|
+
* [new Stack(stackedList, listClass, stackableClass)](#new_Stack_new)
|
|
211
260
|
* _instance_
|
|
212
|
-
* [.stackedList](#Stack+stackedList) ⇒ <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList)
|
|
213
|
-
* [.add(stackable)](#Stack+add)
|
|
214
261
|
* [.empty()](#Stack+empty) ⇒ <code>boolean</code>
|
|
215
|
-
* [.
|
|
216
|
-
* [.getFirst()](#Stack+getFirst) ⇒ [<code>Stackable</code>](#Stackable)
|
|
217
|
-
* [.peek()](#Stack+peek) ⇒ [<code>Stackable</code>](#Stackable)
|
|
262
|
+
* [.top()](#Stack+top) ⇒ [<code>Stackable</code>](#Stackable)
|
|
218
263
|
* [.pop()](#Stack+pop) ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
|
|
219
264
|
* [.push(stackable)](#Stack+push)
|
|
220
265
|
* [.remove()](#Stack+remove) ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
|
|
@@ -224,30 +269,15 @@ Store a collection of items which can only be inserted and removed from the top.
|
|
|
224
269
|
|
|
225
270
|
<a name="new_Stack_new"></a>
|
|
226
271
|
|
|
227
|
-
### new Stack(stackedList)
|
|
272
|
+
### new Stack(stackedList, listClass, stackableClass)
|
|
228
273
|
Instantiate the state with the starter stacked list.
|
|
229
274
|
|
|
230
275
|
|
|
231
276
|
| Param | Type |
|
|
232
277
|
| --- | --- |
|
|
233
|
-
| stackedList | <code>Iterable</code> \| [<code>
|
|
234
|
-
|
|
235
|
-
<
|
|
236
|
-
|
|
237
|
-
### stack.stackedList ⇒ <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList)
|
|
238
|
-
Return the internal stacked list.
|
|
239
|
-
|
|
240
|
-
**Kind**: instance property of [<code>Stack</code>](#Stack)
|
|
241
|
-
<a name="Stack+add"></a>
|
|
242
|
-
|
|
243
|
-
### stack.add(stackable)
|
|
244
|
-
Add a stackable task to the top of the stack.
|
|
245
|
-
|
|
246
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
247
|
-
|
|
248
|
-
| Param | Type |
|
|
249
|
-
| --- | --- |
|
|
250
|
-
| stackable | [<code>Stackable</code>](#Stackable) \| <code>\*</code> |
|
|
278
|
+
| stackedList | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) |
|
|
279
|
+
| listClass | <code>IsArrayable</code> |
|
|
280
|
+
| stackableClass | [<code>Stackable</code>](#Stackable) |
|
|
251
281
|
|
|
252
282
|
<a name="Stack+empty"></a>
|
|
253
283
|
|
|
@@ -255,22 +285,10 @@ Add a stackable task to the top of the stack.
|
|
|
255
285
|
Return true if the stack is empty (there are no tasks in the stacked list)
|
|
256
286
|
|
|
257
287
|
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
258
|
-
<a name="Stack+
|
|
259
|
-
|
|
260
|
-
### stack.get() ⇒ [<code>Stackable</code>](#Stackable)
|
|
261
|
-
Return a reference to the next stacked task.
|
|
262
|
-
|
|
263
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
264
|
-
<a name="Stack+getFirst"></a>
|
|
265
|
-
|
|
266
|
-
### stack.getFirst() ⇒ [<code>Stackable</code>](#Stackable)
|
|
267
|
-
Return a reference to the next stacked / first stacked task (alias for 'get()')
|
|
268
|
-
|
|
269
|
-
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
270
|
-
<a name="Stack+peek"></a>
|
|
288
|
+
<a name="Stack+top"></a>
|
|
271
289
|
|
|
272
|
-
### stack.
|
|
273
|
-
Take a look at the next stacked task
|
|
290
|
+
### stack.top() ⇒ [<code>Stackable</code>](#Stackable)
|
|
291
|
+
Take a look at the next stacked task
|
|
274
292
|
|
|
275
293
|
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
276
294
|
<a name="Stack+pop"></a>
|
|
@@ -286,9 +304,9 @@ Push a stackable task to the top of the stack.
|
|
|
286
304
|
|
|
287
305
|
**Kind**: instance method of [<code>Stack</code>](#Stack)
|
|
288
306
|
|
|
289
|
-
| Param | Type |
|
|
290
|
-
| --- | --- |
|
|
291
|
-
| stackable | [<code>Stackable</code>](#Stackable) \| <code>\*</code> |
|
|
307
|
+
| Param | Type | Description |
|
|
308
|
+
| --- | --- | --- |
|
|
309
|
+
| stackable | [<code>Stackable</code>](#Stackable) \| <code>\*</code> | Add a new stackable to the top of the stack |
|
|
292
310
|
|
|
293
311
|
<a name="Stack+remove"></a>
|
|
294
312
|
|
|
@@ -308,13 +326,12 @@ Get the size of the current stack.
|
|
|
308
326
|
Convert an array to a Stack.
|
|
309
327
|
|
|
310
328
|
**Kind**: static method of [<code>Stack</code>](#Stack)
|
|
311
|
-
**Methodof**: Stack
|
|
312
329
|
|
|
313
|
-
| Param | Type |
|
|
314
|
-
| --- | --- |
|
|
315
|
-
| values | <code>Array</code> |
|
|
316
|
-
| stackableClass | [<code>Stackable</code>](#Stackable) |
|
|
317
|
-
| listClass | [<code>Stack</code>](#Stack) \| <code>Iterable</code> |
|
|
330
|
+
| Param | Type | Description |
|
|
331
|
+
| --- | --- | --- |
|
|
332
|
+
| values | <code>Array</code> | An array of values which will be converted to stackables in this queue |
|
|
333
|
+
| stackableClass | [<code>Stackable</code>](#Stackable) | The class to use for each stackable |
|
|
334
|
+
| listClass | [<code>Stack</code>](#Stack) \| <code>Iterable</code> | The class to use to manage the stackables |
|
|
318
335
|
|
|
319
336
|
<a name="Queueable"></a>
|
|
320
337
|
|
|
@@ -322,52 +339,37 @@ Convert an array to a Stack.
|
|
|
322
339
|
Queueable represents a runnable entry in a queue.
|
|
323
340
|
|
|
324
341
|
**Kind**: global class
|
|
325
|
-
**Extends**: [<code>Linker</code>](#Linker)
|
|
342
|
+
**Extends**: [<code>Linker</code>](#Linker)
|
|
326
343
|
|
|
327
344
|
* [Queueable](#Queueable) ⇐ [<code>Linker</code>](#Linker)
|
|
328
|
-
* [new Queueable([queueableData]
|
|
345
|
+
* [new Queueable([queueableData])](#new_Queueable_new)
|
|
329
346
|
* _instance_
|
|
330
|
-
* [.complete](#Queueable+complete) ⇒ <code>boolean</code>
|
|
331
347
|
* [.isReady](#Queueable+isReady) ⇒ <code>boolean</code>
|
|
332
|
-
* [.running](#Queueable+running) ⇒ <code>boolean</code>
|
|
333
348
|
* [.task](#Queueable+task) ⇒ <code>\*</code>
|
|
334
|
-
* [.
|
|
335
|
-
* [.
|
|
336
|
-
* [.run()](#Queueable+run) ⇒ [<code>completeResponse</code>](#completeResponse)
|
|
349
|
+
* [.markCompleted(completeResponse)](#Queueable+markCompleted) ⇒ <code>completeResponse</code>
|
|
350
|
+
* [.run()](#Queueable+run) ⇒ <code>completeResponse</code>
|
|
337
351
|
* _static_
|
|
338
|
-
* [.make(queueable, [
|
|
339
|
-
* [.fromArray(values,
|
|
352
|
+
* [.make(queueable, [classType])](#Queueable.make) ⇒ [<code>Queueable</code>](#Queueable)
|
|
353
|
+
* [.fromArray(values, [classType])](#Queueable.fromArray) ⇒ <code>Object</code>
|
|
340
354
|
|
|
341
355
|
<a name="new_Queueable_new"></a>
|
|
342
356
|
|
|
343
|
-
### new Queueable([queueableData]
|
|
357
|
+
### new Queueable([queueableData])
|
|
344
358
|
Create a queueable item that can be used in a queue.
|
|
345
359
|
|
|
346
360
|
|
|
347
|
-
| Param | Type | Default |
|
|
348
|
-
| --- | --- | --- |
|
|
349
|
-
| [queueableData] | <code>Object</code> | <code>{}</code> |
|
|
350
|
-
| [queueableData.task] | <code>\*</code> | <code></code> |
|
|
351
|
-
| [queueableData.
|
|
352
|
-
| [
|
|
353
|
-
|
|
354
|
-
<a name="Queueable+complete"></a>
|
|
355
|
-
|
|
356
|
-
### queueable.complete ⇒ <code>boolean</code>
|
|
357
|
-
Check complete state.
|
|
361
|
+
| Param | Type | Default | Description |
|
|
362
|
+
| --- | --- | --- | --- |
|
|
363
|
+
| [queueableData] | <code>Object</code> | <code>{}</code> | |
|
|
364
|
+
| [queueableData.task] | <code>\*</code> | <code></code> | The data to be stored in this queueable |
|
|
365
|
+
| [queueableData.next] | [<code>Queueable</code>](#Queueable) \| <code>null</code> | <code></code> | The reference to the next queueable if any |
|
|
366
|
+
| [queueableData.ready] | <code>boolean</code> \| <code>function</code> | <code>false</code> | Indicate if the queueable is ready to run |
|
|
358
367
|
|
|
359
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
360
368
|
<a name="Queueable+isReady"></a>
|
|
361
369
|
|
|
362
370
|
### queueable.isReady ⇒ <code>boolean</code>
|
|
363
371
|
Check ready state.
|
|
364
372
|
|
|
365
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
366
|
-
<a name="Queueable+running"></a>
|
|
367
|
-
|
|
368
|
-
### queueable.running ⇒ <code>boolean</code>
|
|
369
|
-
Check running state.
|
|
370
|
-
|
|
371
373
|
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
372
374
|
<a name="Queueable+task"></a>
|
|
373
375
|
|
|
@@ -375,59 +377,49 @@ Check running state.
|
|
|
375
377
|
Retrieve the data which should be formed as a task.
|
|
376
378
|
|
|
377
379
|
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
378
|
-
**Overrides**: [<code>task</code>](#Runnable+task)
|
|
379
|
-
<a name="ArrayElement+classType"></a>
|
|
380
|
-
|
|
381
|
-
### queueable.classType ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
382
|
-
Return the type of class used for Element.
|
|
383
|
-
|
|
384
|
-
**Kind**: instance property of [<code>Queueable</code>](#Queueable)
|
|
385
|
-
**Overrides**: [<code>classType</code>](#ArrayElement+classType)
|
|
386
380
|
<a name="Queueable+markCompleted"></a>
|
|
387
381
|
|
|
388
|
-
### queueable.markCompleted(completeResponse) ⇒
|
|
382
|
+
### queueable.markCompleted(completeResponse) ⇒ <code>completeResponse</code>
|
|
389
383
|
Set this queueable as completed.
|
|
390
384
|
|
|
391
385
|
**Kind**: instance method of [<code>Queueable</code>](#Queueable)
|
|
392
386
|
|
|
393
|
-
| Param | Type | Default |
|
|
394
|
-
| --- | --- | --- |
|
|
395
|
-
| completeResponse | <code>Object</code> | |
|
|
396
|
-
| [completeResponse.success] | <code>\*</code> | <code>true</code> |
|
|
397
|
-
| [completeResponse.error] | <code>\*</code> | <code>false</code> |
|
|
398
|
-
| [completeResponse.context] | <code>\*</code> | <code></code> |
|
|
387
|
+
| Param | Type | Default | Description |
|
|
388
|
+
| --- | --- | --- | --- |
|
|
389
|
+
| completeResponse | <code>Object</code> | | |
|
|
390
|
+
| [completeResponse.success] | <code>\*</code> | <code>true</code> | Indicate when the task failed (use false) or give a success message |
|
|
391
|
+
| [completeResponse.error] | <code>\*</code> | <code>false</code> | Indicate a task was error-free (use false) or give an error message |
|
|
392
|
+
| [completeResponse.context] | <code>\*</code> | <code></code> | Provide additional data in the response |
|
|
399
393
|
|
|
400
394
|
<a name="Queueable+run"></a>
|
|
401
395
|
|
|
402
|
-
### queueable.run() ⇒
|
|
396
|
+
### queueable.run() ⇒ <code>completeResponse</code>
|
|
403
397
|
Intend to run the queued task when it is ready. If ready, mark this task as running and run the task.
|
|
404
398
|
|
|
405
399
|
**Kind**: instance method of [<code>Queueable</code>](#Queueable)
|
|
406
|
-
**Overrides**: [<code>run</code>](#Runnable+run)
|
|
407
400
|
<a name="Queueable.make"></a>
|
|
408
401
|
|
|
409
|
-
### Queueable.make(queueable, [
|
|
402
|
+
### Queueable.make(queueable, [classType]) ⇒ [<code>Queueable</code>](#Queueable)
|
|
410
403
|
Make a new Queueable from the data given if it is not already a valid Queueable.
|
|
411
404
|
|
|
412
405
|
**Kind**: static method of [<code>Queueable</code>](#Queueable)
|
|
413
|
-
**Methodof**: Queueable
|
|
414
406
|
|
|
415
|
-
| Param | Type | Default |
|
|
416
|
-
| --- | --- | --- |
|
|
417
|
-
| queueable | [<code>Queueable</code>](#Queueable) \| <code>\*</code> | |
|
|
418
|
-
| [
|
|
407
|
+
| Param | Type | Default | Description |
|
|
408
|
+
| --- | --- | --- | --- |
|
|
409
|
+
| queueable | [<code>Queueable</code>](#Queueable) \| <code>\*</code> | | Return a valid Queueable instance from given data, or even an already valid one. |
|
|
410
|
+
| [classType] | <code>IsLinker</code> | <code>Queueable</code> | Provide the type of IsLinker to use. |
|
|
419
411
|
|
|
420
412
|
<a name="Queueable.fromArray"></a>
|
|
421
413
|
|
|
422
|
-
### Queueable.fromArray(values,
|
|
414
|
+
### Queueable.fromArray(values, [classType]) ⇒ <code>Object</code>
|
|
423
415
|
Convert an array into Queueable instances, return the head and tail Queueables.
|
|
424
416
|
|
|
425
417
|
**Kind**: static method of [<code>Queueable</code>](#Queueable)
|
|
426
418
|
|
|
427
|
-
| Param | Type |
|
|
428
|
-
| --- | --- |
|
|
429
|
-
| values | <code>Array</code> |
|
|
430
|
-
|
|
|
419
|
+
| Param | Type | Default | Description |
|
|
420
|
+
| --- | --- | --- | --- |
|
|
421
|
+
| values | <code>Array</code> | | Provide an array of data that will be converted to a chain of queueable linkers. |
|
|
422
|
+
| [classType] | <code>IsLinker</code> | <code>Queueable</code> | Provide the type of IsLinker to use. |
|
|
431
423
|
|
|
432
424
|
<a name="Queue"></a>
|
|
433
425
|
|
|
@@ -435,18 +427,13 @@ Convert an array into Queueable instances, return the head and tail Queueables.
|
|
|
435
427
|
Maintain a series of queued items.
|
|
436
428
|
|
|
437
429
|
**Kind**: global class
|
|
438
|
-
**See**: [Java Queue Interface](http://www.cs.williams.edu/~freund/cs136-073/javadoc/structure5/structure5/Queue.html)
|
|
439
430
|
|
|
440
431
|
* [Queue](#Queue)
|
|
441
|
-
* [new Queue(queuedList)](#new_Queue_new)
|
|
432
|
+
* [new Queue(queuedList, listClass, queueableClass)](#new_Queue_new)
|
|
442
433
|
* _instance_
|
|
443
|
-
* [.
|
|
444
|
-
* [.add(queueable)](#Queue+add)
|
|
445
|
-
* [.dequeue()](#Queue+dequeue) ⇒ [<code>completeResponse</code>](#completeResponse) \| <code>\*</code>
|
|
434
|
+
* [.dequeue()](#Queue+dequeue) ⇒ <code>completeResponse</code> \| <code>\*</code>
|
|
446
435
|
* [.empty()](#Queue+empty) ⇒ <code>boolean</code>
|
|
447
436
|
* [.enqueue(queueable)](#Queue+enqueue)
|
|
448
|
-
* [.get()](#Queue+get) ⇒ [<code>Queueable</code>](#Queueable)
|
|
449
|
-
* [.getFirst()](#Queue+getFirst) ⇒ [<code>Queueable</code>](#Queueable)
|
|
450
437
|
* [.peek()](#Queue+peek) ⇒ [<code>Queueable</code>](#Queueable)
|
|
451
438
|
* [.remove()](#Queue+remove) ⇒ [<code>Queueable</code>](#Queueable) \| <code>null</code>
|
|
452
439
|
* [.size()](#Queue+size) ⇒ <code>number</code>
|
|
@@ -455,34 +442,19 @@ Maintain a series of queued items.
|
|
|
455
442
|
|
|
456
443
|
<a name="new_Queue_new"></a>
|
|
457
444
|
|
|
458
|
-
### new Queue(queuedList)
|
|
445
|
+
### new Queue(queuedList, listClass, queueableClass)
|
|
459
446
|
Instantiate the queue with the given queue list.
|
|
460
447
|
|
|
461
448
|
|
|
462
|
-
| Param | Type |
|
|
463
|
-
| --- | --- |
|
|
464
|
-
| queuedList | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) |
|
|
465
|
-
|
|
466
|
-
<
|
|
467
|
-
|
|
468
|
-
### queue.queuedList ⇒ <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList)
|
|
469
|
-
Return the internal queued list.
|
|
470
|
-
|
|
471
|
-
**Kind**: instance property of [<code>Queue</code>](#Queue)
|
|
472
|
-
<a name="Queue+add"></a>
|
|
473
|
-
|
|
474
|
-
### queue.add(queueable)
|
|
475
|
-
Add a queued task to the end of the queue
|
|
476
|
-
|
|
477
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
478
|
-
|
|
479
|
-
| Param | Type |
|
|
480
|
-
| --- | --- |
|
|
481
|
-
| queueable | [<code>Queueable</code>](#Queueable) \| <code>\*</code> |
|
|
449
|
+
| Param | Type | Description |
|
|
450
|
+
| --- | --- | --- |
|
|
451
|
+
| queuedList | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) | Give the list of queueables to start in this queue. |
|
|
452
|
+
| listClass | <code>IsArrayable</code> | |
|
|
453
|
+
| queueableClass | [<code>Queueable</code>](#Queueable) | |
|
|
482
454
|
|
|
483
455
|
<a name="Queue+dequeue"></a>
|
|
484
456
|
|
|
485
|
-
### queue.dequeue() ⇒
|
|
457
|
+
### queue.dequeue() ⇒ <code>completeResponse</code> \| <code>\*</code>
|
|
486
458
|
Take a queued task from the front of the queue and run it if ready.
|
|
487
459
|
|
|
488
460
|
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
@@ -495,30 +467,18 @@ Return true if the queue is empty (there are no tasks in the queue list)
|
|
|
495
467
|
<a name="Queue+enqueue"></a>
|
|
496
468
|
|
|
497
469
|
### queue.enqueue(queueable)
|
|
498
|
-
Add a queued task to the end of the queue
|
|
499
|
-
|
|
500
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
501
|
-
|
|
502
|
-
| Param | Type |
|
|
503
|
-
| --- | --- |
|
|
504
|
-
| queueable | [<code>Queueable</code>](#Queueable) |
|
|
505
|
-
|
|
506
|
-
<a name="Queue+get"></a>
|
|
507
|
-
|
|
508
|
-
### queue.get() ⇒ [<code>Queueable</code>](#Queueable)
|
|
509
|
-
Return a reference to the next queued task.
|
|
470
|
+
Add a queued task to the end of the queue
|
|
510
471
|
|
|
511
472
|
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
512
|
-
<a name="Queue+getFirst"></a>
|
|
513
473
|
|
|
514
|
-
|
|
515
|
-
|
|
474
|
+
| Param | Type | Description |
|
|
475
|
+
| --- | --- | --- |
|
|
476
|
+
| queueable | [<code>Queueable</code>](#Queueable) | Add a new queueable to the end of the queue |
|
|
516
477
|
|
|
517
|
-
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
518
478
|
<a name="Queue+peek"></a>
|
|
519
479
|
|
|
520
480
|
### queue.peek() ⇒ [<code>Queueable</code>](#Queueable)
|
|
521
|
-
Take a look at the next queued task
|
|
481
|
+
Take a look at the next queued task
|
|
522
482
|
|
|
523
483
|
**Kind**: instance method of [<code>Queue</code>](#Queue)
|
|
524
484
|
<a name="Queue+remove"></a>
|
|
@@ -539,214 +499,179 @@ Get the length of the current queue.
|
|
|
539
499
|
Convert an array to a Queue.
|
|
540
500
|
|
|
541
501
|
**Kind**: static method of [<code>Queue</code>](#Queue)
|
|
542
|
-
**Methodof**: Queue
|
|
543
502
|
|
|
544
|
-
| Param | Type |
|
|
545
|
-
| --- | --- |
|
|
546
|
-
| values | <code>Array</code> |
|
|
547
|
-
| queueableClass | [<code>Queueable</code>](#Queueable) |
|
|
548
|
-
| listClass | [<code>Queue</code>](#Queue) \| <code>Iterable</code> |
|
|
503
|
+
| Param | Type | Description |
|
|
504
|
+
| --- | --- | --- |
|
|
505
|
+
| values | <code>Array</code> | An array of values which will be converted to queueables in this queue |
|
|
506
|
+
| queueableClass | [<code>Queueable</code>](#Queueable) | The class to use for each queueable |
|
|
507
|
+
| listClass | [<code>Queue</code>](#Queue) \| <code>Iterable</code> | The class to use to manage the queueables |
|
|
549
508
|
|
|
550
509
|
<a name="TreeLinker"></a>
|
|
551
510
|
|
|
552
511
|
## TreeLinker ⇐ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
553
|
-
TreeLinker represents a node in a LinkedTreeList.
|
|
512
|
+
TreeLinker represents a node in a LinkedTreeList having a parent (or root) and child nodes.
|
|
554
513
|
|
|
555
514
|
**Kind**: global class
|
|
556
515
|
**Extends**: [<code>DoubleLinker</code>](#DoubleLinker)
|
|
557
516
|
|
|
558
517
|
* [TreeLinker](#TreeLinker) ⇐ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
559
|
-
* [new TreeLinker([settings]
|
|
518
|
+
* [new TreeLinker([settings])](#new_TreeLinker_new)
|
|
560
519
|
* _instance_
|
|
561
|
-
* [.
|
|
562
|
-
* [.children](#TreeLinker+children) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
|
|
563
|
-
* [.classType](#ArrayElement+classType) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
564
|
-
* [.childrenFromArray(children, linkerClass)](#TreeLinker+childrenFromArray) ⇒ [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code>
|
|
520
|
+
* [.childrenFromArray(children, classType)](#TreeLinker+childrenFromArray) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
|
|
565
521
|
* _static_
|
|
566
|
-
* [.make(linker, [
|
|
567
|
-
* [.fromArray([values], [
|
|
522
|
+
* [.make(linker, [classType])](#TreeLinker.make) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
523
|
+
* [.fromArray([values], [classType])](#TreeLinker.fromArray) ⇒ <code>Object</code>
|
|
568
524
|
|
|
569
525
|
<a name="new_TreeLinker_new"></a>
|
|
570
526
|
|
|
571
|
-
### new TreeLinker([settings]
|
|
572
|
-
Create the new TreeLinker instance, provide the data and optionally
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
| Param | Type | Default |
|
|
576
|
-
| --- | --- | --- |
|
|
577
|
-
| [settings] | <code>Object</code> | <code>{}</code> |
|
|
578
|
-
| [settings.data] | <code>\*</code> | <code></code> |
|
|
579
|
-
| [settings.prev] | [<code>TreeLinker</code>](#TreeLinker) | <code></code> |
|
|
580
|
-
| [settings.next] | [<code>TreeLinker</code>](#TreeLinker) | <code></code> |
|
|
581
|
-
| [settings.children] | [<code>LinkedTreeList</code>](#LinkedTreeList) | <code></code> |
|
|
582
|
-
| [settings.parent] | [<code>TreeLinker</code>](#TreeLinker) | <code></code> |
|
|
583
|
-
| [linkerClass] | [<code>TreeLinker</code>](#TreeLinker) | <code>TreeLinker</code> |
|
|
584
|
-
|
|
585
|
-
<a name="TreeLinker+parent"></a>
|
|
586
|
-
|
|
587
|
-
### treeLinker.parent ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
|
|
588
|
-
Return the parent of this Tree Linker.
|
|
589
|
-
|
|
590
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
591
|
-
<a name="TreeLinker+children"></a>
|
|
592
|
-
|
|
593
|
-
### treeLinker.children ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
|
|
594
|
-
Return the children of this Tree Linker.
|
|
527
|
+
### new TreeLinker([settings])
|
|
528
|
+
Create the new TreeLinker instance, provide the data and optionally set references for next, prev, parent, or children.
|
|
595
529
|
|
|
596
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
597
|
-
<a name="ArrayElement+classType"></a>
|
|
598
530
|
|
|
599
|
-
|
|
600
|
-
|
|
531
|
+
| Param | Type | Default | Description |
|
|
532
|
+
| --- | --- | --- | --- |
|
|
533
|
+
| [settings] | <code>Object</code> | <code>{}</code> | |
|
|
534
|
+
| [settings.data] | <code>\*</code> | <code></code> | The data to be stored in this tree node |
|
|
535
|
+
| [settings.next] | [<code>TreeLinker</code>](#TreeLinker) | <code></code> | The reference to the next linker if any |
|
|
536
|
+
| [settings.prev] | [<code>TreeLinker</code>](#TreeLinker) | <code></code> | The reference to the previous linker if any |
|
|
537
|
+
| [settings.children] | [<code>LinkedTreeList</code>](#LinkedTreeList) | <code></code> | The references to child linkers if any |
|
|
538
|
+
| [settings.parent] | [<code>TreeLinker</code>](#TreeLinker) | <code></code> | The reference to a parent linker if any |
|
|
601
539
|
|
|
602
|
-
**Kind**: instance property of [<code>TreeLinker</code>](#TreeLinker)
|
|
603
|
-
**Overrides**: [<code>classType</code>](#ArrayElement+classType)
|
|
604
540
|
<a name="TreeLinker+childrenFromArray"></a>
|
|
605
541
|
|
|
606
|
-
### treeLinker.childrenFromArray(children,
|
|
542
|
+
### treeLinker.childrenFromArray(children, classType) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
|
|
607
543
|
Create the children for this tree from an array.
|
|
608
544
|
|
|
609
545
|
**Kind**: instance method of [<code>TreeLinker</code>](#TreeLinker)
|
|
610
546
|
|
|
611
|
-
| Param | Type |
|
|
547
|
+
| Param | Type | Description |
|
|
612
548
|
| --- | --- | --- |
|
|
613
|
-
| children | <code>Array</code> \| <code>null</code> |
|
|
614
|
-
|
|
|
549
|
+
| children | <code>Array</code> \| <code>null</code> | Provide an array of data / linker references to be children of this tree node. |
|
|
550
|
+
| classType | <code>IsTree</code> | Provide the type of IsElement to use. |
|
|
615
551
|
|
|
616
552
|
<a name="TreeLinker.make"></a>
|
|
617
553
|
|
|
618
|
-
### TreeLinker.make(linker, [
|
|
554
|
+
### TreeLinker.make(linker, [classType]) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
619
555
|
Make a new DoubleLinker from the data given if it is not already a valid Linker.
|
|
620
556
|
|
|
621
557
|
**Kind**: static method of [<code>TreeLinker</code>](#TreeLinker)
|
|
622
|
-
**Methodof**: TreeLinker
|
|
623
558
|
|
|
624
|
-
| Param | Type | Default |
|
|
625
|
-
| --- | --- | --- |
|
|
626
|
-
| linker | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | |
|
|
627
|
-
| [
|
|
559
|
+
| Param | Type | Default | Description |
|
|
560
|
+
| --- | --- | --- | --- |
|
|
561
|
+
| linker | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | | Return a valid TreeLinker instance from given data, or even an already valid one. |
|
|
562
|
+
| [classType] | <code>IsTreeNode</code> | <code>TreeLinker</code> | Provide the type of IsTreeNode to use. |
|
|
628
563
|
|
|
629
564
|
<a name="TreeLinker.fromArray"></a>
|
|
630
565
|
|
|
631
|
-
### TreeLinker.fromArray([values], [
|
|
566
|
+
### TreeLinker.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
632
567
|
Convert an array into DoubleLinker instances, return the head and tail DoubleLinkers.
|
|
633
568
|
|
|
634
569
|
**Kind**: static method of [<code>TreeLinker</code>](#TreeLinker)
|
|
635
|
-
**Methodof**: TreeLinker
|
|
636
570
|
|
|
637
|
-
| Param | Type | Default |
|
|
638
|
-
| --- | --- | --- |
|
|
639
|
-
| [values] | <code>Array</code> | <code>[]</code> |
|
|
640
|
-
| [
|
|
571
|
+
| Param | Type | Default | Description |
|
|
572
|
+
| --- | --- | --- | --- |
|
|
573
|
+
| [values] | <code>Array</code> | <code>[]</code> | Provide an array of data that will be converted to a chain of tree-linkers. |
|
|
574
|
+
| [classType] | <code>IsTreeNode</code> | <code>TreeLinker</code> | Provide the type of IsTreeNode to use. |
|
|
641
575
|
|
|
642
576
|
<a name="LinkedTreeList"></a>
|
|
643
577
|
|
|
644
578
|
## LinkedTreeList ⇐ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
645
|
-
LinkedTreeList represents a collection stored with a root and spreading in branching (tree) formation
|
|
579
|
+
LinkedTreeList represents a collection stored with a root and spreading in branching (tree) formation.
|
|
646
580
|
|
|
647
581
|
**Kind**: global class
|
|
648
582
|
**Extends**: [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
649
583
|
|
|
650
584
|
* [LinkedTreeList](#LinkedTreeList) ⇐ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
651
|
-
* [new LinkedTreeList(
|
|
585
|
+
* [new LinkedTreeList()](#new_LinkedTreeList_new)
|
|
652
586
|
* _instance_
|
|
587
|
+
* [.list](#LinkedTreeList+list) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
588
|
+
* [.first](#LinkedTreeList+first) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
589
|
+
* [.last](#LinkedTreeList+last) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
590
|
+
* [.length](#LinkedTreeList+length) ⇒ <code>number</code>
|
|
653
591
|
* [.parent](#LinkedTreeList+parent) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
654
592
|
* [.parent](#LinkedTreeList+parent)
|
|
655
593
|
* [.rootParent](#LinkedTreeList+rootParent) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
656
|
-
* [.
|
|
657
|
-
* [.last](#DoublyLinkedList+last) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
658
|
-
* [.length](#DoublyLinkedList+length) ⇒ <code>number</code>
|
|
659
|
-
* [.classType](#Arrayable+classType) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
660
|
-
* [.initialized](#Arrayable+initialized) ⇒ <code>boolean</code>
|
|
661
|
-
* [.innerList](#Arrayable+innerList) ⇒ <code>Array</code>
|
|
594
|
+
* [.initialize(initialList)](#LinkedTreeList+initialize) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
662
595
|
* [.setChildren(item, children)](#LinkedTreeList+setChildren)
|
|
663
|
-
* [.insertAfter(node, newNode)](#
|
|
664
|
-
* [.insertBefore(node, newNode)](#
|
|
665
|
-
* [.
|
|
666
|
-
* [.
|
|
667
|
-
* [.
|
|
668
|
-
* [.
|
|
669
|
-
* [.
|
|
670
|
-
* [.
|
|
671
|
-
* [.prepend(node, before)](#LinkedList+prepend) ⇒ [<code>Linker</code>](#Linker)
|
|
596
|
+
* [.insertAfter(node, newNode)](#LinkedTreeList+insertAfter) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
597
|
+
* [.insertBefore(node, newNode)](#LinkedTreeList+insertBefore) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
598
|
+
* [.append(node, after)](#LinkedTreeList+append) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
599
|
+
* [.prepend(node, before)](#LinkedTreeList+prepend) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
600
|
+
* [.remove(node)](#LinkedTreeList+remove) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
601
|
+
* [.reset()](#LinkedTreeList+reset) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
602
|
+
* [.item(index)](#LinkedTreeList+item) ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
|
|
603
|
+
* [.forEach(callback, thisArg)](#LinkedTreeList+forEach)
|
|
672
604
|
* _static_
|
|
673
|
-
* [.fromArray([values], [linkerClass], [
|
|
605
|
+
* [.fromArray([values], [linkerClass], [classType])](#LinkedTreeList.fromArray) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
674
606
|
|
|
675
607
|
<a name="new_LinkedTreeList_new"></a>
|
|
676
608
|
|
|
677
|
-
### new LinkedTreeList(
|
|
609
|
+
### new LinkedTreeList()
|
|
678
610
|
Create the new LinkedTreeList instance, configure the list class.
|
|
679
611
|
|
|
612
|
+
<a name="LinkedTreeList+list"></a>
|
|
680
613
|
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
| [listClass] | [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>Iterable</code> | <code>LinkedTreeList</code> |
|
|
684
|
-
|
|
685
|
-
<a name="LinkedTreeList+parent"></a>
|
|
686
|
-
|
|
687
|
-
### linkedTreeList.parent ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
688
|
-
Get the parent of this tree list.
|
|
689
|
-
|
|
690
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
691
|
-
<a name="LinkedTreeList+parent"></a>
|
|
692
|
-
|
|
693
|
-
### linkedTreeList.parent
|
|
694
|
-
Set the parent of this tree list
|
|
695
|
-
|
|
696
|
-
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
697
|
-
|
|
698
|
-
| Param | Type |
|
|
699
|
-
| --- | --- |
|
|
700
|
-
| parent | [<code>TreeLinker</code>](#TreeLinker) |
|
|
701
|
-
|
|
702
|
-
<a name="LinkedTreeList+rootParent"></a>
|
|
703
|
-
|
|
704
|
-
### linkedTreeList.rootParent ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
705
|
-
Return the root parent of the entire tree.
|
|
614
|
+
### linkedTreeList.list ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
615
|
+
Retrieve a copy of the innerList used.
|
|
706
616
|
|
|
707
617
|
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
708
|
-
<
|
|
618
|
+
**Overrides**: [<code>list</code>](#DoublyLinkedList+list)
|
|
619
|
+
<a name="LinkedTreeList+first"></a>
|
|
709
620
|
|
|
710
|
-
### linkedTreeList.first ⇒ [<code>
|
|
711
|
-
Retrieve the first
|
|
621
|
+
### linkedTreeList.first ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
622
|
+
Retrieve the first TreeLinker in the list.
|
|
712
623
|
|
|
713
624
|
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
714
625
|
**Overrides**: [<code>first</code>](#DoublyLinkedList+first)
|
|
715
|
-
<a name="
|
|
626
|
+
<a name="LinkedTreeList+last"></a>
|
|
716
627
|
|
|
717
|
-
### linkedTreeList.last ⇒ [<code>
|
|
718
|
-
Retrieve the last
|
|
628
|
+
### linkedTreeList.last ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
629
|
+
Retrieve the last TreeLinker in the list.
|
|
719
630
|
|
|
720
631
|
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
721
632
|
**Overrides**: [<code>last</code>](#DoublyLinkedList+last)
|
|
722
|
-
<a name="
|
|
633
|
+
<a name="LinkedTreeList+length"></a>
|
|
723
634
|
|
|
724
635
|
### linkedTreeList.length ⇒ <code>number</code>
|
|
725
636
|
Return the length of the list.
|
|
726
637
|
|
|
727
638
|
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
728
639
|
**Overrides**: [<code>length</code>](#DoublyLinkedList+length)
|
|
729
|
-
<a name="
|
|
640
|
+
<a name="LinkedTreeList+parent"></a>
|
|
730
641
|
|
|
731
|
-
### linkedTreeList.
|
|
732
|
-
|
|
642
|
+
### linkedTreeList.parent ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
643
|
+
Get the parent of this tree list.
|
|
733
644
|
|
|
734
645
|
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
735
|
-
|
|
736
|
-
<a name="Arrayable+initialized"></a>
|
|
646
|
+
<a name="LinkedTreeList+parent"></a>
|
|
737
647
|
|
|
738
|
-
### linkedTreeList.
|
|
739
|
-
|
|
648
|
+
### linkedTreeList.parent
|
|
649
|
+
Set the parent of this tree list
|
|
740
650
|
|
|
741
651
|
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
742
|
-
**Overrides**: [<code>initialized</code>](#Arrayable+initialized)
|
|
743
|
-
<a name="Arrayable+innerList"></a>
|
|
744
652
|
|
|
745
|
-
|
|
746
|
-
|
|
653
|
+
| Param | Type | Description |
|
|
654
|
+
| --- | --- | --- |
|
|
655
|
+
| parent | [<code>TreeLinker</code>](#TreeLinker) | The new node to use as the parent for this group of children |
|
|
656
|
+
|
|
657
|
+
<a name="LinkedTreeList+rootParent"></a>
|
|
658
|
+
|
|
659
|
+
### linkedTreeList.rootParent ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
660
|
+
Return the root parent of the entire tree.
|
|
747
661
|
|
|
748
662
|
**Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
749
|
-
|
|
663
|
+
<a name="LinkedTreeList+initialize"></a>
|
|
664
|
+
|
|
665
|
+
### linkedTreeList.initialize(initialList) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
666
|
+
Initialize the inner list, should only run once.
|
|
667
|
+
|
|
668
|
+
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
669
|
+
**Overrides**: [<code>initialize</code>](#DoublyLinkedList+initialize)
|
|
670
|
+
|
|
671
|
+
| Param | Type | Description |
|
|
672
|
+
| --- | --- | --- |
|
|
673
|
+
| initialList | [<code>TreeLinker</code>](#TreeLinker) | Give the list of tree-linkers to start in this linked-tree-list. |
|
|
674
|
+
|
|
750
675
|
<a name="LinkedTreeList+setChildren"></a>
|
|
751
676
|
|
|
752
677
|
### linkedTreeList.setChildren(item, children)
|
|
@@ -754,131 +679,119 @@ Set the children on a parent item.
|
|
|
754
679
|
|
|
755
680
|
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
756
681
|
|
|
757
|
-
| Param | Type |
|
|
682
|
+
| Param | Type | Description |
|
|
758
683
|
| --- | --- | --- |
|
|
759
|
-
| item | [<code>TreeLinker</code>](#TreeLinker) |
|
|
760
|
-
| children | [<code>LinkedTreeList</code>](#LinkedTreeList) |
|
|
684
|
+
| item | [<code>TreeLinker</code>](#TreeLinker) | The TreeLinker node that will be the parent of the children |
|
|
685
|
+
| children | [<code>LinkedTreeList</code>](#LinkedTreeList) | The LinkedTreeList which has the child nodes to use |
|
|
761
686
|
|
|
762
|
-
<a name="
|
|
687
|
+
<a name="LinkedTreeList+insertAfter"></a>
|
|
763
688
|
|
|
764
|
-
### linkedTreeList.insertAfter(node, newNode) ⇒ [<code>
|
|
689
|
+
### linkedTreeList.insertAfter(node, newNode) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
765
690
|
Insert a new node (or data) after a node.
|
|
766
691
|
|
|
767
692
|
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
768
693
|
**Overrides**: [<code>insertAfter</code>](#DoublyLinkedList+insertAfter)
|
|
769
694
|
|
|
770
|
-
| Param | Type |
|
|
771
|
-
| --- | --- |
|
|
772
|
-
| node | [<code>
|
|
773
|
-
| newNode | [<code>
|
|
695
|
+
| Param | Type | Description |
|
|
696
|
+
| --- | --- | --- |
|
|
697
|
+
| node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The existing node as reference |
|
|
698
|
+
| newNode | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to go after the existing node |
|
|
774
699
|
|
|
775
|
-
<a name="
|
|
700
|
+
<a name="LinkedTreeList+insertBefore"></a>
|
|
776
701
|
|
|
777
|
-
### linkedTreeList.insertBefore(node, newNode) ⇒ [<code>
|
|
702
|
+
### linkedTreeList.insertBefore(node, newNode) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
778
703
|
Insert a new node (or data) before a node.
|
|
779
704
|
|
|
780
705
|
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
781
706
|
**Overrides**: [<code>insertBefore</code>](#DoublyLinkedList+insertBefore)
|
|
782
707
|
|
|
783
|
-
| Param | Type |
|
|
784
|
-
| --- | --- |
|
|
785
|
-
| node | [<code>
|
|
786
|
-
| newNode | [<code>
|
|
708
|
+
| Param | Type | Description |
|
|
709
|
+
| --- | --- | --- |
|
|
710
|
+
| node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The existing node as reference |
|
|
711
|
+
| newNode | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to go before the existing node |
|
|
787
712
|
|
|
788
|
-
<a name="
|
|
713
|
+
<a name="LinkedTreeList+append"></a>
|
|
789
714
|
|
|
790
|
-
### linkedTreeList.
|
|
791
|
-
|
|
715
|
+
### linkedTreeList.append(node, after) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
716
|
+
Add a node (or data) after the given (or last) node in the list.
|
|
792
717
|
|
|
793
718
|
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
794
|
-
**Overrides**: [<code>
|
|
795
|
-
|
|
796
|
-
| Param | Type |
|
|
797
|
-
| --- | --- |
|
|
798
|
-
| node | [<code>DoubleLinker</code>](#DoubleLinker) |
|
|
719
|
+
**Overrides**: [<code>append</code>](#DoublyLinkedList+append)
|
|
799
720
|
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
721
|
+
| Param | Type | Description |
|
|
722
|
+
| --- | --- | --- |
|
|
723
|
+
| node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to add to the end of the list |
|
|
724
|
+
| after | [<code>TreeLinker</code>](#TreeLinker) | The existing last node |
|
|
804
725
|
|
|
805
|
-
|
|
806
|
-
**Overrides**: [<code>reset</code>](#DoublyLinkedList+reset)
|
|
807
|
-
<a name="DoublyLinkedList+item"></a>
|
|
726
|
+
<a name="LinkedTreeList+prepend"></a>
|
|
808
727
|
|
|
809
|
-
### linkedTreeList.
|
|
810
|
-
|
|
728
|
+
### linkedTreeList.prepend(node, before) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
729
|
+
Add a node (or data) before the given (or first) node in the list.
|
|
811
730
|
|
|
812
731
|
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
813
|
-
**Overrides**: [<code>
|
|
732
|
+
**Overrides**: [<code>prepend</code>](#DoublyLinkedList+prepend)
|
|
814
733
|
|
|
815
|
-
| Param | Type |
|
|
816
|
-
| --- | --- |
|
|
817
|
-
|
|
|
734
|
+
| Param | Type | Description |
|
|
735
|
+
| --- | --- | --- |
|
|
736
|
+
| node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to add to the start of the list |
|
|
737
|
+
| before | [<code>TreeLinker</code>](#TreeLinker) | The existing first node |
|
|
818
738
|
|
|
819
|
-
<a name="
|
|
739
|
+
<a name="LinkedTreeList+remove"></a>
|
|
820
740
|
|
|
821
|
-
### linkedTreeList.
|
|
822
|
-
|
|
741
|
+
### linkedTreeList.remove(node) ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
742
|
+
Remove a linker from this linked list.
|
|
823
743
|
|
|
824
744
|
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
825
|
-
**Overrides**: [<code>
|
|
745
|
+
**Overrides**: [<code>remove</code>](#DoublyLinkedList+remove)
|
|
826
746
|
|
|
827
|
-
| Param | Type |
|
|
828
|
-
| --- | --- |
|
|
829
|
-
|
|
|
830
|
-
| thisArg | [<code>DoublyLinkedList</code>](#DoublyLinkedList) |
|
|
747
|
+
| Param | Type | Description |
|
|
748
|
+
| --- | --- | --- |
|
|
749
|
+
| node | [<code>TreeLinker</code>](#TreeLinker) | The node we wish to remove (and it will be returned after removal) |
|
|
831
750
|
|
|
832
|
-
<a name="
|
|
751
|
+
<a name="LinkedTreeList+reset"></a>
|
|
833
752
|
|
|
834
|
-
### linkedTreeList.
|
|
835
|
-
|
|
753
|
+
### linkedTreeList.reset() ⇒ [<code>TreeLinker</code>](#TreeLinker)
|
|
754
|
+
Refresh all references and return head reference.
|
|
836
755
|
|
|
837
756
|
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
838
|
-
**Overrides**: [<code>
|
|
839
|
-
|
|
840
|
-
| Param | Type |
|
|
841
|
-
| --- | --- |
|
|
842
|
-
| initialList | [<code>Linker</code>](#Linker) \| <code>Array</code> |
|
|
843
|
-
|
|
844
|
-
<a name="LinkedList+append"></a>
|
|
757
|
+
**Overrides**: [<code>reset</code>](#DoublyLinkedList+reset)
|
|
758
|
+
<a name="LinkedTreeList+item"></a>
|
|
845
759
|
|
|
846
|
-
### linkedTreeList.
|
|
847
|
-
|
|
760
|
+
### linkedTreeList.item(index) ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
|
|
761
|
+
Retrieve a TreeLinker item from this list by numeric index, otherwise return null.
|
|
848
762
|
|
|
849
763
|
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
850
|
-
**Overrides**: [<code>
|
|
764
|
+
**Overrides**: [<code>item</code>](#DoublyLinkedList+item)
|
|
851
765
|
|
|
852
|
-
| Param | Type |
|
|
853
|
-
| --- | --- |
|
|
854
|
-
|
|
|
855
|
-
| after | [<code>Linker</code>](#Linker) |
|
|
766
|
+
| Param | Type | Description |
|
|
767
|
+
| --- | --- | --- |
|
|
768
|
+
| index | <code>number</code> | The integer number for retrieving a node by position. |
|
|
856
769
|
|
|
857
|
-
<a name="
|
|
770
|
+
<a name="LinkedTreeList+forEach"></a>
|
|
858
771
|
|
|
859
|
-
### linkedTreeList.
|
|
860
|
-
|
|
772
|
+
### linkedTreeList.forEach(callback, thisArg)
|
|
773
|
+
Be able to run forEach on this LinkedTreeList to iterate over the TreeLinker Items.
|
|
861
774
|
|
|
862
775
|
**Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
863
|
-
**Overrides**: [<code>
|
|
776
|
+
**Overrides**: [<code>forEach</code>](#DoublyLinkedList+forEach)
|
|
864
777
|
|
|
865
|
-
| Param | Type |
|
|
866
|
-
| --- | --- |
|
|
867
|
-
|
|
|
868
|
-
|
|
|
778
|
+
| Param | Type | Description |
|
|
779
|
+
| --- | --- | --- |
|
|
780
|
+
| callback | <code>forEachCallback</code> | The function to call for-each tree node |
|
|
781
|
+
| thisArg | [<code>LinkedTreeList</code>](#LinkedTreeList) | Optional, 'this' reference |
|
|
869
782
|
|
|
870
783
|
<a name="LinkedTreeList.fromArray"></a>
|
|
871
784
|
|
|
872
|
-
### LinkedTreeList.fromArray([values], [linkerClass], [
|
|
873
|
-
|
|
785
|
+
### LinkedTreeList.fromArray([values], [linkerClass], [classType]) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
786
|
+
Convert an array into a LinkedTreeList instance, return the new instance.
|
|
874
787
|
|
|
875
788
|
**Kind**: static method of [<code>LinkedTreeList</code>](#LinkedTreeList)
|
|
876
789
|
|
|
877
|
-
| Param | Type | Default |
|
|
878
|
-
| --- | --- | --- |
|
|
879
|
-
| [values] | <code>Array</code> | <code>[]</code> |
|
|
880
|
-
| [linkerClass] | [<code>TreeLinker</code>](#TreeLinker) | <code>TreeLinker</code> |
|
|
881
|
-
| [
|
|
790
|
+
| Param | Type | Default | Description |
|
|
791
|
+
| --- | --- | --- | --- |
|
|
792
|
+
| [values] | <code>Array</code> | <code>[]</code> | An array of values which will be converted to nodes in this tree-list |
|
|
793
|
+
| [linkerClass] | [<code>TreeLinker</code>](#TreeLinker) | <code>TreeLinker</code> | The class to use for each node |
|
|
794
|
+
| [classType] | [<code>IsArrayable.<TreeLinker></code>](#TreeLinker) | <code>LinkedTreeList</code> | Provide the type of IsArrayable to use. |
|
|
882
795
|
|
|
883
796
|
<a name="Linker"></a>
|
|
884
797
|
|
|
@@ -889,58 +802,45 @@ Linker represents a node in a LinkedList.
|
|
|
889
802
|
**Extends**: [<code>ArrayElement</code>](#ArrayElement)
|
|
890
803
|
|
|
891
804
|
* [Linker](#Linker) ⇐ [<code>ArrayElement</code>](#ArrayElement)
|
|
892
|
-
* [new Linker([nodeData]
|
|
893
|
-
*
|
|
894
|
-
|
|
895
|
-
* _static_
|
|
896
|
-
* [.make(linker, [linkerClass])](#Linker.make) ⇒ [<code>Linker</code>](#Linker)
|
|
897
|
-
* [.fromArray([values], [linkerClass])](#Linker.fromArray) ⇒ <code>Object</code>
|
|
805
|
+
* [new Linker([nodeData])](#new_Linker_new)
|
|
806
|
+
* [.make(linker, [classType])](#Linker.make) ⇒ [<code>Linker</code>](#Linker)
|
|
807
|
+
* [.fromArray([values], [classType])](#Linker.fromArray) ⇒ <code>Object</code>
|
|
898
808
|
|
|
899
809
|
<a name="new_Linker_new"></a>
|
|
900
810
|
|
|
901
|
-
### new Linker([nodeData]
|
|
902
|
-
Create the new Linker instance, provide the data and optionally
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
| Param | Type | Default |
|
|
906
|
-
| --- | --- | --- |
|
|
907
|
-
| [nodeData] | <code>Object</code> | <code>{}</code> |
|
|
908
|
-
| [nodeData.data] | <code>\*</code> | <code></code> |
|
|
909
|
-
| [nodeData.next] | [<code>Linker</code>](#Linker) \| <code>null</code> | <code></code> |
|
|
910
|
-
| [linkerClass] | [<code>Linker</code>](#Linker) | <code>Linker</code> |
|
|
811
|
+
### new Linker([nodeData])
|
|
812
|
+
Create the new Linker instance, provide the data and optionally give the next Linker.
|
|
911
813
|
|
|
912
|
-
<a name="ArrayElement+classType"></a>
|
|
913
814
|
|
|
914
|
-
|
|
915
|
-
|
|
815
|
+
| Param | Type | Default | Description |
|
|
816
|
+
| --- | --- | --- | --- |
|
|
817
|
+
| [nodeData] | <code>Object</code> | <code>{}</code> | |
|
|
818
|
+
| [nodeData.data] | <code>\*</code> | <code></code> | The data to be stored in this linker |
|
|
819
|
+
| [nodeData.next] | [<code>Linker</code>](#Linker) \| <code>null</code> | <code></code> | The reference to the next linker if any |
|
|
916
820
|
|
|
917
|
-
**Kind**: instance property of [<code>Linker</code>](#Linker)
|
|
918
|
-
**Overrides**: [<code>classType</code>](#ArrayElement+classType)
|
|
919
821
|
<a name="Linker.make"></a>
|
|
920
822
|
|
|
921
|
-
### Linker.make(linker, [
|
|
823
|
+
### Linker.make(linker, [classType]) ⇒ [<code>Linker</code>](#Linker)
|
|
922
824
|
Make a new Linker from the data given if it is not already a valid Linker.
|
|
923
825
|
|
|
924
826
|
**Kind**: static method of [<code>Linker</code>](#Linker)
|
|
925
|
-
**Methodof**: Linker
|
|
926
827
|
|
|
927
|
-
| Param | Type | Default |
|
|
928
|
-
| --- | --- | --- |
|
|
929
|
-
| linker | [<code>Linker</code>](#Linker) \| <code>\*</code> | |
|
|
930
|
-
| [
|
|
828
|
+
| Param | Type | Default | Description |
|
|
829
|
+
| --- | --- | --- | --- |
|
|
830
|
+
| linker | [<code>Linker</code>](#Linker) \| <code>\*</code> | | Return a valid Linker instance from given data, or even an already valid one. |
|
|
831
|
+
| [classType] | <code>IsLinker</code> | <code>Linker</code> | Provide the type of IsLinker to use. |
|
|
931
832
|
|
|
932
833
|
<a name="Linker.fromArray"></a>
|
|
933
834
|
|
|
934
|
-
### Linker.fromArray([values], [
|
|
835
|
+
### Linker.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
935
836
|
Convert an array into Linker instances, return the head and tail Linkers.
|
|
936
837
|
|
|
937
838
|
**Kind**: static method of [<code>Linker</code>](#Linker)
|
|
938
|
-
**Methodof**: Linker
|
|
939
839
|
|
|
940
|
-
| Param | Type | Default |
|
|
941
|
-
| --- | --- | --- |
|
|
942
|
-
| [values] | <code>Array</code> | <code>[]</code> |
|
|
943
|
-
| [
|
|
840
|
+
| Param | Type | Default | Description |
|
|
841
|
+
| --- | --- | --- | --- |
|
|
842
|
+
| [values] | <code>Array</code> | <code>[]</code> | Provide an array of data that will be converted to a chain of linkers. |
|
|
843
|
+
| [classType] | <code>IsLinker</code> | <code>Linker</code> | Provide the type of IsLinker to use. |
|
|
944
844
|
|
|
945
845
|
<a name="LinkedList"></a>
|
|
946
846
|
|
|
@@ -951,14 +851,12 @@ LinkedList represents a collection stored as a LinkedList with next references.
|
|
|
951
851
|
**Extends**: [<code>Arrayable</code>](#Arrayable)
|
|
952
852
|
|
|
953
853
|
* [LinkedList](#LinkedList) ⇐ [<code>Arrayable</code>](#Arrayable)
|
|
954
|
-
* [new LinkedList(
|
|
854
|
+
* [new LinkedList()](#new_LinkedList_new)
|
|
955
855
|
* _instance_
|
|
856
|
+
* [.list](#LinkedList+list) ⇒ [<code>Linker</code>](#Linker)
|
|
956
857
|
* [.first](#LinkedList+first) ⇒ [<code>Linker</code>](#Linker)
|
|
957
858
|
* [.last](#LinkedList+last) ⇒ [<code>Linker</code>](#Linker)
|
|
958
859
|
* [.length](#LinkedList+length) ⇒ <code>number</code>
|
|
959
|
-
* [.classType](#Arrayable+classType) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
960
|
-
* [.initialized](#Arrayable+initialized) ⇒ <code>boolean</code>
|
|
961
|
-
* [.innerList](#Arrayable+innerList) ⇒ <code>Array</code>
|
|
962
860
|
* [.initialize(initialList)](#LinkedList+initialize) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
963
861
|
* [.insertAfter(node, newNode)](#LinkedList+insertAfter) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
964
862
|
* [.insertBefore(node, newNode)](#LinkedList+insertBefore) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
@@ -968,18 +866,20 @@ LinkedList represents a collection stored as a LinkedList with next references.
|
|
|
968
866
|
* [.item(index)](#LinkedList+item) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
|
|
969
867
|
* [.forEach(callback, thisArg)](#LinkedList+forEach) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
970
868
|
* _static_
|
|
971
|
-
* [.fromArray(values, linkerClass,
|
|
869
|
+
* [.fromArray(values, linkerClass, [classType])](#LinkedList.fromArray) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
972
870
|
|
|
973
871
|
<a name="new_LinkedList_new"></a>
|
|
974
872
|
|
|
975
|
-
### new LinkedList(
|
|
976
|
-
Create the new LinkedList instance
|
|
873
|
+
### new LinkedList()
|
|
874
|
+
Create the new LinkedList instance.
|
|
977
875
|
|
|
876
|
+
<a name="LinkedList+list"></a>
|
|
978
877
|
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
| listClass | [<code>LinkedList</code>](#LinkedList) \| <code>Iterable</code> |
|
|
878
|
+
### linkedList.list ⇒ [<code>Linker</code>](#Linker)
|
|
879
|
+
Retrieve a copy of the innerList used.
|
|
982
880
|
|
|
881
|
+
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
882
|
+
**Overrides**: [<code>list</code>](#Arrayable+list)
|
|
983
883
|
<a name="LinkedList+first"></a>
|
|
984
884
|
|
|
985
885
|
### linkedList.first ⇒ [<code>Linker</code>](#Linker)
|
|
@@ -1001,27 +901,6 @@ Return the length of the list.
|
|
|
1001
901
|
|
|
1002
902
|
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
1003
903
|
**Overrides**: [<code>length</code>](#Arrayable+length)
|
|
1004
|
-
<a name="Arrayable+classType"></a>
|
|
1005
|
-
|
|
1006
|
-
### linkedList.classType ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1007
|
-
Return the type of class used for Arrayable.
|
|
1008
|
-
|
|
1009
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
1010
|
-
**Overrides**: [<code>classType</code>](#Arrayable+classType)
|
|
1011
|
-
<a name="Arrayable+initialized"></a>
|
|
1012
|
-
|
|
1013
|
-
### linkedList.initialized ⇒ <code>boolean</code>
|
|
1014
|
-
Detect if the inner list has been initialized.
|
|
1015
|
-
|
|
1016
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
1017
|
-
**Overrides**: [<code>initialized</code>](#Arrayable+initialized)
|
|
1018
|
-
<a name="Arrayable+innerList"></a>
|
|
1019
|
-
|
|
1020
|
-
### linkedList.innerList ⇒ <code>Array</code>
|
|
1021
|
-
Retrieve a copy of the innerList used.
|
|
1022
|
-
|
|
1023
|
-
**Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
|
|
1024
|
-
**Overrides**: [<code>innerList</code>](#Arrayable+innerList)
|
|
1025
904
|
<a name="LinkedList+initialize"></a>
|
|
1026
905
|
|
|
1027
906
|
### linkedList.initialize(initialList) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
@@ -1030,9 +909,9 @@ Initialize the inner list, should only run once.
|
|
|
1030
909
|
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1031
910
|
**Overrides**: [<code>initialize</code>](#Arrayable+initialize)
|
|
1032
911
|
|
|
1033
|
-
| Param | Type |
|
|
1034
|
-
| --- | --- |
|
|
1035
|
-
| initialList | [<code>Linker</code>](#Linker) \| <code>Array</code> |
|
|
912
|
+
| Param | Type | Description |
|
|
913
|
+
| --- | --- | --- |
|
|
914
|
+
| initialList | [<code>Linker</code>](#Linker) \| <code>Array</code> | Give the list of linkers to start in this linked-list. |
|
|
1036
915
|
|
|
1037
916
|
<a name="LinkedList+insertAfter"></a>
|
|
1038
917
|
|
|
@@ -1042,10 +921,10 @@ Insert a new node (or data) after a node.
|
|
|
1042
921
|
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1043
922
|
**Overrides**: [<code>insertAfter</code>](#Arrayable+insertAfter)
|
|
1044
923
|
|
|
1045
|
-
| Param | Type |
|
|
1046
|
-
| --- | --- |
|
|
1047
|
-
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> |
|
|
1048
|
-
| newNode | [<code>Linker</code>](#Linker) \| <code>\*</code> |
|
|
924
|
+
| Param | Type | Description |
|
|
925
|
+
| --- | --- | --- |
|
|
926
|
+
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The existing node as reference |
|
|
927
|
+
| newNode | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to go after the existing node |
|
|
1049
928
|
|
|
1050
929
|
<a name="LinkedList+insertBefore"></a>
|
|
1051
930
|
|
|
@@ -1055,10 +934,10 @@ Insert a new node (or data) before a node.
|
|
|
1055
934
|
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1056
935
|
**Overrides**: [<code>insertBefore</code>](#Arrayable+insertBefore)
|
|
1057
936
|
|
|
1058
|
-
| Param | Type |
|
|
1059
|
-
| --- | --- |
|
|
1060
|
-
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> |
|
|
1061
|
-
| newNode | [<code>Linker</code>](#Linker) \| <code>\*</code> |
|
|
937
|
+
| Param | Type | Description |
|
|
938
|
+
| --- | --- | --- |
|
|
939
|
+
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The existing node as reference |
|
|
940
|
+
| newNode | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to go before the existing node |
|
|
1062
941
|
|
|
1063
942
|
<a name="LinkedList+append"></a>
|
|
1064
943
|
|
|
@@ -1068,10 +947,10 @@ Add a node (or data) after the given (or last) node in the list.
|
|
|
1068
947
|
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1069
948
|
**Overrides**: [<code>append</code>](#Arrayable+append)
|
|
1070
949
|
|
|
1071
|
-
| Param | Type |
|
|
1072
|
-
| --- | --- |
|
|
1073
|
-
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> |
|
|
1074
|
-
| after | [<code>Linker</code>](#Linker) |
|
|
950
|
+
| Param | Type | Description |
|
|
951
|
+
| --- | --- | --- |
|
|
952
|
+
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to add to the end of the list |
|
|
953
|
+
| after | [<code>Linker</code>](#Linker) | The existing last node |
|
|
1075
954
|
|
|
1076
955
|
<a name="LinkedList+prepend"></a>
|
|
1077
956
|
|
|
@@ -1081,10 +960,10 @@ Add a node (or data) before the given (or first) node in the list.
|
|
|
1081
960
|
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1082
961
|
**Overrides**: [<code>prepend</code>](#Arrayable+prepend)
|
|
1083
962
|
|
|
1084
|
-
| Param | Type |
|
|
1085
|
-
| --- | --- |
|
|
1086
|
-
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> |
|
|
1087
|
-
| before | [<code>Linker</code>](#Linker) |
|
|
963
|
+
| Param | Type | Description |
|
|
964
|
+
| --- | --- | --- |
|
|
965
|
+
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to add to the start of the list |
|
|
966
|
+
| before | [<code>Linker</code>](#Linker) | The existing first node |
|
|
1088
967
|
|
|
1089
968
|
<a name="LinkedList+remove"></a>
|
|
1090
969
|
|
|
@@ -1094,9 +973,9 @@ Remove a linker from this linked list.
|
|
|
1094
973
|
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1095
974
|
**Overrides**: [<code>remove</code>](#Arrayable+remove)
|
|
1096
975
|
|
|
1097
|
-
| Param | Type |
|
|
1098
|
-
| --- | --- |
|
|
1099
|
-
| node | [<code>Linker</code>](#Linker) |
|
|
976
|
+
| Param | Type | Description |
|
|
977
|
+
| --- | --- | --- |
|
|
978
|
+
| node | [<code>Linker</code>](#Linker) | The node we wish to remove (and it will be returned after removal) |
|
|
1100
979
|
|
|
1101
980
|
<a name="LinkedList+item"></a>
|
|
1102
981
|
|
|
@@ -1106,9 +985,9 @@ Retrieve a Linker item from this list by numeric index, otherwise return null.
|
|
|
1106
985
|
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1107
986
|
**Overrides**: [<code>item</code>](#Arrayable+item)
|
|
1108
987
|
|
|
1109
|
-
| Param | Type |
|
|
1110
|
-
| --- | --- |
|
|
1111
|
-
| index | <code>number</code> |
|
|
988
|
+
| Param | Type | Description |
|
|
989
|
+
| --- | --- | --- |
|
|
990
|
+
| index | <code>number</code> | The integer number for retrieving a node by position. |
|
|
1112
991
|
|
|
1113
992
|
<a name="LinkedList+forEach"></a>
|
|
1114
993
|
|
|
@@ -1118,24 +997,23 @@ Be able to run forEach on this LinkedList to iterate over the linkers.
|
|
|
1118
997
|
**Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
|
|
1119
998
|
**Overrides**: [<code>forEach</code>](#Arrayable+forEach)
|
|
1120
999
|
|
|
1121
|
-
| Param | Type |
|
|
1122
|
-
| --- | --- |
|
|
1123
|
-
| callback |
|
|
1124
|
-
| thisArg | [<code>LinkedList</code>](#LinkedList)
|
|
1000
|
+
| Param | Type | Description |
|
|
1001
|
+
| --- | --- | --- |
|
|
1002
|
+
| callback | <code>forEachCallback</code> | The function to call for-each linker |
|
|
1003
|
+
| thisArg | [<code>LinkedList</code>](#LinkedList) | Optional, 'this' reference |
|
|
1125
1004
|
|
|
1126
1005
|
<a name="LinkedList.fromArray"></a>
|
|
1127
1006
|
|
|
1128
|
-
### LinkedList.fromArray(values, linkerClass,
|
|
1007
|
+
### LinkedList.fromArray(values, linkerClass, [classType]) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
1129
1008
|
Convert an array to a LinkedList.
|
|
1130
1009
|
|
|
1131
1010
|
**Kind**: static method of [<code>LinkedList</code>](#LinkedList)
|
|
1132
|
-
**Methodof**: LinkedList
|
|
1133
1011
|
|
|
1134
|
-
| Param | Type |
|
|
1135
|
-
| --- | --- |
|
|
1136
|
-
| values | <code>Array</code> |
|
|
1137
|
-
| linkerClass |
|
|
1138
|
-
|
|
|
1012
|
+
| Param | Type | Default | Description |
|
|
1013
|
+
| --- | --- | --- | --- |
|
|
1014
|
+
| values | <code>Array</code> | | An array of values which will be converted to linkers in this linked-list |
|
|
1015
|
+
| linkerClass | <code>IsLinker</code> | | The class to use for each linker |
|
|
1016
|
+
| [classType] | [<code>IsArrayable.<Linker></code>](#Linker) | <code>LinkedList</code> | Provide the type of IsArrayable to use. |
|
|
1139
1017
|
|
|
1140
1018
|
<a name="DoublyLinkedList"></a>
|
|
1141
1019
|
|
|
@@ -1146,36 +1024,36 @@ DoublyLinkedList represents a collection stored as a LinkedList with prev and ne
|
|
|
1146
1024
|
**Extends**: [<code>LinkedList</code>](#LinkedList)
|
|
1147
1025
|
|
|
1148
1026
|
* [DoublyLinkedList](#DoublyLinkedList) ⇐ [<code>LinkedList</code>](#LinkedList)
|
|
1149
|
-
* [new DoublyLinkedList(
|
|
1027
|
+
* [new DoublyLinkedList()](#new_DoublyLinkedList_new)
|
|
1150
1028
|
* _instance_
|
|
1029
|
+
* [.list](#DoublyLinkedList+list) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1151
1030
|
* [.first](#DoublyLinkedList+first) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1152
1031
|
* [.last](#DoublyLinkedList+last) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1153
1032
|
* [.length](#DoublyLinkedList+length) ⇒ <code>number</code>
|
|
1154
|
-
* [.
|
|
1155
|
-
* [.initialized](#Arrayable+initialized) ⇒ <code>boolean</code>
|
|
1156
|
-
* [.innerList](#Arrayable+innerList) ⇒ <code>Array</code>
|
|
1033
|
+
* [.initialize(initialList)](#DoublyLinkedList+initialize) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1157
1034
|
* [.insertAfter(node, newNode)](#DoublyLinkedList+insertAfter) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1158
1035
|
* [.insertBefore(node, newNode)](#DoublyLinkedList+insertBefore) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1036
|
+
* [.append(node, after)](#DoublyLinkedList+append) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1037
|
+
* [.prepend(node, before)](#DoublyLinkedList+prepend) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1159
1038
|
* [.remove(node)](#DoublyLinkedList+remove) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1160
1039
|
* [.reset()](#DoublyLinkedList+reset) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1161
1040
|
* [.item(index)](#DoublyLinkedList+item) ⇒ [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code>
|
|
1162
1041
|
* [.forEach(callback, thisArg)](#DoublyLinkedList+forEach)
|
|
1163
|
-
* [.initialize(initialList)](#LinkedList+initialize) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
1164
|
-
* [.append(node, after)](#LinkedList+append) ⇒ [<code>Linker</code>](#Linker)
|
|
1165
|
-
* [.prepend(node, before)](#LinkedList+prepend) ⇒ [<code>Linker</code>](#Linker)
|
|
1166
1042
|
* _static_
|
|
1167
|
-
* [.fromArray([values], [linkerClass], [
|
|
1043
|
+
* [.fromArray([values], [linkerClass], [classType])](#DoublyLinkedList.fromArray) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1168
1044
|
|
|
1169
1045
|
<a name="new_DoublyLinkedList_new"></a>
|
|
1170
1046
|
|
|
1171
|
-
### new DoublyLinkedList(
|
|
1172
|
-
Create the new DoublyLinkedList instance
|
|
1047
|
+
### new DoublyLinkedList()
|
|
1048
|
+
Create the new DoublyLinkedList instance.
|
|
1173
1049
|
|
|
1050
|
+
<a name="DoublyLinkedList+list"></a>
|
|
1174
1051
|
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
| [listClass] | [<code>DoublyLinkedList</code>](#DoublyLinkedList) \| <code>Iterable</code> | <code>DoublyLinkedList</code> |
|
|
1052
|
+
### doublyLinkedList.list ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1053
|
+
Retrieve a copy of the innerList used.
|
|
1178
1054
|
|
|
1055
|
+
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1056
|
+
**Overrides**: [<code>list</code>](#LinkedList+list)
|
|
1179
1057
|
<a name="DoublyLinkedList+first"></a>
|
|
1180
1058
|
|
|
1181
1059
|
### doublyLinkedList.first ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
@@ -1197,27 +1075,18 @@ Return the length of the list.
|
|
|
1197
1075
|
|
|
1198
1076
|
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1199
1077
|
**Overrides**: [<code>length</code>](#LinkedList+length)
|
|
1200
|
-
<a name="
|
|
1201
|
-
|
|
1202
|
-
### doublyLinkedList.classType ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1203
|
-
Return the type of class used for Arrayable.
|
|
1204
|
-
|
|
1205
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1206
|
-
**Overrides**: [<code>classType</code>](#Arrayable+classType)
|
|
1207
|
-
<a name="Arrayable+initialized"></a>
|
|
1078
|
+
<a name="DoublyLinkedList+initialize"></a>
|
|
1208
1079
|
|
|
1209
|
-
### doublyLinkedList.
|
|
1210
|
-
|
|
1080
|
+
### doublyLinkedList.initialize(initialList) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1081
|
+
Initialize the inner list, should only run once.
|
|
1211
1082
|
|
|
1212
|
-
**Kind**: instance
|
|
1213
|
-
**Overrides**: [<code>
|
|
1214
|
-
<a name="Arrayable+innerList"></a>
|
|
1083
|
+
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1084
|
+
**Overrides**: [<code>initialize</code>](#LinkedList+initialize)
|
|
1215
1085
|
|
|
1216
|
-
|
|
1217
|
-
|
|
1086
|
+
| Param | Type | Description |
|
|
1087
|
+
| --- | --- | --- |
|
|
1088
|
+
| initialList | [<code>DoubleLinker</code>](#DoubleLinker) | Give the list of double-linkers to start in this doubly linked-list. |
|
|
1218
1089
|
|
|
1219
|
-
**Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1220
|
-
**Overrides**: [<code>innerList</code>](#Arrayable+innerList)
|
|
1221
1090
|
<a name="DoublyLinkedList+insertAfter"></a>
|
|
1222
1091
|
|
|
1223
1092
|
### doublyLinkedList.insertAfter(node, newNode) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
@@ -1226,10 +1095,10 @@ Insert a new node (or data) after a node.
|
|
|
1226
1095
|
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1227
1096
|
**Overrides**: [<code>insertAfter</code>](#LinkedList+insertAfter)
|
|
1228
1097
|
|
|
1229
|
-
| Param | Type |
|
|
1230
|
-
| --- | --- |
|
|
1231
|
-
| node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> |
|
|
1232
|
-
| newNode | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> |
|
|
1098
|
+
| Param | Type | Description |
|
|
1099
|
+
| --- | --- | --- |
|
|
1100
|
+
| node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The existing node as reference |
|
|
1101
|
+
| newNode | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to go after the existing node |
|
|
1233
1102
|
|
|
1234
1103
|
<a name="DoublyLinkedList+insertBefore"></a>
|
|
1235
1104
|
|
|
@@ -1239,10 +1108,36 @@ Insert a new node (or data) before a node.
|
|
|
1239
1108
|
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1240
1109
|
**Overrides**: [<code>insertBefore</code>](#LinkedList+insertBefore)
|
|
1241
1110
|
|
|
1242
|
-
| Param | Type |
|
|
1243
|
-
| --- | --- |
|
|
1244
|
-
| node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> |
|
|
1245
|
-
| newNode | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> |
|
|
1111
|
+
| Param | Type | Description |
|
|
1112
|
+
| --- | --- | --- |
|
|
1113
|
+
| node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The existing node as reference |
|
|
1114
|
+
| newNode | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to go before the existing node |
|
|
1115
|
+
|
|
1116
|
+
<a name="DoublyLinkedList+append"></a>
|
|
1117
|
+
|
|
1118
|
+
### doublyLinkedList.append(node, after) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1119
|
+
Add a node (or data) after the given (or last) node in the list.
|
|
1120
|
+
|
|
1121
|
+
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1122
|
+
**Overrides**: [<code>append</code>](#LinkedList+append)
|
|
1123
|
+
|
|
1124
|
+
| Param | Type | Description |
|
|
1125
|
+
| --- | --- | --- |
|
|
1126
|
+
| node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to add to the end of the list |
|
|
1127
|
+
| after | [<code>DoubleLinker</code>](#DoubleLinker) | The existing last node |
|
|
1128
|
+
|
|
1129
|
+
<a name="DoublyLinkedList+prepend"></a>
|
|
1130
|
+
|
|
1131
|
+
### doublyLinkedList.prepend(node, before) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1132
|
+
Add a node (or data) before the given (or first) node in the list.
|
|
1133
|
+
|
|
1134
|
+
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1135
|
+
**Overrides**: [<code>prepend</code>](#LinkedList+prepend)
|
|
1136
|
+
|
|
1137
|
+
| Param | Type | Description |
|
|
1138
|
+
| --- | --- | --- |
|
|
1139
|
+
| node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to add to the start of the list |
|
|
1140
|
+
| before | [<code>DoubleLinker</code>](#DoubleLinker) | The existing first node |
|
|
1246
1141
|
|
|
1247
1142
|
<a name="DoublyLinkedList+remove"></a>
|
|
1248
1143
|
|
|
@@ -1252,9 +1147,9 @@ Remove a linker from this linked list.
|
|
|
1252
1147
|
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1253
1148
|
**Overrides**: [<code>remove</code>](#LinkedList+remove)
|
|
1254
1149
|
|
|
1255
|
-
| Param | Type |
|
|
1256
|
-
| --- | --- |
|
|
1257
|
-
| node | [<code>DoubleLinker</code>](#DoubleLinker) |
|
|
1150
|
+
| Param | Type | Description |
|
|
1151
|
+
| --- | --- | --- |
|
|
1152
|
+
| node | [<code>DoubleLinker</code>](#DoubleLinker) | The node we wish to remove (and it will be returned after removal) |
|
|
1258
1153
|
|
|
1259
1154
|
<a name="DoublyLinkedList+reset"></a>
|
|
1260
1155
|
|
|
@@ -1270,151 +1165,97 @@ Retrieve a DoubleLinker item from this list by numeric index, otherwise return n
|
|
|
1270
1165
|
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1271
1166
|
**Overrides**: [<code>item</code>](#LinkedList+item)
|
|
1272
1167
|
|
|
1273
|
-
| Param | Type |
|
|
1274
|
-
| --- | --- |
|
|
1275
|
-
| index | <code>number</code> |
|
|
1168
|
+
| Param | Type | Description |
|
|
1169
|
+
| --- | --- | --- |
|
|
1170
|
+
| index | <code>number</code> | The integer number for retrieving a node by position. |
|
|
1276
1171
|
|
|
1277
1172
|
<a name="DoublyLinkedList+forEach"></a>
|
|
1278
1173
|
|
|
1279
1174
|
### doublyLinkedList.forEach(callback, thisArg)
|
|
1280
|
-
Be able to run forEach on this DoublyLinkedList
|
|
1175
|
+
Be able to run forEach on this DoublyLinkedList to iterate over the DoubleLinker Items.
|
|
1281
1176
|
|
|
1282
1177
|
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1283
1178
|
**Overrides**: [<code>forEach</code>](#LinkedList+forEach)
|
|
1284
1179
|
|
|
1285
|
-
| Param | Type |
|
|
1286
|
-
| --- | --- |
|
|
1287
|
-
| callback |
|
|
1288
|
-
| thisArg | [<code>DoublyLinkedList</code>](#DoublyLinkedList) |
|
|
1289
|
-
|
|
1290
|
-
<a name="LinkedList+initialize"></a>
|
|
1291
|
-
|
|
1292
|
-
### doublyLinkedList.initialize(initialList) ⇒ [<code>LinkedList</code>](#LinkedList)
|
|
1293
|
-
Initialize the inner list, should only run once.
|
|
1294
|
-
|
|
1295
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1296
|
-
**Overrides**: [<code>initialize</code>](#LinkedList+initialize)
|
|
1297
|
-
|
|
1298
|
-
| Param | Type |
|
|
1299
|
-
| --- | --- |
|
|
1300
|
-
| initialList | [<code>Linker</code>](#Linker) \| <code>Array</code> |
|
|
1301
|
-
|
|
1302
|
-
<a name="LinkedList+append"></a>
|
|
1303
|
-
|
|
1304
|
-
### doublyLinkedList.append(node, after) ⇒ [<code>Linker</code>](#Linker)
|
|
1305
|
-
Add a node (or data) after the given (or last) node in the list.
|
|
1306
|
-
|
|
1307
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1308
|
-
**Overrides**: [<code>append</code>](#LinkedList+append)
|
|
1309
|
-
|
|
1310
|
-
| Param | Type |
|
|
1311
|
-
| --- | --- |
|
|
1312
|
-
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> |
|
|
1313
|
-
| after | [<code>Linker</code>](#Linker) |
|
|
1314
|
-
|
|
1315
|
-
<a name="LinkedList+prepend"></a>
|
|
1316
|
-
|
|
1317
|
-
### doublyLinkedList.prepend(node, before) ⇒ [<code>Linker</code>](#Linker)
|
|
1318
|
-
Add a node (or data) before the given (or first) node in the list.
|
|
1319
|
-
|
|
1320
|
-
**Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1321
|
-
**Overrides**: [<code>prepend</code>](#LinkedList+prepend)
|
|
1322
|
-
|
|
1323
|
-
| Param | Type |
|
|
1324
|
-
| --- | --- |
|
|
1325
|
-
| node | [<code>Linker</code>](#Linker) \| <code>\*</code> |
|
|
1326
|
-
| before | [<code>Linker</code>](#Linker) |
|
|
1180
|
+
| Param | Type | Description |
|
|
1181
|
+
| --- | --- | --- |
|
|
1182
|
+
| callback | <code>forEachCallback</code> | The function to call for-each double linker |
|
|
1183
|
+
| thisArg | [<code>DoublyLinkedList</code>](#DoublyLinkedList) | Optional, 'this' reference |
|
|
1327
1184
|
|
|
1328
1185
|
<a name="DoublyLinkedList.fromArray"></a>
|
|
1329
1186
|
|
|
1330
|
-
### DoublyLinkedList.fromArray([values], [linkerClass], [
|
|
1187
|
+
### DoublyLinkedList.fromArray([values], [linkerClass], [classType]) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1331
1188
|
Convert an array into a DoublyLinkedList instance, return the new instance.
|
|
1332
1189
|
|
|
1333
1190
|
**Kind**: static method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
|
|
1334
|
-
**Methodof**: DoublyLinkedList
|
|
1335
1191
|
|
|
1336
|
-
| Param | Type | Default |
|
|
1337
|
-
| --- | --- | --- |
|
|
1338
|
-
| [values] | <code>Array</code> | <code>[]</code> |
|
|
1339
|
-
| [linkerClass] |
|
|
1340
|
-
| [
|
|
1192
|
+
| Param | Type | Default | Description |
|
|
1193
|
+
| --- | --- | --- | --- |
|
|
1194
|
+
| [values] | <code>Array</code> | <code>[]</code> | An array of values which will be converted to linkers in this doubly-linked-list |
|
|
1195
|
+
| [linkerClass] | <code>IsDoubleLinker</code> | <code>DoubleLinker</code> | The class to use for each linker |
|
|
1196
|
+
| [classType] | <code>IsArrayable.<IsDoubleLinker></code> | <code>LinkedList</code> | Provide the type of IsArrayable to use. |
|
|
1341
1197
|
|
|
1342
1198
|
<a name="DoubleLinker"></a>
|
|
1343
1199
|
|
|
1344
1200
|
## DoubleLinker ⇐ [<code>Linker</code>](#Linker)
|
|
1345
|
-
DoubleLinker represents a node in a DoublyLinkedList.
|
|
1201
|
+
DoubleLinker represents a node in a DoublyLinkedList which is chained by next and prev.
|
|
1346
1202
|
|
|
1347
1203
|
**Kind**: global class
|
|
1348
1204
|
**Extends**: [<code>Linker</code>](#Linker)
|
|
1349
1205
|
|
|
1350
1206
|
* [DoubleLinker](#DoubleLinker) ⇐ [<code>Linker</code>](#Linker)
|
|
1351
|
-
* [new DoubleLinker([nodeData]
|
|
1352
|
-
*
|
|
1353
|
-
|
|
1354
|
-
* _static_
|
|
1355
|
-
* [.make(linker, [linkerClass])](#DoubleLinker.make) ⇒ [<code>Linker</code>](#Linker)
|
|
1356
|
-
* [.fromArray([values], [linkerClass])](#DoubleLinker.fromArray) ⇒ <code>Object</code>
|
|
1207
|
+
* [new DoubleLinker([nodeData])](#new_DoubleLinker_new)
|
|
1208
|
+
* [.make(linker, [classType])](#DoubleLinker.make) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1209
|
+
* [.fromArray([values], [classType])](#DoubleLinker.fromArray) ⇒ <code>Object</code>
|
|
1357
1210
|
|
|
1358
1211
|
<a name="new_DoubleLinker_new"></a>
|
|
1359
1212
|
|
|
1360
|
-
### new DoubleLinker([nodeData]
|
|
1361
|
-
Create the new DoubleLinker instance, provide the data and optionally
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
| Param | Type | Default |
|
|
1365
|
-
| --- | --- | --- |
|
|
1366
|
-
| [nodeData] | <code>Object</code> | <code>{}</code> |
|
|
1367
|
-
| [nodeData.data] | <code>\*</code> | <code></code> |
|
|
1368
|
-
| [nodeData.prev] | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code> | <code></code> |
|
|
1369
|
-
| [nodeData.next] | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code> | <code></code> |
|
|
1370
|
-
| [linkerClass] | [<code>DoubleLinker</code>](#DoubleLinker) | <code>DoubleLinker</code> |
|
|
1213
|
+
### new DoubleLinker([nodeData])
|
|
1214
|
+
Create the new DoubleLinker instance, provide the data and optionally the next and prev references.
|
|
1371
1215
|
|
|
1372
|
-
<a name="ArrayElement+classType"></a>
|
|
1373
1216
|
|
|
1374
|
-
|
|
1375
|
-
|
|
1217
|
+
| Param | Type | Default | Description |
|
|
1218
|
+
| --- | --- | --- | --- |
|
|
1219
|
+
| [nodeData] | <code>Object</code> | <code>{}</code> | |
|
|
1220
|
+
| [nodeData.data] | <code>\*</code> | <code></code> | The data to be stored in this linker |
|
|
1221
|
+
| [nodeData.next] | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code> | <code></code> | The reference to the next linker if any |
|
|
1222
|
+
| [nodeData.prev] | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code> | <code></code> | The reference to the previous linker if any |
|
|
1376
1223
|
|
|
1377
|
-
**Kind**: instance property of [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1378
|
-
**Overrides**: [<code>classType</code>](#ArrayElement+classType)
|
|
1379
1224
|
<a name="DoubleLinker.make"></a>
|
|
1380
1225
|
|
|
1381
|
-
### DoubleLinker.make(linker, [
|
|
1226
|
+
### DoubleLinker.make(linker, [classType]) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1382
1227
|
Make a new DoubleLinker from the data given if it is not already a valid Linker.
|
|
1383
1228
|
|
|
1384
1229
|
**Kind**: static method of [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1385
|
-
**Methodof**: DoubleLinker
|
|
1386
1230
|
|
|
1387
|
-
| Param | Type | Default |
|
|
1388
|
-
| --- | --- | --- |
|
|
1389
|
-
| linker | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | |
|
|
1390
|
-
| [
|
|
1231
|
+
| Param | Type | Default | Description |
|
|
1232
|
+
| --- | --- | --- | --- |
|
|
1233
|
+
| linker | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | | Return a valid Linker instance from given data, or even an already valid one. |
|
|
1234
|
+
| [classType] | <code>IsDoubleLinker</code> | <code>DoubleLinker</code> | Provide the type of IsDoubleLinker to use. |
|
|
1391
1235
|
|
|
1392
1236
|
<a name="DoubleLinker.fromArray"></a>
|
|
1393
1237
|
|
|
1394
|
-
### DoubleLinker.fromArray([values], [
|
|
1238
|
+
### DoubleLinker.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
1395
1239
|
Convert an array into DoubleLinker instances, return the head and tail DoubleLinkers.
|
|
1396
1240
|
|
|
1397
1241
|
**Kind**: static method of [<code>DoubleLinker</code>](#DoubleLinker)
|
|
1398
|
-
**Methodof**: DoubleLinker
|
|
1399
1242
|
|
|
1400
|
-
| Param | Type | Default |
|
|
1401
|
-
| --- | --- | --- |
|
|
1402
|
-
| [values] | <code>Array</code> | <code>[]</code> |
|
|
1403
|
-
| [
|
|
1243
|
+
| Param | Type | Default | Description |
|
|
1244
|
+
| --- | --- | --- | --- |
|
|
1245
|
+
| [values] | <code>Array</code> | <code>[]</code> | Provide an array of data that will be converted to a chain of linkers. |
|
|
1246
|
+
| [classType] | <code>IsDoubleLinker</code> | <code>DoubleLinker</code> | Provide the type of IsDoubleLinker to use. |
|
|
1404
1247
|
|
|
1405
1248
|
<a name="Arrayable"></a>
|
|
1406
1249
|
|
|
1407
1250
|
## Arrayable
|
|
1408
|
-
|
|
1251
|
+
Arrayable represents a collection stored as an array.
|
|
1409
1252
|
|
|
1410
1253
|
**Kind**: global class
|
|
1411
1254
|
|
|
1412
1255
|
* [Arrayable](#Arrayable)
|
|
1413
|
-
* [new Arrayable(
|
|
1256
|
+
* [new Arrayable()](#new_Arrayable_new)
|
|
1414
1257
|
* _instance_
|
|
1415
|
-
* [.
|
|
1416
|
-
* [.initialized](#Arrayable+initialized) ⇒ <code>boolean</code>
|
|
1417
|
-
* [.innerList](#Arrayable+innerList) ⇒ <code>Array</code>
|
|
1258
|
+
* [.list](#Arrayable+list) ⇒ [<code>Array.<ArrayElement></code>](#ArrayElement)
|
|
1418
1259
|
* [.first](#Arrayable+first) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
1419
1260
|
* [.last](#Arrayable+last) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
1420
1261
|
* [.length](#Arrayable+length) ⇒ <code>number</code>
|
|
@@ -1427,33 +1268,16 @@ DoublyLinkedList represents a collection stored as a LinkedList with prev and ne
|
|
|
1427
1268
|
* [.item(index)](#Arrayable+item) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
|
|
1428
1269
|
* [.forEach(callback, thisArg)](#Arrayable+forEach) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1429
1270
|
* _static_
|
|
1430
|
-
* [.fromArray(values, elementClass, classType)](#Arrayable.fromArray) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1271
|
+
* [.fromArray(values, [elementClass], [classType])](#Arrayable.fromArray) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1431
1272
|
|
|
1432
1273
|
<a name="new_Arrayable_new"></a>
|
|
1433
1274
|
|
|
1434
|
-
### new Arrayable(
|
|
1275
|
+
### new Arrayable()
|
|
1435
1276
|
Create the new Arrayable instance, configure the Arrayable class.
|
|
1436
1277
|
|
|
1278
|
+
<a name="Arrayable+list"></a>
|
|
1437
1279
|
|
|
1438
|
-
|
|
1439
|
-
| --- | --- |
|
|
1440
|
-
| classType | [<code>Arrayable</code>](#Arrayable) \| <code>Iterable</code> |
|
|
1441
|
-
|
|
1442
|
-
<a name="Arrayable+classType"></a>
|
|
1443
|
-
|
|
1444
|
-
### arrayable.classType ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1445
|
-
Return the type of class used for Arrayable.
|
|
1446
|
-
|
|
1447
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
1448
|
-
<a name="Arrayable+initialized"></a>
|
|
1449
|
-
|
|
1450
|
-
### arrayable.initialized ⇒ <code>boolean</code>
|
|
1451
|
-
Detect if the inner list has been initialized.
|
|
1452
|
-
|
|
1453
|
-
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
1454
|
-
<a name="Arrayable+innerList"></a>
|
|
1455
|
-
|
|
1456
|
-
### arrayable.innerList ⇒ <code>Array</code>
|
|
1280
|
+
### arrayable.list ⇒ [<code>Array.<ArrayElement></code>](#ArrayElement)
|
|
1457
1281
|
Retrieve a copy of the innerList used.
|
|
1458
1282
|
|
|
1459
1283
|
**Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
|
|
@@ -1482,9 +1306,9 @@ Initialize the inner list, should only run once.
|
|
|
1482
1306
|
|
|
1483
1307
|
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1484
1308
|
|
|
1485
|
-
| Param | Type |
|
|
1486
|
-
| --- | --- |
|
|
1487
|
-
| initialList | [<code>ArrayElement
|
|
1309
|
+
| Param | Type | Description |
|
|
1310
|
+
| --- | --- | --- |
|
|
1311
|
+
| initialList | [<code>Array.<ArrayElement></code>](#ArrayElement) | Give the array of elements to start in this Arrayable. |
|
|
1488
1312
|
|
|
1489
1313
|
<a name="Arrayable+insertAfter"></a>
|
|
1490
1314
|
|
|
@@ -1493,10 +1317,10 @@ Insert a new node (or data) after a node.
|
|
|
1493
1317
|
|
|
1494
1318
|
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1495
1319
|
|
|
1496
|
-
| Param | Type |
|
|
1497
|
-
| --- | --- |
|
|
1498
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> |
|
|
1499
|
-
| newNode | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> |
|
|
1320
|
+
| Param | Type | Description |
|
|
1321
|
+
| --- | --- | --- |
|
|
1322
|
+
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The existing node as reference |
|
|
1323
|
+
| newNode | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to go after the existing node |
|
|
1500
1324
|
|
|
1501
1325
|
<a name="Arrayable+insertBefore"></a>
|
|
1502
1326
|
|
|
@@ -1505,10 +1329,10 @@ Insert a new node (or data) before a node.
|
|
|
1505
1329
|
|
|
1506
1330
|
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1507
1331
|
|
|
1508
|
-
| Param | Type |
|
|
1509
|
-
| --- | --- |
|
|
1510
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> |
|
|
1511
|
-
| newNode | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> |
|
|
1332
|
+
| Param | Type | Description |
|
|
1333
|
+
| --- | --- | --- |
|
|
1334
|
+
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The existing node as reference |
|
|
1335
|
+
| newNode | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to go before the existing node |
|
|
1512
1336
|
|
|
1513
1337
|
<a name="Arrayable+append"></a>
|
|
1514
1338
|
|
|
@@ -1517,10 +1341,10 @@ Add a node (or data) after the given (or last) node in the list.
|
|
|
1517
1341
|
|
|
1518
1342
|
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1519
1343
|
|
|
1520
|
-
| Param | Type |
|
|
1521
|
-
| --- | --- |
|
|
1522
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> |
|
|
1523
|
-
| after | [<code>ArrayElement</code>](#ArrayElement) |
|
|
1344
|
+
| Param | Type | Description |
|
|
1345
|
+
| --- | --- | --- |
|
|
1346
|
+
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to add to the end of the list |
|
|
1347
|
+
| after | [<code>ArrayElement</code>](#ArrayElement) | The existing last node |
|
|
1524
1348
|
|
|
1525
1349
|
<a name="Arrayable+prepend"></a>
|
|
1526
1350
|
|
|
@@ -1529,10 +1353,10 @@ Add a node (or data) before the given (or first) node in the list.
|
|
|
1529
1353
|
|
|
1530
1354
|
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1531
1355
|
|
|
1532
|
-
| Param | Type |
|
|
1533
|
-
| --- | --- |
|
|
1534
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> |
|
|
1535
|
-
| before | [<code>ArrayElement</code>](#ArrayElement) |
|
|
1356
|
+
| Param | Type | Description |
|
|
1357
|
+
| --- | --- | --- |
|
|
1358
|
+
| node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to add to the start of the list |
|
|
1359
|
+
| before | [<code>ArrayElement</code>](#ArrayElement) | The existing first node |
|
|
1536
1360
|
|
|
1537
1361
|
<a name="Arrayable+remove"></a>
|
|
1538
1362
|
|
|
@@ -1541,20 +1365,20 @@ Remove an element from this arrayable.
|
|
|
1541
1365
|
|
|
1542
1366
|
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1543
1367
|
|
|
1544
|
-
| Param | Type |
|
|
1545
|
-
| --- | --- |
|
|
1546
|
-
| node | [<code>ArrayElement</code>](#ArrayElement) |
|
|
1368
|
+
| Param | Type | Description |
|
|
1369
|
+
| --- | --- | --- |
|
|
1370
|
+
| node | [<code>ArrayElement</code>](#ArrayElement) | The node we wish to remove (and it will be returned after removal) |
|
|
1547
1371
|
|
|
1548
1372
|
<a name="Arrayable+item"></a>
|
|
1549
1373
|
|
|
1550
1374
|
### arrayable.item(index) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
|
|
1551
|
-
Retrieve
|
|
1375
|
+
Retrieve an ArrayElement item from this list by numeric index, otherwise return null.
|
|
1552
1376
|
|
|
1553
1377
|
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1554
1378
|
|
|
1555
|
-
| Param | Type |
|
|
1556
|
-
| --- | --- |
|
|
1557
|
-
| index | <code>number</code> |
|
|
1379
|
+
| Param | Type | Description |
|
|
1380
|
+
| --- | --- | --- |
|
|
1381
|
+
| index | <code>number</code> | The integer number for retrieving a node by position. |
|
|
1558
1382
|
|
|
1559
1383
|
<a name="Arrayable+forEach"></a>
|
|
1560
1384
|
|
|
@@ -1563,24 +1387,23 @@ Be able to run forEach on this Arrayable to iterate over the elements.
|
|
|
1563
1387
|
|
|
1564
1388
|
**Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
|
|
1565
1389
|
|
|
1566
|
-
| Param | Type |
|
|
1567
|
-
| --- | --- |
|
|
1568
|
-
| callback |
|
|
1569
|
-
| thisArg | [<code>Arrayable</code>](#Arrayable) |
|
|
1390
|
+
| Param | Type | Description |
|
|
1391
|
+
| --- | --- | --- |
|
|
1392
|
+
| callback | <code>forEachCallback</code> | The function to call for-each element |
|
|
1393
|
+
| thisArg | [<code>Arrayable</code>](#Arrayable) | Optional, 'this' reference |
|
|
1570
1394
|
|
|
1571
1395
|
<a name="Arrayable.fromArray"></a>
|
|
1572
1396
|
|
|
1573
|
-
### Arrayable.fromArray(values, elementClass, classType) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1397
|
+
### Arrayable.fromArray(values, [elementClass], [classType]) ⇒ [<code>Arrayable</code>](#Arrayable)
|
|
1574
1398
|
Convert an array to an Arrayable.
|
|
1575
1399
|
|
|
1576
1400
|
**Kind**: static method of [<code>Arrayable</code>](#Arrayable)
|
|
1577
|
-
**Methodof**: Arrayable
|
|
1578
1401
|
|
|
1579
|
-
| Param | Type |
|
|
1580
|
-
| --- | --- |
|
|
1581
|
-
| values | <code>Array</code> |
|
|
1582
|
-
| elementClass |
|
|
1583
|
-
| classType | [<code>
|
|
1402
|
+
| Param | Type | Default | Description |
|
|
1403
|
+
| --- | --- | --- | --- |
|
|
1404
|
+
| values | <code>Array</code> | | An array of values which will be converted to elements in this arrayable |
|
|
1405
|
+
| [elementClass] | <code>IsElement</code> | <code>ArrayElement</code> | The class to use for each element |
|
|
1406
|
+
| [classType] | [<code>IsArrayable.<ArrayElement></code>](#ArrayElement) | <code>Arrayable</code> | Provide the type of IsArrayable to use. |
|
|
1584
1407
|
|
|
1585
1408
|
<a name="ArrayElement"></a>
|
|
1586
1409
|
|
|
@@ -1590,87 +1413,83 @@ Element represents a node in an Arrayable.
|
|
|
1590
1413
|
**Kind**: global class
|
|
1591
1414
|
|
|
1592
1415
|
* [ArrayElement](#ArrayElement)
|
|
1593
|
-
* [new ArrayElement([data]
|
|
1594
|
-
*
|
|
1595
|
-
|
|
1596
|
-
* _static_
|
|
1597
|
-
* [.make(element, [elementClass])](#ArrayElement.make) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
1598
|
-
* [.fromArray([values], [elementClass])](#ArrayElement.fromArray) ⇒ <code>Object</code>
|
|
1416
|
+
* [new ArrayElement([data])](#new_ArrayElement_new)
|
|
1417
|
+
* [.make(element, [classType])](#ArrayElement.make) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
1418
|
+
* [.fromArray([values], [classType])](#ArrayElement.fromArray) ⇒ <code>Object</code>
|
|
1599
1419
|
|
|
1600
1420
|
<a name="new_ArrayElement_new"></a>
|
|
1601
1421
|
|
|
1602
|
-
### new ArrayElement([data]
|
|
1422
|
+
### new ArrayElement([data])
|
|
1603
1423
|
Create the new Element instance, provide the data and optionally configure the type of Element.
|
|
1604
1424
|
|
|
1605
1425
|
|
|
1606
|
-
| Param | Type | Default |
|
|
1607
|
-
| --- | --- | --- |
|
|
1608
|
-
| [data] | <code>\*</code> | <code></code> |
|
|
1609
|
-
| [elementClass] | [<code>ArrayElement</code>](#ArrayElement) | <code>Element</code> |
|
|
1610
|
-
|
|
1611
|
-
<a name="ArrayElement+classType"></a>
|
|
1612
|
-
|
|
1613
|
-
### arrayElement.classType ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
1614
|
-
Return the type of class used for Element.
|
|
1426
|
+
| Param | Type | Default | Description |
|
|
1427
|
+
| --- | --- | --- | --- |
|
|
1428
|
+
| [data] | <code>\*</code> | <code></code> | The data to be stored in this element. |
|
|
1615
1429
|
|
|
1616
|
-
**Kind**: instance property of [<code>ArrayElement</code>](#ArrayElement)
|
|
1617
1430
|
<a name="ArrayElement.make"></a>
|
|
1618
1431
|
|
|
1619
|
-
### ArrayElement.make(element, [
|
|
1432
|
+
### ArrayElement.make(element, [classType]) ⇒ [<code>ArrayElement</code>](#ArrayElement)
|
|
1620
1433
|
Make a new Element from the data given if it is not already a valid Element.
|
|
1621
1434
|
|
|
1622
1435
|
**Kind**: static method of [<code>ArrayElement</code>](#ArrayElement)
|
|
1623
|
-
**Methodof**: ArrayElement
|
|
1624
1436
|
|
|
1625
|
-
| Param | Type | Default |
|
|
1626
|
-
| --- | --- | --- |
|
|
1627
|
-
| element | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | |
|
|
1628
|
-
| [
|
|
1437
|
+
| Param | Type | Default | Description |
|
|
1438
|
+
| --- | --- | --- | --- |
|
|
1439
|
+
| element | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | | Return a valid ArrayElement instance from given data, or even an already valid one. |
|
|
1440
|
+
| [classType] | <code>IsElement</code> | <code>ArrayElement</code> | Provide the type of IsElement to use. |
|
|
1629
1441
|
|
|
1630
1442
|
<a name="ArrayElement.fromArray"></a>
|
|
1631
1443
|
|
|
1632
|
-
### ArrayElement.fromArray([values], [
|
|
1444
|
+
### ArrayElement.fromArray([values], [classType]) ⇒ <code>Object</code>
|
|
1633
1445
|
Convert an array into Element instances, return the head and tail Elements.
|
|
1634
1446
|
|
|
1635
1447
|
**Kind**: static method of [<code>ArrayElement</code>](#ArrayElement)
|
|
1636
|
-
**Methodof**: ArrayElement
|
|
1637
1448
|
|
|
1638
|
-
| Param | Type | Default |
|
|
1639
|
-
| --- | --- | --- |
|
|
1640
|
-
| [values] | <code>Array
|
|
1641
|
-
| [
|
|
1449
|
+
| Param | Type | Default | Description |
|
|
1450
|
+
| --- | --- | --- | --- |
|
|
1451
|
+
| [values] | <code>Array.<IsElement></code> | <code>[]</code> | Provide an array of data that will be converted to array of elements. |
|
|
1452
|
+
| [classType] | <code>IsElement</code> | <code>ArrayElement</code> | Provide the type of IsElement to use. |
|
|
1453
|
+
|
|
1454
|
+
<a name="services"></a>
|
|
1455
|
+
|
|
1456
|
+
## services
|
|
1457
|
+
List helpful functions when dealing with collections.
|
|
1642
1458
|
|
|
1459
|
+
**Kind**: global constant
|
|
1643
1460
|
<a name="recipes"></a>
|
|
1644
1461
|
|
|
1645
|
-
## recipes
|
|
1462
|
+
## recipes
|
|
1646
1463
|
List of class declarations that can be used to specify attributes for a style of object / class.
|
|
1647
1464
|
|
|
1648
1465
|
**Kind**: global constant
|
|
1649
|
-
<a name="
|
|
1466
|
+
<a name="parseTreeNext"></a>
|
|
1650
1467
|
|
|
1651
|
-
##
|
|
1652
|
-
|
|
1468
|
+
## parseTreeNext(treeNode) ⇒ <code>IsTreeNode</code> \| <code>null</code>
|
|
1469
|
+
Be able to parse over every node in a tree.
|
|
1470
|
+
1. Start at root (get root parent)
|
|
1471
|
+
2. Get first child (repeat until no children)
|
|
1472
|
+
3. Check next child
|
|
1473
|
+
4. Repeat 2
|
|
1474
|
+
5. Repeat 3
|
|
1475
|
+
6. If no next child, return to parent and repeat 3
|
|
1476
|
+
7. Stop at root (next is null and parent is null
|
|
1653
1477
|
|
|
1654
|
-
**Kind**: global
|
|
1655
|
-
**Properties**
|
|
1478
|
+
**Kind**: global function
|
|
1656
1479
|
|
|
1657
|
-
|
|
|
1658
|
-
| --- | --- |
|
|
1659
|
-
|
|
|
1660
|
-
| error | <code>\*</code> |
|
|
1661
|
-
| context | <code>\*</code> |
|
|
1480
|
+
| Param | Type | Description |
|
|
1481
|
+
| --- | --- | --- |
|
|
1482
|
+
| treeNode | <code>IsTreeNode</code> | Provide a node in a tree and get the next node (left-first approach) |
|
|
1662
1483
|
|
|
1663
|
-
<a name="
|
|
1484
|
+
<a name="parseTree"></a>
|
|
1664
1485
|
|
|
1665
|
-
##
|
|
1666
|
-
|
|
1486
|
+
## parseTree(tree, callback) ⇒ <code>IsArrayable.<IsTreeNode></code>
|
|
1487
|
+
Loop over all the nodes in a tree starting from left and apply a callback for each
|
|
1667
1488
|
|
|
1668
|
-
**Kind**: global
|
|
1669
|
-
**Returns**: void
|
|
1489
|
+
**Kind**: global function
|
|
1670
1490
|
|
|
1671
1491
|
| Param | Type |
|
|
1672
1492
|
| --- | --- |
|
|
1673
|
-
|
|
|
1674
|
-
|
|
|
1675
|
-
| thisArg | [<code>Arrayable</code>](#Arrayable) |
|
|
1493
|
+
| tree | <code>IsArrayable.<IsTreeNode></code> |
|
|
1494
|
+
| callback | <code>forEachCallback</code> |
|
|
1676
1495
|
|