当前位置: 首页>>代码示例>>PHP>>正文


PHP SplDoublyLinkedList::rewind方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:crystalplanet,项目名称:redshift,代码行数:12,代码来源:EventLoop.php

示例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);
}
开发者ID:erackson,项目名称:samu,代码行数:35,代码来源:index.php

示例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
 }
开发者ID:matthewstyler,项目名称:php-automobile-maintenence-tracker,代码行数:34,代码来源:MaintenanceTracker.php

示例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;
}
开发者ID:eltonoliver,项目名称:Algorithms,代码行数:33,代码来源:snakes_and_ladders.php

示例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() . " ";
     }
 }
开发者ID:asandi01,项目名称:phpLitsTest,代码行数:21,代码来源:LinkedListBuiltIn.php

示例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);
 }
开发者ID:Namiastek,项目名称:SGD,代码行数:36,代码来源:VertexCalculatorService.php

示例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) {
        ?>
开发者ID:asandi01,项目名称:phpLitsTest,代码行数:31,代码来源:product.php

示例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) {
开发者ID:eltonoliver,项目名称:Algorithms,代码行数:31,代码来源:bfs_2.php

示例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===
开发者ID:gleamingthecube,项目名称:php,代码行数:12,代码来源:ext_spl_tests_dllist_007.php

示例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];
开发者ID:ParfaitG,项目名称:DATA_STRUCTURES,代码行数:31,代码来源:DataStructures.php

示例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();
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:11,代码来源:AbstractRecordCollection.php

示例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";
开发者ID:ssekar1,项目名称:Planes-for-Hire,代码行数:31,代码来源:userprofile.php

示例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) {
开发者ID:ssekar1,项目名称:Planes-for-Hire,代码行数:31,代码来源:waitingList.php

示例14: run

 /**
  * Run the router
  * @return mixed
  */
 public function run()
 {
     $this->routes->rewind();
     return $this->dispatch();
 }
开发者ID:zorca,项目名称:parvula,代码行数:9,代码来源:Router.php

示例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();
}
开发者ID:badlamer,项目名称:hhvm,代码行数:12,代码来源:SplDoublyLinkedList_lifoMode.php


注:本文中的SplDoublyLinkedList::rewind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。