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


PHP SplDoublyLinkedList::setIteratorMode方法代码示例

本文整理汇总了PHP中SplDoublyLinkedList::setIteratorMode方法的典型用法代码示例。如果您正苦于以下问题:PHP SplDoublyLinkedList::setIteratorMode方法的具体用法?PHP SplDoublyLinkedList::setIteratorMode怎么用?PHP SplDoublyLinkedList::setIteratorMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SplDoublyLinkedList的用法示例。


在下文中一共展示了SplDoublyLinkedList::setIteratorMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: setIteratorMode

 /**
  * (excerpt from http://docs.hhvm.com/manual/en/splstack.setiteratormode.php)
  *
  *
  * @mode       mixed   There is only one iteration parameter you can
  *                     modify. The behavior of the iterator (either one or
  *                     the other): SplDoublyLinkedList::IT_MODE_DELETE
  *                     (Elements are deleted by the iterator)
  *                     SplDoublyLinkedList::IT_MODE_KEEP (Elements are
  *                     traversed by the iterator)
  *
  *                     The default mode is 0x2 :
  *                     SplDoublyLinkedList::IT_MODE_LIFO |
  *                     SplDoublyLinkedList::IT_MODE_KEEP Warning
  *
  *                     The direction of iteration can no longer be changed
  *                     for SplStacks. Trying to do so will result in a
  *                     RuntimeException being thrown.
  *
  * @return     mixed   No value is returned.
  */
 public function setIteratorMode($mode)
 {
     if (($mode & self::IT_MODE_LIFO) == 0) {
         throw new RuntimeException('Iterators\' LIFO/FIFO modes for SplStack/SplQueue objects are frozen');
     }
     parent::setIteratorMode($mode);
 }
开发者ID:lsqtongxin,项目名称:hhvm,代码行数:28,代码来源:SplStack.php

示例3: createTransitionsList

 /**
  * @param $vertex
  * @return \SplDoublyLinkedList
  */
 public function createTransitionsList($vertex)
 {
     $list = new \SplDoublyLinkedList();
     $list->setIteratorMode(\SplDoublyLinkedList::IT_MODE_FIFO | \SplDoublyLinkedList::IT_MODE_KEEP);
     $list->push($vertex);
     return $list;
 }
开发者ID:ne0h12,项目名称:word-transformer,代码行数:11,代码来源:BreadthFirstSearchAlgorithm.php

示例4: castDoublyLinkedList

 public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, Stub $stub, $isNested)
 {
     $mode = $c->getIteratorMode();
     $c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE);
     $a += array("~mode" => new ConstStub(($mode & \SplDoublyLinkedList::IT_MODE_LIFO ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO') . ' | ' . ($mode & \SplDoublyLinkedList::IT_MODE_KEEP ? 'IT_MODE_KEEP' : 'IT_MODE_DELETE'), $mode), "~dllist" => iterator_to_array($c));
     $c->setIteratorMode($mode);
     return $a;
 }
开发者ID:Chaireeee,项目名称:chaireeee,代码行数:8,代码来源:SplCaster.php

示例5: castDoublyLinkedList

 public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, Stub $stub, $isNested)
 {
     $prefix = Caster::PREFIX_VIRTUAL;
     $mode = $c->getIteratorMode();
     $c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE);
     $a += array($prefix . 'mode' => new ConstStub(($mode & \SplDoublyLinkedList::IT_MODE_LIFO ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO') . ' | ' . ($mode & \SplDoublyLinkedList::IT_MODE_KEEP ? 'IT_MODE_KEEP' : 'IT_MODE_DELETE'), $mode), $prefix . 'dllist' => iterator_to_array($c));
     $c->setIteratorMode($mode);
     return $a;
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:9,代码来源:SplCaster.php

示例6: tokenize

 /**
  * {@inheritdoc}
  */
 public function tokenize($userAgent)
 {
     $iterator = new \SplDoublyLinkedList();
     $iterator->setIteratorMode(\SplDoublyLinkedList::IT_MODE_FIFO);
     foreach ($this->getTokens($userAgent) as $position => $token) {
         $token = trim($token);
         $iterator->push(new Node($token, $position, $this->resolveType($token)));
     }
     return $iterator;
 }
开发者ID:zientalak,项目名称:devicedetector,代码行数:13,代码来源:UserAgentTokenizer.php

示例7: __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

示例8: Node

 function it_tokenize_useragent()
 {
     $tokenized = $this->tokenize('Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0); 360Spider(compatible; HaosouSpider; http://www.haosou.com/help/help_3_2.html)');
     $nodes = new \SplDoublyLinkedList();
     $nodes->setIteratorMode(\SplDoublyLinkedList::IT_MODE_FIFO);
     $nodes->push(new Node('mozilla', 0, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('/', 1, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('5.0', 2, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('', 3, NodeInterface::TYPE_SPACE));
     $nodes->push(new Node('(', 4, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('compatible', 5, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node(';', 6, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('', 7, NodeInterface::TYPE_SPACE));
     $nodes->push(new Node('msie', 8, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('', 9, NodeInterface::TYPE_SPACE));
     $nodes->push(new Node('9.0', 10, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node(';', 11, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('', 12, NodeInterface::TYPE_SPACE));
     $nodes->push(new Node('windows', 13, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('', 14, NodeInterface::TYPE_SPACE));
     $nodes->push(new Node('nt', 15, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('', 16, NodeInterface::TYPE_SPACE));
     $nodes->push(new Node('6.1', 17, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node(';', 18, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('', 19, NodeInterface::TYPE_SPACE));
     $nodes->push(new Node('trident', 20, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('/', 21, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('5.0', 22, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node(')', 23, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node(';', 24, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('', 25, NodeInterface::TYPE_SPACE));
     $nodes->push(new Node('360spider', 26, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('(', 27, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('compatible', 28, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node(';', 29, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('', 30, NodeInterface::TYPE_SPACE));
     $nodes->push(new Node('haosouspider', 31, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node(';', 32, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node('', 33, NodeInterface::TYPE_SPACE));
     $nodes->push(new Node('http://www.haosou.com/help/help_3_2.html', 34, NodeInterface::TYPE_TEXT));
     $nodes->push(new Node(')', 35, NodeInterface::TYPE_TEXT));
     $tokenized->shouldReturnAnInstanceOf('\\Iterator');
     /** @var NodeInterface $node */
     foreach ($nodes as $node) {
         $tokenized[$node->getPosition()]->getValue()->shouldReturn($node->getValue());
         $tokenized[$node->getPosition()]->getType()->shouldReturn($node->getType());
     }
 }
开发者ID:zientalak,项目名称:devicedetector,代码行数:48,代码来源:UserAgentTokenizerSpec.php

示例9: SplDoublyLinkedList

$dlanguages = new SplDoublyLinkedList();
$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];
开发者ID:ParfaitG,项目名称:DATA_STRUCTURES,代码行数:31,代码来源:DataStructures.php

示例10: SplDoublyLinkedList

<?php

$stack = new SplDoublyLinkedList();
$stack->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO | SplDoublyLinkedList::IT_MODE_DELETE);
$stack->push(13);
$stack->push(17);
$stack->push(19);
foreach ($stack as $item) {
    var_dump($item);
}
var_dump(count($stack));
foreach ($stack as $item) {
    var_dump($item);
}
var_dump(count($stack));
开发者ID:badlamer,项目名称:hhvm,代码行数:15,代码来源:SplDoublyLinkedList_foreach_with_delete.php

示例11: testCastSplDoublyLinkedList

    /**
     * @dataProvider provideCastSplDoublyLinkedList
     */
    public function testCastSplDoublyLinkedList($modeValue, $modeDump)
    {
        $var = new \SplDoublyLinkedList();
        $var->setIteratorMode($modeValue);
        $dump = <<<EOTXT
SplDoublyLinkedList {
%Amode: {$modeDump}
  dllist: []
}
EOTXT;
        $this->assertDumpMatchesFormat($dump, $var);
    }
开发者ID:symfony,项目名称:symfony,代码行数:15,代码来源:SplCasterTest.php

示例12: SplDoublyLinkedList

<?php

$dll = new SplDoublyLinkedList(2);
$dll->setIteratorMode(new SplDoublyLinkedList(2));
开发者ID:badlamer,项目名称:hhvm,代码行数:4,代码来源:SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.php

示例13: SplDoublyLinkedList

<?php

$list = new SplDoublyLinkedList();
$list->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_KEEP);
echo $list->getIteratorMode();
开发者ID:badlamer,项目名称:hhvm,代码行数:5,代码来源:SplDoublyLinkedList_getIteratorMode.php

示例14: __construct

 public function __construct()
 {
     $list = new \SplDoublyLinkedList();
     $list->setIteratorMode(\SplDoublyLinkedList::IT_MODE_LIFO | \SplDoublyLinkedList::IT_MODE_DELETE);
     $this->collected = $list;
 }
开发者ID:helstern,项目名称:nomsky-lib,代码行数:6,代码来源:WalkActionStack.php

示例15: SplDoublyLinkedList

<?php

$dll = new SplDoublyLinkedList();
$dll->push(2);
$dll->push(3);
$dll->push(4);
$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
foreach ($dll as $k => $v) {
    echo "{$k}=>{$v}\n";
}
$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
foreach ($dll as $k => $v) {
    echo "{$k}=>{$v}\n";
}
$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_DELETE);
var_dump($dll->count());
foreach ($dll as $k => $v) {
    echo "{$k}=>{$v}\n";
}
var_dump($dll->count());
?>
===DONE===
开发者ID:gleamingthecube,项目名称:php,代码行数:22,代码来源:ext_spl_tests_dllist_003.php


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