- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

Packages: default System System.Caching System.Collections System.Data System.Data.ActiveRecord System.Data.ActiveRecord.Relations System.Data.ActiveRecord.Scaffold System.Data.ActiveReecord.Scaffold.InputBuilder System.Data.Commom.Sqlite System.Data.Common System.Data.Common.Mssql System.Data.Common.Mysql System.Data.Common.Oracle System.Data.Common.Pgsql System.Data.Common.Sqlite System.Data.DataGateway System.Data.SqlMap System.Data.SqlMap.Configuration System.Data.SqlMap.Statements System.Exceptions System.I18N System.IO System.Security System.Util System.Web System.Web.Services System.Web.UI System.Web.UI.ActiveControls System.Web.UI.WebControls System.Web.UI.WebControls.assets System.Xml Classes: TAttributeCollection TDummyDataSource TDummyDataSourceIterator TList TListIterator TMap TMapIterator TPagedDataSource TPagedList TPagedListFetchDataEventParameter TPagedListIterator TPagedListPageChangedEventParameter TPagedMapIterator TQueue TQueueIterator TStack TStackIterator |
Keyword
# Class TQueue
    TComponent
       |
       --TQueue
TQueue class TQueue implements a queue. The typical queue operations are implemented, which include enqueue(), dequeue() and peek(). In addition, 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 Count property. Items in the queue may be traversed using foreach as follows,

     foreach($queue as $item) ...
Since: 3.1 Author: Qiang Xue <qiang.xue@gmail.com> Author: Knut Urdalen <knut.urdalen@gmail.com>
Constructor Summary
public | __construct Array Constructor.
Method Summary
void | clear () Removes all items in the queue.
boolean | contains ( mixed $item)
void | copyFrom ( mixed $data) Copies iterable data into the queue.
integer | count () Returns the number of items in the queue.
mixed | dequeue () Removes and returns the object at the beginning of the queue.
void | enqueue ( mixed $item) Adds an object to the end of the queue.
integer | getCount ()
Iterator | getIterator () Returns an iterator for traversing the items in the queue.
mixed | peek () Returns the item at the top of the queue.
array | toArray ()
Methods Inherited From TComponent
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()
Constructor Details
## __construct
public __construct | Array
Constructor. Initializes the queue with an array or an iterable object. Throws: TInvalidDataTypeException If data is not null and neither an array nor an iterator.
Method Details
## clear
public void clear | ()
Removes all items in the queue.
Output
Exception
## contains
public boolean contains | (mixed $item )
Input
mixed | $item | the item
Output
boolean | whether the queue contains the item
Exception
## copyFrom
public void copyFrom | (mixed $data )
Copies iterable data into the queue. Note, existing data in the list will be cleared first.
Input
mixed | $data | the data to be copied from, must be an array or object implementing Traversable
Output
Exception
throws | TInvalidDataTypeException If data is neither an array nor a Traversable.
## count
public integer count | ()
Returns the number of items in the queue. This method is required by Countable interface.
Output
integer | number of items in the queue.
Exception
## dequeue
public mixed dequeue | ()
Removes and returns the object at the beginning of the queue.
Output
mixed | the item at the beginning of the queue
Exception
throws | TInvalidOperationException if the queue is empty
## enqueue
public void enqueue | (mixed $item )
Adds an object to the end of the queue.
Input
mixed | $item | the item to be appended into the queue
Output
Exception
## getCount
public integer getCount | ()
Output
integer | the number of items in the queue
Exception
## getIterator
public Iterator getIterator | ()
Returns an iterator for traversing the items in the queue. This method is required by the interface IteratorAggregate.
Output
Iterator | an iterator for traversing the items in the queue.
Exception
## peek
public mixed peek | ()
Returns the item at the top of the queue. Unlike pop(), this method does not remove the item from the queue.
Output
mixed | item at the top of the queue
Exception
throws | TInvalidOperationException if the queue is empty
## toArray
public array toArray | ()
Output
array | the list of items in queue
Exception