Completed
Push — master ( f1605c...0f0c8b )
by Siro Díaz
02:06
created
DataStructures/Trees/BinaryTreeAbstract.php 1 patch
Doc Comments   +16 added lines, -12 removed lines patch added patch discarded remove patch
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
     /**
89 89
      * Creates a new node or updates it if already exists.
90 90
      *
91
-     * @param int|string $key the key.
92
-     * @param mixed $data the data to be stored. 
91
+     * @param integer $key the key.
92
+     * @param string $data the data to be stored. 
93 93
      */
94 94
     public function putOrUpdate($key, $data) {
95 95
         $this->put($key, $data, true);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     /**
99 99
      * Retrieve the data stored in the tree.
100 100
      *
101
-     * @param int|string $key the key to identify the data.
101
+     * @param integer $key the key to identify the data.
102 102
      * @return mixed
103 103
      */
104 104
     public function get($key){
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
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){
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     /**
235 235
      * Returns the minimum node from a given node in position X.
236 236
      *
237
-     * @param DataStructures\Trees\Nodes\BSTNode $node the start point.
237
+     * @param BinaryNodeInterface $node the start point.
238 238
      * @return DataStructures\Trees\Nodes\BSTNode|null the minimum node.
239 239
      */
240 240
     private function getMinNode(BinaryNodeInterface $node = null) {
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
     /**
253 253
      * Returns the maximum node from a given node in position X.
254 254
      *
255
-     * @param DataStructures\Trees\Nodes\BSTNode $node the start point.
255
+     * @param BinaryNodeInterface $node the start point.
256 256
      * @return DataStructures\Trees\Nodes\BSTNode|null the maximum node.
257 257
      */
258 258
     private function getMaxNode(BinaryNodeInterface $node = null) {
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
      * Deletes the node with the minimum key and returns it. The most left and more bottom.
272 272
      * 
273 273
      * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root.
274
-     * @return DataStructures\Trees\Nodes\BSTNode|null the minimum node or
274
+     * @return BinaryNodeInterface|null the minimum node or
275 275
      *  null if the tree is empty.
276 276
      */
277 277
     public function deleteMin(BinaryNodeInterface $node = null) {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
      * Deletes the node with the maximum key and returns it. The most right and more bottom.
288 288
      * 
289 289
      * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root.
290
-     * @return DataStructures\Trees\Nodes\BSTNode|null the maximum node or
290
+     * @return BinaryNodeInterface|null the maximum node or
291 291
      *  null if the tree is empty.
292 292
      */
293 293
     public function deleteMax(BinaryNodeInterface $node = null) {
@@ -303,7 +303,8 @@  discard block
 block discarded – undo
303 303
      * Deletes the node with the maximum key and returns it. The most right and more bottom.
304 304
      * 
305 305
      * @param DataStructures\Trees\Nodes\BSTNode|null if null takes the root.
306
-     * @return DataStructures\Trees\Nodes\BSTNode|null the maximum node or
306
+     * @param integer $key
307
+     * @return BinaryNodeInterface|null the maximum node or
307 308
      *  null if the tree is empty.
308 309
      */
309 310
     public function delete($key) {
@@ -321,7 +322,7 @@  discard block
 block discarded – undo
321 322
      * that replaces the deleted node. Also decrease the size of tree.
322 323
      *
323 324
      * @param DataStructures\Trees\Nodes\BSTNode|null The node to be deleted.
324
-     * @return the node that replaces the deleted.
325
+     * @return DataStructures\Trees\Nodes\BSTNode|null node that replaces the deleted.
325 326
      */
326 327
     protected function _delete(BinaryNodeInterface &$node) {
327 328
         if($node !== null) {
@@ -409,7 +410,7 @@  discard block
 block discarded – undo
409 410
      * Returns true if is leaf the node.
410 411
      *
411 412
      * @param DataStructures\Trees\Nodes\BSTNode|null $node default to null.
412
-     * @return true if is leaf the node, is not null and their subtrees has no
413
+     * @return boolean if is leaf the node, is not null and their subtrees has no
413 414
      *  pointers to successors.
414 415
      */
415 416
     public function isLeaf($node) { // BinaryTreeNode
@@ -421,7 +422,7 @@  discard block
 block discarded – undo
421 422
      * also are called a root node.
422 423
      *
423 424
      * @param DataStructures\Trees\Nodes\BSTNode|null $node default to null.
424
-     * @return true if is root the node, is not null and their subtrees has no
425
+     * @return boolean if is root the node, is not null and their subtrees has no
425 426
      *  pointers to successors.
426 427
      */
427 428
     public function isRoot($node) {
@@ -446,6 +447,7 @@  discard block
 block discarded – undo
446 447
      * @param DataStructures\Trees\Nodes\BSTNode|null $node.
447 448
      * @param Callable|null $callback the callback function to apply to each
448 449
      *  node.
450
+     * @param null|DataStructures\Trees\Nodes\BSTNode $node
449 451
      */
450 452
     private function _preorder($node, Callable $callback = null) {
451 453
         if($node === null) {
@@ -476,6 +478,7 @@  discard block
 block discarded – undo
476 478
      * @param DataStructures\Trees\Nodes\BSTNode|null $node.
477 479
      * @param Callable|null $callback the callback function to apply to each
478 480
      *  node.
481
+     * @param null|DataStructures\Trees\Nodes\BSTNode $node
479 482
      */
480 483
     private function _inorder($node, Callable $callback = null) {
481 484
         if($node === null) {
@@ -507,6 +510,7 @@  discard block
 block discarded – undo
507 510
      * @param DataStructures\Trees\Nodes\BSTNode|null $node.
508 511
      * @param Callable|null $callback the callback function to apply to each
509 512
      *  node.
513
+     * @param null|DataStructures\Trees\Nodes\BSTNode $node
510 514
      */
511 515
     private function _postorder($node, Callable $callback = null) {
512 516
         if($node === null) {
Please login to merge, or discard this patch.