DataStructures/Lists/SimpleLinkedList.php 1 location
|
@@ 46-53 (lines=8) @@
|
| 43 |
|
* @return mixed The data stored in the given index |
| 44 |
|
* @throws OutOfBoundsException if index is out bounds. |
| 45 |
|
*/ |
| 46 |
|
public function get($index) { |
| 47 |
|
$node = $this->search($index); |
| 48 |
|
if($node === null) { |
| 49 |
|
return null; |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
return $node->data; |
| 53 |
|
} |
| 54 |
|
|
| 55 |
|
/** |
| 56 |
|
* Returns the node stored in the given position. |
DataStructures/Lists/CircularLinkedList.php 1 location
|
@@ 124-131 (lines=8) @@
|
| 121 |
|
* @throws OutOfBoundsException if it is out of limits (< 0 or > size - 1) |
| 122 |
|
* @return mixed the data stored in $index node. |
| 123 |
|
*/ |
| 124 |
|
public function get($index) { |
| 125 |
|
$node = $this->search($index); |
| 126 |
|
if($node === null) { |
| 127 |
|
return null; |
| 128 |
|
} |
| 129 |
|
|
| 130 |
|
return $node->data; |
| 131 |
|
} |
| 132 |
|
|
| 133 |
|
/** |
| 134 |
|
* Returns the node stored in the given position. |
DataStructures/Lists/DoublyLinkedList.php 1 location
|
@@ 48-55 (lines=8) @@
|
| 45 |
|
* @return mixed The data stored in the given index |
| 46 |
|
* @throws OutOfBoundsException if index is out bounds. |
| 47 |
|
*/ |
| 48 |
|
public function get($index) { |
| 49 |
|
$node = $this->search($index); |
| 50 |
|
if($node === null) { |
| 51 |
|
return null; |
| 52 |
|
} |
| 53 |
|
|
| 54 |
|
return $node->data; |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
/** |
| 58 |
|
* Gets the node stored in the position especified. |