@@ -89,7 +89,6 @@ discard block |
||
89 | 89 | /** |
90 | 90 | * Add a new node in the specified index. |
91 | 91 | * |
92 | - * @param integer $index the position. |
|
93 | 92 | * @param mixed $data the data to be stored. |
94 | 93 | */ |
95 | 94 | private function insertEnd($data) { |
@@ -133,7 +132,7 @@ discard block |
||
133 | 132 | /** |
134 | 133 | * Adds at the beginning a node in the list. |
135 | 134 | * |
136 | - * @param mixed $data |
|
135 | + * @param integer $data |
|
137 | 136 | * @return mixed the data stored. |
138 | 137 | */ |
139 | 138 | public function unshift($data) { |
@@ -186,7 +185,7 @@ discard block |
||
186 | 185 | /** |
187 | 186 | * Generator for retrieve all nodes stored. |
188 | 187 | * |
189 | - * @return null if the head is null (or list is empty) |
|
188 | + * @return \Generator if the head is null (or list is empty) |
|
190 | 189 | */ |
191 | 190 | public function getAll() { |
192 | 191 | if($this->head === null) { |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use DataStructures\Lists\Nodes\SimpleLinkedListNode as Node; |
6 | 6 | use DataStructures\Lists\Interfaces\ListInterface; |
7 | 7 | use OutOfBoundsException; |
8 | -use Iterator; |
|
9 | 8 | |
10 | 9 | /** |
11 | 10 | * CircularLinkedList is a single and circular linked list that has |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | /** |
91 | 91 | * Generator for retrieve all nodes stored. |
92 | 92 | * |
93 | - * @return null if the head is null (or list is empty) |
|
93 | + * @return \Generator if the head is null (or list is empty) |
|
94 | 94 | */ |
95 | 95 | public function getAll() { |
96 | 96 | if($this->head === null) { |
@@ -164,7 +164,6 @@ discard block |
||
164 | 164 | /** |
165 | 165 | * Add a new node in the specified index. |
166 | 166 | * |
167 | - * @param integer $index the position. |
|
168 | 167 | * @param mixed $data the data to be stored. |
169 | 168 | */ |
170 | 169 | private function insertEnd($data) { |
@@ -212,7 +211,7 @@ discard block |
||
212 | 211 | /** |
213 | 212 | * Adds at the beginning a node in the list. |
214 | 213 | * |
215 | - * @param mixed $data |
|
214 | + * @param integer $data |
|
216 | 215 | * @return mixed the data stored. |
217 | 216 | */ |
218 | 217 | public function unshift($data) { |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | /** |
85 | 85 | * Creates a new node or updates it if already exists. |
86 | 86 | * |
87 | - * @param int|string $key the key. |
|
88 | - * @param mixed $data the data to be stored. |
|
87 | + * @param integer $key the key. |
|
88 | + * @param string $data the data to be stored. |
|
89 | 89 | */ |
90 | 90 | public function putOrUpdate($key, $data) { |
91 | 91 | $this->put($key, $data, true); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | /** |
95 | 95 | * Retrieve the data stored in the tree. |
96 | 96 | * |
97 | - * @param int|string $key the key to identify the data. |
|
97 | + * @param integer $key the key to identify the data. |
|
98 | 98 | * @return mixed |
99 | 99 | */ |
100 | 100 | public function get($key) { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | /** |
133 | 133 | * Looks for the node with the given key. |
134 | 134 | * |
135 | - * @param int|string $key the key used to look for. |
|
135 | + * @param string $key the key used to look for. |
|
136 | 136 | * @return bool true if was found. |
137 | 137 | */ |
138 | 138 | public function exists($key) : bool { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | /** |
197 | 197 | * Returns the minimum node from a given node in position X. |
198 | 198 | * |
199 | - * @param DataStructures\Trees\Nodes\BSTNode $node the start point. |
|
199 | + * @param Node $node the start point. |
|
200 | 200 | * @return DataStructures\Trees\Nodes\BSTNode|null the minimum node. |
201 | 201 | */ |
202 | 202 | private function getMinNode(Node $node) { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | /** |
234 | 234 | * Returns the maximum node from a given node in position X. |
235 | 235 | * |
236 | - * @param DataStructures\Trees\Nodes\BSTNode $node the start point. |
|
236 | + * @param Node $node the start point. |
|
237 | 237 | * @return DataStructures\Trees\Nodes\BSTNode|null the maximum node. |
238 | 238 | */ |
239 | 239 | private function getMaxNode(Node $node) { |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * Deletes the node with the minimum key and returns it. The most left and more bottom. |
249 | 249 | * |
250 | 250 | * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root. |
251 | - * @return DataStructures\Trees\Nodes\BSTNode|null the minimum node or |
|
251 | + * @return Node|null the minimum node or |
|
252 | 252 | * null if the tree is empty. |
253 | 253 | */ |
254 | 254 | public function deleteMin(Node $node = null) { |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * Deletes the node with the maximum key and returns it. The most right and more bottom. |
265 | 265 | * |
266 | 266 | * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root. |
267 | - * @return DataStructures\Trees\Nodes\BSTNode|null the maximum node or |
|
267 | + * @return Node|null the maximum node or |
|
268 | 268 | * null if the tree is empty. |
269 | 269 | */ |
270 | 270 | public function deleteMax(Node $node = null) { |
@@ -280,7 +280,8 @@ discard block |
||
280 | 280 | * Deletes the node with the maximum key and returns it. The most right and more bottom. |
281 | 281 | * |
282 | 282 | * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root. |
283 | - * @return DataStructures\Trees\Nodes\BSTNode|null the maximum node or |
|
283 | + * @param integer $key |
|
284 | + * @return Node|null the maximum node or |
|
284 | 285 | * null if the tree is empty. |
285 | 286 | */ |
286 | 287 | public function delete($key) { |
@@ -323,7 +324,7 @@ discard block |
||
323 | 324 | * that replaces the deleted node. Also decrease the size of tree. |
324 | 325 | * |
325 | 326 | * @param DataStructures\Trees\Nodes\BSTNode|null The node to be deleted. |
326 | - * @return the node that replaces the deleted. |
|
327 | + * @return DataStructures\Trees\Nodes\BSTNode|null node that replaces the deleted. |
|
327 | 328 | */ |
328 | 329 | private function _delete(Node &$node) { |
329 | 330 | if($node !== null) { |
@@ -386,7 +387,7 @@ discard block |
||
386 | 387 | * Returns true if is leaf the node. |
387 | 388 | * |
388 | 389 | * @param DataStructures\Trees\Nodes\BSTNode|null $node default to null. |
389 | - * @return true if is leaf the node, is not null and their subtrees has no |
|
390 | + * @return boolean if is leaf the node, is not null and their subtrees has no |
|
390 | 391 | * pointers to successors. |
391 | 392 | */ |
392 | 393 | public function isLeaf($node) { |
@@ -398,7 +399,7 @@ discard block |
||
398 | 399 | * also are called a root node. |
399 | 400 | * |
400 | 401 | * @param DataStructures\Trees\Nodes\BSTNode|null $node default to null. |
401 | - * @return true if is root the node, is not null and their subtrees has no |
|
402 | + * @return boolean if is root the node, is not null and their subtrees has no |
|
402 | 403 | * pointers to successors. |
403 | 404 | */ |
404 | 405 | public function isRoot($node) { |