collect-your-stuff 2.1.1 → 2.1.2

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.
Files changed (68) hide show
  1. package/README.md +898 -213
  2. package/browser/collect-your-stuff.js +677 -648
  3. package/browser/collect-your-stuff.min.js +1 -1
  4. package/dist/collections/arrayable/ArrayElement.d.ts +38 -38
  5. package/dist/collections/arrayable/ArrayElement.js +66 -66
  6. package/dist/collections/arrayable/Arrayable.d.ts +122 -122
  7. package/dist/collections/arrayable/Arrayable.js +2 -2
  8. package/dist/collections/doubly-linked-list/DoubleLinker.d.ts +50 -50
  9. package/dist/collections/doubly-linked-list/DoubleLinker.js +1 -1
  10. package/dist/collections/doubly-linked-list/DoublyLinkedList.d.ts +125 -125
  11. package/dist/collections/doubly-linked-list/DoublyLinkedList.js +3 -3
  12. package/dist/collections/linked-list/LinkedList.d.ts +126 -126
  13. package/dist/collections/linked-list/LinkedList.js +3 -3
  14. package/dist/collections/linked-list/Linker.d.ts +46 -46
  15. package/dist/collections/linked-list/Linker.js +1 -1
  16. package/dist/collections/linked-tree-list/LinkedTreeList.d.ts +159 -159
  17. package/dist/collections/linked-tree-list/LinkedTreeList.js +3 -3
  18. package/dist/collections/linked-tree-list/TreeLinker.d.ts +71 -71
  19. package/dist/collections/linked-tree-list/TreeLinker.js +2 -2
  20. package/dist/collections/queue/Queue.d.ts +59 -59
  21. package/dist/collections/queue/Queue.js +11 -9
  22. package/dist/collections/queue/Queueable.d.ts +83 -83
  23. package/dist/collections/queue/Queueable.js +9 -7
  24. package/dist/collections/queue/TaskQueue.d.ts +68 -68
  25. package/dist/collections/queue/TaskQueue.js +2 -2
  26. package/dist/collections/stack/Stack.d.ts +64 -64
  27. package/dist/collections/stack/Stack.js +11 -9
  28. package/dist/collections/stack/Stackable.d.ts +59 -59
  29. package/dist/collections/stack/Stackable.js +1 -1
  30. package/dist/collections/stack/TaskStack.d.ts +65 -65
  31. package/dist/collections/stack/TaskStack.js +2 -2
  32. package/dist/main.d.ts +68 -68
  33. package/dist/main.js +1 -1
  34. package/dist/recipes/ArrayIterator.d.ts +20 -20
  35. package/dist/recipes/ArrayIterator.js +39 -39
  36. package/dist/recipes/DoubleLinkerIterator.d.ts +18 -18
  37. package/dist/recipes/DoubleLinkerIterator.js +33 -33
  38. package/dist/recipes/IsArrayable.d.ts +105 -105
  39. package/dist/recipes/IsArrayable.js +5 -5
  40. package/dist/recipes/IsDoubleLinker.d.ts +14 -14
  41. package/dist/recipes/IsDoubleLinker.js +5 -5
  42. package/dist/recipes/IsElement.d.ts +14 -14
  43. package/dist/recipes/IsElement.js +5 -5
  44. package/dist/recipes/IsLinker.d.ts +10 -10
  45. package/dist/recipes/IsLinker.js +5 -5
  46. package/dist/recipes/IsQueue.d.ts +37 -37
  47. package/dist/recipes/IsQueue.js +5 -5
  48. package/dist/recipes/IsStack.d.ts +36 -36
  49. package/dist/recipes/IsStack.js +5 -5
  50. package/dist/recipes/IsTree.d.ts +11 -11
  51. package/dist/recipes/IsTree.js +5 -5
  52. package/dist/recipes/IsTreeNode.d.ts +29 -29
  53. package/dist/recipes/IsTreeNode.js +5 -5
  54. package/dist/recipes/LinkerIterator.d.ts +18 -18
  55. package/dist/recipes/LinkerIterator.js +33 -33
  56. package/dist/recipes/Runnable.d.ts +55 -55
  57. package/dist/recipes/Runnable.js +69 -69
  58. package/dist/recipes/TreeLinkerIterator.d.ts +20 -20
  59. package/dist/recipes/TreeLinkerIterator.js +1 -1
  60. package/dist/recipes/recipes.d.ts +15 -15
  61. package/dist/recipes/recipes.js +2 -2
  62. package/dist/services/parseTree.d.ts +9 -9
  63. package/dist/services/parseTree.js +1 -1
  64. package/dist/services/parseTreeNext.d.ts +17 -17
  65. package/dist/services/parseTreeNext.js +42 -42
  66. package/dist/services/services.d.ts +13 -13
  67. package/dist/services/services.js +2 -2
  68. package/package.json +2 -2
package/README.md CHANGED
@@ -28,17 +28,30 @@ Data allocation and manipulation.
28
28
  <dt><a href="#ArrayIterator">ArrayIterator</a></dt>
29
29
  <dd><p>Class ArrayIterator returns the next value when using elements of array type list.</p>
30
30
  </dd>
31
+ <dt><a href="#TaskStack">TaskStack</a></dt>
32
+ <dd><p>Store a collection of tasks (Stackables) which can only be inserted and removed from the top: pop() takes the task from
33
+ the top and RUNS it. For a plain last-in-first-out collection of items use Stack.</p>
34
+ </dd>
31
35
  <dt><a href="#Stackable">Stackable</a> ⇐ <code><a href="#Linker">Linker</a></code></dt>
32
36
  <dd><p>Stackable represents a runnable entry in stack.</p>
33
37
  </dd>
34
38
  <dt><a href="#Stack">Stack</a></dt>
35
- <dd><p>Store a collection of items which can only be inserted and removed from the top.</p>
39
+ <dd><p>A last-in-first-out collection: items are added to the top with push and taken from the top with pop. Any value can
40
+ be stacked (it is stored as it is, whether it is a function, an object or null), and adding and taking are constant
41
+ time. To stack tasks which are run as they are taken use TaskStack.</p>
42
+ </dd>
43
+ <dt><a href="#TaskQueue">TaskQueue</a></dt>
44
+ <dd><p>Maintain a series of queued tasks (Queueables): dequeue() takes the next task from the front and RUNS it, giving each
45
+ task in turn a chance to run (a task which is not ready, or which has not finished, is placed at the back again).
46
+ This is a task scheduler, for a plain first-in-first-out collection of items use Queue.</p>
36
47
  </dd>
37
48
  <dt><a href="#Queueable">Queueable</a> ⇐ <code><a href="#Linker">Linker</a></code></dt>
38
49
  <dd><p>Queueable represents a runnable entry in a queue.</p>
39
50
  </dd>
40
51
  <dt><a href="#Queue">Queue</a></dt>
41
- <dd><p>Maintain a series of queued items.</p>
52
+ <dd><p>A first-in-first-out collection: items are added to the back with enqueue and taken from the front with dequeue.
53
+ Any value can be queued (it is stored as it is, whether it is a function, an object or null), and adding and taking
54
+ are constant time. To queue tasks which are run as they are taken use TaskQueue.</p>
42
55
  </dd>
43
56
  <dt><a href="#TreeLinker">TreeLinker</a> ⇐ <code><a href="#DoubleLinker">DoubleLinker</a></code></dt>
44
57
  <dd><p>TreeLinker represents a node in a LinkedTreeList having a parent (or root) and child nodes.</p>
@@ -69,17 +82,23 @@ Data allocation and manipulation.
69
82
  ## Members
70
83
 
71
84
  <dl>
85
+ <dt><a href="#TaskStack">TaskStack</a> ⇒ <code><a href="#TaskStack">TaskStack</a></code></dt>
86
+ <dd><p>Convert an array to a TaskStack.</p>
87
+ </dd>
72
88
  <dt><a href="#Stackable">Stackable</a> ⇒ <code><a href="#Stackable">Stackable</a></code></dt>
73
89
  <dd><p>Make a new Stackable from the data given if it is not already a valid Stackable.</p>
74
90
  </dd>
75
91
  <dt><a href="#Stack">Stack</a> ⇒ <code><a href="#Stack">Stack</a></code></dt>
76
- <dd><p>Convert an array to a Stack.</p>
92
+ <dd><p>Convert an array to a Stack by pushing each value in turn, so the last value is on the top.</p>
93
+ </dd>
94
+ <dt><a href="#TaskQueue">TaskQueue</a> ⇒ <code><a href="#TaskQueue">TaskQueue</a></code></dt>
95
+ <dd><p>Convert an array to a TaskQueue.</p>
77
96
  </dd>
78
97
  <dt><a href="#Queueable">Queueable</a> ⇒ <code><a href="#Queueable">Queueable</a></code></dt>
79
98
  <dd><p>Make a new Queueable from the data given if it is not already a valid Queueable.</p>
80
99
  </dd>
81
100
  <dt><a href="#Queue">Queue</a> ⇒ <code><a href="#Queue">Queue</a></code></dt>
82
- <dd><p>Convert an array to a Queue.</p>
101
+ <dd><p>Convert an array to a Queue, the first value is at the front.</p>
83
102
  </dd>
84
103
  <dt><a href="#TreeLinker">TreeLinker</a> ⇒ <code><a href="#TreeLinker">TreeLinker</a></code></dt>
85
104
  <dd><p>Make a new DoubleLinker from the data given if it is not already a valid Linker.</p>
@@ -121,7 +140,7 @@ Data allocation and manipulation.
121
140
  ## Functions
122
141
 
123
142
  <dl>
124
- <dt><a href="#parseTreeNext">parseTreeNext(treeNode)</a> ⇒ <code>IsTreeNode</code> | <code>null</code></dt>
143
+ <dt><a href="#parseTreeNext">parseTreeNext(treeNode, [boundaryParent])</a> ⇒ <code>IsTreeNode</code> | <code>null</code></dt>
125
144
  <dd><p>Be able to parse over every node in a tree.</p>
126
145
  <ol>
127
146
  <li>Start at root (get root parent)</li>
@@ -130,12 +149,17 @@ Data allocation and manipulation.
130
149
  <li>Repeat 2</li>
131
150
  <li>Repeat 3</li>
132
151
  <li>If no next child, return to parent and repeat 3</li>
133
- <li>Stop at root (next is null and parent is null</li>
152
+ <li>Stop at root (next is null and parent is null
153
+ A boundary can be given to parse only part of a tree: going back up to the parents stops at the boundary, so the
154
+ parsing stays within the nodes whose parent is the boundary (and everything below them).</li>
134
155
  </ol>
135
156
  </dd>
136
157
  <dt><a href="#parseTree">parseTree(tree, callback)</a> ⇒ <code>IsArrayable.&lt;IsTreeNode&gt;</code></dt>
137
158
  <dd><p>Loop over all the nodes in a tree starting from left and apply a callback for each</p>
138
159
  </dd>
160
+ <dt><a href="#borrowedGetter">borrowedGetter(name, list)</a> ⇒ <code>*</code></dt>
161
+ <dd><p>Use one of the accessors of DoublyLinkedList (which keeps track of the head, tail and length) for a LinkedTreeList.</p>
162
+ </dd>
139
163
  </dl>
140
164
 
141
165
  <a name="module_collect-your-stuff"></a>
@@ -160,18 +184,19 @@ Class TreeLinkerIterator returns the next value taking a left-first approach dow
160
184
  **Kind**: global class
161
185
 
162
186
  * [TreeLinkerIterator](#TreeLinkerIterator)
163
- * [new TreeLinkerIterator(current)](#new_TreeLinkerIterator_new)
187
+ * [new TreeLinkerIterator(current, [boundaryParent])](#new_TreeLinkerIterator_new)
164
188
  * [.next([value])](#TreeLinkerIterator+next) ⇒ <code>IteratorResult.&lt;IsTreeNode&gt;</code>
165
189
 
166
190
  <a name="new_TreeLinkerIterator_new"></a>
167
191
 
168
- ### new TreeLinkerIterator(current)
192
+ ### new TreeLinkerIterator(current, [boundaryParent])
169
193
  Create an iterator starting at the given item.
170
194
 
171
195
 
172
196
  | Param | Type | Description |
173
197
  | --- | --- | --- |
174
198
  | current | <code>IsTreeNode</code> | The item to start from. |
199
+ | [boundaryParent] | <code>IsTreeNode</code> \| <code>null</code> | The parent of the nodes to stay within (null for the top of a tree), the whole tree when not given. |
175
200
 
176
201
  <a name="TreeLinkerIterator+next"></a>
177
202
 
@@ -340,6 +365,76 @@ Get the next element, moving the iterator forward.
340
365
  | --- | --- | --- |
341
366
  | [value] | <code>\*</code> | Not used, present to match the Iterator interface. |
342
367
 
368
+ <a name="TaskStack"></a>
369
+
370
+ ## TaskStack
371
+ Store a collection of tasks (Stackables) which can only be inserted and removed from the top: pop() takes the task from
372
+ the top and RUNS it. For a plain last-in-first-out collection of items use Stack.
373
+
374
+ **Kind**: global class
375
+
376
+ * [TaskStack](#TaskStack)
377
+ * [new TaskStack([stackedList], [listClass], [stackableClass])](#new_TaskStack_new)
378
+ * [.empty()](#TaskStack+empty) ⇒ <code>boolean</code>
379
+ * [.top()](#TaskStack+top) ⇒ [<code>Stackable</code>](#Stackable)
380
+ * [.pop()](#TaskStack+pop) ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
381
+ * [.push(stackable)](#TaskStack+push)
382
+ * [.remove()](#TaskStack+remove) ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
383
+ * [.size()](#TaskStack+size) ⇒ <code>number</code>
384
+
385
+ <a name="new_TaskStack_new"></a>
386
+
387
+ ### new TaskStack([stackedList], [listClass], [stackableClass])
388
+ Instantiate the state with the starter stacked list.
389
+
390
+
391
+ | Param | Type | Default | Description |
392
+ | --- | --- | --- | --- |
393
+ | [stackedList] | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) | <code></code> | The list of stackables to start in this stack. |
394
+ | [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no stacked list is given. |
395
+ | [stackableClass] | [<code>Stackable</code>](#Stackable) | <code>Stackable</code> | The class used to wrap stacked items. |
396
+
397
+ <a name="TaskStack+empty"></a>
398
+
399
+ ### taskStack.empty() ⇒ <code>boolean</code>
400
+ Return true if the stack is empty (there are no tasks in the stacked list)
401
+
402
+ **Kind**: instance method of [<code>TaskStack</code>](#TaskStack)
403
+ <a name="TaskStack+top"></a>
404
+
405
+ ### taskStack.top() ⇒ [<code>Stackable</code>](#Stackable)
406
+ Take a look at the next stacked task
407
+
408
+ **Kind**: instance method of [<code>TaskStack</code>](#TaskStack)
409
+ <a name="TaskStack+pop"></a>
410
+
411
+ ### taskStack.pop() ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
412
+ Remove the next stacked task and return it.
413
+
414
+ **Kind**: instance method of [<code>TaskStack</code>](#TaskStack)
415
+ <a name="TaskStack+push"></a>
416
+
417
+ ### taskStack.push(stackable)
418
+ Push a stackable task to the top of the stack.
419
+
420
+ **Kind**: instance method of [<code>TaskStack</code>](#TaskStack)
421
+
422
+ | Param | Type | Description |
423
+ | --- | --- | --- |
424
+ | stackable | [<code>Stackable</code>](#Stackable) \| <code>\*</code> | Add a new stackable to the top of the stack |
425
+
426
+ <a name="TaskStack+remove"></a>
427
+
428
+ ### taskStack.remove() ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
429
+ Remove the next stacked task and return it.
430
+
431
+ **Kind**: instance method of [<code>TaskStack</code>](#TaskStack)
432
+ <a name="TaskStack+size"></a>
433
+
434
+ ### taskStack.size() ⇒ <code>number</code>
435
+ Get the size of the current stack.
436
+
437
+ **Kind**: instance method of [<code>TaskStack</code>](#TaskStack)
343
438
  <a name="Stackable"></a>
344
439
 
345
440
  ## Stackable ⇐ [<code>Linker</code>](#Linker)
@@ -420,72 +515,151 @@ Convert an array into Stackable instances, return the head and tail Stackables.
420
515
  <a name="Stack"></a>
421
516
 
422
517
  ## Stack
423
- Store a collection of items which can only be inserted and removed from the top.
518
+ A last-in-first-out collection: items are added to the top with push and taken from the top with pop. Any value can
519
+ be stacked (it is stored as it is, whether it is a function, an object or null), and adding and taking are constant
520
+ time. To stack tasks which are run as they are taken use TaskStack.
424
521
 
425
522
  **Kind**: global class
426
523
 
427
524
  * [Stack](#Stack)
428
- * [new Stack([stackedList], [listClass], [stackableClass])](#new_Stack_new)
525
+ * [new Stack([stackedList], [listClass], [linkerClass])](#new_Stack_new)
429
526
  * [.empty()](#Stack+empty) ⇒ <code>boolean</code>
430
- * [.top()](#Stack+top) ⇒ [<code>Stackable</code>](#Stackable)
431
- * [.pop()](#Stack+pop) ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
432
- * [.push(stackable)](#Stack+push)
433
- * [.remove()](#Stack+remove) ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
527
+ * [.peek()](#Stack+peek) ⇒ <code>\*</code> \| <code>null</code>
528
+ * [.pop()](#Stack+pop) ⇒ <code>\*</code> \| <code>null</code>
529
+ * [.push(data)](#Stack+push) ⇒ [<code>Stack</code>](#Stack)
434
530
  * [.size()](#Stack+size) ⇒ <code>number</code>
531
+ * [.top()](#Stack+top) ⇒ <code>\*</code> \| <code>null</code>
435
532
 
436
533
  <a name="new_Stack_new"></a>
437
534
 
438
- ### new Stack([stackedList], [listClass], [stackableClass])
439
- Instantiate the state with the starter stacked list.
535
+ ### new Stack([stackedList], [listClass], [linkerClass])
536
+ Instantiate the stack, optionally with a list of items to start from.
440
537
 
441
538
 
442
539
  | Param | Type | Default | Description |
443
540
  | --- | --- | --- | --- |
444
- | [stackedList] | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) | <code></code> | The list of stackables to start in this stack. |
445
- | [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no stacked list is given. |
446
- | [stackableClass] | [<code>Stackable</code>](#Stackable) | <code>Stackable</code> | The class used to wrap stacked items. |
541
+ | [stackedList] | <code>IsArrayable</code> \| <code>null</code> | <code></code> | The list of linkers to start in this stack (the first is the top) |
542
+ | [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no stacked list is given |
543
+ | [linkerClass] | [<code>Linker</code>](#Linker) | <code>Linker</code> | The class used to hold each stacked item |
447
544
 
448
545
  <a name="Stack+empty"></a>
449
546
 
450
547
  ### stack.empty() ⇒ <code>boolean</code>
451
- Return true if the stack is empty (there are no tasks in the stacked list)
548
+ Check whether the stack has no items.
452
549
 
453
550
  **Kind**: instance method of [<code>Stack</code>](#Stack)
454
- <a name="Stack+top"></a>
551
+ <a name="Stack+peek"></a>
455
552
 
456
- ### stack.top() ⇒ [<code>Stackable</code>](#Stackable)
457
- Take a look at the next stacked task
553
+ ### stack.peek() ⇒ <code>\*</code> \| <code>null</code>
554
+ Look at the item on the top of the stack, without removing it.
458
555
 
459
556
  **Kind**: instance method of [<code>Stack</code>](#Stack)
557
+ **Returns**: <code>\*</code> \| <code>null</code> - The item, or null when the stack is empty
460
558
  <a name="Stack+pop"></a>
461
559
 
462
- ### stack.pop() ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
463
- Remove the next stacked task and return it.
560
+ ### stack.pop() ⇒ <code>\*</code> \| <code>null</code>
561
+ Take the item from the top of the stack.
464
562
 
465
563
  **Kind**: instance method of [<code>Stack</code>](#Stack)
564
+ **Returns**: <code>\*</code> \| <code>null</code> - The item, or null when the stack is empty
466
565
  <a name="Stack+push"></a>
467
566
 
468
- ### stack.push(stackable)
469
- Push a stackable task to the top of the stack.
567
+ ### stack.push(data) ⇒ [<code>Stack</code>](#Stack)
568
+ Add an item to the top of the stack.
470
569
 
471
570
  **Kind**: instance method of [<code>Stack</code>](#Stack)
571
+ **Returns**: [<code>Stack</code>](#Stack) - This stack, so that adding can be chained
472
572
 
473
573
  | Param | Type | Description |
474
574
  | --- | --- | --- |
475
- | stackable | [<code>Stackable</code>](#Stackable) \| <code>\*</code> | Add a new stackable to the top of the stack |
575
+ | data | <code>\*</code> | The item to add |
476
576
 
477
- <a name="Stack+remove"></a>
577
+ <a name="Stack+size"></a>
478
578
 
479
- ### stack.remove() ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
480
- Remove the next stacked task and return it.
579
+ ### stack.size() ⇒ <code>number</code>
580
+ Count the items in the stack.
481
581
 
482
582
  **Kind**: instance method of [<code>Stack</code>](#Stack)
483
- <a name="Stack+size"></a>
583
+ <a name="Stack+top"></a>
484
584
 
485
- ### stack.size() ⇒ <code>number</code>
486
- Get the size of the current stack.
585
+ ### stack.top() ⇒ <code>\*</code> \| <code>null</code>
586
+ The item on the top of the stack (the same as peek).
487
587
 
488
588
  **Kind**: instance method of [<code>Stack</code>](#Stack)
589
+ **Returns**: <code>\*</code> \| <code>null</code> - The item, or null when the stack is empty
590
+ <a name="TaskQueue"></a>
591
+
592
+ ## TaskQueue
593
+ Maintain a series of queued tasks (Queueables): dequeue() takes the next task from the front and RUNS it, giving each
594
+ task in turn a chance to run (a task which is not ready, or which has not finished, is placed at the back again).
595
+ This is a task scheduler, for a plain first-in-first-out collection of items use Queue.
596
+
597
+ **Kind**: global class
598
+
599
+ * [TaskQueue](#TaskQueue)
600
+ * [new TaskQueue(queuedList, [listClass], [queueableClass])](#new_TaskQueue_new)
601
+ * [.dequeue()](#TaskQueue+dequeue) ⇒ <code>completeResponse</code> \| <code>\*</code>
602
+ * [.empty()](#TaskQueue+empty) ⇒ <code>boolean</code>
603
+ * [.enqueue(queueable)](#TaskQueue+enqueue)
604
+ * [.peek()](#TaskQueue+peek) ⇒ [<code>Queueable</code>](#Queueable)
605
+ * [.remove()](#TaskQueue+remove) ⇒ [<code>Queueable</code>](#Queueable) \| <code>null</code>
606
+ * [.size()](#TaskQueue+size) ⇒ <code>number</code>
607
+
608
+ <a name="new_TaskQueue_new"></a>
609
+
610
+ ### new TaskQueue(queuedList, [listClass], [queueableClass])
611
+ Instantiate the queue with the given queue list.
612
+
613
+
614
+ | Param | Type | Default | Description |
615
+ | --- | --- | --- | --- |
616
+ | queuedList | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) | <code></code> | Give the list of queueables to start in this queue. |
617
+ | [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no queued list is given. |
618
+ | [queueableClass] | [<code>Queueable</code>](#Queueable) | <code>Queueable</code> | The class used to wrap queued items. |
619
+
620
+ <a name="TaskQueue+dequeue"></a>
621
+
622
+ ### taskQueue.dequeue() ⇒ <code>completeResponse</code> \| <code>\*</code>
623
+ Take a queued task from the front of the queue and run it if ready. A task which is not ready yet is kept in the
624
+ queue (never dropped), a task which is still running is reported as blocking and left to finish on its own, and
625
+ completed tasks are discarded.
626
+
627
+ **Kind**: instance method of [<code>TaskQueue</code>](#TaskQueue)
628
+ <a name="TaskQueue+empty"></a>
629
+
630
+ ### taskQueue.empty() ⇒ <code>boolean</code>
631
+ Return true if the queue is empty (there are no tasks in the queue list)
632
+
633
+ **Kind**: instance method of [<code>TaskQueue</code>](#TaskQueue)
634
+ <a name="TaskQueue+enqueue"></a>
635
+
636
+ ### taskQueue.enqueue(queueable)
637
+ Add a queued task to the end of the queue
638
+
639
+ **Kind**: instance method of [<code>TaskQueue</code>](#TaskQueue)
640
+
641
+ | Param | Type | Description |
642
+ | --- | --- | --- |
643
+ | queueable | [<code>Queueable</code>](#Queueable) | Add a new queueable to the end of the queue |
644
+
645
+ <a name="TaskQueue+peek"></a>
646
+
647
+ ### taskQueue.peek() ⇒ [<code>Queueable</code>](#Queueable)
648
+ Take a look at the next queued task
649
+
650
+ **Kind**: instance method of [<code>TaskQueue</code>](#TaskQueue)
651
+ <a name="TaskQueue+remove"></a>
652
+
653
+ ### taskQueue.remove() ⇒ [<code>Queueable</code>](#Queueable) \| <code>null</code>
654
+ Remove the next queued item and return it.
655
+
656
+ **Kind**: instance method of [<code>TaskQueue</code>](#TaskQueue)
657
+ <a name="TaskQueue+size"></a>
658
+
659
+ ### taskQueue.size() ⇒ <code>number</code>
660
+ Get the length of the current queue.
661
+
662
+ **Kind**: instance method of [<code>TaskQueue</code>](#TaskQueue)
489
663
  <a name="Queueable"></a>
490
664
 
491
665
  ## Queueable ⇐ [<code>Linker</code>](#Linker)
@@ -609,70 +783,68 @@ Convert an array into Queueable instances, return the head and tail Queueables.
609
783
  <a name="Queue"></a>
610
784
 
611
785
  ## Queue
612
- Maintain a series of queued items.
786
+ A first-in-first-out collection: items are added to the back with enqueue and taken from the front with dequeue.
787
+ Any value can be queued (it is stored as it is, whether it is a function, an object or null), and adding and taking
788
+ are constant time. To queue tasks which are run as they are taken use TaskQueue.
613
789
 
614
790
  **Kind**: global class
615
791
 
616
792
  * [Queue](#Queue)
617
- * [new Queue(queuedList, [listClass], [queueableClass])](#new_Queue_new)
618
- * [.dequeue()](#Queue+dequeue) ⇒ <code>completeResponse</code> \| <code>\*</code>
793
+ * [new Queue([queuedList], [listClass], [linkerClass])](#new_Queue_new)
794
+ * [.dequeue()](#Queue+dequeue) ⇒ <code>\*</code> \| <code>null</code>
619
795
  * [.empty()](#Queue+empty) ⇒ <code>boolean</code>
620
- * [.enqueue(queueable)](#Queue+enqueue)
621
- * [.peek()](#Queue+peek) ⇒ [<code>Queueable</code>](#Queueable)
622
- * [.remove()](#Queue+remove) ⇒ [<code>Queueable</code>](#Queueable) \| <code>null</code>
796
+ * [.enqueue(data)](#Queue+enqueue) ⇒ [<code>Queue</code>](#Queue)
797
+ * [.peek()](#Queue+peek) ⇒ <code>\*</code> \| <code>null</code>
623
798
  * [.size()](#Queue+size) ⇒ <code>number</code>
624
799
 
625
800
  <a name="new_Queue_new"></a>
626
801
 
627
- ### new Queue(queuedList, [listClass], [queueableClass])
628
- Instantiate the queue with the given queue list.
802
+ ### new Queue([queuedList], [listClass], [linkerClass])
803
+ Instantiate the queue, optionally with a list of items to start from.
629
804
 
630
805
 
631
806
  | Param | Type | Default | Description |
632
807
  | --- | --- | --- | --- |
633
- | queuedList | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) | <code></code> | Give the list of queueables to start in this queue. |
634
- | [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no queued list is given. |
635
- | [queueableClass] | [<code>Queueable</code>](#Queueable) | <code>Queueable</code> | The class used to wrap queued items. |
808
+ | [queuedList] | <code>IsArrayable</code> \| <code>null</code> | <code></code> | The list of linkers to start in this queue (the first is the front) |
809
+ | [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no queued list is given |
810
+ | [linkerClass] | [<code>Linker</code>](#Linker) | <code>Linker</code> | The class used to hold each queued item |
636
811
 
637
812
  <a name="Queue+dequeue"></a>
638
813
 
639
- ### queue.dequeue() ⇒ <code>completeResponse</code> \| <code>\*</code>
640
- Take a queued task from the front of the queue and run it if ready.
814
+ ### queue.dequeue() ⇒ <code>\*</code> \| <code>null</code>
815
+ Take the item from the front of the queue.
641
816
 
642
817
  **Kind**: instance method of [<code>Queue</code>](#Queue)
818
+ **Returns**: <code>\*</code> \| <code>null</code> - The item, or null when the queue is empty
643
819
  <a name="Queue+empty"></a>
644
820
 
645
821
  ### queue.empty() ⇒ <code>boolean</code>
646
- Return true if the queue is empty (there are no tasks in the queue list)
822
+ Check whether the queue has no items.
647
823
 
648
824
  **Kind**: instance method of [<code>Queue</code>](#Queue)
649
825
  <a name="Queue+enqueue"></a>
650
826
 
651
- ### queue.enqueue(queueable)
652
- Add a queued task to the end of the queue
827
+ ### queue.enqueue(data) ⇒ [<code>Queue</code>](#Queue)
828
+ Add an item to the back of the queue.
653
829
 
654
830
  **Kind**: instance method of [<code>Queue</code>](#Queue)
831
+ **Returns**: [<code>Queue</code>](#Queue) - This queue, so that adding can be chained
655
832
 
656
833
  | Param | Type | Description |
657
834
  | --- | --- | --- |
658
- | queueable | [<code>Queueable</code>](#Queueable) | Add a new queueable to the end of the queue |
835
+ | data | <code>\*</code> | The item to add |
659
836
 
660
837
  <a name="Queue+peek"></a>
661
838
 
662
- ### queue.peek() ⇒ [<code>Queueable</code>](#Queueable)
663
- Take a look at the next queued task
664
-
665
- **Kind**: instance method of [<code>Queue</code>](#Queue)
666
- <a name="Queue+remove"></a>
667
-
668
- ### queue.remove() ⇒ [<code>Queueable</code>](#Queueable) \| <code>null</code>
669
- Remove the next queued item and return it.
839
+ ### queue.peek() ⇒ <code>\*</code> \| <code>null</code>
840
+ Look at the item at the front of the queue, without removing it.
670
841
 
671
842
  **Kind**: instance method of [<code>Queue</code>](#Queue)
843
+ **Returns**: <code>\*</code> \| <code>null</code> - The item, or null when the queue is empty
672
844
  <a name="Queue+size"></a>
673
845
 
674
846
  ### queue.size() ⇒ <code>number</code>
675
- Get the length of the current queue.
847
+ Count the items in the queue.
676
848
 
677
849
  **Kind**: instance method of [<code>Queue</code>](#Queue)
678
850
  <a name="TreeLinker"></a>
@@ -755,7 +927,9 @@ The list of the children of this node, or null when it has none.
755
927
  <a name="TreeLinker+childrenFromArray"></a>
756
928
 
757
929
  ### treeLinker.childrenFromArray(children, listClass) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
758
- Create the children for this tree from an array.
930
+ Create the children for this tree from an array. Each child becomes a tree linker with this node as its parent: an
931
+ existing linker is kept as it is, an object with a data property gives the settings of the linker, and anything
932
+ else is the data of the linker.
759
933
 
760
934
  **Kind**: instance method of [<code>TreeLinker</code>](#TreeLinker)
761
935
 
@@ -789,23 +963,28 @@ LinkedTreeList represents a collection stored with a root and spreading in branc
789
963
  * [.classType](#LinkedTreeList+classType)
790
964
  * [.innerList](#LinkedTreeList+innerList)
791
965
  * [.initialized](#LinkedTreeList+initialized)
966
+ * [.tailCache](#LinkedTreeList+tailCache)
967
+ * [.countCache](#LinkedTreeList+countCache)
968
+ * [.ownerNode](#LinkedTreeList+ownerNode)
792
969
  * [.list](#LinkedTreeList+list) ⇒ [<code>TreeLinker</code>](#TreeLinker)
793
970
  * [.first](#LinkedTreeList+first) ⇒ [<code>TreeLinker</code>](#TreeLinker)
794
971
  * [.last](#LinkedTreeList+last) ⇒ [<code>TreeLinker</code>](#TreeLinker)
795
972
  * [.length](#LinkedTreeList+length) ⇒ <code>number</code>
796
- * [.parent](#LinkedTreeList+parent) ⇒ [<code>TreeLinker</code>](#TreeLinker)
973
+ * [.parent](#LinkedTreeList+parent) ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
797
974
  * [.parent](#LinkedTreeList+parent)
798
975
  * [.rootParent](#LinkedTreeList+rootParent) ⇒ [<code>TreeLinker</code>](#TreeLinker)
799
976
  * [.initialize(initialList)](#LinkedTreeList+initialize) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
800
- * [.setChildren(item, children)](#LinkedTreeList+setChildren)
977
+ * [.setChildren(item, [children])](#LinkedTreeList+setChildren)
978
+ * [.adopt(newNode)](#LinkedTreeList+adopt) ⇒ [<code>TreeLinker</code>](#TreeLinker)
801
979
  * [.insertAfter(node, newNode)](#LinkedTreeList+insertAfter) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
802
980
  * [.insertBefore(node, newNode)](#LinkedTreeList+insertBefore) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
803
981
  * [.append(node, after)](#LinkedTreeList+append) ⇒ [<code>TreeLinker</code>](#TreeLinker)
804
982
  * [.prepend(node, before)](#LinkedTreeList+prepend) ⇒ [<code>TreeLinker</code>](#TreeLinker)
805
- * [.remove(node)](#LinkedTreeList+remove) ⇒ [<code>TreeLinker</code>](#TreeLinker)
983
+ * [.remove(node)](#LinkedTreeList+remove) ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
806
984
  * [.reset()](#LinkedTreeList+reset) ⇒ [<code>TreeLinker</code>](#TreeLinker)
807
985
  * [.item(index)](#LinkedTreeList+item) ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
808
986
  * [.forEach(callback, thisArg)](#LinkedTreeList+forEach) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
987
+ * [.indexOfElement(node)](#Arrayable+indexOfElement) ⇒ <code>number</code>
809
988
 
810
989
  <a name="new_LinkedTreeList_new"></a>
811
990
 
@@ -838,10 +1017,30 @@ Whether the inner list has been initialized (it can only be initialized once).
838
1017
 
839
1018
  **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
840
1019
  **Overrides**: [<code>initialized</code>](#DoublyLinkedList+initialized)
1020
+ <a name="LinkedTreeList+tailCache"></a>
1021
+
1022
+ ### linkedTreeList.tailCache
1023
+ The last linker, remembered so that adding to the end does not need to walk the whole list (null when not known yet).
1024
+
1025
+ **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
1026
+ **Overrides**: [<code>tailCache</code>](#DoublyLinkedList+tailCache)
1027
+ <a name="LinkedTreeList+countCache"></a>
1028
+
1029
+ ### linkedTreeList.countCache
1030
+ The number of linkers, kept up to date by the list's own methods so that the length does not need to walk the whole list (null when not known yet).
1031
+
1032
+ **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
1033
+ **Overrides**: [<code>countCache</code>](#DoublyLinkedList+countCache)
1034
+ <a name="LinkedTreeList+ownerNode"></a>
1035
+
1036
+ ### linkedTreeList.ownerNode
1037
+ The node these linkers are the children of, remembered so that it is known even while the list is empty (undefined until it is known).
1038
+
1039
+ **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
841
1040
  <a name="LinkedTreeList+list"></a>
842
1041
 
843
1042
  ### linkedTreeList.list ⇒ [<code>TreeLinker</code>](#TreeLinker)
844
- Retrieve a copy of the innerList used.
1043
+ Retrieve the innerList used (the list itself, not a copy).
845
1044
 
846
1045
  **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
847
1046
  **Overrides**: [<code>list</code>](#DoublyLinkedList+list)
@@ -855,33 +1054,36 @@ Retrieve the first TreeLinker in the list.
855
1054
  <a name="LinkedTreeList+last"></a>
856
1055
 
857
1056
  ### linkedTreeList.last ⇒ [<code>TreeLinker</code>](#TreeLinker)
858
- Retrieve the last TreeLinker in the list.
1057
+ Retrieve the last TreeLinker in the list. The end is remembered, so this does not walk the list.
859
1058
 
860
1059
  **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
861
1060
  **Overrides**: [<code>last</code>](#DoublyLinkedList+last)
862
1061
  <a name="LinkedTreeList+length"></a>
863
1062
 
864
1063
  ### linkedTreeList.length ⇒ <code>number</code>
865
- Return the length of the list.
1064
+ Return the length of the list. It is kept up to date by the list's own methods, so this does not walk the list
1065
+ (call reset() after linkers were changed directly).
866
1066
 
867
1067
  **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
868
1068
  **Overrides**: [<code>length</code>](#DoublyLinkedList+length)
869
1069
  <a name="LinkedTreeList+parent"></a>
870
1070
 
871
- ### linkedTreeList.parent ⇒ [<code>TreeLinker</code>](#TreeLinker)
872
- Get the parent of this tree list.
1071
+ ### linkedTreeList.parent ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
1072
+ Get the parent of this tree list: the node these linkers are the children of (remembered even while the list is
1073
+ empty), or null for the linkers at the top of a tree.
873
1074
 
874
1075
  **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
875
1076
  <a name="LinkedTreeList+parent"></a>
876
1077
 
877
1078
  ### linkedTreeList.parent
878
- Set the parent of this tree list
1079
+ Set the parent of this tree list: every linker in it gets the node as its parent, and the node gets this list as its
1080
+ children. Linkers added to the list later get this parent too.
879
1081
 
880
1082
  **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
881
1083
 
882
1084
  | Param | Type | Description |
883
1085
  | --- | --- | --- |
884
- | parent | [<code>TreeLinker</code>](#TreeLinker) | The new node to use as the parent for this group of children |
1086
+ | parent | [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code> | The new node to use as the parent for this group of children |
885
1087
 
886
1088
  <a name="LinkedTreeList+rootParent"></a>
887
1089
 
@@ -903,40 +1105,55 @@ Initialize the inner list, should only run once.
903
1105
 
904
1106
  <a name="LinkedTreeList+setChildren"></a>
905
1107
 
906
- ### linkedTreeList.setChildren(item, children)
1108
+ ### linkedTreeList.setChildren(item, [children])
907
1109
  Set the children on a parent item.
908
1110
 
909
1111
  **Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
1112
+ **Throws**:
1113
+
1114
+ - <code>Error</code> When the item is not one of the linkers of this list
1115
+
910
1116
 
911
1117
  | Param | Type | Default | Description |
912
1118
  | --- | --- | --- | --- |
913
- | item | [<code>TreeLinker</code>](#TreeLinker) | | The TreeLinker node that will be the parent of the children |
914
- | children | [<code>LinkedTreeList</code>](#LinkedTreeList) | <code></code> | The LinkedTreeList which has the child nodes to use |
1119
+ | item | [<code>TreeLinker</code>](#TreeLinker) | | The TreeLinker node (one of the linkers of this list) that will be the parent of the children |
1120
+ | [children] | [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code> | <code></code> | The LinkedTreeList which has the child nodes to use, or null to remove the children of the item |
1121
+
1122
+ <a name="LinkedTreeList+adopt"></a>
1123
+
1124
+ ### linkedTreeList.adopt(newNode) ⇒ [<code>TreeLinker</code>](#TreeLinker)
1125
+ Make a linker of the given node (or data) and make this list's parent its parent.
1126
+
1127
+ **Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
1128
+
1129
+ | Param | Type | Description |
1130
+ | --- | --- | --- |
1131
+ | newNode | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The node (or data) which is being added to this list |
915
1132
 
916
1133
  <a name="LinkedTreeList+insertAfter"></a>
917
1134
 
918
1135
  ### linkedTreeList.insertAfter(node, newNode) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
919
- Insert a new node (or data) after a node.
1136
+ Insert a new node (or data) after a node. The new node gets the parent of this list.
920
1137
 
921
1138
  **Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
922
1139
  **Overrides**: [<code>insertAfter</code>](#DoublyLinkedList+insertAfter)
923
1140
 
924
1141
  | Param | Type | Description |
925
1142
  | --- | --- | --- |
926
- | node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The existing node as reference |
1143
+ | node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The existing node as reference, or null to insert at the start of the list |
927
1144
  | newNode | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to go after the existing node |
928
1145
 
929
1146
  <a name="LinkedTreeList+insertBefore"></a>
930
1147
 
931
1148
  ### linkedTreeList.insertBefore(node, newNode) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
932
- Insert a new node (or data) before a node.
1149
+ Insert a new node (or data) before a node. The new node gets the parent of this list.
933
1150
 
934
1151
  **Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
935
1152
  **Overrides**: [<code>insertBefore</code>](#DoublyLinkedList+insertBefore)
936
1153
 
937
1154
  | Param | Type | Description |
938
1155
  | --- | --- | --- |
939
- | node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The existing node as reference |
1156
+ | node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The existing node as reference, or null to insert at the end of the list |
940
1157
  | newNode | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to go before the existing node |
941
1158
 
942
1159
  <a name="LinkedTreeList+append"></a>
@@ -967,11 +1184,12 @@ Add a node (or data) before the given (or first) node in the list.
967
1184
 
968
1185
  <a name="LinkedTreeList+remove"></a>
969
1186
 
970
- ### linkedTreeList.remove(node) ⇒ [<code>TreeLinker</code>](#TreeLinker)
971
- Remove a linker from this linked list.
1187
+ ### linkedTreeList.remove(node) ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
1188
+ Remove a linker from this linked list. The removed node no longer has a parent.
972
1189
 
973
1190
  **Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
974
1191
  **Overrides**: [<code>remove</code>](#DoublyLinkedList+remove)
1192
+ **Returns**: [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code> - The removed node, or null when there was nothing to remove
975
1193
 
976
1194
  | Param | Type | Description |
977
1195
  | --- | --- | --- |
@@ -980,7 +1198,8 @@ Remove a linker from this linked list.
980
1198
  <a name="LinkedTreeList+reset"></a>
981
1199
 
982
1200
  ### linkedTreeList.reset() ⇒ [<code>TreeLinker</code>](#TreeLinker)
983
- Refresh all references and return head reference.
1201
+ Refresh all references (the head, the end and the length) by walking the list once, and return the head. The
1202
+ list's own methods keep these up to date, so this is only needed after linkers were changed directly.
984
1203
 
985
1204
  **Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
986
1205
  **Overrides**: [<code>reset</code>](#DoublyLinkedList+reset)
@@ -1010,6 +1229,22 @@ Be able to run forEach on this LinkedTreeList to iterate over the TreeLinker Ite
1010
1229
  | callback | <code>forEachCallback</code> | The function to call for-each tree node |
1011
1230
  | thisArg | [<code>LinkedTreeList</code>](#LinkedTreeList) | Optional, 'this' reference |
1012
1231
 
1232
+ <a name="Arrayable+indexOfElement"></a>
1233
+
1234
+ ### linkedTreeList.indexOfElement(node) ⇒ <code>number</code>
1235
+ Find the position of an element which must be in this list.
1236
+
1237
+ **Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
1238
+ **Overrides**: [<code>indexOfElement</code>](#Arrayable+indexOfElement)
1239
+ **Throws**:
1240
+
1241
+ - <code>Error</code> When the element is not in this list
1242
+
1243
+
1244
+ | Param | Type | Description |
1245
+ | --- | --- | --- |
1246
+ | node | [<code>ArrayElement</code>](#ArrayElement) | The element to find |
1247
+
1013
1248
  <a name="Linker"></a>
1014
1249
 
1015
1250
  ## Linker ⇐ [<code>ArrayElement</code>](#ArrayElement)
@@ -1084,6 +1319,8 @@ LinkedList represents a collection stored as a LinkedList with next references.
1084
1319
  * [.classType](#LinkedList+classType)
1085
1320
  * [.innerList](#LinkedList+innerList)
1086
1321
  * [.initialized](#LinkedList+initialized)
1322
+ * [.tailCache](#LinkedList+tailCache)
1323
+ * [.countCache](#LinkedList+countCache)
1087
1324
  * [.list](#LinkedList+list) ⇒ [<code>Linker</code>](#Linker)
1088
1325
  * [.first](#LinkedList+first) ⇒ [<code>Linker</code>](#Linker)
1089
1326
  * [.last](#LinkedList+last) ⇒ [<code>Linker</code>](#Linker)
@@ -1093,9 +1330,11 @@ LinkedList represents a collection stored as a LinkedList with next references.
1093
1330
  * [.insertBefore(node, newNode)](#LinkedList+insertBefore) ⇒ [<code>LinkedList</code>](#LinkedList)
1094
1331
  * [.append(node, after)](#LinkedList+append) ⇒ [<code>Linker</code>](#Linker)
1095
1332
  * [.prepend(node, before)](#LinkedList+prepend) ⇒ [<code>Linker</code>](#Linker)
1096
- * [.remove(node)](#LinkedList+remove) ⇒ [<code>Linker</code>](#Linker)
1333
+ * [.remove(node)](#LinkedList+remove) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
1334
+ * [.reset()](#LinkedList+reset) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
1097
1335
  * [.item(index)](#LinkedList+item) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
1098
1336
  * [.forEach(callback, thisArg)](#LinkedList+forEach) ⇒ [<code>LinkedList</code>](#LinkedList)
1337
+ * [.indexOfElement(node)](#Arrayable+indexOfElement) ⇒ <code>number</code>
1099
1338
 
1100
1339
  <a name="new_LinkedList_new"></a>
1101
1340
 
@@ -1128,10 +1367,22 @@ Whether the inner list has been initialized (it can only be initialized once).
1128
1367
 
1129
1368
  **Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
1130
1369
  **Overrides**: [<code>initialized</code>](#Arrayable+initialized)
1370
+ <a name="LinkedList+tailCache"></a>
1371
+
1372
+ ### linkedList.tailCache
1373
+ The last linker, remembered so that adding to the end does not need to walk the whole list (null when not known yet).
1374
+
1375
+ **Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
1376
+ <a name="LinkedList+countCache"></a>
1377
+
1378
+ ### linkedList.countCache
1379
+ The number of linkers, kept up to date by the list's own methods so that the length does not need to walk the whole list (null when not known yet).
1380
+
1381
+ **Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
1131
1382
  <a name="LinkedList+list"></a>
1132
1383
 
1133
1384
  ### linkedList.list ⇒ [<code>Linker</code>](#Linker)
1134
- Retrieve a copy of the innerList used.
1385
+ Retrieve the innerList used (the list itself, not a copy).
1135
1386
 
1136
1387
  **Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
1137
1388
  **Overrides**: [<code>list</code>](#Arrayable+list)
@@ -1145,14 +1396,15 @@ Retrieve the first Linker in the list.
1145
1396
  <a name="LinkedList+last"></a>
1146
1397
 
1147
1398
  ### linkedList.last ⇒ [<code>Linker</code>](#Linker)
1148
- Retrieve the last Linker in the list.
1399
+ Retrieve the last Linker in the list. The end is remembered, so this does not walk the list.
1149
1400
 
1150
1401
  **Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
1151
1402
  **Overrides**: [<code>last</code>](#Arrayable+last)
1152
1403
  <a name="LinkedList+length"></a>
1153
1404
 
1154
1405
  ### linkedList.length ⇒ <code>number</code>
1155
- Return the length of the list.
1406
+ Return the length of the list. It is kept up to date by the list's own methods, so this does not walk the list
1407
+ (call reset() after linkers were changed directly).
1156
1408
 
1157
1409
  **Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
1158
1410
  **Overrides**: [<code>length</code>](#Arrayable+length)
@@ -1178,7 +1430,7 @@ Insert a new node (or data) after a node.
1178
1430
 
1179
1431
  | Param | Type | Description |
1180
1432
  | --- | --- | --- |
1181
- | node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The existing node as reference |
1433
+ | node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The existing node as reference, or null to insert at the start of the list |
1182
1434
  | newNode | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to go after the existing node |
1183
1435
 
1184
1436
  <a name="LinkedList+insertBefore"></a>
@@ -1188,10 +1440,14 @@ Insert a new node (or data) before a node.
1188
1440
 
1189
1441
  **Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
1190
1442
  **Overrides**: [<code>insertBefore</code>](#Arrayable+insertBefore)
1443
+ **Throws**:
1444
+
1445
+ - <code>Error</code> When the reference node is not in this list
1446
+
1191
1447
 
1192
1448
  | Param | Type | Description |
1193
1449
  | --- | --- | --- |
1194
- | node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The existing node as reference |
1450
+ | node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The existing node as reference, or null to insert at the end of the list |
1195
1451
  | newNode | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to go before the existing node |
1196
1452
 
1197
1453
  <a name="LinkedList+append"></a>
@@ -1222,16 +1478,25 @@ Add a node (or data) before the given (or first) node in the list.
1222
1478
 
1223
1479
  <a name="LinkedList+remove"></a>
1224
1480
 
1225
- ### linkedList.remove(node) ⇒ [<code>Linker</code>](#Linker)
1481
+ ### linkedList.remove(node) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
1226
1482
  Remove a linker from this linked list.
1227
1483
 
1228
1484
  **Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
1229
1485
  **Overrides**: [<code>remove</code>](#Arrayable+remove)
1486
+ **Returns**: [<code>Linker</code>](#Linker) \| <code>null</code> - The removed node, or null when it was not in this list (nothing is removed)
1230
1487
 
1231
1488
  | Param | Type | Description |
1232
1489
  | --- | --- | --- |
1233
1490
  | node | [<code>Linker</code>](#Linker) | The node we wish to remove (and it will be returned after removal) |
1234
1491
 
1492
+ <a name="LinkedList+reset"></a>
1493
+
1494
+ ### linkedList.reset() ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
1495
+ Refresh the remembered end and length of the list by walking it once. The list's own methods keep these up to date,
1496
+ so this is only needed after linkers were changed directly (for example by setting next on a linker).
1497
+
1498
+ **Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
1499
+ **Returns**: [<code>Linker</code>](#Linker) \| <code>null</code> - The first linker of the list
1235
1500
  <a name="LinkedList+item"></a>
1236
1501
 
1237
1502
  ### linkedList.item(index) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
@@ -1257,6 +1522,22 @@ Be able to run forEach on this LinkedList to iterate over the linkers.
1257
1522
  | callback | <code>forEachCallback</code> | The function to call for-each linker |
1258
1523
  | thisArg | [<code>LinkedList</code>](#LinkedList) | Optional, 'this' reference |
1259
1524
 
1525
+ <a name="Arrayable+indexOfElement"></a>
1526
+
1527
+ ### linkedList.indexOfElement(node) ⇒ <code>number</code>
1528
+ Find the position of an element which must be in this list.
1529
+
1530
+ **Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
1531
+ **Overrides**: [<code>indexOfElement</code>](#Arrayable+indexOfElement)
1532
+ **Throws**:
1533
+
1534
+ - <code>Error</code> When the element is not in this list
1535
+
1536
+
1537
+ | Param | Type | Description |
1538
+ | --- | --- | --- |
1539
+ | node | [<code>ArrayElement</code>](#ArrayElement) | The element to find |
1540
+
1260
1541
  <a name="DoublyLinkedList"></a>
1261
1542
 
1262
1543
  ## DoublyLinkedList ⇐ [<code>LinkedList</code>](#LinkedList)
@@ -1270,6 +1551,8 @@ DoublyLinkedList represents a collection stored as a LinkedList with prev and ne
1270
1551
  * [.classType](#DoublyLinkedList+classType)
1271
1552
  * [.innerList](#DoublyLinkedList+innerList)
1272
1553
  * [.initialized](#DoublyLinkedList+initialized)
1554
+ * [.tailCache](#DoublyLinkedList+tailCache)
1555
+ * [.countCache](#DoublyLinkedList+countCache)
1273
1556
  * [.list](#DoublyLinkedList+list) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
1274
1557
  * [.first](#DoublyLinkedList+first) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
1275
1558
  * [.last](#DoublyLinkedList+last) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
@@ -1280,9 +1563,10 @@ DoublyLinkedList represents a collection stored as a LinkedList with prev and ne
1280
1563
  * [.append(node, after)](#DoublyLinkedList+append) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
1281
1564
  * [.prepend(node, before)](#DoublyLinkedList+prepend) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
1282
1565
  * [.remove(node)](#DoublyLinkedList+remove) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
1283
- * [.reset()](#DoublyLinkedList+reset) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
1566
+ * [.reset()](#DoublyLinkedList+reset) ⇒ [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code>
1284
1567
  * [.item(index)](#DoublyLinkedList+item) ⇒ [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code>
1285
1568
  * [.forEach(callback, thisArg)](#DoublyLinkedList+forEach) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
1569
+ * [.indexOfElement(node)](#Arrayable+indexOfElement) ⇒ <code>number</code>
1286
1570
 
1287
1571
  <a name="new_DoublyLinkedList_new"></a>
1288
1572
 
@@ -1315,10 +1599,24 @@ Whether the inner list has been initialized (it can only be initialized once).
1315
1599
 
1316
1600
  **Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
1317
1601
  **Overrides**: [<code>initialized</code>](#LinkedList+initialized)
1602
+ <a name="DoublyLinkedList+tailCache"></a>
1603
+
1604
+ ### doublyLinkedList.tailCache
1605
+ The last linker, remembered so that adding to the end does not need to walk the whole list (null when not known yet).
1606
+
1607
+ **Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
1608
+ **Overrides**: [<code>tailCache</code>](#LinkedList+tailCache)
1609
+ <a name="DoublyLinkedList+countCache"></a>
1610
+
1611
+ ### doublyLinkedList.countCache
1612
+ The number of linkers, kept up to date by the list's own methods so that the length does not need to walk the whole list (null when not known yet).
1613
+
1614
+ **Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
1615
+ **Overrides**: [<code>countCache</code>](#LinkedList+countCache)
1318
1616
  <a name="DoublyLinkedList+list"></a>
1319
1617
 
1320
1618
  ### doublyLinkedList.list ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
1321
- Retrieve a copy of the innerList used.
1619
+ Retrieve the innerList used (the list itself, not a copy).
1322
1620
 
1323
1621
  **Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
1324
1622
  **Overrides**: [<code>list</code>](#LinkedList+list)
@@ -1332,14 +1630,15 @@ Retrieve the first DoubleLinker in the list.
1332
1630
  <a name="DoublyLinkedList+last"></a>
1333
1631
 
1334
1632
  ### doublyLinkedList.last ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
1335
- Retrieve the last DoubleLinker in the list.
1633
+ Retrieve the last DoubleLinker in the list. The end is remembered, so this does not walk the list.
1336
1634
 
1337
1635
  **Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
1338
1636
  **Overrides**: [<code>last</code>](#LinkedList+last)
1339
1637
  <a name="DoublyLinkedList+length"></a>
1340
1638
 
1341
1639
  ### doublyLinkedList.length ⇒ <code>number</code>
1342
- Return the length of the list.
1640
+ Return the length of the list. It is kept up to date by the list's own methods, so this does not walk the list
1641
+ (call reset() after linkers were changed directly).
1343
1642
 
1344
1643
  **Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
1345
1644
  **Overrides**: [<code>length</code>](#LinkedList+length)
@@ -1365,7 +1664,7 @@ Insert a new node (or data) after a node.
1365
1664
 
1366
1665
  | Param | Type | Description |
1367
1666
  | --- | --- | --- |
1368
- | node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The existing node as reference |
1667
+ | node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The existing node as reference (which must be in this list, this is not checked), or null to insert at the start of the list |
1369
1668
  | newNode | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to go after the existing node |
1370
1669
 
1371
1670
  <a name="DoublyLinkedList+insertBefore"></a>
@@ -1378,7 +1677,7 @@ Insert a new node (or data) before a node.
1378
1677
 
1379
1678
  | Param | Type | Description |
1380
1679
  | --- | --- | --- |
1381
- | node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The existing node as reference |
1680
+ | node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The existing node as reference (which must be in this list, this is not checked), or null to insert at the end of the list |
1382
1681
  | newNode | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to go before the existing node |
1383
1682
 
1384
1683
  <a name="DoublyLinkedList+append"></a>
@@ -1421,10 +1720,12 @@ Remove a linker from this linked list.
1421
1720
 
1422
1721
  <a name="DoublyLinkedList+reset"></a>
1423
1722
 
1424
- ### doublyLinkedList.reset() ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
1425
- Refresh all references and return head reference.
1723
+ ### doublyLinkedList.reset() ⇒ [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code>
1724
+ Refresh all references (the head, the end and the length) by walking the list once, and return the head. The list's
1725
+ own methods keep these up to date, so this is only needed after linkers were changed directly.
1426
1726
 
1427
1727
  **Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
1728
+ **Overrides**: [<code>reset</code>](#LinkedList+reset)
1428
1729
  <a name="DoublyLinkedList+item"></a>
1429
1730
 
1430
1731
  ### doublyLinkedList.item(index) ⇒ [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code>
@@ -1451,6 +1752,22 @@ Be able to run forEach on this DoublyLinkedList to iterate over the DoubleLinker
1451
1752
  | callback | <code>forEachCallback</code> | The function to call for-each double linker |
1452
1753
  | thisArg | [<code>DoublyLinkedList</code>](#DoublyLinkedList) | Optional, 'this' reference |
1453
1754
 
1755
+ <a name="Arrayable+indexOfElement"></a>
1756
+
1757
+ ### doublyLinkedList.indexOfElement(node) ⇒ <code>number</code>
1758
+ Find the position of an element which must be in this list.
1759
+
1760
+ **Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
1761
+ **Overrides**: [<code>indexOfElement</code>](#Arrayable+indexOfElement)
1762
+ **Throws**:
1763
+
1764
+ - <code>Error</code> When the element is not in this list
1765
+
1766
+
1767
+ | Param | Type | Description |
1768
+ | --- | --- | --- |
1769
+ | node | [<code>ArrayElement</code>](#ArrayElement) | The element to find |
1770
+
1454
1771
  <a name="DoubleLinker"></a>
1455
1772
 
1456
1773
  ## DoubleLinker ⇐ [<code>Linker</code>](#Linker)
@@ -1534,15 +1851,16 @@ Arrayable represents a collection stored as an array.
1534
1851
  * [.innerList](#Arrayable+innerList)
1535
1852
  * [.initialized](#Arrayable+initialized)
1536
1853
  * [.list](#Arrayable+list) ⇒ [<code>Array.&lt;ArrayElement&gt;</code>](#ArrayElement)
1537
- * [.first](#Arrayable+first) ⇒ [<code>ArrayElement</code>](#ArrayElement)
1538
- * [.last](#Arrayable+last) ⇒ [<code>ArrayElement</code>](#ArrayElement)
1854
+ * [.first](#Arrayable+first) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
1855
+ * [.last](#Arrayable+last) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
1539
1856
  * [.length](#Arrayable+length) ⇒ <code>number</code>
1857
+ * [.indexOfElement(node)](#Arrayable+indexOfElement) ⇒ <code>number</code>
1540
1858
  * [.initialize(initialList)](#Arrayable+initialize) ⇒ [<code>Arrayable</code>](#Arrayable)
1541
1859
  * [.insertAfter(node, newNode)](#Arrayable+insertAfter) ⇒ [<code>Arrayable</code>](#Arrayable)
1542
1860
  * [.insertBefore(node, newNode)](#Arrayable+insertBefore) ⇒ [<code>Arrayable</code>](#Arrayable)
1543
1861
  * [.append(node, after)](#Arrayable+append) ⇒ [<code>Arrayable</code>](#Arrayable)
1544
1862
  * [.prepend(node, before)](#Arrayable+prepend) ⇒ [<code>Arrayable</code>](#Arrayable)
1545
- * [.remove(node)](#Arrayable+remove) ⇒ [<code>ArrayElement</code>](#ArrayElement)
1863
+ * [.remove(node)](#Arrayable+remove) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
1546
1864
  * [.item(index)](#Arrayable+item) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
1547
1865
  * [.forEach(callback, thisArg)](#Arrayable+forEach) ⇒ [<code>Arrayable</code>](#Arrayable)
1548
1866
 
@@ -1577,27 +1895,44 @@ Whether the inner list has been initialized (it can only be initialized once).
1577
1895
  <a name="Arrayable+list"></a>
1578
1896
 
1579
1897
  ### arrayable.list ⇒ [<code>Array.&lt;ArrayElement&gt;</code>](#ArrayElement)
1580
- Retrieve a copy of the innerList used.
1898
+ Retrieve the innerList used (the list itself, not a copy).
1581
1899
 
1582
1900
  **Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
1583
1901
  <a name="Arrayable+first"></a>
1584
1902
 
1585
- ### arrayable.first ⇒ [<code>ArrayElement</code>](#ArrayElement)
1903
+ ### arrayable.first ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
1586
1904
  Retrieve the first Element from the Arrayable
1587
1905
 
1588
1906
  **Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
1907
+ **Returns**: [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code> - The first element, or null when the Arrayable is empty
1589
1908
  <a name="Arrayable+last"></a>
1590
1909
 
1591
- ### arrayable.last ⇒ [<code>ArrayElement</code>](#ArrayElement)
1910
+ ### arrayable.last ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
1592
1911
  Retrieve the last Element from the Arrayable
1593
1912
 
1594
1913
  **Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
1914
+ **Returns**: [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code> - The last element, or null when the Arrayable is empty
1595
1915
  <a name="Arrayable+length"></a>
1596
1916
 
1597
1917
  ### arrayable.length ⇒ <code>number</code>
1598
1918
  Return the length of the list.
1599
1919
 
1600
1920
  **Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
1921
+ <a name="Arrayable+indexOfElement"></a>
1922
+
1923
+ ### arrayable.indexOfElement(node) ⇒ <code>number</code>
1924
+ Find the position of an element which must be in this list.
1925
+
1926
+ **Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
1927
+ **Throws**:
1928
+
1929
+ - <code>Error</code> When the element is not in this list
1930
+
1931
+
1932
+ | Param | Type | Description |
1933
+ | --- | --- | --- |
1934
+ | node | [<code>ArrayElement</code>](#ArrayElement) | The element to find |
1935
+
1601
1936
  <a name="Arrayable+initialize"></a>
1602
1937
 
1603
1938
  ### arrayable.initialize(initialList) ⇒ [<code>Arrayable</code>](#Arrayable)
@@ -1615,10 +1950,14 @@ Initialize the inner list, should only run once.
1615
1950
  Insert a new node (or data) after a node.
1616
1951
 
1617
1952
  **Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
1953
+ **Throws**:
1954
+
1955
+ - <code>Error</code> When the reference node is not in this list
1956
+
1618
1957
 
1619
1958
  | Param | Type | Description |
1620
1959
  | --- | --- | --- |
1621
- | node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The existing node as reference |
1960
+ | node | [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code> | The existing node as reference, or null to insert at the start of the list |
1622
1961
  | newNode | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to go after the existing node |
1623
1962
 
1624
1963
  <a name="Arrayable+insertBefore"></a>
@@ -1627,10 +1966,14 @@ Insert a new node (or data) after a node.
1627
1966
  Insert a new node (or data) before a node.
1628
1967
 
1629
1968
  **Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
1969
+ **Throws**:
1970
+
1971
+ - <code>Error</code> When the reference node is not in this list
1972
+
1630
1973
 
1631
1974
  | Param | Type | Description |
1632
1975
  | --- | --- | --- |
1633
- | node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The existing node as reference |
1976
+ | node | [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code> | The existing node as reference, or null to insert at the end of the list |
1634
1977
  | newNode | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to go before the existing node |
1635
1978
 
1636
1979
  <a name="Arrayable+append"></a>
@@ -1659,10 +2002,11 @@ Add a node (or data) before the given (or first) node in the list.
1659
2002
 
1660
2003
  <a name="Arrayable+remove"></a>
1661
2004
 
1662
- ### arrayable.remove(node) ⇒ [<code>ArrayElement</code>](#ArrayElement)
2005
+ ### arrayable.remove(node) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
1663
2006
  Remove an element from this arrayable.
1664
2007
 
1665
2008
  **Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
2009
+ **Returns**: [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code> - The removed node, or null when it was not in this list (nothing is removed)
1666
2010
 
1667
2011
  | Param | Type | Description |
1668
2012
  | --- | --- | --- |
@@ -1740,6 +2084,82 @@ Convert an array into Element instances, return the head and tail Elements.
1740
2084
  | [values] | <code>Array.&lt;IsElement&gt;</code> | <code>[]</code> | Provide an array of data that will be converted to array of elements. |
1741
2085
  | [classType] | <code>IsElement</code> | <code>ArrayElement</code> | Provide the type of IsElement to use. |
1742
2086
 
2087
+ <a name="TaskStack"></a>
2088
+
2089
+ ## TaskStack ⇒ [<code>TaskStack</code>](#TaskStack)
2090
+ Convert an array to a TaskStack.
2091
+
2092
+ **Kind**: global variable
2093
+
2094
+ | Param | Type | Description |
2095
+ | --- | --- | --- |
2096
+ | values | <code>Array</code> | An array of values which will be converted to stackables in this queue |
2097
+ | stackableClass | [<code>Stackable</code>](#Stackable) | The class to use for each stackable |
2098
+ | listClass | [<code>TaskStack</code>](#TaskStack) \| <code>Iterable</code> | The class to use to manage the stackables |
2099
+
2100
+
2101
+ * [TaskStack](#TaskStack) ⇒ [<code>TaskStack</code>](#TaskStack)
2102
+ * [new TaskStack([stackedList], [listClass], [stackableClass])](#new_TaskStack_new)
2103
+ * [.empty()](#TaskStack+empty) ⇒ <code>boolean</code>
2104
+ * [.top()](#TaskStack+top) ⇒ [<code>Stackable</code>](#Stackable)
2105
+ * [.pop()](#TaskStack+pop) ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
2106
+ * [.push(stackable)](#TaskStack+push)
2107
+ * [.remove()](#TaskStack+remove) ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
2108
+ * [.size()](#TaskStack+size) ⇒ <code>number</code>
2109
+
2110
+ <a name="new_TaskStack_new"></a>
2111
+
2112
+ ### new TaskStack([stackedList], [listClass], [stackableClass])
2113
+ Instantiate the state with the starter stacked list.
2114
+
2115
+
2116
+ | Param | Type | Default | Description |
2117
+ | --- | --- | --- | --- |
2118
+ | [stackedList] | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) | <code></code> | The list of stackables to start in this stack. |
2119
+ | [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no stacked list is given. |
2120
+ | [stackableClass] | [<code>Stackable</code>](#Stackable) | <code>Stackable</code> | The class used to wrap stacked items. |
2121
+
2122
+ <a name="TaskStack+empty"></a>
2123
+
2124
+ ### taskStack.empty() ⇒ <code>boolean</code>
2125
+ Return true if the stack is empty (there are no tasks in the stacked list)
2126
+
2127
+ **Kind**: instance method of [<code>TaskStack</code>](#TaskStack)
2128
+ <a name="TaskStack+top"></a>
2129
+
2130
+ ### taskStack.top() ⇒ [<code>Stackable</code>](#Stackable)
2131
+ Take a look at the next stacked task
2132
+
2133
+ **Kind**: instance method of [<code>TaskStack</code>](#TaskStack)
2134
+ <a name="TaskStack+pop"></a>
2135
+
2136
+ ### taskStack.pop() ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
2137
+ Remove the next stacked task and return it.
2138
+
2139
+ **Kind**: instance method of [<code>TaskStack</code>](#TaskStack)
2140
+ <a name="TaskStack+push"></a>
2141
+
2142
+ ### taskStack.push(stackable)
2143
+ Push a stackable task to the top of the stack.
2144
+
2145
+ **Kind**: instance method of [<code>TaskStack</code>](#TaskStack)
2146
+
2147
+ | Param | Type | Description |
2148
+ | --- | --- | --- |
2149
+ | stackable | [<code>Stackable</code>](#Stackable) \| <code>\*</code> | Add a new stackable to the top of the stack |
2150
+
2151
+ <a name="TaskStack+remove"></a>
2152
+
2153
+ ### taskStack.remove() ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
2154
+ Remove the next stacked task and return it.
2155
+
2156
+ **Kind**: instance method of [<code>TaskStack</code>](#TaskStack)
2157
+ <a name="TaskStack+size"></a>
2158
+
2159
+ ### taskStack.size() ⇒ <code>number</code>
2160
+ Get the size of the current stack.
2161
+
2162
+ **Kind**: instance method of [<code>TaskStack</code>](#TaskStack)
1743
2163
  <a name="Stackable"></a>
1744
2164
 
1745
2165
  ## Stackable ⇒ [<code>Stackable</code>](#Stackable)
@@ -1825,79 +2245,161 @@ Convert an array into Stackable instances, return the head and tail Stackables.
1825
2245
  <a name="Stack"></a>
1826
2246
 
1827
2247
  ## Stack ⇒ [<code>Stack</code>](#Stack)
1828
- Convert an array to a Stack.
2248
+ Convert an array to a Stack by pushing each value in turn, so the last value is on the top.
1829
2249
 
1830
2250
  **Kind**: global variable
1831
2251
 
1832
- | Param | Type | Description |
1833
- | --- | --- | --- |
1834
- | values | <code>Array</code> | An array of values which will be converted to stackables in this queue |
1835
- | stackableClass | [<code>Stackable</code>](#Stackable) | The class to use for each stackable |
1836
- | listClass | [<code>Stack</code>](#Stack) \| <code>Iterable</code> | The class to use to manage the stackables |
2252
+ | Param | Type | Default | Description |
2253
+ | --- | --- | --- | --- |
2254
+ | [values] | <code>Array</code> | <code>[]</code> | The items to stack |
2255
+ | [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list used to store the items |
2256
+ | [linkerClass] | [<code>Linker</code>](#Linker) | <code>Linker</code> | The class used to hold each stacked item |
1837
2257
 
1838
2258
 
1839
2259
  * [Stack](#Stack) ⇒ [<code>Stack</code>](#Stack)
1840
- * [new Stack([stackedList], [listClass], [stackableClass])](#new_Stack_new)
2260
+ * [new Stack([stackedList], [listClass], [linkerClass])](#new_Stack_new)
1841
2261
  * [.empty()](#Stack+empty) ⇒ <code>boolean</code>
1842
- * [.top()](#Stack+top) ⇒ [<code>Stackable</code>](#Stackable)
1843
- * [.pop()](#Stack+pop) ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
1844
- * [.push(stackable)](#Stack+push)
1845
- * [.remove()](#Stack+remove) ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
2262
+ * [.peek()](#Stack+peek) ⇒ <code>\*</code> \| <code>null</code>
2263
+ * [.pop()](#Stack+pop) ⇒ <code>\*</code> \| <code>null</code>
2264
+ * [.push(data)](#Stack+push) ⇒ [<code>Stack</code>](#Stack)
1846
2265
  * [.size()](#Stack+size) ⇒ <code>number</code>
2266
+ * [.top()](#Stack+top) ⇒ <code>\*</code> \| <code>null</code>
1847
2267
 
1848
2268
  <a name="new_Stack_new"></a>
1849
2269
 
1850
- ### new Stack([stackedList], [listClass], [stackableClass])
1851
- Instantiate the state with the starter stacked list.
2270
+ ### new Stack([stackedList], [listClass], [linkerClass])
2271
+ Instantiate the stack, optionally with a list of items to start from.
1852
2272
 
1853
2273
 
1854
2274
  | Param | Type | Default | Description |
1855
2275
  | --- | --- | --- | --- |
1856
- | [stackedList] | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) | <code></code> | The list of stackables to start in this stack. |
1857
- | [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no stacked list is given. |
1858
- | [stackableClass] | [<code>Stackable</code>](#Stackable) | <code>Stackable</code> | The class used to wrap stacked items. |
2276
+ | [stackedList] | <code>IsArrayable</code> \| <code>null</code> | <code></code> | The list of linkers to start in this stack (the first is the top) |
2277
+ | [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no stacked list is given |
2278
+ | [linkerClass] | [<code>Linker</code>](#Linker) | <code>Linker</code> | The class used to hold each stacked item |
1859
2279
 
1860
2280
  <a name="Stack+empty"></a>
1861
2281
 
1862
2282
  ### stack.empty() ⇒ <code>boolean</code>
1863
- Return true if the stack is empty (there are no tasks in the stacked list)
2283
+ Check whether the stack has no items.
1864
2284
 
1865
2285
  **Kind**: instance method of [<code>Stack</code>](#Stack)
1866
- <a name="Stack+top"></a>
2286
+ <a name="Stack+peek"></a>
1867
2287
 
1868
- ### stack.top() ⇒ [<code>Stackable</code>](#Stackable)
1869
- Take a look at the next stacked task
2288
+ ### stack.peek() ⇒ <code>\*</code> \| <code>null</code>
2289
+ Look at the item on the top of the stack, without removing it.
1870
2290
 
1871
2291
  **Kind**: instance method of [<code>Stack</code>](#Stack)
2292
+ **Returns**: <code>\*</code> \| <code>null</code> - The item, or null when the stack is empty
1872
2293
  <a name="Stack+pop"></a>
1873
2294
 
1874
- ### stack.pop() ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
1875
- Remove the next stacked task and return it.
2295
+ ### stack.pop() ⇒ <code>\*</code> \| <code>null</code>
2296
+ Take the item from the top of the stack.
1876
2297
 
1877
2298
  **Kind**: instance method of [<code>Stack</code>](#Stack)
2299
+ **Returns**: <code>\*</code> \| <code>null</code> - The item, or null when the stack is empty
1878
2300
  <a name="Stack+push"></a>
1879
2301
 
1880
- ### stack.push(stackable)
1881
- Push a stackable task to the top of the stack.
2302
+ ### stack.push(data) ⇒ [<code>Stack</code>](#Stack)
2303
+ Add an item to the top of the stack.
1882
2304
 
1883
2305
  **Kind**: instance method of [<code>Stack</code>](#Stack)
2306
+ **Returns**: [<code>Stack</code>](#Stack) - This stack, so that adding can be chained
1884
2307
 
1885
2308
  | Param | Type | Description |
1886
2309
  | --- | --- | --- |
1887
- | stackable | [<code>Stackable</code>](#Stackable) \| <code>\*</code> | Add a new stackable to the top of the stack |
2310
+ | data | <code>\*</code> | The item to add |
1888
2311
 
1889
- <a name="Stack+remove"></a>
2312
+ <a name="Stack+size"></a>
1890
2313
 
1891
- ### stack.remove() ⇒ [<code>Stackable</code>](#Stackable) \| <code>null</code>
1892
- Remove the next stacked task and return it.
2314
+ ### stack.size() ⇒ <code>number</code>
2315
+ Count the items in the stack.
1893
2316
 
1894
2317
  **Kind**: instance method of [<code>Stack</code>](#Stack)
1895
- <a name="Stack+size"></a>
2318
+ <a name="Stack+top"></a>
1896
2319
 
1897
- ### stack.size() ⇒ <code>number</code>
1898
- Get the size of the current stack.
2320
+ ### stack.top() ⇒ <code>\*</code> \| <code>null</code>
2321
+ The item on the top of the stack (the same as peek).
1899
2322
 
1900
2323
  **Kind**: instance method of [<code>Stack</code>](#Stack)
2324
+ **Returns**: <code>\*</code> \| <code>null</code> - The item, or null when the stack is empty
2325
+ <a name="TaskQueue"></a>
2326
+
2327
+ ## TaskQueue ⇒ [<code>TaskQueue</code>](#TaskQueue)
2328
+ Convert an array to a TaskQueue.
2329
+
2330
+ **Kind**: global variable
2331
+
2332
+ | Param | Type | Description |
2333
+ | --- | --- | --- |
2334
+ | values | <code>Array</code> | An array of values which will be converted to queueables in this queue |
2335
+ | queueableClass | [<code>Queueable</code>](#Queueable) | The class to use for each queueable |
2336
+ | listClass | [<code>TaskQueue</code>](#TaskQueue) \| <code>Iterable</code> | The class to use to manage the queueables |
2337
+
2338
+
2339
+ * [TaskQueue](#TaskQueue) ⇒ [<code>TaskQueue</code>](#TaskQueue)
2340
+ * [new TaskQueue(queuedList, [listClass], [queueableClass])](#new_TaskQueue_new)
2341
+ * [.dequeue()](#TaskQueue+dequeue) ⇒ <code>completeResponse</code> \| <code>\*</code>
2342
+ * [.empty()](#TaskQueue+empty) ⇒ <code>boolean</code>
2343
+ * [.enqueue(queueable)](#TaskQueue+enqueue)
2344
+ * [.peek()](#TaskQueue+peek) ⇒ [<code>Queueable</code>](#Queueable)
2345
+ * [.remove()](#TaskQueue+remove) ⇒ [<code>Queueable</code>](#Queueable) \| <code>null</code>
2346
+ * [.size()](#TaskQueue+size) ⇒ <code>number</code>
2347
+
2348
+ <a name="new_TaskQueue_new"></a>
2349
+
2350
+ ### new TaskQueue(queuedList, [listClass], [queueableClass])
2351
+ Instantiate the queue with the given queue list.
2352
+
2353
+
2354
+ | Param | Type | Default | Description |
2355
+ | --- | --- | --- | --- |
2356
+ | queuedList | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) | <code></code> | Give the list of queueables to start in this queue. |
2357
+ | [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no queued list is given. |
2358
+ | [queueableClass] | [<code>Queueable</code>](#Queueable) | <code>Queueable</code> | The class used to wrap queued items. |
2359
+
2360
+ <a name="TaskQueue+dequeue"></a>
2361
+
2362
+ ### taskQueue.dequeue() ⇒ <code>completeResponse</code> \| <code>\*</code>
2363
+ Take a queued task from the front of the queue and run it if ready. A task which is not ready yet is kept in the
2364
+ queue (never dropped), a task which is still running is reported as blocking and left to finish on its own, and
2365
+ completed tasks are discarded.
2366
+
2367
+ **Kind**: instance method of [<code>TaskQueue</code>](#TaskQueue)
2368
+ <a name="TaskQueue+empty"></a>
2369
+
2370
+ ### taskQueue.empty() ⇒ <code>boolean</code>
2371
+ Return true if the queue is empty (there are no tasks in the queue list)
2372
+
2373
+ **Kind**: instance method of [<code>TaskQueue</code>](#TaskQueue)
2374
+ <a name="TaskQueue+enqueue"></a>
2375
+
2376
+ ### taskQueue.enqueue(queueable)
2377
+ Add a queued task to the end of the queue
2378
+
2379
+ **Kind**: instance method of [<code>TaskQueue</code>](#TaskQueue)
2380
+
2381
+ | Param | Type | Description |
2382
+ | --- | --- | --- |
2383
+ | queueable | [<code>Queueable</code>](#Queueable) | Add a new queueable to the end of the queue |
2384
+
2385
+ <a name="TaskQueue+peek"></a>
2386
+
2387
+ ### taskQueue.peek() ⇒ [<code>Queueable</code>](#Queueable)
2388
+ Take a look at the next queued task
2389
+
2390
+ **Kind**: instance method of [<code>TaskQueue</code>](#TaskQueue)
2391
+ <a name="TaskQueue+remove"></a>
2392
+
2393
+ ### taskQueue.remove() ⇒ [<code>Queueable</code>](#Queueable) \| <code>null</code>
2394
+ Remove the next queued item and return it.
2395
+
2396
+ **Kind**: instance method of [<code>TaskQueue</code>](#TaskQueue)
2397
+ <a name="TaskQueue+size"></a>
2398
+
2399
+ ### taskQueue.size() ⇒ <code>number</code>
2400
+ Get the length of the current queue.
2401
+
2402
+ **Kind**: instance method of [<code>TaskQueue</code>](#TaskQueue)
1901
2403
  <a name="Queueable"></a>
1902
2404
 
1903
2405
  ## Queueable ⇒ [<code>Queueable</code>](#Queueable)
@@ -2026,77 +2528,73 @@ Convert an array into Queueable instances, return the head and tail Queueables.
2026
2528
  <a name="Queue"></a>
2027
2529
 
2028
2530
  ## Queue ⇒ [<code>Queue</code>](#Queue)
2029
- Convert an array to a Queue.
2531
+ Convert an array to a Queue, the first value is at the front.
2030
2532
 
2031
2533
  **Kind**: global variable
2032
2534
 
2033
- | Param | Type | Description |
2034
- | --- | --- | --- |
2035
- | values | <code>Array</code> | An array of values which will be converted to queueables in this queue |
2036
- | queueableClass | [<code>Queueable</code>](#Queueable) | The class to use for each queueable |
2037
- | listClass | [<code>Queue</code>](#Queue) \| <code>Iterable</code> | The class to use to manage the queueables |
2535
+ | Param | Type | Default | Description |
2536
+ | --- | --- | --- | --- |
2537
+ | [values] | <code>Array</code> | <code>[]</code> | The items to queue |
2538
+ | [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list used to store the items |
2539
+ | [linkerClass] | [<code>Linker</code>](#Linker) | <code>Linker</code> | The class used to hold each queued item |
2038
2540
 
2039
2541
 
2040
2542
  * [Queue](#Queue) ⇒ [<code>Queue</code>](#Queue)
2041
- * [new Queue(queuedList, [listClass], [queueableClass])](#new_Queue_new)
2042
- * [.dequeue()](#Queue+dequeue) ⇒ <code>completeResponse</code> \| <code>\*</code>
2543
+ * [new Queue([queuedList], [listClass], [linkerClass])](#new_Queue_new)
2544
+ * [.dequeue()](#Queue+dequeue) ⇒ <code>\*</code> \| <code>null</code>
2043
2545
  * [.empty()](#Queue+empty) ⇒ <code>boolean</code>
2044
- * [.enqueue(queueable)](#Queue+enqueue)
2045
- * [.peek()](#Queue+peek) ⇒ [<code>Queueable</code>](#Queueable)
2046
- * [.remove()](#Queue+remove) ⇒ [<code>Queueable</code>](#Queueable) \| <code>null</code>
2546
+ * [.enqueue(data)](#Queue+enqueue) ⇒ [<code>Queue</code>](#Queue)
2547
+ * [.peek()](#Queue+peek) ⇒ <code>\*</code> \| <code>null</code>
2047
2548
  * [.size()](#Queue+size) ⇒ <code>number</code>
2048
2549
 
2049
2550
  <a name="new_Queue_new"></a>
2050
2551
 
2051
- ### new Queue(queuedList, [listClass], [queueableClass])
2052
- Instantiate the queue with the given queue list.
2552
+ ### new Queue([queuedList], [listClass], [linkerClass])
2553
+ Instantiate the queue, optionally with a list of items to start from.
2053
2554
 
2054
2555
 
2055
2556
  | Param | Type | Default | Description |
2056
2557
  | --- | --- | --- | --- |
2057
- | queuedList | <code>Iterable</code> \| [<code>LinkedList</code>](#LinkedList) | <code></code> | Give the list of queueables to start in this queue. |
2058
- | [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no queued list is given. |
2059
- | [queueableClass] | [<code>Queueable</code>](#Queueable) | <code>Queueable</code> | The class used to wrap queued items. |
2558
+ | [queuedList] | <code>IsArrayable</code> \| <code>null</code> | <code></code> | The list of linkers to start in this queue (the first is the front) |
2559
+ | [listClass] | <code>IsArrayable</code> | <code>LinkedList</code> | The type of list to create when no queued list is given |
2560
+ | [linkerClass] | [<code>Linker</code>](#Linker) | <code>Linker</code> | The class used to hold each queued item |
2060
2561
 
2061
2562
  <a name="Queue+dequeue"></a>
2062
2563
 
2063
- ### queue.dequeue() ⇒ <code>completeResponse</code> \| <code>\*</code>
2064
- Take a queued task from the front of the queue and run it if ready.
2564
+ ### queue.dequeue() ⇒ <code>\*</code> \| <code>null</code>
2565
+ Take the item from the front of the queue.
2065
2566
 
2066
2567
  **Kind**: instance method of [<code>Queue</code>](#Queue)
2568
+ **Returns**: <code>\*</code> \| <code>null</code> - The item, or null when the queue is empty
2067
2569
  <a name="Queue+empty"></a>
2068
2570
 
2069
2571
  ### queue.empty() ⇒ <code>boolean</code>
2070
- Return true if the queue is empty (there are no tasks in the queue list)
2572
+ Check whether the queue has no items.
2071
2573
 
2072
2574
  **Kind**: instance method of [<code>Queue</code>](#Queue)
2073
2575
  <a name="Queue+enqueue"></a>
2074
2576
 
2075
- ### queue.enqueue(queueable)
2076
- Add a queued task to the end of the queue
2577
+ ### queue.enqueue(data) ⇒ [<code>Queue</code>](#Queue)
2578
+ Add an item to the back of the queue.
2077
2579
 
2078
2580
  **Kind**: instance method of [<code>Queue</code>](#Queue)
2581
+ **Returns**: [<code>Queue</code>](#Queue) - This queue, so that adding can be chained
2079
2582
 
2080
2583
  | Param | Type | Description |
2081
2584
  | --- | --- | --- |
2082
- | queueable | [<code>Queueable</code>](#Queueable) | Add a new queueable to the end of the queue |
2585
+ | data | <code>\*</code> | The item to add |
2083
2586
 
2084
2587
  <a name="Queue+peek"></a>
2085
2588
 
2086
- ### queue.peek() ⇒ [<code>Queueable</code>](#Queueable)
2087
- Take a look at the next queued task
2088
-
2089
- **Kind**: instance method of [<code>Queue</code>](#Queue)
2090
- <a name="Queue+remove"></a>
2091
-
2092
- ### queue.remove() ⇒ [<code>Queueable</code>](#Queueable) \| <code>null</code>
2093
- Remove the next queued item and return it.
2589
+ ### queue.peek() ⇒ <code>\*</code> \| <code>null</code>
2590
+ Look at the item at the front of the queue, without removing it.
2094
2591
 
2095
2592
  **Kind**: instance method of [<code>Queue</code>](#Queue)
2593
+ **Returns**: <code>\*</code> \| <code>null</code> - The item, or null when the queue is empty
2096
2594
  <a name="Queue+size"></a>
2097
2595
 
2098
2596
  ### queue.size() ⇒ <code>number</code>
2099
- Get the length of the current queue.
2597
+ Count the items in the queue.
2100
2598
 
2101
2599
  **Kind**: instance method of [<code>Queue</code>](#Queue)
2102
2600
  <a name="TreeLinker"></a>
@@ -2184,7 +2682,9 @@ The list of the children of this node, or null when it has none.
2184
2682
  <a name="TreeLinker+childrenFromArray"></a>
2185
2683
 
2186
2684
  ### treeLinker.childrenFromArray(children, listClass) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code>
2187
- Create the children for this tree from an array.
2685
+ Create the children for this tree from an array. Each child becomes a tree linker with this node as its parent: an
2686
+ existing linker is kept as it is, an object with a data property gives the settings of the linker, and anything
2687
+ else is the data of the linker.
2188
2688
 
2189
2689
  **Kind**: instance method of [<code>TreeLinker</code>](#TreeLinker)
2190
2690
 
@@ -2224,23 +2724,28 @@ Convert an array into a LinkedTreeList instance, return the new instance.
2224
2724
  * [.classType](#LinkedTreeList+classType)
2225
2725
  * [.innerList](#LinkedTreeList+innerList)
2226
2726
  * [.initialized](#LinkedTreeList+initialized)
2727
+ * [.tailCache](#LinkedTreeList+tailCache)
2728
+ * [.countCache](#LinkedTreeList+countCache)
2729
+ * [.ownerNode](#LinkedTreeList+ownerNode)
2227
2730
  * [.list](#LinkedTreeList+list) ⇒ [<code>TreeLinker</code>](#TreeLinker)
2228
2731
  * [.first](#LinkedTreeList+first) ⇒ [<code>TreeLinker</code>](#TreeLinker)
2229
2732
  * [.last](#LinkedTreeList+last) ⇒ [<code>TreeLinker</code>](#TreeLinker)
2230
2733
  * [.length](#LinkedTreeList+length) ⇒ <code>number</code>
2231
- * [.parent](#LinkedTreeList+parent) ⇒ [<code>TreeLinker</code>](#TreeLinker)
2734
+ * [.parent](#LinkedTreeList+parent) ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
2232
2735
  * [.parent](#LinkedTreeList+parent)
2233
2736
  * [.rootParent](#LinkedTreeList+rootParent) ⇒ [<code>TreeLinker</code>](#TreeLinker)
2234
2737
  * [.initialize(initialList)](#LinkedTreeList+initialize) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
2235
- * [.setChildren(item, children)](#LinkedTreeList+setChildren)
2738
+ * [.setChildren(item, [children])](#LinkedTreeList+setChildren)
2739
+ * [.adopt(newNode)](#LinkedTreeList+adopt) ⇒ [<code>TreeLinker</code>](#TreeLinker)
2236
2740
  * [.insertAfter(node, newNode)](#LinkedTreeList+insertAfter) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
2237
2741
  * [.insertBefore(node, newNode)](#LinkedTreeList+insertBefore) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
2238
2742
  * [.append(node, after)](#LinkedTreeList+append) ⇒ [<code>TreeLinker</code>](#TreeLinker)
2239
2743
  * [.prepend(node, before)](#LinkedTreeList+prepend) ⇒ [<code>TreeLinker</code>](#TreeLinker)
2240
- * [.remove(node)](#LinkedTreeList+remove) ⇒ [<code>TreeLinker</code>](#TreeLinker)
2744
+ * [.remove(node)](#LinkedTreeList+remove) ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
2241
2745
  * [.reset()](#LinkedTreeList+reset) ⇒ [<code>TreeLinker</code>](#TreeLinker)
2242
2746
  * [.item(index)](#LinkedTreeList+item) ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
2243
2747
  * [.forEach(callback, thisArg)](#LinkedTreeList+forEach) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
2748
+ * [.indexOfElement(node)](#Arrayable+indexOfElement) ⇒ <code>number</code>
2244
2749
 
2245
2750
  <a name="new_LinkedTreeList_new"></a>
2246
2751
 
@@ -2273,10 +2778,30 @@ Whether the inner list has been initialized (it can only be initialized once).
2273
2778
 
2274
2779
  **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
2275
2780
  **Overrides**: [<code>initialized</code>](#DoublyLinkedList+initialized)
2781
+ <a name="LinkedTreeList+tailCache"></a>
2782
+
2783
+ ### linkedTreeList.tailCache
2784
+ The last linker, remembered so that adding to the end does not need to walk the whole list (null when not known yet).
2785
+
2786
+ **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
2787
+ **Overrides**: [<code>tailCache</code>](#DoublyLinkedList+tailCache)
2788
+ <a name="LinkedTreeList+countCache"></a>
2789
+
2790
+ ### linkedTreeList.countCache
2791
+ The number of linkers, kept up to date by the list's own methods so that the length does not need to walk the whole list (null when not known yet).
2792
+
2793
+ **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
2794
+ **Overrides**: [<code>countCache</code>](#DoublyLinkedList+countCache)
2795
+ <a name="LinkedTreeList+ownerNode"></a>
2796
+
2797
+ ### linkedTreeList.ownerNode
2798
+ The node these linkers are the children of, remembered so that it is known even while the list is empty (undefined until it is known).
2799
+
2800
+ **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
2276
2801
  <a name="LinkedTreeList+list"></a>
2277
2802
 
2278
2803
  ### linkedTreeList.list ⇒ [<code>TreeLinker</code>](#TreeLinker)
2279
- Retrieve a copy of the innerList used.
2804
+ Retrieve the innerList used (the list itself, not a copy).
2280
2805
 
2281
2806
  **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
2282
2807
  **Overrides**: [<code>list</code>](#DoublyLinkedList+list)
@@ -2290,33 +2815,36 @@ Retrieve the first TreeLinker in the list.
2290
2815
  <a name="LinkedTreeList+last"></a>
2291
2816
 
2292
2817
  ### linkedTreeList.last ⇒ [<code>TreeLinker</code>](#TreeLinker)
2293
- Retrieve the last TreeLinker in the list.
2818
+ Retrieve the last TreeLinker in the list. The end is remembered, so this does not walk the list.
2294
2819
 
2295
2820
  **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
2296
2821
  **Overrides**: [<code>last</code>](#DoublyLinkedList+last)
2297
2822
  <a name="LinkedTreeList+length"></a>
2298
2823
 
2299
2824
  ### linkedTreeList.length ⇒ <code>number</code>
2300
- Return the length of the list.
2825
+ Return the length of the list. It is kept up to date by the list's own methods, so this does not walk the list
2826
+ (call reset() after linkers were changed directly).
2301
2827
 
2302
2828
  **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
2303
2829
  **Overrides**: [<code>length</code>](#DoublyLinkedList+length)
2304
2830
  <a name="LinkedTreeList+parent"></a>
2305
2831
 
2306
- ### linkedTreeList.parent ⇒ [<code>TreeLinker</code>](#TreeLinker)
2307
- Get the parent of this tree list.
2832
+ ### linkedTreeList.parent ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
2833
+ Get the parent of this tree list: the node these linkers are the children of (remembered even while the list is
2834
+ empty), or null for the linkers at the top of a tree.
2308
2835
 
2309
2836
  **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
2310
2837
  <a name="LinkedTreeList+parent"></a>
2311
2838
 
2312
2839
  ### linkedTreeList.parent
2313
- Set the parent of this tree list
2840
+ Set the parent of this tree list: every linker in it gets the node as its parent, and the node gets this list as its
2841
+ children. Linkers added to the list later get this parent too.
2314
2842
 
2315
2843
  **Kind**: instance property of [<code>LinkedTreeList</code>](#LinkedTreeList)
2316
2844
 
2317
2845
  | Param | Type | Description |
2318
2846
  | --- | --- | --- |
2319
- | parent | [<code>TreeLinker</code>](#TreeLinker) | The new node to use as the parent for this group of children |
2847
+ | parent | [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code> | The new node to use as the parent for this group of children |
2320
2848
 
2321
2849
  <a name="LinkedTreeList+rootParent"></a>
2322
2850
 
@@ -2338,40 +2866,55 @@ Initialize the inner list, should only run once.
2338
2866
 
2339
2867
  <a name="LinkedTreeList+setChildren"></a>
2340
2868
 
2341
- ### linkedTreeList.setChildren(item, children)
2869
+ ### linkedTreeList.setChildren(item, [children])
2342
2870
  Set the children on a parent item.
2343
2871
 
2344
2872
  **Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
2873
+ **Throws**:
2874
+
2875
+ - <code>Error</code> When the item is not one of the linkers of this list
2876
+
2345
2877
 
2346
2878
  | Param | Type | Default | Description |
2347
2879
  | --- | --- | --- | --- |
2348
- | item | [<code>TreeLinker</code>](#TreeLinker) | | The TreeLinker node that will be the parent of the children |
2349
- | children | [<code>LinkedTreeList</code>](#LinkedTreeList) | <code></code> | The LinkedTreeList which has the child nodes to use |
2880
+ | item | [<code>TreeLinker</code>](#TreeLinker) | | The TreeLinker node (one of the linkers of this list) that will be the parent of the children |
2881
+ | [children] | [<code>LinkedTreeList</code>](#LinkedTreeList) \| <code>null</code> | <code></code> | The LinkedTreeList which has the child nodes to use, or null to remove the children of the item |
2882
+
2883
+ <a name="LinkedTreeList+adopt"></a>
2884
+
2885
+ ### linkedTreeList.adopt(newNode) ⇒ [<code>TreeLinker</code>](#TreeLinker)
2886
+ Make a linker of the given node (or data) and make this list's parent its parent.
2887
+
2888
+ **Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
2889
+
2890
+ | Param | Type | Description |
2891
+ | --- | --- | --- |
2892
+ | newNode | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The node (or data) which is being added to this list |
2350
2893
 
2351
2894
  <a name="LinkedTreeList+insertAfter"></a>
2352
2895
 
2353
2896
  ### linkedTreeList.insertAfter(node, newNode) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
2354
- Insert a new node (or data) after a node.
2897
+ Insert a new node (or data) after a node. The new node gets the parent of this list.
2355
2898
 
2356
2899
  **Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
2357
2900
  **Overrides**: [<code>insertAfter</code>](#DoublyLinkedList+insertAfter)
2358
2901
 
2359
2902
  | Param | Type | Description |
2360
2903
  | --- | --- | --- |
2361
- | node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The existing node as reference |
2904
+ | node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The existing node as reference, or null to insert at the start of the list |
2362
2905
  | newNode | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to go after the existing node |
2363
2906
 
2364
2907
  <a name="LinkedTreeList+insertBefore"></a>
2365
2908
 
2366
2909
  ### linkedTreeList.insertBefore(node, newNode) ⇒ [<code>LinkedTreeList</code>](#LinkedTreeList)
2367
- Insert a new node (or data) before a node.
2910
+ Insert a new node (or data) before a node. The new node gets the parent of this list.
2368
2911
 
2369
2912
  **Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
2370
2913
  **Overrides**: [<code>insertBefore</code>](#DoublyLinkedList+insertBefore)
2371
2914
 
2372
2915
  | Param | Type | Description |
2373
2916
  | --- | --- | --- |
2374
- | node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The existing node as reference |
2917
+ | node | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The existing node as reference, or null to insert at the end of the list |
2375
2918
  | newNode | [<code>TreeLinker</code>](#TreeLinker) \| <code>\*</code> | The new node to go before the existing node |
2376
2919
 
2377
2920
  <a name="LinkedTreeList+append"></a>
@@ -2402,11 +2945,12 @@ Add a node (or data) before the given (or first) node in the list.
2402
2945
 
2403
2946
  <a name="LinkedTreeList+remove"></a>
2404
2947
 
2405
- ### linkedTreeList.remove(node) ⇒ [<code>TreeLinker</code>](#TreeLinker)
2406
- Remove a linker from this linked list.
2948
+ ### linkedTreeList.remove(node) ⇒ [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code>
2949
+ Remove a linker from this linked list. The removed node no longer has a parent.
2407
2950
 
2408
2951
  **Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
2409
2952
  **Overrides**: [<code>remove</code>](#DoublyLinkedList+remove)
2953
+ **Returns**: [<code>TreeLinker</code>](#TreeLinker) \| <code>null</code> - The removed node, or null when there was nothing to remove
2410
2954
 
2411
2955
  | Param | Type | Description |
2412
2956
  | --- | --- | --- |
@@ -2415,7 +2959,8 @@ Remove a linker from this linked list.
2415
2959
  <a name="LinkedTreeList+reset"></a>
2416
2960
 
2417
2961
  ### linkedTreeList.reset() ⇒ [<code>TreeLinker</code>](#TreeLinker)
2418
- Refresh all references and return head reference.
2962
+ Refresh all references (the head, the end and the length) by walking the list once, and return the head. The
2963
+ list's own methods keep these up to date, so this is only needed after linkers were changed directly.
2419
2964
 
2420
2965
  **Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
2421
2966
  **Overrides**: [<code>reset</code>](#DoublyLinkedList+reset)
@@ -2445,6 +2990,22 @@ Be able to run forEach on this LinkedTreeList to iterate over the TreeLinker Ite
2445
2990
  | callback | <code>forEachCallback</code> | The function to call for-each tree node |
2446
2991
  | thisArg | [<code>LinkedTreeList</code>](#LinkedTreeList) | Optional, 'this' reference |
2447
2992
 
2993
+ <a name="Arrayable+indexOfElement"></a>
2994
+
2995
+ ### linkedTreeList.indexOfElement(node) ⇒ <code>number</code>
2996
+ Find the position of an element which must be in this list.
2997
+
2998
+ **Kind**: instance method of [<code>LinkedTreeList</code>](#LinkedTreeList)
2999
+ **Overrides**: [<code>indexOfElement</code>](#Arrayable+indexOfElement)
3000
+ **Throws**:
3001
+
3002
+ - <code>Error</code> When the element is not in this list
3003
+
3004
+
3005
+ | Param | Type | Description |
3006
+ | --- | --- | --- |
3007
+ | node | [<code>ArrayElement</code>](#ArrayElement) | The element to find |
3008
+
2448
3009
  <a name="Linker"></a>
2449
3010
 
2450
3011
  ## Linker ⇒ [<code>Linker</code>](#Linker)
@@ -2530,6 +3091,8 @@ Convert an array to a LinkedList.
2530
3091
  * [.classType](#LinkedList+classType)
2531
3092
  * [.innerList](#LinkedList+innerList)
2532
3093
  * [.initialized](#LinkedList+initialized)
3094
+ * [.tailCache](#LinkedList+tailCache)
3095
+ * [.countCache](#LinkedList+countCache)
2533
3096
  * [.list](#LinkedList+list) ⇒ [<code>Linker</code>](#Linker)
2534
3097
  * [.first](#LinkedList+first) ⇒ [<code>Linker</code>](#Linker)
2535
3098
  * [.last](#LinkedList+last) ⇒ [<code>Linker</code>](#Linker)
@@ -2539,9 +3102,11 @@ Convert an array to a LinkedList.
2539
3102
  * [.insertBefore(node, newNode)](#LinkedList+insertBefore) ⇒ [<code>LinkedList</code>](#LinkedList)
2540
3103
  * [.append(node, after)](#LinkedList+append) ⇒ [<code>Linker</code>](#Linker)
2541
3104
  * [.prepend(node, before)](#LinkedList+prepend) ⇒ [<code>Linker</code>](#Linker)
2542
- * [.remove(node)](#LinkedList+remove) ⇒ [<code>Linker</code>](#Linker)
3105
+ * [.remove(node)](#LinkedList+remove) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
3106
+ * [.reset()](#LinkedList+reset) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
2543
3107
  * [.item(index)](#LinkedList+item) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
2544
3108
  * [.forEach(callback, thisArg)](#LinkedList+forEach) ⇒ [<code>LinkedList</code>](#LinkedList)
3109
+ * [.indexOfElement(node)](#Arrayable+indexOfElement) ⇒ <code>number</code>
2545
3110
 
2546
3111
  <a name="new_LinkedList_new"></a>
2547
3112
 
@@ -2574,10 +3139,22 @@ Whether the inner list has been initialized (it can only be initialized once).
2574
3139
 
2575
3140
  **Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
2576
3141
  **Overrides**: [<code>initialized</code>](#Arrayable+initialized)
3142
+ <a name="LinkedList+tailCache"></a>
3143
+
3144
+ ### linkedList.tailCache
3145
+ The last linker, remembered so that adding to the end does not need to walk the whole list (null when not known yet).
3146
+
3147
+ **Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
3148
+ <a name="LinkedList+countCache"></a>
3149
+
3150
+ ### linkedList.countCache
3151
+ The number of linkers, kept up to date by the list's own methods so that the length does not need to walk the whole list (null when not known yet).
3152
+
3153
+ **Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
2577
3154
  <a name="LinkedList+list"></a>
2578
3155
 
2579
3156
  ### linkedList.list ⇒ [<code>Linker</code>](#Linker)
2580
- Retrieve a copy of the innerList used.
3157
+ Retrieve the innerList used (the list itself, not a copy).
2581
3158
 
2582
3159
  **Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
2583
3160
  **Overrides**: [<code>list</code>](#Arrayable+list)
@@ -2591,14 +3168,15 @@ Retrieve the first Linker in the list.
2591
3168
  <a name="LinkedList+last"></a>
2592
3169
 
2593
3170
  ### linkedList.last ⇒ [<code>Linker</code>](#Linker)
2594
- Retrieve the last Linker in the list.
3171
+ Retrieve the last Linker in the list. The end is remembered, so this does not walk the list.
2595
3172
 
2596
3173
  **Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
2597
3174
  **Overrides**: [<code>last</code>](#Arrayable+last)
2598
3175
  <a name="LinkedList+length"></a>
2599
3176
 
2600
3177
  ### linkedList.length ⇒ <code>number</code>
2601
- Return the length of the list.
3178
+ Return the length of the list. It is kept up to date by the list's own methods, so this does not walk the list
3179
+ (call reset() after linkers were changed directly).
2602
3180
 
2603
3181
  **Kind**: instance property of [<code>LinkedList</code>](#LinkedList)
2604
3182
  **Overrides**: [<code>length</code>](#Arrayable+length)
@@ -2624,7 +3202,7 @@ Insert a new node (or data) after a node.
2624
3202
 
2625
3203
  | Param | Type | Description |
2626
3204
  | --- | --- | --- |
2627
- | node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The existing node as reference |
3205
+ | node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The existing node as reference, or null to insert at the start of the list |
2628
3206
  | newNode | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to go after the existing node |
2629
3207
 
2630
3208
  <a name="LinkedList+insertBefore"></a>
@@ -2634,10 +3212,14 @@ Insert a new node (or data) before a node.
2634
3212
 
2635
3213
  **Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
2636
3214
  **Overrides**: [<code>insertBefore</code>](#Arrayable+insertBefore)
3215
+ **Throws**:
3216
+
3217
+ - <code>Error</code> When the reference node is not in this list
3218
+
2637
3219
 
2638
3220
  | Param | Type | Description |
2639
3221
  | --- | --- | --- |
2640
- | node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The existing node as reference |
3222
+ | node | [<code>Linker</code>](#Linker) \| <code>\*</code> | The existing node as reference, or null to insert at the end of the list |
2641
3223
  | newNode | [<code>Linker</code>](#Linker) \| <code>\*</code> | The new node to go before the existing node |
2642
3224
 
2643
3225
  <a name="LinkedList+append"></a>
@@ -2668,16 +3250,25 @@ Add a node (or data) before the given (or first) node in the list.
2668
3250
 
2669
3251
  <a name="LinkedList+remove"></a>
2670
3252
 
2671
- ### linkedList.remove(node) ⇒ [<code>Linker</code>](#Linker)
3253
+ ### linkedList.remove(node) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
2672
3254
  Remove a linker from this linked list.
2673
3255
 
2674
3256
  **Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
2675
3257
  **Overrides**: [<code>remove</code>](#Arrayable+remove)
3258
+ **Returns**: [<code>Linker</code>](#Linker) \| <code>null</code> - The removed node, or null when it was not in this list (nothing is removed)
2676
3259
 
2677
3260
  | Param | Type | Description |
2678
3261
  | --- | --- | --- |
2679
3262
  | node | [<code>Linker</code>](#Linker) | The node we wish to remove (and it will be returned after removal) |
2680
3263
 
3264
+ <a name="LinkedList+reset"></a>
3265
+
3266
+ ### linkedList.reset() ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
3267
+ Refresh the remembered end and length of the list by walking it once. The list's own methods keep these up to date,
3268
+ so this is only needed after linkers were changed directly (for example by setting next on a linker).
3269
+
3270
+ **Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
3271
+ **Returns**: [<code>Linker</code>](#Linker) \| <code>null</code> - The first linker of the list
2681
3272
  <a name="LinkedList+item"></a>
2682
3273
 
2683
3274
  ### linkedList.item(index) ⇒ [<code>Linker</code>](#Linker) \| <code>null</code>
@@ -2703,6 +3294,22 @@ Be able to run forEach on this LinkedList to iterate over the linkers.
2703
3294
  | callback | <code>forEachCallback</code> | The function to call for-each linker |
2704
3295
  | thisArg | [<code>LinkedList</code>](#LinkedList) | Optional, 'this' reference |
2705
3296
 
3297
+ <a name="Arrayable+indexOfElement"></a>
3298
+
3299
+ ### linkedList.indexOfElement(node) ⇒ <code>number</code>
3300
+ Find the position of an element which must be in this list.
3301
+
3302
+ **Kind**: instance method of [<code>LinkedList</code>](#LinkedList)
3303
+ **Overrides**: [<code>indexOfElement</code>](#Arrayable+indexOfElement)
3304
+ **Throws**:
3305
+
3306
+ - <code>Error</code> When the element is not in this list
3307
+
3308
+
3309
+ | Param | Type | Description |
3310
+ | --- | --- | --- |
3311
+ | node | [<code>ArrayElement</code>](#ArrayElement) | The element to find |
3312
+
2706
3313
  <a name="DoublyLinkedList"></a>
2707
3314
 
2708
3315
  ## DoublyLinkedList ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
@@ -2722,6 +3329,8 @@ Convert an array into a DoublyLinkedList instance, return the new instance.
2722
3329
  * [.classType](#DoublyLinkedList+classType)
2723
3330
  * [.innerList](#DoublyLinkedList+innerList)
2724
3331
  * [.initialized](#DoublyLinkedList+initialized)
3332
+ * [.tailCache](#DoublyLinkedList+tailCache)
3333
+ * [.countCache](#DoublyLinkedList+countCache)
2725
3334
  * [.list](#DoublyLinkedList+list) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
2726
3335
  * [.first](#DoublyLinkedList+first) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
2727
3336
  * [.last](#DoublyLinkedList+last) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
@@ -2732,9 +3341,10 @@ Convert an array into a DoublyLinkedList instance, return the new instance.
2732
3341
  * [.append(node, after)](#DoublyLinkedList+append) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
2733
3342
  * [.prepend(node, before)](#DoublyLinkedList+prepend) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
2734
3343
  * [.remove(node)](#DoublyLinkedList+remove) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
2735
- * [.reset()](#DoublyLinkedList+reset) ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
3344
+ * [.reset()](#DoublyLinkedList+reset) ⇒ [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code>
2736
3345
  * [.item(index)](#DoublyLinkedList+item) ⇒ [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code>
2737
3346
  * [.forEach(callback, thisArg)](#DoublyLinkedList+forEach) ⇒ [<code>DoublyLinkedList</code>](#DoublyLinkedList)
3347
+ * [.indexOfElement(node)](#Arrayable+indexOfElement) ⇒ <code>number</code>
2738
3348
 
2739
3349
  <a name="new_DoublyLinkedList_new"></a>
2740
3350
 
@@ -2767,10 +3377,24 @@ Whether the inner list has been initialized (it can only be initialized once).
2767
3377
 
2768
3378
  **Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
2769
3379
  **Overrides**: [<code>initialized</code>](#LinkedList+initialized)
3380
+ <a name="DoublyLinkedList+tailCache"></a>
3381
+
3382
+ ### doublyLinkedList.tailCache
3383
+ The last linker, remembered so that adding to the end does not need to walk the whole list (null when not known yet).
3384
+
3385
+ **Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
3386
+ **Overrides**: [<code>tailCache</code>](#LinkedList+tailCache)
3387
+ <a name="DoublyLinkedList+countCache"></a>
3388
+
3389
+ ### doublyLinkedList.countCache
3390
+ The number of linkers, kept up to date by the list's own methods so that the length does not need to walk the whole list (null when not known yet).
3391
+
3392
+ **Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
3393
+ **Overrides**: [<code>countCache</code>](#LinkedList+countCache)
2770
3394
  <a name="DoublyLinkedList+list"></a>
2771
3395
 
2772
3396
  ### doublyLinkedList.list ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
2773
- Retrieve a copy of the innerList used.
3397
+ Retrieve the innerList used (the list itself, not a copy).
2774
3398
 
2775
3399
  **Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
2776
3400
  **Overrides**: [<code>list</code>](#LinkedList+list)
@@ -2784,14 +3408,15 @@ Retrieve the first DoubleLinker in the list.
2784
3408
  <a name="DoublyLinkedList+last"></a>
2785
3409
 
2786
3410
  ### doublyLinkedList.last ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
2787
- Retrieve the last DoubleLinker in the list.
3411
+ Retrieve the last DoubleLinker in the list. The end is remembered, so this does not walk the list.
2788
3412
 
2789
3413
  **Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
2790
3414
  **Overrides**: [<code>last</code>](#LinkedList+last)
2791
3415
  <a name="DoublyLinkedList+length"></a>
2792
3416
 
2793
3417
  ### doublyLinkedList.length ⇒ <code>number</code>
2794
- Return the length of the list.
3418
+ Return the length of the list. It is kept up to date by the list's own methods, so this does not walk the list
3419
+ (call reset() after linkers were changed directly).
2795
3420
 
2796
3421
  **Kind**: instance property of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
2797
3422
  **Overrides**: [<code>length</code>](#LinkedList+length)
@@ -2817,7 +3442,7 @@ Insert a new node (or data) after a node.
2817
3442
 
2818
3443
  | Param | Type | Description |
2819
3444
  | --- | --- | --- |
2820
- | node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The existing node as reference |
3445
+ | node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The existing node as reference (which must be in this list, this is not checked), or null to insert at the start of the list |
2821
3446
  | newNode | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to go after the existing node |
2822
3447
 
2823
3448
  <a name="DoublyLinkedList+insertBefore"></a>
@@ -2830,7 +3455,7 @@ Insert a new node (or data) before a node.
2830
3455
 
2831
3456
  | Param | Type | Description |
2832
3457
  | --- | --- | --- |
2833
- | node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The existing node as reference |
3458
+ | node | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The existing node as reference (which must be in this list, this is not checked), or null to insert at the end of the list |
2834
3459
  | newNode | [<code>DoubleLinker</code>](#DoubleLinker) \| <code>\*</code> | The new node to go before the existing node |
2835
3460
 
2836
3461
  <a name="DoublyLinkedList+append"></a>
@@ -2873,10 +3498,12 @@ Remove a linker from this linked list.
2873
3498
 
2874
3499
  <a name="DoublyLinkedList+reset"></a>
2875
3500
 
2876
- ### doublyLinkedList.reset() ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
2877
- Refresh all references and return head reference.
3501
+ ### doublyLinkedList.reset() ⇒ [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code>
3502
+ Refresh all references (the head, the end and the length) by walking the list once, and return the head. The list's
3503
+ own methods keep these up to date, so this is only needed after linkers were changed directly.
2878
3504
 
2879
3505
  **Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
3506
+ **Overrides**: [<code>reset</code>](#LinkedList+reset)
2880
3507
  <a name="DoublyLinkedList+item"></a>
2881
3508
 
2882
3509
  ### doublyLinkedList.item(index) ⇒ [<code>DoubleLinker</code>](#DoubleLinker) \| <code>null</code>
@@ -2903,6 +3530,22 @@ Be able to run forEach on this DoublyLinkedList to iterate over the DoubleLinker
2903
3530
  | callback | <code>forEachCallback</code> | The function to call for-each double linker |
2904
3531
  | thisArg | [<code>DoublyLinkedList</code>](#DoublyLinkedList) | Optional, 'this' reference |
2905
3532
 
3533
+ <a name="Arrayable+indexOfElement"></a>
3534
+
3535
+ ### doublyLinkedList.indexOfElement(node) ⇒ <code>number</code>
3536
+ Find the position of an element which must be in this list.
3537
+
3538
+ **Kind**: instance method of [<code>DoublyLinkedList</code>](#DoublyLinkedList)
3539
+ **Overrides**: [<code>indexOfElement</code>](#Arrayable+indexOfElement)
3540
+ **Throws**:
3541
+
3542
+ - <code>Error</code> When the element is not in this list
3543
+
3544
+
3545
+ | Param | Type | Description |
3546
+ | --- | --- | --- |
3547
+ | node | [<code>ArrayElement</code>](#ArrayElement) | The element to find |
3548
+
2906
3549
  <a name="DoubleLinker"></a>
2907
3550
 
2908
3551
  ## DoubleLinker ⇒ [<code>DoubleLinker</code>](#DoubleLinker)
@@ -2998,15 +3641,16 @@ Convert an array to an Arrayable.
2998
3641
  * [.innerList](#Arrayable+innerList)
2999
3642
  * [.initialized](#Arrayable+initialized)
3000
3643
  * [.list](#Arrayable+list) ⇒ [<code>Array.&lt;ArrayElement&gt;</code>](#ArrayElement)
3001
- * [.first](#Arrayable+first) ⇒ [<code>ArrayElement</code>](#ArrayElement)
3002
- * [.last](#Arrayable+last) ⇒ [<code>ArrayElement</code>](#ArrayElement)
3644
+ * [.first](#Arrayable+first) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
3645
+ * [.last](#Arrayable+last) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
3003
3646
  * [.length](#Arrayable+length) ⇒ <code>number</code>
3647
+ * [.indexOfElement(node)](#Arrayable+indexOfElement) ⇒ <code>number</code>
3004
3648
  * [.initialize(initialList)](#Arrayable+initialize) ⇒ [<code>Arrayable</code>](#Arrayable)
3005
3649
  * [.insertAfter(node, newNode)](#Arrayable+insertAfter) ⇒ [<code>Arrayable</code>](#Arrayable)
3006
3650
  * [.insertBefore(node, newNode)](#Arrayable+insertBefore) ⇒ [<code>Arrayable</code>](#Arrayable)
3007
3651
  * [.append(node, after)](#Arrayable+append) ⇒ [<code>Arrayable</code>](#Arrayable)
3008
3652
  * [.prepend(node, before)](#Arrayable+prepend) ⇒ [<code>Arrayable</code>](#Arrayable)
3009
- * [.remove(node)](#Arrayable+remove) ⇒ [<code>ArrayElement</code>](#ArrayElement)
3653
+ * [.remove(node)](#Arrayable+remove) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
3010
3654
  * [.item(index)](#Arrayable+item) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
3011
3655
  * [.forEach(callback, thisArg)](#Arrayable+forEach) ⇒ [<code>Arrayable</code>](#Arrayable)
3012
3656
 
@@ -3041,27 +3685,44 @@ Whether the inner list has been initialized (it can only be initialized once).
3041
3685
  <a name="Arrayable+list"></a>
3042
3686
 
3043
3687
  ### arrayable.list ⇒ [<code>Array.&lt;ArrayElement&gt;</code>](#ArrayElement)
3044
- Retrieve a copy of the innerList used.
3688
+ Retrieve the innerList used (the list itself, not a copy).
3045
3689
 
3046
3690
  **Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
3047
3691
  <a name="Arrayable+first"></a>
3048
3692
 
3049
- ### arrayable.first ⇒ [<code>ArrayElement</code>](#ArrayElement)
3693
+ ### arrayable.first ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
3050
3694
  Retrieve the first Element from the Arrayable
3051
3695
 
3052
3696
  **Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
3697
+ **Returns**: [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code> - The first element, or null when the Arrayable is empty
3053
3698
  <a name="Arrayable+last"></a>
3054
3699
 
3055
- ### arrayable.last ⇒ [<code>ArrayElement</code>](#ArrayElement)
3700
+ ### arrayable.last ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
3056
3701
  Retrieve the last Element from the Arrayable
3057
3702
 
3058
3703
  **Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
3704
+ **Returns**: [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code> - The last element, or null when the Arrayable is empty
3059
3705
  <a name="Arrayable+length"></a>
3060
3706
 
3061
3707
  ### arrayable.length ⇒ <code>number</code>
3062
3708
  Return the length of the list.
3063
3709
 
3064
3710
  **Kind**: instance property of [<code>Arrayable</code>](#Arrayable)
3711
+ <a name="Arrayable+indexOfElement"></a>
3712
+
3713
+ ### arrayable.indexOfElement(node) ⇒ <code>number</code>
3714
+ Find the position of an element which must be in this list.
3715
+
3716
+ **Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
3717
+ **Throws**:
3718
+
3719
+ - <code>Error</code> When the element is not in this list
3720
+
3721
+
3722
+ | Param | Type | Description |
3723
+ | --- | --- | --- |
3724
+ | node | [<code>ArrayElement</code>](#ArrayElement) | The element to find |
3725
+
3065
3726
  <a name="Arrayable+initialize"></a>
3066
3727
 
3067
3728
  ### arrayable.initialize(initialList) ⇒ [<code>Arrayable</code>](#Arrayable)
@@ -3079,10 +3740,14 @@ Initialize the inner list, should only run once.
3079
3740
  Insert a new node (or data) after a node.
3080
3741
 
3081
3742
  **Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
3743
+ **Throws**:
3744
+
3745
+ - <code>Error</code> When the reference node is not in this list
3746
+
3082
3747
 
3083
3748
  | Param | Type | Description |
3084
3749
  | --- | --- | --- |
3085
- | node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The existing node as reference |
3750
+ | node | [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code> | The existing node as reference, or null to insert at the start of the list |
3086
3751
  | newNode | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to go after the existing node |
3087
3752
 
3088
3753
  <a name="Arrayable+insertBefore"></a>
@@ -3091,10 +3756,14 @@ Insert a new node (or data) after a node.
3091
3756
  Insert a new node (or data) before a node.
3092
3757
 
3093
3758
  **Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
3759
+ **Throws**:
3760
+
3761
+ - <code>Error</code> When the reference node is not in this list
3762
+
3094
3763
 
3095
3764
  | Param | Type | Description |
3096
3765
  | --- | --- | --- |
3097
- | node | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The existing node as reference |
3766
+ | node | [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code> | The existing node as reference, or null to insert at the end of the list |
3098
3767
  | newNode | [<code>ArrayElement</code>](#ArrayElement) \| <code>\*</code> | The new node to go before the existing node |
3099
3768
 
3100
3769
  <a name="Arrayable+append"></a>
@@ -3123,10 +3792,11 @@ Add a node (or data) before the given (or first) node in the list.
3123
3792
 
3124
3793
  <a name="Arrayable+remove"></a>
3125
3794
 
3126
- ### arrayable.remove(node) ⇒ [<code>ArrayElement</code>](#ArrayElement)
3795
+ ### arrayable.remove(node) ⇒ [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code>
3127
3796
  Remove an element from this arrayable.
3128
3797
 
3129
3798
  **Kind**: instance method of [<code>Arrayable</code>](#Arrayable)
3799
+ **Returns**: [<code>ArrayElement</code>](#ArrayElement) \| <code>null</code> - The removed node, or null when it was not in this list (nothing is removed)
3130
3800
 
3131
3801
  | Param | Type | Description |
3132
3802
  | --- | --- | --- |
@@ -3224,7 +3894,7 @@ List of class declarations that can be used to specify attributes for a style of
3224
3894
  **Kind**: global constant
3225
3895
  <a name="parseTreeNext"></a>
3226
3896
 
3227
- ## parseTreeNext(treeNode) ⇒ <code>IsTreeNode</code> \| <code>null</code>
3897
+ ## parseTreeNext(treeNode, [boundaryParent]) ⇒ <code>IsTreeNode</code> \| <code>null</code>
3228
3898
  Be able to parse over every node in a tree.
3229
3899
  1. Start at root (get root parent)
3230
3900
  2. Get first child (repeat until no children)
@@ -3233,12 +3903,15 @@ Be able to parse over every node in a tree.
3233
3903
  5. Repeat 3
3234
3904
  6. If no next child, return to parent and repeat 3
3235
3905
  7. Stop at root (next is null and parent is null
3906
+ A boundary can be given to parse only part of a tree: going back up to the parents stops at the boundary, so the
3907
+ parsing stays within the nodes whose parent is the boundary (and everything below them).
3236
3908
 
3237
3909
  **Kind**: global function
3238
3910
 
3239
3911
  | Param | Type | Description |
3240
3912
  | --- | --- | --- |
3241
3913
  | treeNode | <code>IsTreeNode</code> | Provide a node in a tree and get the next node (left-first approach) |
3914
+ | [boundaryParent] | <code>IsTreeNode</code> \| <code>null</code> | The parent of the nodes to stay within, null for the nodes at the top of a tree. When it is not given the whole tree is parsed. |
3242
3915
 
3243
3916
  <a name="parseTree"></a>
3244
3917
 
@@ -3252,3 +3925,15 @@ Loop over all the nodes in a tree starting from left and apply a callback for ea
3252
3925
  | tree | <code>IsArrayable.&lt;IsTreeNode&gt;</code> |
3253
3926
  | callback | <code>forEachCallback</code> |
3254
3927
 
3928
+ <a name="borrowedGetter"></a>
3929
+
3930
+ ## borrowedGetter(name, list) ⇒ <code>\*</code>
3931
+ Use one of the accessors of DoublyLinkedList (which keeps track of the head, tail and length) for a LinkedTreeList.
3932
+
3933
+ **Kind**: global function
3934
+
3935
+ | Param | Type | Description |
3936
+ | --- | --- | --- |
3937
+ | name | <code>string</code> | The accessor to use |
3938
+ | list | [<code>LinkedTreeList</code>](#LinkedTreeList) | The list to use it on |
3939
+