1 using System;
 2 
 3 namespace cmsx.util
 4 {
 5     public class Node
 6     {
 7         public nothrow Node() : prev(this)next(this)
 8         {
 9         }
10         public Node* prev;
11         public Node* next;
12     }
13 
14     public nothrow void Link(Node* headNode* node)
15     {
16         head->prev->next = node;
17         node->prev = head->prev;
18         head->prev = node;
19         node->next = head;
20     }
21 
22     public nothrow Node* Unlink(Node*& head)
23     {
24         Node* node = head;
25         if (head->next == head)
26         {
27             head = null;
28         }
29         else
30         {
31             Node* next = head->next;
32             head->next->prev = head->prev;
33             head->prev->next = head->next;
34             head->next = head;
35             head->prev = head;
36             head = next;
37         }
38         return node;
39     }
40 }