DataStructures/Lists/DoublyLinkedList.php 1 location
|
@@ 57-64 (lines=8) @@
|
| 54 |
|
* @return mixed The data stored in the given index |
| 55 |
|
* @throws OutOfBoundsException if index is out bounds. |
| 56 |
|
*/ |
| 57 |
|
public function get($index) { |
| 58 |
|
$node = $this->search($index); |
| 59 |
|
if($node === null) { |
| 60 |
|
return null; |
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
return $node->data; |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
/** |
| 67 |
|
* Gets the node stored in the position especified. |
DataStructures/Lists/CircularLinkedList.php 1 location
|
@@ 145-152 (lines=8) @@
|
| 142 |
|
* @throws OutOfBoundsException if it is out of limits (< 0 or > size - 1) |
| 143 |
|
* @return mixed the data stored in $index node. |
| 144 |
|
*/ |
| 145 |
|
public function get($index) { |
| 146 |
|
$node = $this->search($index); |
| 147 |
|
if($node === null) { |
| 148 |
|
return null; |
| 149 |
|
} |
| 150 |
|
|
| 151 |
|
return $node->data; |
| 152 |
|
} |
| 153 |
|
|
| 154 |
|
/** |
| 155 |
|
* Returns the node stored in the given position. |
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. |