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


PHP SplDoublyLinkedList::offsetUnset方法代码示例

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


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

 /**
  * Removes a maintenance task entry from the maintenance task list
  * @param $maintenanceTaskEntryIdentifier   Remove entry with this identifier
  * @return bool                             Result of attempted removal
  * @throws InvalidArgumentException         if the provided argument is not set or of correct type
  */
 public function removeMaintenanceTaskEntry($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, nothing to remove
         return false;
     } else {
         if ($this->retrieveMaintenanceTaskEntry($maintenanceTaskEntryIdentifier) != null) {
             $this->maintenanceTaskList->offsetUnset($this->maintenanceTaskList->key());
             //remove from list
             return true;
             //return true, success
         } else {
             return false;
         }
     }
     //if entry was not found, return false
 }
开发者ID:matthewstyler,项目名称:php-automobile-maintenence-tracker,代码行数:32,代码来源:MaintenanceTracker.php

示例3: removeChild

 /**
  * Look for the node in the list and remove it
  *
  * @param Node $node
  */
 public function removeChild(Node $node)
 {
     foreach ($this->children as $key => $child) {
         if ($child !== $node) {
             continue;
         }
         $this->children->offsetUnset($key);
         break;
     }
 }
开发者ID:tebru,项目名称:tree,代码行数:15,代码来源:Node.php

示例4:

// isEmpty()
// 判断该链表是否为空链表,返回bool
$list->isEmpty();
// offsetExists($index)
// 判断参索引是否存在,返回bool
$list->offsetExists(2);
// offsetGet($index)
// 返回参数索引的节点值
$list->offsetGet(2);
// offsetSet($index, $newValue)
// 设置参数索引的节点值, $index必须在链表的键范围中。
// 当一个节点用offsetUnset删掉时时,并不能用offsetSet重新给已删掉的节点设置值,只能对当前可见的节点的值进行修改
$list->offsetSet(3, 'value6');
// offsetUnset($index)
// 删除参数索引的节点
$list->offsetUnset(3);
// add($index, $value);
// 对指定的索引新增一个新值。 当一个节点用offsetUnset时,并没有直接删除,该节点还仍然会保存在内存中。用add可以重新给该节点设置值
$list->add(3, 'first');
// unshift($value)
// 在链表的开始节点插入value作为新的开始节点
$list->unshift('second');
// shift()
// 将链表的第一个移除
$list->shift();
// setIteratorMode(int $mode)
// 设置链表的模式。等价于下面的情况:
// IT_MODE_LIFO: 栈模式,先进后出;IT_MODE_FIFO:队列模式,先进先出
// IT_MODE_DELETE; IT_MODE_KEEP
$list->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
// getIteratorMode()
开发者ID:ray0916,项目名称:learn,代码行数:31,代码来源:splDoublyLinkedList.php

示例5: microtime

 $e = microtime(true);
 echo "Count: " . count($array) . "\n";
 echo "Elapsed time: " . ($e - $s) . " sec.\n";
 echo "Mem usage: " . __convert(memory_get_usage()) . "\n";
 echo "Mem real: " . __convert(memory_get_usage(true)) . "\n";
 unset($array);
 echo "\n-- SplDoublyLinkedList \n";
 echo "Mem usage: " . __convert(memory_get_usage()) . "\n";
 echo "Mem real: " . __convert(memory_get_usage(true)) . "\n";
 $s = microtime(true);
 $spl = new SplDoublyLinkedList();
 for ($i = 0; $i < $v; $i++) {
     $spl->push($i);
 }
 try {
     $spl->offsetUnset(102);
     var_dump($spl->offsetGet(100));
     var_dump($spl->offsetGet(102));
 } catch (OutOfRangeException $e) {
     echo $e;
 }
 $e = microtime(true);
 echo "Count: " . $spl->count() . "\n";
 echo "Elapsed time: " . ($e - $s) . " sec.\n";
 echo "Mem usage: " . __convert(memory_get_usage()) . "\n";
 echo "Mem real: " . __convert(memory_get_usage(true)) . "\n";
 try {
     for ($i = 0; $i < $v; $i++) {
         $spl->pop();
     }
 } catch (Exception $e) {
开发者ID:balajivenki,项目名称:php-judy,代码行数:31,代码来源:judy-bench-bitset.php

示例6: offsetUnset

 /**
  * @see \ArrayAccess::offsetUnset()
  * @param int $offset
  */
 public function offsetUnset($offset)
 {
     $offset = count($this) + $offset;
     parent::offsetUnset($offset);
 }
开发者ID:nmarley,项目名称:bitcoin-php,代码行数:9,代码来源:Stack.php

示例7: SplDoublyLinkedList

<?php

// Create a new Doubly Linked List
$dll = new SplDoublyLinkedList();
// Add some items to the list
$dll->push(1);
$dll->push(2);
$dll->push(3);
try {
    $dll->offsetUnset(-1);
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
}
开发者ID:badlamer,项目名称:hhvm,代码行数:13,代码来源:SplDoublyLinkedList_offsetUnset_negative-parameter.php

示例8: SplDoublyLinkedList

<?php

$ll = new SplDoublyLinkedList();
$ll->push('1');
$ll->push('2');
$ll->push('3');
try {
    $ll->offsetUnset($ll->count() + 1);
    var_dump($ll);
} catch (Exception $e) {
    echo $e->getMessage();
}
开发者ID:badlamer,项目名称:hhvm,代码行数:12,代码来源:SplDoublyLinkedList_offsetUnset_greater_than_elements.php

示例9: SplDoublyLinkedList

<?php

$list = new SplDoublyLinkedList();
$list->push('oh');
$list->push('hai');
$list->push('thar');
$list->offsetUnset(0);
var_dump($list);
开发者ID:badlamer,项目名称:hhvm,代码行数:8,代码来源:SplDoublylinkedlist_offsetunset_first.php

示例10: SplDoublyLinkedList

<?php

// Create a new Doubly Linked List
$dll = new SplDoublyLinkedList();
// Add some items to the list
$dll->push(1);
$dll->push(2);
$dll->push(3);
try {
    $dll->offsetUnset(3);
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
}
开发者ID:badlamer,项目名称:hhvm,代码行数:13,代码来源:SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.php

示例11: SplDoublyLinkedList

<?php

$list = new SplDoublyLinkedList();
$list->push('oh');
$list->push('hai');
$list->push('thar');
$list->offsetUnset(2);
var_dump($list);
开发者ID:badlamer,项目名称:hhvm,代码行数:8,代码来源:SplDoublylinkedlist_offsetunset_last.php


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