@structs-arena/doubled-linked-list 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +41 -3
- package/package.json +41 -6
- package/src/index.js +821 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Augusto Vasques
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @structs-arena/doubled-linked-list
|
|
2
|
+
|
|
3
|
+
A Balloc-backed doubly linked list with forward and backward cursor navigation, optional cyclic traversal, multiple cursors, and CBOR serialization.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @structs-arena/doubled-linked-list
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import { DoubledLinkedList } from "@structs-arena/doubled-linked-list";
|
|
15
|
+
|
|
16
|
+
const list = new DoubledLinkedList();
|
|
17
|
+
list.insertTail("first");
|
|
18
|
+
list.insertTail("second");
|
|
19
|
+
|
|
20
|
+
console.log(list.current);
|
|
21
|
+
list.next();
|
|
22
|
+
console.log(list.current);
|
|
23
|
+
list.previous();
|
|
24
|
+
console.log(list.peekAfter());
|
|
25
|
+
console.log(list.length); // 2
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## API overview
|
|
29
|
+
|
|
30
|
+
- Insert: `insertAfter`, `insertBefore`, `insertHead`, `insertTail`.
|
|
31
|
+
- Read or replace: `current`, `set`.
|
|
32
|
+
- Navigate: `next`, `previous`, `peekAfter`, `peekBefore`, `reset`.
|
|
33
|
+
- Remove: `delete`, `deleteBefore`, `deleteAfter`, `deleteHead`, `deleteTail`.
|
|
34
|
+
- Cursors: `createCursor`, `deleteCursor`, `setCursor`, `cloneCursor`.
|
|
35
|
+
- State: `tail`, `isCyclic`, `length`.
|
|
36
|
+
- Serialization: `dump`, `DoubledLinkedList.load`.
|
|
37
|
+
- `DoubledLinkedListFactory` creates lists that share a Balloc instance.
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@structs-arena/doubled-linked-list",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@structs-arena/doubled-linked-list",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./src/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"src",
|
|
11
|
+
"LICENSE"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"description": "Balloc-backed doubly linked list with cursor navigation and optional cyclic traversal.",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"doubled-linked-list",
|
|
17
|
+
"linked-list",
|
|
18
|
+
"data-structures",
|
|
19
|
+
"javascript",
|
|
20
|
+
"balloc"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/AugustoVasques75/structs-arena.git",
|
|
25
|
+
"directory": "packages/doubled-linked-list"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/AugustoVasques75/structs-arena/issues"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"test:watch": "vitest"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"balloc": "^2.0.1",
|
|
36
|
+
"cbor-x": "^1.6.8"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=20"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,821 @@
|
|
|
1
|
+
import Balloc from "balloc";
|
|
2
|
+
import { decode, encode } from 'cbor-x';
|
|
3
|
+
|
|
4
|
+
const UNKNOWN = 0xFFFFFFFF >>> 0;
|
|
5
|
+
const DISABLED = 0xFFFFFFFE >>> 0;
|
|
6
|
+
|
|
7
|
+
export class DoubledLinkedList {
|
|
8
|
+
#cyclic = false;
|
|
9
|
+
#head = UNKNOWN;
|
|
10
|
+
#tail = UNKNOWN;
|
|
11
|
+
#cursor = UNKNOWN;
|
|
12
|
+
#cursorIdx = 0;
|
|
13
|
+
static #token = Symbol("DoubledLinkedList");
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new list or restores a serialized instance.
|
|
17
|
+
|
|
18
|
+
* @overload
|
|
19
|
+
* @param {boolean}
|
|
20
|
+
* @param {number}
|
|
21
|
+
* @param {string}
|
|
22
|
+
* @param {Balloc}
|
|
23
|
+
* @param {Balloc}
|
|
24
|
+
* @overload
|
|
25
|
+
* @param {symbol}
|
|
26
|
+
* @param {Uint8Array|Buffer}
|
|
27
|
+
* @param {{cursors?: boolean}} [options={cursors:false}] Cursor-state import options.
|
|
28
|
+
* @param {Balloc}
|
|
29
|
+
* @throws {DoubledLinkedListDeserializationError}
|
|
30
|
+
*/
|
|
31
|
+
constructor(arg1, arg2, arg3, arg4, arg5) {
|
|
32
|
+
if (arg1 === DoubledLinkedList.#token) {
|
|
33
|
+
try {
|
|
34
|
+
const pack = decode(arg2);
|
|
35
|
+
if (pack.format !== "DoubledLinkedList") throw new TypeError(`Unable to read the structure. Expected LinkedList, received v${pack.format ?? "null"}.`);
|
|
36
|
+
if (pack.version !== 1) throw new RangeError(`Invalid dump version. Expected v1, received v${pack.version ?? "null"}.`);
|
|
37
|
+
|
|
38
|
+
this.#cyclic = pack.cyclic;
|
|
39
|
+
this.#head = pack.head;
|
|
40
|
+
this.#tail = pack.tail;
|
|
41
|
+
|
|
42
|
+
const cursors = !pack.cursors ? false : arg3?.cursors ?? false;
|
|
43
|
+
|
|
44
|
+
this.#cursor = cursors ? pack.cursor : UNKNOWN;
|
|
45
|
+
this.#cursorIdx = cursors ? pack.cursorIdx : 0;
|
|
46
|
+
|
|
47
|
+
this.dataBus = arg4 ?? new Balloc();
|
|
48
|
+
this.values = this.dataBus.load(pack.data.values);
|
|
49
|
+
|
|
50
|
+
this.idxBus = new Balloc();
|
|
51
|
+
this.idxNext = this.idxBus.load(pack.indexes.idxNext);
|
|
52
|
+
this.idxPrevious = this.idxBus.load(pack.indexes.idxPrevious);
|
|
53
|
+
this.freeStack = this.idxBus.load(pack.indexes.freeStack);
|
|
54
|
+
this.cursorStack = cursors ? this.idxBus.load(pack.indexes.cursorStack) : this.idxBus.alloc();
|
|
55
|
+
this.cursorFreeStack = cursors ? this.idxBus.load(pack.indexes.cursorFreeStack) : this.idxBus.alloc();
|
|
56
|
+
if (!cursors) this.idxBus.push(this.cursorStack, UNKNOWN);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
throw new DoubledLinkedListDeserializationError("Failed to deserialize the data package. See `cause` for details.", {
|
|
59
|
+
cause: e
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
this.dataBus = arg5 ?? (arg4 instanceof Balloc ? arg4 : null) ?? new Balloc(arg2 ?? 0x80000000, arg3 ?? "32u");
|
|
64
|
+
this.idxBus = new Balloc(this.dataBus.maxSize, "32u");
|
|
65
|
+
|
|
66
|
+
this.#cyclic = arg1 ?? false;
|
|
67
|
+
|
|
68
|
+
const initialCapacity = Math.min(16, this.dataBus.maxSize - 1);
|
|
69
|
+
|
|
70
|
+
this.values = this.dataBus.alloc(initialCapacity);
|
|
71
|
+
this.idxPrevious = this.idxBus.alloc(initialCapacity);
|
|
72
|
+
this.idxNext = this.idxBus.alloc(initialCapacity);
|
|
73
|
+
this.freeStack = this.idxBus.alloc(initialCapacity);
|
|
74
|
+
this.cursorStack = this.idxBus.alloc(initialCapacity);
|
|
75
|
+
this.cursorFreeStack = this.idxBus.alloc(initialCapacity);
|
|
76
|
+
|
|
77
|
+
this.idxBus.push(this.cursorStack, UNKNOWN);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Reuses a node index from the free-index stack when available.
|
|
83
|
+
|
|
84
|
+
* @private
|
|
85
|
+
* @returns {number}
|
|
86
|
+
*/
|
|
87
|
+
#recycleNode() {
|
|
88
|
+
return this.idxBus.occupied(this.freeStack) > 0 ? this.idxBus.pop(this.freeStack) : UNKNOWN;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* A doubly linked list backed by Balloc-managed memory.
|
|
94
|
+
|
|
95
|
+
* @private
|
|
96
|
+
* @param {*}
|
|
97
|
+
* @returns {number}
|
|
98
|
+
*/
|
|
99
|
+
/**
|
|
100
|
+
* Releases a node index and makes the slot available for reuse.
|
|
101
|
+
|
|
102
|
+
* @private
|
|
103
|
+
* @param {number}
|
|
104
|
+
*/
|
|
105
|
+
#releaseNode(idx) {
|
|
106
|
+
if (idx !== this.idxBus.occupied(this.idxNext) - 1) {
|
|
107
|
+
if (this.idxBus.occupied(this.freeStack) === this.idxBus.length(this.freeStack)) this.idxBus.realloc(this.freeStack);
|
|
108
|
+
this.idxBus.push(this.freeStack, idx);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
this.dataBus.pop(this.values);
|
|
113
|
+
this.idxBus.pop(this.idxNext);
|
|
114
|
+
this.idxBus.pop(this.idxPrevious);
|
|
115
|
+
|
|
116
|
+
while (this.idxBus.occupied(this.idxNext) > 0) {
|
|
117
|
+
const lastIdx = this.idxBus.occupied(this.idxNext) - 1;
|
|
118
|
+
const freeCount = this.idxBus.occupied(this.freeStack);
|
|
119
|
+
let freePosition = -1;
|
|
120
|
+
|
|
121
|
+
for (let i = freeCount - 1; i >= 0; i--) {
|
|
122
|
+
if (this.idxBus.get(this.freeStack, i) === lastIdx) {
|
|
123
|
+
freePosition = i;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (freePosition === -1) break;
|
|
129
|
+
if (freePosition !== freeCount - 1) this.idxBus.set(this.freeStack, freePosition, this.idxBus.get(this.freeStack, freeCount - 1));
|
|
130
|
+
this.idxBus.pop(this.freeStack);
|
|
131
|
+
this.dataBus.pop(this.values);
|
|
132
|
+
this.idxBus.pop(this.idxNext);
|
|
133
|
+
this.idxBus.pop(this.idxPrevious);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
#allocateNode(value) {
|
|
138
|
+
let idx = this.#recycleNode();
|
|
139
|
+
|
|
140
|
+
if (idx === UNKNOWN) {
|
|
141
|
+
if (this.dataBus.isFull(this.values)) {
|
|
142
|
+
const oldCapacity = this.dataBus.length(this.values);
|
|
143
|
+
const newCapacity = Math.min(oldCapacity * 2, this.dataBus.maxSize - 1);
|
|
144
|
+
|
|
145
|
+
if (newCapacity <= oldCapacity) throw new RangeError("DoubledLinkedList capacity exceeded");
|
|
146
|
+
|
|
147
|
+
this.dataBus.realloc(this.values, newCapacity);
|
|
148
|
+
this.idxBus.realloc(this.idxPrevious, newCapacity);
|
|
149
|
+
this.idxBus.realloc(this.idxNext, newCapacity);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
idx = this.idxBus.occupied(this.idxNext);
|
|
153
|
+
this.dataBus.push(this.values, value);
|
|
154
|
+
this.idxBus.push(this.idxPrevious, UNKNOWN);
|
|
155
|
+
this.idxBus.push(this.idxNext, UNKNOWN);
|
|
156
|
+
} else {
|
|
157
|
+
this.dataBus.set(this.values, idx, value);
|
|
158
|
+
this.idxBus.set(this.idxPrevious, idx, UNKNOWN);
|
|
159
|
+
this.idxBus.set(this.idxNext, idx, UNKNOWN);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return idx;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Moves cursors that reference a removed node to the specified replacement node.
|
|
168
|
+
|
|
169
|
+
* @private
|
|
170
|
+
* @param {number}
|
|
171
|
+
* @param {number}
|
|
172
|
+
* @returns {void}
|
|
173
|
+
*/
|
|
174
|
+
#updateCursors(idx, newIdx) {
|
|
175
|
+
const length = this.idxBus.occupied(this.cursorStack);
|
|
176
|
+
for (let i = 0; i < length; i++) {
|
|
177
|
+
const cursor = this.idxBus.get(this.cursorStack, i);
|
|
178
|
+
if (cursor === DISABLED) continue;
|
|
179
|
+
if (cursor === idx) this.idxBus.set(this.cursorStack, i, newIdx);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Inserts a value immediately after the active cursor.
|
|
186
|
+
|
|
187
|
+
* @param {*}
|
|
188
|
+
* @returns {*|undefined}
|
|
189
|
+
*/
|
|
190
|
+
insertAfter(value) {
|
|
191
|
+
if (this.#cursor === UNKNOWN) return undefined;
|
|
192
|
+
|
|
193
|
+
const newNode = this.#allocateNode(value);
|
|
194
|
+
|
|
195
|
+
if (this.#head === UNKNOWN) {
|
|
196
|
+
this.#head = this.#tail = newNode;
|
|
197
|
+
} else {
|
|
198
|
+
const nextNode = this.idxBus.get(this.idxNext, this.#cursor);
|
|
199
|
+
this.idxBus.set(this.idxNext, this.#cursor, newNode);
|
|
200
|
+
this.idxBus.set(this.idxPrevious, newNode, this.#cursor);
|
|
201
|
+
|
|
202
|
+
if (this.#cursor === this.#tail) {
|
|
203
|
+
this.#tail = newNode;
|
|
204
|
+
} else {
|
|
205
|
+
this.idxBus.set(this.idxNext, newNode, nextNode);
|
|
206
|
+
this.idxBus.set(this.idxPrevious, nextNode, newNode);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return value;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Inserts a value immediately before the active cursor.
|
|
215
|
+
|
|
216
|
+
* @param {*}
|
|
217
|
+
* @returns {*|undefined}
|
|
218
|
+
*/
|
|
219
|
+
insertBefore(value) {
|
|
220
|
+
if (this.#cursor === UNKNOWN) return undefined;
|
|
221
|
+
|
|
222
|
+
const newNode = this.#allocateNode(value);
|
|
223
|
+
|
|
224
|
+
if (this.#head === UNKNOWN) {
|
|
225
|
+
this.#head = this.#tail = newNode;
|
|
226
|
+
} else {
|
|
227
|
+
const previousNode = this.idxBus.get(this.idxPrevious, this.#cursor);
|
|
228
|
+
this.idxBus.set(this.idxPrevious, this.#cursor, newNode);
|
|
229
|
+
this.idxBus.set(this.idxNext, newNode, this.#cursor);
|
|
230
|
+
if (this.#cursor === this.#head) {
|
|
231
|
+
this.#head = newNode;
|
|
232
|
+
} else {
|
|
233
|
+
this.idxBus.set(this.idxPrevious, newNode, previousNode);
|
|
234
|
+
this.idxBus.set(this.idxNext, previousNode, newNode);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return value;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* A doubly linked list backed by Balloc-managed memory.
|
|
243
|
+
|
|
244
|
+
* @param {*}
|
|
245
|
+
* @returns {*}
|
|
246
|
+
*/
|
|
247
|
+
insertHead(value) {
|
|
248
|
+
const newNode = this.#allocateNode(value);
|
|
249
|
+
if (this.#head === UNKNOWN) {
|
|
250
|
+
this.#head = this.#tail = newNode;
|
|
251
|
+
} else {
|
|
252
|
+
this.idxBus.set(this.idxPrevious, this.#head, newNode);
|
|
253
|
+
this.idxBus.set(this.idxNext, newNode, this.#head);
|
|
254
|
+
this.#head = newNode;
|
|
255
|
+
}
|
|
256
|
+
return value;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* A doubly linked list backed by Balloc-managed memory.
|
|
262
|
+
|
|
263
|
+
* @param {*}
|
|
264
|
+
* @returns {*}
|
|
265
|
+
*/
|
|
266
|
+
insertTail(value) {
|
|
267
|
+
const newNode = this.#allocateNode(value);
|
|
268
|
+
if (this.#head === UNKNOWN) {
|
|
269
|
+
this.#head = this.#tail = newNode;
|
|
270
|
+
} else {
|
|
271
|
+
this.idxBus.set(this.idxNext, this.#tail, newNode);
|
|
272
|
+
this.idxBus.set(this.idxPrevious, newNode, this.#tail);
|
|
273
|
+
this.#tail = newNode;
|
|
274
|
+
}
|
|
275
|
+
return value;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Replaces the value at the active cursor.
|
|
281
|
+
|
|
282
|
+
* @param {*}
|
|
283
|
+
* @returns {boolean}
|
|
284
|
+
*/
|
|
285
|
+
set(value) {
|
|
286
|
+
if (this.#cursor === UNKNOWN) return false;
|
|
287
|
+
|
|
288
|
+
this.dataBus.set(this.values, this.#cursor, value);
|
|
289
|
+
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Removes the node selected by the active cursor.
|
|
296
|
+
|
|
297
|
+
* @param {boolean}
|
|
298
|
+
* @returns {*|undefined}
|
|
299
|
+
*/
|
|
300
|
+
delete(forward = true) {
|
|
301
|
+
if (this.#cursor === UNKNOWN) return undefined;
|
|
302
|
+
if (this.#cursor === this.#head) return this.deleteHead(forward);
|
|
303
|
+
if (this.#cursor === this.#tail) return this.deleteTail(forward);
|
|
304
|
+
|
|
305
|
+
const oldNode = this.#cursor;
|
|
306
|
+
const nextNode = this.idxBus.get(this.idxNext, this.#cursor);
|
|
307
|
+
const previousNode = this.idxBus.get(this.idxPrevious, this.#cursor);
|
|
308
|
+
const value = this.dataBus.get(this.values, oldNode);
|
|
309
|
+
|
|
310
|
+
this.idxBus.set(this.idxNext, previousNode, nextNode);
|
|
311
|
+
this.idxBus.set(this.idxPrevious, nextNode, previousNode);
|
|
312
|
+
|
|
313
|
+
if (forward) {
|
|
314
|
+
this.#updateCursors(oldNode, nextNode);
|
|
315
|
+
this.#cursor = nextNode;
|
|
316
|
+
} else {
|
|
317
|
+
this.#updateCursors(oldNode, previousNode);
|
|
318
|
+
this.#cursor = previousNode;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
this.#releaseNode(oldNode);
|
|
322
|
+
|
|
323
|
+
return value;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Removes the node immediately before the active cursor.
|
|
328
|
+
|
|
329
|
+
* @param {boolean}
|
|
330
|
+
* @returns {*|undefined}
|
|
331
|
+
*/
|
|
332
|
+
deleteBefore(forward = true) {
|
|
333
|
+
if (this.#cursor === UNKNOWN) return undefined;
|
|
334
|
+
|
|
335
|
+
const oldNode = this.idxBus.get(this.idxPrevious, this.#cursor);
|
|
336
|
+
if (oldNode === UNKNOWN) return undefined;
|
|
337
|
+
if (oldNode === this.#head) return this.deleteHead(forward);
|
|
338
|
+
|
|
339
|
+
const nextNode = this.#cursor;
|
|
340
|
+
const previousNode = this.idxBus.get(this.idxPrevious, oldNode);
|
|
341
|
+
const value = this.dataBus.get(this.values, oldNode);
|
|
342
|
+
|
|
343
|
+
this.idxBus.set(this.idxNext, previousNode, nextNode);
|
|
344
|
+
this.idxBus.set(this.idxPrevious, nextNode, previousNode);
|
|
345
|
+
|
|
346
|
+
//if (oldNode == this.#cursor) this.#cursor = forward ? nextNode : previousNode;
|
|
347
|
+
this.#updateCursors(oldNode, forward ? nextNode : previousNode);
|
|
348
|
+
|
|
349
|
+
this.#releaseNode(oldNode);
|
|
350
|
+
|
|
351
|
+
return value;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Removes the node immediately after the active cursor.
|
|
356
|
+
|
|
357
|
+
* @param {boolean}
|
|
358
|
+
* @returns {*|undefined}
|
|
359
|
+
*/
|
|
360
|
+
deleteAfter(forward = true) {
|
|
361
|
+
if (this.#cursor === UNKNOWN) return undefined;
|
|
362
|
+
|
|
363
|
+
const oldNode = this.idxBus.get(this.idxNext, this.#cursor);
|
|
364
|
+
if (oldNode === UNKNOWN) return undefined;
|
|
365
|
+
if (oldNode === this.#tail) return this.deleteTail(forward);
|
|
366
|
+
|
|
367
|
+
const nextNode = this.idxBus.get(this.idxNext, oldNode);
|
|
368
|
+
const previousNode = this.#cursor;
|
|
369
|
+
const value = this.dataBus.get(this.values, oldNode);
|
|
370
|
+
|
|
371
|
+
this.idxBus.set(this.idxNext, previousNode, nextNode);
|
|
372
|
+
this.idxBus.set(this.idxPrevious, nextNode, previousNode);
|
|
373
|
+
|
|
374
|
+
//if (oldNode == this.#cursor) this.#cursor = forward ? nextNode : previousNode
|
|
375
|
+
this.#updateCursors(oldNode, forward ? nextNode : previousNode);
|
|
376
|
+
|
|
377
|
+
this.#releaseNode(oldNode);
|
|
378
|
+
|
|
379
|
+
return value;
|
|
380
|
+
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Removes the head node.
|
|
386
|
+
|
|
387
|
+
* @param {boolean}
|
|
388
|
+
* @returns {*|undefined}
|
|
389
|
+
*/
|
|
390
|
+
deleteHead(forward = true) {
|
|
391
|
+
if (this.#head === UNKNOWN) {
|
|
392
|
+
return undefined;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
const oldNode = this.#head;
|
|
396
|
+
const previousNode = UNKNOWN;
|
|
397
|
+
const value = this.dataBus.get(this.values, oldNode);
|
|
398
|
+
|
|
399
|
+
let nextNode;
|
|
400
|
+
if (this.#head === this.#tail) {
|
|
401
|
+
nextNode = UNKNOWN;
|
|
402
|
+
this.#tail = UNKNOWN;
|
|
403
|
+
} else {
|
|
404
|
+
nextNode = this.idxBus.get(this.idxNext, oldNode);
|
|
405
|
+
this.idxBus.set(this.idxPrevious, nextNode, UNKNOWN);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
this.#head = nextNode;
|
|
409
|
+
if (this.#cursor === oldNode) this.#cursor = forward ? nextNode : previousNode;
|
|
410
|
+
this.#updateCursors(oldNode, forward ? nextNode : previousNode);
|
|
411
|
+
|
|
412
|
+
this.#releaseNode(oldNode);
|
|
413
|
+
|
|
414
|
+
return value;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Removes the tail node.
|
|
420
|
+
|
|
421
|
+
* @param {boolean}
|
|
422
|
+
* @returns {*|undefined}
|
|
423
|
+
*/
|
|
424
|
+
deleteTail(forward = true) {
|
|
425
|
+
if (this.#tail === UNKNOWN) {
|
|
426
|
+
return undefined;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
const oldNode = this.#tail;
|
|
430
|
+
const nextNode = UNKNOWN;
|
|
431
|
+
const value = this.dataBus.get(this.values, oldNode);
|
|
432
|
+
|
|
433
|
+
let previousNode;
|
|
434
|
+
if (this.#head === this.#tail) {
|
|
435
|
+
previousNode = UNKNOWN;
|
|
436
|
+
this.#head = UNKNOWN;
|
|
437
|
+
} else {
|
|
438
|
+
previousNode = this.idxBus.get(this.idxPrevious, oldNode);
|
|
439
|
+
this.idxBus.set(this.idxNext, previousNode, nextNode);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
this.#tail = previousNode;
|
|
443
|
+
if (this.#cursor === oldNode) this.#cursor = forward ? previousNode : nextNode;
|
|
444
|
+
this.#updateCursors(oldNode, forward ? previousNode : nextNode);
|
|
445
|
+
|
|
446
|
+
this.#releaseNode(oldNode);
|
|
447
|
+
|
|
448
|
+
return value;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Moves the active cursor to the next node.
|
|
453
|
+
|
|
454
|
+
* @returns {boolean}
|
|
455
|
+
*/
|
|
456
|
+
next() {
|
|
457
|
+
if (this.#tail === this.#head && this.#head == UNKNOWN) return false;
|
|
458
|
+
|
|
459
|
+
if (this.#cursor === UNKNOWN) {
|
|
460
|
+
this.#cursor = this.#head;
|
|
461
|
+
} else {
|
|
462
|
+
if (this.#cyclic) {
|
|
463
|
+
if (this.#cursor === this.#tail) {
|
|
464
|
+
this.#cursor = this.#head;
|
|
465
|
+
} else {
|
|
466
|
+
this.#cursor = this.idxBus.get(this.idxNext, this.#cursor);
|
|
467
|
+
}
|
|
468
|
+
} else {
|
|
469
|
+
if (this.#cursor === this.#tail) {
|
|
470
|
+
return false;
|
|
471
|
+
} else {
|
|
472
|
+
this.#cursor = this.idxBus.get(this.idxNext, this.#cursor);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
return true;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Moves the active cursor to the previous node.
|
|
482
|
+
|
|
483
|
+
* @returns {boolean}
|
|
484
|
+
*/
|
|
485
|
+
previous() {
|
|
486
|
+
if (this.#tail === this.#head && this.#head == UNKNOWN) return false;
|
|
487
|
+
|
|
488
|
+
if (this.#cursor === UNKNOWN) {
|
|
489
|
+
this.#cursor = this.#tail;
|
|
490
|
+
} else {
|
|
491
|
+
if (this.#cyclic) {
|
|
492
|
+
if (this.#cursor === this.#head) {
|
|
493
|
+
this.#cursor = this.#tail;
|
|
494
|
+
} else {
|
|
495
|
+
this.#cursor = this.idxBus.get(this.idxPrevious, this.#cursor);
|
|
496
|
+
}
|
|
497
|
+
} else {
|
|
498
|
+
if (this.#cursor === this.#head) {
|
|
499
|
+
return false;
|
|
500
|
+
} else {
|
|
501
|
+
this.#cursor = this.idxBus.get(this.idxPrevious, this.#cursor);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
return true;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Reads the value after the active cursor without moving it.
|
|
512
|
+
|
|
513
|
+
* @returns {*|undefined}
|
|
514
|
+
*/
|
|
515
|
+
peekAfter() {
|
|
516
|
+
if (this.#head === UNKNOWN) return undefined;
|
|
517
|
+
|
|
518
|
+
if (this.#cursor === UNKNOWN) {
|
|
519
|
+
return this.dataBus.get(this.values, this.#head);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
if (this.#cursor === this.#tail) {
|
|
523
|
+
return this.#cyclic ? this.dataBus.get(this.values, this.#head) : undefined;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
const idx = this.idxBus.get(this.idxNext, this.#cursor);
|
|
527
|
+
return this.dataBus.get(this.values, idx);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Reads the value before the active cursor without moving it.
|
|
532
|
+
|
|
533
|
+
* @returns {*|undefined}
|
|
534
|
+
*/
|
|
535
|
+
peekBefore() {
|
|
536
|
+
if (this.#tail === UNKNOWN) return undefined;
|
|
537
|
+
|
|
538
|
+
if (this.#cursor === UNKNOWN) {
|
|
539
|
+
return this.dataBus.get(this.values, this.#tail);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
if (this.#cursor === this.#head) {
|
|
543
|
+
return this.#cyclic ? this.dataBus.get(this.values, this.#tail) : undefined;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
const idx = this.idxBus.get(this.idxPrevious, this.#cursor);
|
|
547
|
+
return this.dataBus.get(this.values, idx);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Resets the active cursor to the unpositioned state.
|
|
552
|
+
|
|
553
|
+
* @returns {void}
|
|
554
|
+
*/
|
|
555
|
+
reset() {
|
|
556
|
+
this.#cursor = UNKNOWN;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Removes all nodes and reinitializes the list's internal storage.
|
|
562
|
+
|
|
563
|
+
* @param {boolean}
|
|
564
|
+
* @returns {void}
|
|
565
|
+
*/
|
|
566
|
+
clear(cyclic = this.#cyclic) {
|
|
567
|
+
this.#cyclic = cyclic;
|
|
568
|
+
this.#head = UNKNOWN;
|
|
569
|
+
this.#tail = UNKNOWN;
|
|
570
|
+
this.#cursor = UNKNOWN;
|
|
571
|
+
this.#cursorIdx = 0;
|
|
572
|
+
|
|
573
|
+
this.dataBus.free(this.values);
|
|
574
|
+
|
|
575
|
+
this.idxBus.free(this.idxNext);
|
|
576
|
+
this.idxBus.free(this.idxPrevious);
|
|
577
|
+
this.idxBus.free(this.freeStack);
|
|
578
|
+
this.idxBus.free(this.cursorStack);
|
|
579
|
+
this.idxBus.free(this.cursorFreeStack);
|
|
580
|
+
|
|
581
|
+
const initialCapacity = Math.min(16, this.dataBus.maxSize - 1);
|
|
582
|
+
|
|
583
|
+
this.values = this.dataBus.alloc(initialCapacity);
|
|
584
|
+
|
|
585
|
+
this.idxNext = this.idxBus.alloc(initialCapacity);
|
|
586
|
+
this.idxPrevious = this.idxBus.alloc(initialCapacity);
|
|
587
|
+
this.freeStack = this.idxBus.alloc(initialCapacity);
|
|
588
|
+
this.cursorStack = this.idxBus.alloc(initialCapacity);
|
|
589
|
+
this.cursorFreeStack = this.idxBus.alloc(initialCapacity);
|
|
590
|
+
|
|
591
|
+
this.idxBus.push(this.cursorStack, UNKNOWN);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Creates an independent cursor.
|
|
597
|
+
|
|
598
|
+
* @returns {number}
|
|
599
|
+
*/
|
|
600
|
+
createCursor() {
|
|
601
|
+
if (this.idxBus.occupied(this.cursorFreeStack) > 0) {
|
|
602
|
+
const cursor = this.idxBus.pop(this.cursorFreeStack);
|
|
603
|
+
this.idxBus.set(this.cursorStack, cursor, UNKNOWN);
|
|
604
|
+
return cursor;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
const cursor = this.idxBus.occupied(this.cursorStack);
|
|
608
|
+
if (cursor === this.idxBus.length(this.cursorStack)) this.idxBus.realloc(this.cursorStack);
|
|
609
|
+
this.idxBus.push(this.cursorStack, UNKNOWN);
|
|
610
|
+
return cursor;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Disables an independent cursor and releases its identifier for reuse.
|
|
615
|
+
|
|
616
|
+
* @param {number}
|
|
617
|
+
* @returns {boolean}
|
|
618
|
+
*/
|
|
619
|
+
deleteCursor(cursor) {
|
|
620
|
+
const length = this.idxBus.occupied(this.cursorStack);
|
|
621
|
+
if (!Number.isInteger(cursor) || cursor <= 0 || cursor >= length) return false;
|
|
622
|
+
if (this.idxBus.get(this.cursorStack, cursor) === DISABLED) return false;
|
|
623
|
+
|
|
624
|
+
this.idxBus.set(this.cursorStack, cursor, DISABLED);
|
|
625
|
+
|
|
626
|
+
if (this.#cursorIdx === cursor) {
|
|
627
|
+
this.#cursorIdx = 0;
|
|
628
|
+
this.#cursor = this.idxBus.get(this.cursorStack, 0);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
if (cursor === length - 1) {
|
|
632
|
+
this.idxBus.pop(this.cursorStack);
|
|
633
|
+
} else {
|
|
634
|
+
if (this.idxBus.occupied(this.cursorFreeStack) === this.idxBus.length(this.cursorFreeStack)) {
|
|
635
|
+
this.idxBus.realloc(this.cursorFreeStack);
|
|
636
|
+
}
|
|
637
|
+
this.idxBus.push(this.cursorFreeStack, cursor);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
return true;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Selects the cursor used by position-dependent operations.
|
|
646
|
+
|
|
647
|
+
* @param {number}
|
|
648
|
+
* @returns {boolean}
|
|
649
|
+
*/
|
|
650
|
+
setCursor(cursor) {
|
|
651
|
+
if (cursor === this.#cursorIdx) return true;
|
|
652
|
+
const length = this.idxBus.occupied(this.cursorStack);
|
|
653
|
+
if (!Number.isInteger(cursor) || cursor < 0 || cursor >= length) return false;
|
|
654
|
+
|
|
655
|
+
const state = this.idxBus.get(this.cursorStack, cursor);
|
|
656
|
+
if (state === DISABLED) return false;
|
|
657
|
+
|
|
658
|
+
this.idxBus.set(this.cursorStack, this.#cursorIdx, this.#cursor);
|
|
659
|
+
this.#cursorIdx = cursor;
|
|
660
|
+
this.#cursor = state;
|
|
661
|
+
|
|
662
|
+
return true;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Creates an independent cursor at the same position as another cursor.
|
|
668
|
+
|
|
669
|
+
* @param {number}
|
|
670
|
+
* @returns {number|undefined}
|
|
671
|
+
*/
|
|
672
|
+
cloneCursor(cursor) {
|
|
673
|
+
const length = this.idxBus.occupied(this.cursorStack);
|
|
674
|
+
if (!Number.isInteger(cursor) || cursor < 0 || cursor >= length) return undefined;
|
|
675
|
+
if (this.idxBus.get(this.cursorStack, cursor) === DISABLED) return undefined;
|
|
676
|
+
|
|
677
|
+
const state = cursor === this.#cursorIdx ? this.#cursor : this.idxBus.get(this.cursorStack, cursor);
|
|
678
|
+
const clone = this.createCursor();
|
|
679
|
+
this.idxBus.set(this.cursorStack, clone, state);
|
|
680
|
+
return clone;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Serializes the list state into a CBOR-encoded binary buffer.
|
|
686
|
+
|
|
687
|
+
* @param {{cursors?: boolean}} [options={cursors:false}] Export options. If cursors is true, the secondary cursor stack and states are included.
|
|
688
|
+
* @returns {Uint8Array}
|
|
689
|
+
*/
|
|
690
|
+
dump(options = { cursors: false, }) {
|
|
691
|
+
this.idxBus.set(this.cursorStack, this.#cursorIdx, this.#cursor);
|
|
692
|
+
return encode({
|
|
693
|
+
format: "DoubledLinkedList",
|
|
694
|
+
version: 1,
|
|
695
|
+
cyclic: this.#cyclic,
|
|
696
|
+
type: this.dataBus.bucketSize ?? "32u",
|
|
697
|
+
head: this.#head,
|
|
698
|
+
tail: this.#tail,
|
|
699
|
+
cursors: options.cursors,
|
|
700
|
+
cursorIdx: options.cursors ? this.#cursorIdx : 0,
|
|
701
|
+
cursor: this.#cursor,
|
|
702
|
+
data: {
|
|
703
|
+
values: this.dataBus.dump(this.values)
|
|
704
|
+
},
|
|
705
|
+
indexes: {
|
|
706
|
+
idxNext: this.idxBus.dump(this.idxNext),
|
|
707
|
+
idxPrevious: this.idxBus.dump(this.idxPrevious),
|
|
708
|
+
freeStack: this.idxBus.dump(this.freeStack),
|
|
709
|
+
...(options.cursors && {
|
|
710
|
+
cursorStack: this.idxBus.dump(this.cursorStack),
|
|
711
|
+
cursorFreeStack: this.idxBus.dump(this.cursorFreeStack)
|
|
712
|
+
})
|
|
713
|
+
}
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Restores a list from a CBOR-encoded binary buffer.
|
|
719
|
+
|
|
720
|
+
* @param {Uint8Array|Buffer}
|
|
721
|
+
* @param {{cursors?: boolean}} [options={cursors:false}] Cursor import options.
|
|
722
|
+
* @param {Balloc}
|
|
723
|
+
* @returns {DoubledLinkedList}
|
|
724
|
+
* @throws {TypeError}
|
|
725
|
+
*/
|
|
726
|
+
static load(data, options = { cursors: false, }, memory) {
|
|
727
|
+
return new DoubledLinkedList(DoubledLinkedList.#token, data, options, memory);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Returns the value at the active cursor.
|
|
733
|
+
|
|
734
|
+
* @returns {*|undefined}
|
|
735
|
+
*/
|
|
736
|
+
get current() {
|
|
737
|
+
return this.#cursor === UNKNOWN ? undefined : this.dataBus.get(this.values, this.#cursor);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* Returns the value stored at the tail node.
|
|
742
|
+
|
|
743
|
+
* @returns {*|undefined}
|
|
744
|
+
*/
|
|
745
|
+
get tail() {
|
|
746
|
+
return this.#tail === UNKNOWN ? undefined : this.dataBus.get(this.values, this.#tail);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Indicates whether the list uses cyclic navigation.
|
|
752
|
+
|
|
753
|
+
* @returns {boolean}
|
|
754
|
+
*/
|
|
755
|
+
get isCyclic() {
|
|
756
|
+
return this.#cyclic;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Returns the number of active nodes in the list.
|
|
762
|
+
|
|
763
|
+
* @returns {number}
|
|
764
|
+
*/
|
|
765
|
+
get length() {
|
|
766
|
+
return this.idxBus.occupied(this.idxNext) - this.idxBus.occupied(this.freeStack);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
export class DoubledLinkedListFactory {
|
|
771
|
+
/**
|
|
772
|
+
* Creates a new list or restores a serialized instance.
|
|
773
|
+
|
|
774
|
+
* @param {number}
|
|
775
|
+
* @param {string}
|
|
776
|
+
*/
|
|
777
|
+
constructor(memSize = 128, bucketSize = "32u") {
|
|
778
|
+
if (!Number.isSafeInteger(memSize) || memSize < 3 || memSize > 0x80000000) {
|
|
779
|
+
throw new RangeError("memSize must be an integer between 3 and 0x80000000.");
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
this.memory = new Balloc(memSize, bucketSize);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Creates a new doubly linked list using the factory's shared memory manager.
|
|
787
|
+
|
|
788
|
+
* @param {boolean}
|
|
789
|
+
* @returns {DoubledLinkedList}
|
|
790
|
+
*/
|
|
791
|
+
createDoubledLinkedList(cyclic = false) {
|
|
792
|
+
return new DoubledLinkedList(cyclic, null, null, this.memory);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* Restores a doubly linked list using the factory's shared memory manager.
|
|
797
|
+
|
|
798
|
+
* @param {Uint8Array|Buffer}
|
|
799
|
+
* @param {{cursors?: boolean}} [options={cursors:false}]
|
|
800
|
+
* @returns {DoubledLinkedList}
|
|
801
|
+
*/
|
|
802
|
+
loadDoubledLinkedList(data, options = { cursors: false }) {
|
|
803
|
+
return DoubledLinkedList.load(data, options, this.memory);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* A doubly linked list backed by Balloc-managed memory.
|
|
809
|
+
*/
|
|
810
|
+
export class DoubledLinkedListDeserializationError extends Error {
|
|
811
|
+
/**
|
|
812
|
+
* Creates a new list or restores a serialized instance.
|
|
813
|
+
|
|
814
|
+
* @param {string}
|
|
815
|
+
* @param {ErrorOptions}
|
|
816
|
+
*/
|
|
817
|
+
constructor(message, options) {
|
|
818
|
+
super(message, options);
|
|
819
|
+
this.name = "DoubledLinkedListDeserializationError";
|
|
820
|
+
}
|
|
821
|
+
}
|