UNPKG

541 BJavaScriptView Raw
1export class DoubleLinkNode {
2 constructor(value, next = null, prev = null) {
3 this.value = value;
4 this.next = next;
5 this.prev = prev;
6 }
7 get Value() {
8 return this.value;
9 }
10 get Next() {
11 return this.next;
12 }
13 get Prev() {
14 return this.prev;
15 }
16 setValue(value) {
17 this.value = value;
18 }
19 setNext(node) {
20 this.next = node;
21 if (node) {
22 node.prev = this;
23 }
24 }
25 toString() {
26 return `${this.value}`;
27 }
28}