| Total Complexity | 10 |
| Total Lines | 153 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class FibonacciHeapNode |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Node heap |
||
| 14 | * |
||
| 15 | * @var FibonacciHeap |
||
| 16 | */ |
||
| 17 | public $heap; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Node value |
||
| 21 | * |
||
| 22 | * @var mixed |
||
| 23 | */ |
||
| 24 | public $value; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Parent node |
||
| 28 | * |
||
| 29 | * @var FibonacciHeapNode |
||
| 30 | */ |
||
| 31 | public $parent = null; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Child node |
||
| 35 | * |
||
| 36 | * @var FibonacciHeapNode |
||
| 37 | */ |
||
| 38 | public $child = null; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Previous node |
||
| 42 | * |
||
| 43 | * @var FibonacciHeapNode |
||
| 44 | */ |
||
| 45 | public $prev = null; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Next node |
||
| 49 | * |
||
| 50 | * @var FibonacciHeapNode |
||
| 51 | */ |
||
| 52 | public $next = null; |
||
| 53 | |||
| 54 | /** |
||
| 55 | * True if the node lost child nodes |
||
| 56 | * |
||
| 57 | * @var bool |
||
| 58 | */ |
||
| 59 | public $mark = false; |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Node key |
||
| 63 | * |
||
| 64 | * @var int |
||
| 65 | */ |
||
| 66 | public $key; |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Node degree |
||
| 70 | * |
||
| 71 | * @var int |
||
| 72 | */ |
||
| 73 | public $degree = 0; |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Construct a new Fibonacci heap node |
||
| 77 | * |
||
| 78 | * @param FibonacciHeap $heap - heap to which the node belongs |
||
| 79 | * @param int $key - the node key |
||
| 80 | * @param mixed $value - value stored in the node |
||
| 81 | */ |
||
| 82 | public function __construct(FibonacciHeap $heap, int $key, $value) |
||
| 87 | } |
||
| 88 | |||
| 89 | /** |
||
| 90 | * Get the node key |
||
| 91 | * |
||
| 92 | * @return int |
||
| 93 | */ |
||
| 94 | public function getKey(): int |
||
| 95 | { |
||
| 96 | return $this->key; |
||
| 97 | } |
||
| 98 | |||
| 99 | /** |
||
| 100 | * Get the node value |
||
| 101 | * |
||
| 102 | * @return mixed |
||
| 103 | */ |
||
| 104 | public function getValue() |
||
| 105 | { |
||
| 106 | return $this->value; |
||
| 107 | } |
||
| 108 | |||
| 109 | /** |
||
| 110 | * Set the node value |
||
| 111 | * |
||
| 112 | * @param mixed $value - node value |
||
| 113 | */ |
||
| 114 | public function setValue($value): void |
||
| 115 | { |
||
| 116 | $this->value = $value; |
||
| 117 | } |
||
| 118 | |||
| 119 | /** |
||
| 120 | * Decrease the node key |
||
| 121 | * |
||
| 122 | * @param int $newKey - new node key |
||
| 123 | */ |
||
| 124 | public function decreaseKey(int $newKey): void |
||
| 128 | } |
||
| 129 | |||
| 130 | /** |
||
| 131 | * Delete the node |
||
| 132 | */ |
||
| 133 | public function delete(): void |
||
| 138 | } |
||
| 139 | |||
| 140 | /** |
||
| 141 | * Get the owner heap of the node |
||
| 142 | * |
||
| 143 | * @return FibonacciHeap |
||
| 144 | */ |
||
| 145 | public function getOwner(): FibonacciHeap |
||
| 165 |