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


PHP SplDoublyLinkedList::top方法代码示例

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


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

示例1: isCoalesced

 /**
  * {@inheritdoc}
  */
 public function isCoalesced()
 {
     if (count($this->_frames) == 0) {
         return false;
     }
     $last = $this->_frames->top();
     return $last->isCoalesced() && $last->isFinal();
 }
开发者ID:RxPHP,项目名称:RxWebsocket,代码行数:11,代码来源:Message.php

示例2:

$list->pop();
// key()
// 获得当前节点的索引值
$list->key();
// count()
// 获得链表的数量
$list->count();
// rewind()
// 将指针返回至初始节点
$list->rewind();
// current()
// 获得当前节点
$list->current();
// top()
// 返回最后一个节点的值
$list->top();
// bottom()
// 返回第一个节点的值
$list->bottom();
// next()
// 指针移到下一个节点
$list->next();
// prev()
// 指针移到上一个节点, 如果原本指针在第一个,那么前一个节点为-1,并且将无法获得当前值
$list->prev();
// valid()
// 判断该链表是否有更多的值,返回bool
$list->valid();
// isEmpty()
// 判断该链表是否为空链表,返回bool
$list->isEmpty();
开发者ID:ray0916,项目名称:learn,代码行数:31,代码来源:splDoublyLinkedList.php

示例3: currentMethod

 /**
  * @return MethodMetaInfo
  */
 public function currentMethod()
 {
     return $this->methods->top();
 }
开发者ID:komex,项目名称:influence,代码行数:7,代码来源:ClassMetaInfo.php

示例4: count

try {
    $dll->shift();
} catch (RuntimeException $e) {
    echo "Exception: " . $e->getMessage() . "\n";
}
// data consistency
$a = 2;
$dll->push($a);
echo $dll->pop() . "\n";
$a = 2;
$dll->unshift($a);
echo $dll->shift() . "\n";
// peakable
$dll->push(1);
$dll->push(2);
echo $dll->top() . "\n";
echo $dll->bottom() . "\n";
$dll->pop();
$dll->pop();
// countable
$dll->push(NULL);
$dll->push(NULL);
echo count($dll) . "\n";
echo $dll->count() . "\n";
var_dump($dll->pop());
var_dump($dll->pop());
// clonable
$dll->push(2);
$dll_clone = clone $dll;
$dll_clone->pop();
echo count($dll) . "\n";
开发者ID:zaky-92,项目名称:php-1,代码行数:31,代码来源:ext_spl_tests_dllist_001.php

示例5: SplDoublyLinkedList

<?php

$list = new SplDoublyLinkedList();
$list->push("top");
$list->top(null);
开发者ID:badlamer,项目名称:hhvm,代码行数:5,代码来源:SplDoublyLinkedList_top_pass_null.php

示例6: SplDoublyLinkedList

<?php

$list = new SplDoublyLinkedList();
$list->push("top");
$list->top(3.14159);
开发者ID:badlamer,项目名称:hhvm,代码行数:5,代码来源:SplDoublyLinkedList_top_pass_float.php

示例7: SplDoublyLinkedList

<?php

$list = new SplDoublyLinkedList();
$list->push("top");
$list->top(array());
开发者ID:badlamer,项目名称:hhvm,代码行数:5,代码来源:SplDoublyLinkedList_top_pass_array.php

示例8: SplDoublyLinkedList

<?php

$list = new SplDoublyLinkedList();
$list->push("top");
$list->top(45);
开发者ID:badlamer,项目名称:hhvm,代码行数:5,代码来源:SplDoublyLinkedList_top_pass_integer.php

示例9: notify

 /**
  * Notify observers, this method will store the return value from each 
  * observer in a SplDoublyLinkedList. If any one of the observers returns
  * 'false', then the notification stops with the last value of the List
  * being 'false'.
  * 
  * @param string $event
  * @param mixed $args
  * @return SplDoublyLinkedList | return values from the observers
  */
 public function notify($event, $args = null)
 {
     $args = $args instanceof \stdClass && $args->name === 'static' ? $args->args : array_slice(func_get_args(), 1);
     $list = new SplDoublyLinkedList();
     foreach ($this->getObservers($event) as $observer) {
         $list->push($this->invoke($event, $observer, $args));
         if (!$list->isEmpty() && $list->top() === false) {
             break;
         }
     }
     return $list;
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:22,代码来源:Dispatcher.php

示例10: SplDoublyLinkedList

<?php

$dll = new SplDoublyLinkedList();
$dll->push('Never');
$dll->push('gonna');
$dll->push('give');
// at pos 0, shift everything up
$dll->add(0, 'you');
// Should be the end
$dll->add(4, 'up');
// Somewhere in the middle
$dll->add(2, 'let');
try {
    // Key 12 is unaccessible
    $dll->add(12, 'down');
} catch (OutOfRangeException $e) {
    echo $e->getMessage(), PHP_EOL;
}
foreach ($dll as $key => $val) {
    echo $key . '=>' . $val, PHP_EOL;
}
echo "count(): " . $dll->count(), PHP_EOL;
echo "top(): " . $dll->top(), PHP_EOL;
echo "bottom(): " . $dll->bottom(), PHP_EOL;
开发者ID:badlamer,项目名称:hhvm,代码行数:24,代码来源:SplDoublyLinkedList_add.php

示例11: top

 /**
  * Peeks a `Token` from the end of the list.
  *
  * @return Token The last token.
  * @link http://www.php.net/manual/en/spldoublylinkedlist.top.php
  */
 public function top()
 {
     return $this->tokens->top();
 }
开发者ID:mohiva,项目名称:common,代码行数:10,代码来源:TokenStream.php


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