Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CAttributeCollection
  • CConfiguration
  • CList
  • CListIterator
  • CMap
  • CMapIterator
  • CQueue
  • CQueueIterator
  • CStack
  • CStackIterator
  • CTypedList
  • CTypedMap
  • Overview
  • Package
  • Class
  • Tree

Class CQueue

CQueue implements a queue.

The typical queue operations are implemented, which include CQueue::enqueue(), CQueue::dequeue() and CQueue::peek(). In addition, CQueue::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 getCount Count property.

Items in the queue may be traversed using foreach as follows,

foreach($queue as $item) ...
CComponent
Extended by CQueue implements IteratorAggregate, Countable
Package: system\collections
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/collections/CQueue.php
Methods summary
public
# __construct( array $data = null )

Constructor. Initializes the queue with an array or an iterable object.

Constructor. Initializes the queue with an array or an iterable object.

Parameters

$data
array
$data the initial data. Default is null, meaning no initialization.

Throws

CException
If data is not null and neither an array nor an iterator.
public array
# toArray( )

Returns

array
the list of items in queue
public
# copyFrom( mixed $data )

Copies iterable data into the queue. Note, existing data in the list will be cleared first.

Copies iterable data into the queue. Note, existing data in the list will be cleared first.

Parameters

$data
mixed
$data the data to be copied from, must be an array or object implementing Traversable

Throws

CException
If data is neither an array nor a Traversable.
public
# clear( )

Removes all items in the queue.

Removes all items in the queue.

public boolean
# contains( mixed $item )

Parameters

$item
mixed
$item the item

Returns

boolean
whether the queue contains the item
public mixed
# peek( )

Returns the item at the top of the queue.

Returns the item at the top of the queue.

Returns

mixed
item at the top of the queue

Throws

CException
if the queue is empty
public mixed
# dequeue( )

Removes and returns the object at the beginning of the queue.

Removes and returns the object at the beginning of the queue.

Returns

mixed
the item at the beginning of the queue

Throws

CException
if the queue is empty
public
# enqueue( mixed $item )

Adds an object to the end of the queue.

Adds an object to the end of the queue.

Parameters

$item
mixed
$item the item to be appended into the queue
public Iterator
# getIterator( )

Returns an iterator for traversing the items in the queue. This method is required by the interface IteratorAggregate.

Returns an iterator for traversing the items in the queue. This method is required by the interface IteratorAggregate.

Returns

Iterator
an iterator for traversing the items in the queue.

Implementation of

IteratorAggregate::getIterator()
public integer
# getCount( )

Returns the number of items in the queue.

Returns the number of items in the queue.

Returns

integer
the number of items in the queue
public integer
# count( )

Returns the number of items in the queue. This method is required by Countable interface.

Returns the number of items in the queue. This method is required by Countable interface.

Returns

integer
number of items in the queue.

Implementation of

Countable::count()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Magic properties summary
public Iterator $iterator
#

An iterator for traversing the items in the queue.

An iterator for traversing the items in the queue.

public integer $count
#

The number of items in the queue.

The number of items in the queue.

API documentation generated by ApiGen 2.8.0