PHP Класс Prado\Collections\TQueue

TQueue implements a queue. The typical queue operations are implemented, which include {@link enqueue()}, {@link dequeue()} and {@link peek()}. In addition, {@link contains()} can be used to check if an item is contained in the queue. To obtain the number of the items in the queue, check the {@link getCount Count} property. Items in the queue may be traversed using foreach as follows, foreach($queue as $item) ...
С версии: 3.1
Автор: Qiang Xue ([email protected])
Автор: Knut Urdalen ([email protected])
Наследование: extends Prado\TComponent, implements IteratorAggregate, implements Countable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( $data = null ) Constructor.
clear ( ) Removes all items in the queue.
contains ( $item ) : boolean
copyFrom ( $data ) Copies iterable data into the queue.
count ( ) : integer Returns the number of items in the queue.
dequeue ( ) : mixed Removes and returns the object at the beginning of the queue.
enqueue ( $item ) Adds an object to the end of the queue.
getCount ( ) : integer
getIterator ( ) : Iterator Returns an iterator for traversing the items in the queue.
peek ( ) : mixed Returns the first item at the front of the queue.
toArray ( ) : array

Описание методов

__construct() публичный Метод

Initializes the queue with an array or an iterable object.
public __construct ( $data = null )

clear() публичный Метод

Removes all items in the queue.
public clear ( )

contains() публичный Метод

public contains ( $item ) : boolean
Результат boolean whether the queue contains the item

copyFrom() публичный Метод

Note, existing data in the list will be cleared first.
public copyFrom ( $data )

count() публичный Метод

This method is required by \Countable interface.
public count ( ) : integer
Результат integer number of items in the queue.

dequeue() публичный Метод

Removes and returns the object at the beginning of the queue.
public dequeue ( ) : mixed
Результат mixed the item at the beginning of the queue

enqueue() публичный Метод

Adds an object to the end of the queue.
public enqueue ( $item )

getCount() публичный Метод

public getCount ( ) : integer
Результат integer the number of items in the queue

getIterator() публичный Метод

This method is required by the interface \IteratorAggregate.
public getIterator ( ) : Iterator
Результат Iterator an iterator for traversing the items in the queue.

peek() публичный Метод

Unlike {@link dequeue()}, this method does not remove the item from the queue.
public peek ( ) : mixed
Результат mixed item at the top of the queue

toArray() публичный Метод

public toArray ( ) : array
Результат array the list of items in queue