Example #1
0
 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();
     }
 }
 /**
  * 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
 }
Example #3
0
 * 栈和队列都是继承于双向链表,所以,所有双向链表的方法都可以被栈和队列使用。调用方法也一致。
 */
$list = new SplDoublyLinkedList();
// push($value)
// 在结尾插入一个新值
$list->push('value1');
$list->push('value2');
$list->push('value3');
$list->push('value4');
$list->push('value5');
// pop()
// 抛出结尾的一个元素,会使得链表结构减少一个
$list->pop();
// key()
// 获得当前节点的索引值
$list->key();
// count()
// 获得链表的数量
$list->count();
// rewind()
// 将指针返回至初始节点
$list->rewind();
// current()
// 获得当前节点
$list->current();
// top()
// 返回最后一个节点的值
$list->top();
// bottom()
// 返回第一个节点的值
$list->bottom();
Example #4
0
                                        <td class="center">
                                            <?php 
    if ($_SESSION['admin'] == 1) {
        ?>
 
                                                <a class="btn btn-danger" href="product.php?act=4&pas=<?php 
        echo $_GET['pas'];
        ?>
&type=<?php 
        echo $_GET['type'];
        ?>
&prods=<?php 
        echo $_GET['prods'];
        ?>
&del=<?php 
        echo $listPila->key();
        ?>
&sel=<?php 
        echo $_GET['sel'];
        ?>
">
                                                    <i class="glyphicon glyphicon-trash icon-white"></i>
                                                    Borrar
                                                </a>
                                            <?php 
    }
    ?>
                                            <a class="btn btn-warning" href="product.php?act=8&pas=<?php 
    echo $_GET['pas'];
    ?>
&type=<?php 
Example #5
0
 /**
  * Return current token index.
  *
  * @return mixed The current token index.
  * @link http://www.php.net/manual/en/spldoublylinkedlist.key.php
  */
 public function key()
 {
     return $this->tokens->key();
 }