本文整理汇总了PHP中SplDoublyLinkedList::rewind方法的典型用法代码示例。如果您正苦于以下问题:PHP SplDoublyLinkedList::rewind方法的具体用法?PHP SplDoublyLinkedList::rewind怎么用?PHP SplDoublyLinkedList::rewind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SplDoublyLinkedList
的用法示例。
在下文中一共展示了SplDoublyLinkedList::rewind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nextTick
private function nextTick()
{
$this->future->rewind();
while ($this->future->valid() && ($task = $this->future->current())) {
if (!$task->isBlocked() || !$task->isStarted()) {
$this->tick->enqueue($task);
$this->future->offsetUnset($this->future->key());
$this->future->prev();
}
$this->future->next();
}
}
示例2: resetCreateGlobalVars
function resetCreateGlobalVars()
{
global $v0, $v1, $v2, $v3, $v4, $v5, $list0, $list1, $list2, $list3, $list4, $list5, $adjacencyList;
$v0 = new vertex(0);
$v1 = new vertex(1);
$v2 = new vertex(2);
$v3 = new vertex(3);
$v4 = new vertex(4);
$v5 = new vertex(5);
$list0 = new SplDoublyLinkedList();
$list0->push(array('vertex' => $v1, 'distance' => 3));
$list0->push(array('vertex' => $v3, 'distance' => 1));
$list0->rewind();
$list1 = new SplDoublyLinkedList();
$list1->push(array('vertex' => $v0, 'distance' => 3));
$list1->push(array('vertex' => $v2, 'distance' => 7));
$list1->rewind();
$list2 = new SplDoublyLinkedList();
$list2->push(array('vertex' => $v1, 'distance' => 7));
$list2->push(array('vertex' => $v3, 'distance' => 8));
$list2->push(array('vertex' => $v4, 'distance' => 12));
$list2->rewind();
$list3 = new SplDoublyLinkedList();
$list3->push(array('vertex' => $v0, 'distance' => 1));
$list3->push(array('vertex' => $v2, 'distance' => 8));
$list3->rewind();
$list4 = new SplDoublyLinkedList();
$list4->push(array('vertex' => $v2, 'distance' => 12));
$list4->push(array('vertex' => $v5, 'distance' => 3));
$list4->rewind();
$list5 = new SplDoublyLinkedList();
$list5->push(array('vertex' => $v4, 'distance' => 3));
$list5->rewind();
$adjacencyList = array($list0, $list1, $list2, $list3, $list4, $list5);
}
示例3: retrieveMaintenanceTaskEntry
/**
* Retrieve the maintenance task entry, from unique identfier
* @param $maintenanceTaskEntryIdentifier Identifier to locate entry
* @return mixed|null Returns the maintenance task entry or null on error
* @throws InvalidArgumentException if the provided argument is not set or of correct type
*/
public function retrieveMaintenanceTaskEntry($maintenanceTaskEntryIdentifier)
{
if (!isset($maintenanceTaskEntryIdentifier)) {
//argument check
throw new InvalidArgumentException("Missing Argument");
} else {
if (!is_numeric($maintenanceTaskEntryIdentifier)) {
//argument check
throw new InvalidArgumentException("maintenanceTaskEntryIdentifier is not a number");
}
}
if ($this->maintenanceTaskList->isEmpty()) {
//if list is empty, unable to return entry
return null;
} else {
$this->maintenanceTaskList->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
//set iteration FIFO
for ($this->maintenanceTaskList->rewind(); $this->maintenanceTaskList->valid(); $this->maintenanceTaskList->next()) {
if ($this->maintenanceTaskList->current()->getTaskEntryIdentifier() == $maintenanceTaskEntryIdentifier) {
//if entry identifier matches supplied identifier
return $this->maintenanceTaskList->current();
}
//return the matching entry
}
}
return null;
//entry with given identifier not found
}
示例4: get_result
function get_result($t, $ladders, $snakes)
{
fill_graph($t, $ladders);
fill_graph($t, $snakes);
$len = count($t);
$vertices = array();
for ($k = 0; $k < $len; $k++) {
$vertices[$k] = new vertex($k);
}
$adjacencyList = array();
for ($u = 0; $u < $len; $u++) {
$list = new SplDoublyLinkedList();
for ($v = 0; $v < $len; $v++) {
if ($t[$u][$v] != 0) {
$list->push(array('vertex' => $vertices[$v], 'distance' => $t[$u][$v]));
}
}
$list->rewind();
$adjacencyList[] = $list;
}
calcShortestPaths($vertices[0], $adjacencyList);
$path = end($vertices)->path;
$result = $p = 0;
for ($n = 0; $n < count($path); $n++) {
$p++;
if (@$path[$n + 1] - $path[$n] != 1) {
$result = $result + ceil(($p - 1) / 6);
$p = 0;
}
}
//echo "[" . implode(', ', $path) . "]\n\n";
return $result;
}
示例5: __construct
public function __construct()
{
$listLink = new SplDoublyLinkedList();
$listLink->push('Albin');
$listLink->push('to');
$listLink->push('the');
$listLink->push('interface;');
$listLink->push('not');
$listLink->push('the');
$listLink->push('Sandi');
echo "<strong>Free good advice :</strong><br />";
$listLink->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
for ($listLink->rewind(); $listLink->valid(); $listLink->next()) {
echo $listLink->current() . " ";
}
echo "<br /><br /><strong>Yoda talk: last in first out:</strong><br />";
$listLink->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
for ($listLink->rewind(); $listLink->valid(); $listLink->next()) {
echo $listLink->current() . " ";
}
}
示例6: testVertex
public function testVertex()
{
$v0 = new vertex(0);
$v1 = new vertex(1);
$v2 = new vertex(2);
$v3 = new vertex(3);
$v4 = new vertex(4);
$v5 = new vertex(5);
$list0 = new SplDoublyLinkedList();
$list0->push($v1);
$list0->push($v3);
$list0->rewind();
$list1 = new SplDoublyLinkedList();
$list1->push($v0);
$list1->push($v2);
$list1->rewind();
$list2 = new SplDoublyLinkedList();
$list2->push($v1);
$list2->push($v3);
$list2->push($v4);
$list2->rewind();
$list3 = new SplDoublyLinkedList();
$list3->push($v1);
$list3->push($v2);
$list3->rewind();
$list4 = new SplDoublyLinkedList();
$list4->push($v2);
$list4->push($v5);
$list4->rewind();
$list5 = new SplDoublyLinkedList();
$list5->push($v4);
$list5->rewind();
$adjacencyList = array($list0, $list1, $list2, $list3, $list4, $list5);
calcDistances($v0, $adjacencyList);
print_r($adjacencyList);
}
示例7: unserialize
<?php
$listPasilloSession = unserialize($_SESSION['listPasillo']);
$listPasilloTP = $listPasilloSession->offsetGet($_GET['pas']);
$listPa = $listPasilloTP->getTypeProducts();
$listProducts2 = $listPa->offsetGet($_GET['type']);
$listProducts3 = $listProducts2->getListProduct();
$listProductsTP2 = $listProducts3->offsetGet($_GET['prods']);
$listProducts = $listProductsTP2->getListProducts();
$listPila = new SplDoublyLinkedList();
$listProducts->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
for ($listProducts->rewind(); $listProducts->valid(); $listProducts->next()) {
$data = $listProducts->current();
$listPila->push($data);
}
$listPila->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
for ($listPila->rewind(); $listPila->valid(); $listPila->next()) {
$dataPila = $listPila->current();
?>
<tr>
<td class="center"><?php
echo $dataPila->getIdProduct();
?>
</td>
<td><?php
echo $dataPila->getProduct();
?>
</td>
<td class="center">
<?php
if ($_SESSION['admin'] == 1) {
?>
示例8: calcShortestPaths
$list2 = new SplDoublyLinkedList();
$list2->push($v1);
$list2->push($v3);
$list2->push($v4);
$list2->rewind();
$list3 = new SplDoublyLinkedList();
$list3->push($v1);
$list3->push($v2);
$list3->rewind();
$list4 = new SplDoublyLinkedList();
$list4->push($v2);
$list4->push($v5);
$list4->rewind();
$list5 = new SplDoublyLinkedList();
$list5->push($v4);
$list5->rewind();
$adjacencyList = array($list0, $list1, $list2, $list3, $list4, $list5);
function calcShortestPaths(vertex $start, &$adjLists)
{
// define an empty queue
$q = array();
// push the starting vertex into the queue
array_push($q, $start);
// color it gray
$start->color = 'gray';
// mark the distance to it 0
$start->distance = 0;
// the path to the starting vertex
$start->path = new SplDoublyLinkedList();
$start->path->push($start->key);
while ($q) {
示例9: SplDoublyLinkedList
<?php
$a = new SplDoublyLinkedList();
$a->push(1);
$a->push(2);
$a->push(3);
$a->rewind();
while ($a->valid()) {
var_dump($a->current(), $a->next());
}
?>
===DONE===
示例10: SplFixedArray
$dlanguages->push(['Languages', 'Uses', 'Ranking']);
$dlanguages->push(['C++', 'computing', 99.59999999999999]);
$dlanguages->push(['C', 'computing', 99.90000000000001]);
$dlanguages->push(['Java', 'application', 100]);
$dlanguages->push(['C#', 'application', 91.8]);
$dlanguages->push(['Python', 'application', 95.8]);
$dlanguages->push(['PHP', 'web', 84.5]);
$dlanguages->push(['Perl', 'web', 66.90000000000001]);
$dlanguages->push(['R', 'computing', 84.7]);
$dlanguages->push(['Ruby', 'web', 75.3]);
$dlanguages->push(['VB.NET', 'application', 63.4]);
$dlanguages->push(['Javascript', 'web', 83]);
$dlanguages->push(['Matlab', 'computing', 72.40000000000001]);
echo "\nDOUBLY LINK LIST LOOP: FIFO\n";
$dlanguages->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
for ($dlanguages->rewind(); $dlanguages->valid(); $dlanguages->next()) {
echo $dlanguages->current()[0] . "\n";
echo $dlanguages->current()[1] . "\n";
echo $dlanguages->current()[2] . "\n";
}
/* FIXED ARRAY */
$fdatabases = new SplFixedArray(11);
$fdatabases[0] = ['Databases', 'Type', 'Size', 'Ranking'];
$fdatabases[1] = ['Oracle', 'Proprietary', 'Server', 1497.55];
$fdatabases[2] = ['SQL Server', 'Proprietary', 'Server', 1123.16];
$fdatabases[3] = ['PostgreSQL', 'Open-Source', 'Server', 280.09];
$fdatabases[4] = ['MySQL', 'Open-Source', 'Server', 1298.54];
$fdatabases[5] = ['DB2', 'Proprietary', 'Server', 196.13];
$fdatabases[6] = ['SQLite', 'Open-Source', 'File', 100.85];
$fdatabases[7] = ['MS Access', 'Proprietary', 'File', 140.21];
$fdatabases[8] = ['SAP Sybase', 'Proprietary', 'Server', 81.47];
示例11: rewind
/**
* (PHP 5 >= 5.1.0)
* Rewind the Iterator to the first element
*
* @link http://php.net/manual/en/iterator.rewind.php
* @return void Any returned value is ignored.
*/
public function rewind()
{
$this->storage->rewind();
}
示例12: changeAvatar
print "<a style = \"float:right\" href=\"logout.php\">Logout </a><br>";
print "<a href = \"javascript: changeAvatar('userExtenPanel');\"><img id = \"userAvatar\" class = \"userAvatar\" src = \"/picsUploads/" . $avatar . "\"></a><br>";
print "<a href = \"javascript: changeAvatar('userExtenPanel');\"> Choose Avatar</a><br>";
print "</div>";
print "<div id = \"userTrvHistPanel\" class = \"userTrvHistPanel\">";
if (isset($_SESSION['loginId']) && $_SESSION['loginId'] !== "admin") {
print "Travel History\t\t<a href = \"javascript: updateUserInfo('clearHist');\">Clear</a>";
if (isset($travelHistList)) {
//prints the labels for the travel history table
print "<table border='0px'>";
print "<tr>";
print "<td style= 'color:#CC0000; font-weight:bold'>Departing Airport\t\t\t\t\t\t\t</td>";
print "<td style= 'color:#CC0000; font-weight:bold'>Arrival Airport\t\t\t\t\t\t\t\t</td>";
print "<td style= 'color:#CC0000; font-weight:bold'>Date Traveled \t</td>";
print "<td style= 'color:#CC0000; font-weight:bold'>Leased Model\t\t\t\t\t\t\t</td>";
print "</tr>";
for ($travelHistList->rewind(); $travelHistList->valid(); $travelHistList->next()) {
print "<tr><td>" . $travelHistList->current()->depart . "</td><td>" . $travelHistList->current()->arrive . "</td><td>" . $travelHistList->current()->travelDate . "</td><td>" . $travelHistList->current()->leasedModel . "</td></tr>";
}
print "</table></font>";
} else {
print "Error loading travel history table";
}
}
print "</div>";
print "</div>";
print "</font>";
print "</div>";
print "<script>saveTrvHist();</script>";
print "<label id = \"xmlRespondFeedback\" style = \"visibility:hidden;\"></label>";
include "tailHTML.html";
示例13: unserialize
$planeWaitList = unserialize($row['planeWaitList']);
$airport = $row['airport'];
if ($planeWaitList != NULL) {
for ($planeWaitList->rewind(); $planeWaitList->valid(); $planeWaitList->next()) {
$memberWaitList = $planeWaitList->current();
$plane = $memberWaitList->offsetGet(0);
//we're only interested in the first element of the list, since the first element of the memberWaitList is the model of the plane
for ($memberWaitList->rewind(); $memberWaitList->valid(); $memberWaitList->next()) {
$member = $memberWaitList->current();
$positionInLine = $memberWaitList->key();
if ($member == $_SESSION['loginId']) {
preg_match('/^[^,]*/', $airport, $matches);
// put the * back before the /
if ($matches) {
$elemExist = 0;
for ($tempBfr->rewind(); $tempBfr->valid(); $tempBfr->next()) {
if ($tempBfr->current() == "<tr><td>" . $positionInLine . "</td><td>" . $plane . "</td><td>" . $matches[0] . "</td></tr>") {
$elemExist = 1;
}
}
if (!$elemExist) {
$tempBfr->push("<tr><td>" . $positionInLine . "</td><td>" . $plane . "</td><td>" . $matches[0] . "</td></tr>");
}
} else {
$elemExist = 0;
for ($tempBfr->rewind(); $tempBfr->valid(); $tempBfr->next()) {
if ($tempBfr->current() == "<tr><td>" . $positionInLine . "</td><td>" . $plane . "</td><td>" . $airport . "</td></tr>") {
$elemExist = 1;
}
}
if (!$elemExist) {
示例14: run
/**
* Run the router
* @return mixed
*/
public function run()
{
$this->routes->rewind();
return $this->dispatch();
}
示例15: SplDoublyLinkedList
<?php
$list = new SplDoublyLinkedList();
$list->push('o');
$list->push('o');
$list->push('f');
$list->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
$list->rewind();
while ($tmp = $list->current()) {
echo $tmp;
$list->next();
}