CQueueIterator
| 包 | system.collections | 
|---|---|
| 继承 | class CQueueIterator | 
| 实现 | Iterator, Traversable | 
| 可用自 | 1.0 | 
| 源码 | framework/collections/CQueueIterator.php | 
CQueueIterator implements an iterator for CQueue.
It allows CQueue to return a new iterator for traversing the items in the queue.
It allows CQueue to return a new iterator for traversing the items in the queue.
公共方法
| 方法 | 描述 | 被定义在 | 
|---|---|---|
| __construct() | Constructor. | CQueueIterator | 
| current() | Returns the current array item. | CQueueIterator | 
| key() | Returns the key of the current array item. | CQueueIterator | 
| next() | Moves the internal pointer to the next array item. | CQueueIterator | 
| rewind() | Rewinds internal array pointer. | CQueueIterator | 
| valid() | Returns whether there is an item at current position. | CQueueIterator | 
方法详情
__construct()
方法
| 
public void __construct(array &$data) | ||
| $data | array | the data to be iterated through | 
源码: framework/collections/CQueueIterator.php#39 (显示)
public function __construct(&$data)
{
    $this->_d=&$data;
    $this->_i=0;
    $this->_c=count($this->_d);
}
Constructor.
current()
方法
| 
public mixed current() | ||
| {return} | mixed | the current array item | 
源码: framework/collections/CQueueIterator.php#70 (显示)
public function current()
{
    return $this->_d[$this->_i];
}
Returns the current array item. This method is required by the interface Iterator.
key()
方法
| 
public integer key() | ||
| {return} | integer | the key of the current array item | 
Returns the key of the current array item. This method is required by the interface Iterator.
next()
方法
| 
public void next() | 
Moves the internal pointer to the next array item. This method is required by the interface Iterator.
rewind()
方法
| 
public void rewind() | 
Rewinds internal array pointer. This method is required by the interface Iterator.
valid()
方法
| 
public boolean valid() | ||
| {return} | boolean | |
源码: framework/collections/CQueueIterator.php#89 (显示)
public function valid()
{
    return $this->_i<$this->_c;
}
Returns whether there is an item at current position. This method is required by the interface Iterator.