@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param DataStructures\Trees\Nodes\AVLNode|null $left the left child node. |
| 33 | 33 | * @param DataStructures\Trees\Nodes\AVLNode|null $right the right child node. |
| 34 | 34 | * |
| 35 | - * @return DataStructures\Trees\Nodes\AVLNode the new node created. |
|
| 35 | + * @return AVLNode the new node created. |
|
| 36 | 36 | */ |
| 37 | 37 | public function createNode($key, $data, $parent = null, $left = null, $right = null) { |
| 38 | 38 | return new AVLNode($key, $data, $parent, $left, $right); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * Does a right rotation. |
| 43 | 43 | * |
| 44 | - * @param DataStructures\Trees\Nodes\AVLNode $node The node to be |
|
| 44 | + * @param AVLNode $node The node to be |
|
| 45 | 45 | * rotated. |
| 46 | 46 | * @return DataStructures\Trees\Nodes\AVLNode |
| 47 | 47 | */ |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | /** |
| 75 | 75 | * Does a right rotation. |
| 76 | 76 | * |
| 77 | - * @param DataStructures\Trees\Nodes\AVLNode $node The node to be |
|
| 77 | + * @param AVLNode $node The node to be |
|
| 78 | 78 | * rotated. |
| 79 | 79 | * @return DataStructures\Trees\Nodes\AVLNode |
| 80 | 80 | */ |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * in the subtree root that detects the imbalance. |
| 113 | 113 | * Case Right-Left. |
| 114 | 114 | * |
| 115 | - * @param DataStructures\Trees\Nodes\AVLNode $node The node to be |
|
| 115 | + * @param AVLNode $node The node to be |
|
| 116 | 116 | * rotated. |
| 117 | 117 | * @return DataStructures\Trees\Nodes\AVLNode |
| 118 | 118 | */ |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * in the subtree root that detects the imbalance. |
| 128 | 128 | * Case Left-Right. |
| 129 | 129 | * |
| 130 | - * @param DataStructures\Trees\Nodes\AVLNode $node The node to be |
|
| 130 | + * @param AVLNode $node The node to be |
|
| 131 | 131 | * rotated. |
| 132 | 132 | * @return DataStructures\Trees\Nodes\AVLNode |
| 133 | 133 | */ |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * set is created. |
| 34 | 34 | * |
| 35 | 35 | * @param mixed $data the data to store. |
| 36 | - * @return DataStructures\Trees\Nodes\DisjointNode the node created. |
|
| 36 | + * @return DisjointNode the node created. |
|
| 37 | 37 | */ |
| 38 | 38 | public function makeSet($data) : DisjointNode { |
| 39 | 39 | $newSet = new DisjointNode($data); |
@@ -46,8 +46,6 @@ discard block |
||
| 46 | 46 | * Returns the representative node (the root of $node in the tree) and |
| 47 | 47 | * also applies path compression. |
| 48 | 48 | * |
| 49 | - * @param DataStructures\Trees\Nodes\DisjointNode $node the node from |
|
| 50 | - * where start to search the root. |
|
| 51 | 49 | * @return DataStructures\Trees\Nodes\DisjointNode the parent node. |
| 52 | 50 | */ |
| 53 | 51 | public function find($vertex) { |
@@ -67,8 +65,6 @@ discard block |
||
| 67 | 65 | * one). If both have the same rank it doesn't matter what tree |
| 68 | 66 | * is joined to the other tree but the rank will increase. |
| 69 | 67 | * |
| 70 | - * @param DataStructures\Trees\Nodes\DisjointNode $x The set. |
|
| 71 | - * @param DataStructures\Trees\Nodes\DisjointNode $y The other set. |
|
| 72 | 68 | */ |
| 73 | 69 | public function union($vertex1, $vertex2) { |
| 74 | 70 | if($this->subsets[$vertex2]->parent < $this->subsets[$vertex1]->parent) { |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | /** |
| 118 | 118 | * Returns the last node with O(1). |
| 119 | 119 | * |
| 120 | - * @return DataStructures\Lists\Nodes\DoublyLinkedListNode|null if the list is empty. |
|
| 120 | + * @return null|DoublyLinkedListNode if the list is empty. |
|
| 121 | 121 | */ |
| 122 | 122 | public function searchLast() { |
| 123 | 123 | if($this->head === null) { |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | /** |
| 230 | 230 | * Generator for retrieve all nodes stored. |
| 231 | 231 | * |
| 232 | - * @return null if the head is null (or list is empty) |
|
| 232 | + * @return \Generator if the head is null (or list is empty) |
|
| 233 | 233 | */ |
| 234 | 234 | public function getAll() { |
| 235 | 235 | if($this->head === null) { |
@@ -58,7 +58,6 @@ discard block |
||
| 58 | 58 | /** |
| 59 | 59 | * Add a new node in the specified index. |
| 60 | 60 | * |
| 61 | - * @param integer $index the position. |
|
| 62 | 61 | * @param mixed $data the data to be stored. |
| 63 | 62 | */ |
| 64 | 63 | protected function insertEnd($data) { |
@@ -103,7 +102,7 @@ discard block |
||
| 103 | 102 | /** |
| 104 | 103 | * Returns the last node with O(1). |
| 105 | 104 | * |
| 106 | - * @return mixed null if the list is empty. |
|
| 105 | + * @return null|SimpleLinkedListNode null if the list is empty. |
|
| 107 | 106 | */ |
| 108 | 107 | protected function searchLast() { |
| 109 | 108 | if($this->head === null) { |
@@ -269,7 +268,7 @@ discard block |
||
| 269 | 268 | /** |
| 270 | 269 | * Generator for retrieve all nodes stored. |
| 271 | 270 | * |
| 272 | - * @return null if the head is null (or list is empty) |
|
| 271 | + * @return \Generator if the head is null (or list is empty) |
|
| 273 | 272 | */ |
| 274 | 273 | public function getAll() { |
| 275 | 274 | if($this->head === null) { |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | /** |
| 239 | 239 | * Returns the minimum node from a given node in position X. |
| 240 | 240 | * |
| 241 | - * @param DataStructures\Trees\Nodes\BinaryNodeInterface $node the start point. |
|
| 241 | + * @param BinaryNodeInterface $node the start point. |
|
| 242 | 242 | * @return DataStructures\Trees\Nodes\BinaryNodeInterface|null the minimum node. |
| 243 | 243 | */ |
| 244 | 244 | protected function getMinNode(BinaryNodeInterface $node = null) { |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | /** |
| 257 | 257 | * Returns the maximum node from a given node in position X. |
| 258 | 258 | * |
| 259 | - * @param DataStructures\Trees\Nodes\BinaryNodeInterface $node the start point. |
|
| 259 | + * @param BinaryNodeInterface $node the start point. |
|
| 260 | 260 | * @return DataStructures\Trees\Nodes\BinaryNodeInterface|null the maximum node. |
| 261 | 261 | */ |
| 262 | 262 | protected function getMaxNode(BinaryNodeInterface $node = null) { |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * Deletes the node with the minimum key and returns it. The most left and more bottom. |
| 276 | 276 | * |
| 277 | 277 | * @param DataStructures\Trees\Nodes\BinaryNodeInterface|null if null takes the root. |
| 278 | - * @return DataStructures\Trees\Nodes\BinaryNodeInterface|null the minimum node or |
|
| 278 | + * @return BinaryNodeInterface|null the minimum node or |
|
| 279 | 279 | * null if the tree is empty. |
| 280 | 280 | */ |
| 281 | 281 | public function deleteMin(BinaryNodeInterface $node = null) { |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * Deletes the node with the maximum key and returns it. The most right and more bottom. |
| 292 | 292 | * |
| 293 | 293 | * @param DataStructures\Trees\Nodes\BinaryNodeInterface|null if null takes the root. |
| 294 | - * @return DataStructures\Trees\Nodes\BinaryNodeInterface|null the maximum node or |
|
| 294 | + * @return BinaryNodeInterface|null the maximum node or |
|
| 295 | 295 | * null if the tree is empty. |
| 296 | 296 | */ |
| 297 | 297 | public function deleteMax(BinaryNodeInterface $node = null) { |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | * Deletes the node with the maximum key and returns it. The most right and more bottom. |
| 308 | 308 | * |
| 309 | 309 | * @param DataStructures\Trees\Nodes\BinaryNodeInterface|null if null takes the root. |
| 310 | - * @return DataStructures\Trees\Nodes\BinaryNodeInterface|null the maximum node or |
|
| 310 | + * @return BinaryNodeInterface|null the maximum node or |
|
| 311 | 311 | * null if the tree is empty. |
| 312 | 312 | */ |
| 313 | 313 | public function delete($key) { |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | * that replaces the deleted node. Also decrease the size of tree. |
| 326 | 326 | * |
| 327 | 327 | * @param DataStructures\Trees\Nodes\BinaryNodeInterface|null The node to be deleted. |
| 328 | - * @return the node that replaces the deleted. |
|
| 328 | + * @return DataStructures\Trees\Nodes\BinaryNodeInterface|null node that replaces the deleted. |
|
| 329 | 329 | */ |
| 330 | 330 | protected function _delete(BinaryNodeInterface &$node) { |
| 331 | 331 | if($node !== null) { |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | * Returns true if is leaf the node. |
| 414 | 414 | * |
| 415 | 415 | * @param DataStructures\Trees\Nodes\BinaryNodeInterface|null $node default to null. |
| 416 | - * @return true if is leaf the node, is not null and their subtrees has no |
|
| 416 | + * @return boolean if is leaf the node, is not null and their subtrees has no |
|
| 417 | 417 | * pointers to successors. |
| 418 | 418 | */ |
| 419 | 419 | public function isLeaf($node) : bool { // BinaryTreeNode |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | * also are called a root node. |
| 426 | 426 | * |
| 427 | 427 | * @param DataStructures\Trees\Nodes\BinaryNodeInterface|null $node default to null. |
| 428 | - * @return true if is root the node, is not null and their subtrees has no |
|
| 428 | + * @return boolean if is root the node, is not null and their subtrees has no |
|
| 429 | 429 | * pointers to successors. |
| 430 | 430 | */ |
| 431 | 431 | public function isRoot($node) : bool { |
@@ -450,6 +450,7 @@ discard block |
||
| 450 | 450 | * @param DataStructures\Trees\Nodes\BinaryNodeInterface|null $node. |
| 451 | 451 | * @param Callable|null $callback the callback function to apply to each |
| 452 | 452 | * node. |
| 453 | + * @param null|DataStructures\Trees\Nodes\BinaryNodeInterface $node |
|
| 453 | 454 | */ |
| 454 | 455 | private function _preorder($node, Callable $callback = null) { |
| 455 | 456 | if($node === null) { |
@@ -480,6 +481,7 @@ discard block |
||
| 480 | 481 | * @param DataStructures\Trees\Nodes\BinaryNodeInterface|null $node. |
| 481 | 482 | * @param Callable|null $callback the callback function to apply to each |
| 482 | 483 | * node. |
| 484 | + * @param null|DataStructures\Trees\Nodes\BinaryNodeInterface $node |
|
| 483 | 485 | */ |
| 484 | 486 | private function _inorder($node, Callable $callback = null) { |
| 485 | 487 | if($node === null) { |
@@ -511,6 +513,7 @@ discard block |
||
| 511 | 513 | * @param DataStructures\Trees\Nodes\BinaryNodeInterface|null $node. |
| 512 | 514 | * @param Callable|null $callback the callback function to apply to each |
| 513 | 515 | * node. |
| 516 | + * @param null|DataStructures\Trees\Nodes\BinaryNodeInterface $node |
|
| 514 | 517 | */ |
| 515 | 518 | private function _postorder($node, Callable $callback = null) { |
| 516 | 519 | if($node === null) { |