Class Table Of Contents

- All Classes
- All Files
- API
  - comb
    - logging
      - PropertyConfigurator
      - Level
      - BasicConfigurator
      - Logger
      - appenders
        - RollingFileAppender
        - ConsoleAppender
        - Appender
        - FileAppender
        - JSONAppender
    - PromiseList
    - Promise
    - regexp
    - array
    - string
    - collections
      - Pool
      - Iterable
      - HashTable
      - MaxHeap
      - Heap
      - Stack
      - AVLTree
      - AnderssonTree
      - Collection
      - RedBlackTree
      - Tree
      - Queue
      - BinaryTree
      - PriorityQueue
      - MinHeap
    - plugins
      - Middleware
      - Broadcaster
    - number
    - characters
    - date
- comb.collections.Queue
- Properties
  - count
  - isEmpty
  - values
- Methods
  - clear
  - contains
  - dequeue
  - enqueue
  - peek
  - remove

# Class comb.collections.Queue

Extends comb.collections.Collection.

FIFO Data structure

Defined in: Queue.js.

Methods borrowed from class comb.collections.Collection:
  concat, indexOf, join, lastIndexOf, slice, toString

Class Detail
comb.collections.Queue()
Field Detail
{Number} count
the current number of elements in this queue
{Boolean} isEmpty
true if this queue is empty
{Array} values
a copy of the values contained in this queue
Method Detail
clear()
Removes all items from this queue

    this.__queue.length = 0;
    this.__next = 0;
    this.__last = 0;

{Boolean} contains(obj)
Determine if this queue contains the element

Parameters:
{*} obj
  the object to find

Returns:
  {Boolean} true if this queue contains the element

    return this.__queue.indexOf(obj) != -1;

{*} dequeue()
Removes first item from the head of the queue

Returns:
  {*} The element removed from this queue. Returns undefined if the queue is empty.

    var ret = undefined,next = this.__next, queue;
    if (next != this.__last) {
        queue = this.__queue;
        ret = queue[next];
        queue[this.__next++] = undefined;
    }
    return ret;

enqueue(data)
Add data to this queue

Parameters:
{*} data
  element to add

    this.__queue[this.__last++] = data;

{*} peek()
Retrieves the item at the head of the queue without removing it

Returns:
  {*} The element at the head of the queue. Returns undefined if the queue is empty.

    var ret = undefined, next = this.__next;
    if (next != this.__last) {
        ret = this.__queue[next];
    }
    return ret;

{Boolean} remove(obj)
Removes an element from this queue.

Parameters:
{*} obj
  the data to remove.

Returns:
  {Boolean} true if the element was removed, false otherwise.

    var index = this.__queue.indexOf(obj), ret = false;
    if (index != -1) {
        if (index == this.__next) {
            this.dequeue();
        } else {
            this.__queue.splice(index, 1);
            this.__last--;
        }
        ret = true;
    }
    return ret;

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Jan 31 2012 16:14:12 GMT-0600 (CST)