DataStructures/Lists/CircularLinkedList.php 1 location
|
@@ 166-173 (lines=8) @@
|
| 163 |
|
* @throws OutOfBoundsException if it is out of limits (< 0 or > size - 1) |
| 164 |
|
* @return mixed the data stored in $index node. |
| 165 |
|
*/ |
| 166 |
|
public function get($index) { |
| 167 |
|
$node = $this->search($index); |
| 168 |
|
if($node === null) { |
| 169 |
|
return null; |
| 170 |
|
} |
| 171 |
|
|
| 172 |
|
return $node->data; |
| 173 |
|
} |
| 174 |
|
|
| 175 |
|
/** |
| 176 |
|
* Returns the node stored in the given position. |
DataStructures/Lists/SimpleLinkedList.php 1 location
|
@@ 70-77 (lines=8) @@
|
| 67 |
|
* @return mixed The data stored in the given index |
| 68 |
|
* @throws OutOfBoundsException if index is out bounds. |
| 69 |
|
*/ |
| 70 |
|
public function get($index) { |
| 71 |
|
$node = $this->search($index); |
| 72 |
|
if($node === null) { |
| 73 |
|
return null; |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
return $node->data; |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
/** |
| 80 |
|
* Returns the node stored in the given position. |
DataStructures/Lists/DoublyLinkedList.php 1 location
|
@@ 58-65 (lines=8) @@
|
| 55 |
|
* @return mixed The data stored in the given index |
| 56 |
|
* @throws OutOfBoundsException if index is out bounds. |
| 57 |
|
*/ |
| 58 |
|
public function get($index) { |
| 59 |
|
$node = $this->search($index); |
| 60 |
|
if($node === null) { |
| 61 |
|
return null; |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
return $node->data; |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
/** |
| 68 |
|
* Gets the node stored in the position especified. |