Packagesystem.data.queues
Classpublic class LinearQueue
InheritanceLinearQueue Inheritance ArrayCollection Inheritance Object
Implements Queue
Subclasses PriorityQueue

LinearQueue is a collection and stores values in a 'first-in, first-out' manner.

Example :

     import system.data.queues.LinearQueue ;
     
     var q:LinearQueue = new LinearQueue(["item0", "item1"]) ;
     
     trace ("queue size : " + q.size()) ;
     trace ("enqueue item2 : " + q.enqueue ("item2")) ;
     trace ("enqueue item3 : " + q.enqueue ("item3")) ;
     trace ("enqueue item4 : " + q.enqueue ("item4")) ;
     
     trace ("------- element") ;
     trace ("element : " + q.element()) ;
     trace ("peek : " + q.peek()) ;
     
     trace ("------- dequeue") ;
     trace ("dequeue : " + q.dequeue()) ;
     
     trace ("------- iterator") ;
     var it = q.iterator() ;
     while (it.hasNext()) 
     {
         trace (it.next()) ;
     }
     
     trace ("queue size : " + q.size() ) ;
     trace ("queue toSource : " + q.toSource()) ;
     



Public Methods
 MethodDefined By
  
LinearQueue(init:* = null)
Creates a new LinearQueue instance.
LinearQueue
 Inherited
add(o:*):Boolean
Inserts an element in the collection.
ArrayCollection
 Inherited
addAll(c:Collection):Boolean
Appends all of the elements in the specified collection to the end of this Collection, in the order that they are returned by the specified collection's iterator (optional operation).
ArrayCollection
 Inherited
clear():void
Removes all elements in the collection.
ArrayCollection
  
clone():*
[override] Returns a shallow copy of this collection (optional operation).
LinearQueue
 Inherited
contains(o:*):Boolean
Returns true if this collection contains the specified element.
ArrayCollection
 Inherited
Returns true if this collection contains all of the elements of the specified collection.
ArrayCollection
  
dequeue():Boolean
Retrieves and removes the head of this queue.
LinearQueue
  
Retrieves, but does not remove, the head of this queue.
LinearQueue
  
enqueue(o:*):Boolean
Inserts the specified element into this queue, if possible.
LinearQueue
 Inherited
equals(o:*):Boolean
Compares the specified object with this object for equality.
ArrayCollection
 Inherited
get(key:*):*
Returns the element from this collection at the passed key index.
ArrayCollection
 Inherited
indexOf(o:*, fromIndex:uint = 0):int
Returns the index of an element in the collection.
ArrayCollection
 Inherited
isEmpty():Boolean
Returns true if this collection contains no elements.
ArrayCollection
 Inherited
Returns the iterator reference of the object.
ArrayCollection
  
peek():*
Retrieves, but does not remove, the head of this queue, returning null if this queue is empty.
LinearQueue
  
poll():*
Retrieves and removes the head of this queue.
LinearQueue
 Inherited
remove(o:*):*
Removes a single instance of the specified element from this collection, if it is present (optional operation).
ArrayCollection
 Inherited
Removes from this Collection all the elements that are contained in the specified Collection (optional operation).
ArrayCollection
 Inherited
Retains only the elements in this Collection that are contained in the specified Collection (optional operation).
ArrayCollection
 Inherited
size():uint
Returns the number of elements in this collection.
ArrayCollection
 Inherited
toArray():Array
Returns an array containing all of the elements in this collection.
ArrayCollection
 Inherited
toSource(indent:int = 0):String
Returns the source code string representation of the object.
ArrayCollection
 Inherited
toString():String
Returns the string representation of this instance.
ArrayCollection
Constructor Detail
LinearQueue()Constructor
public function LinearQueue(init:* = null)

Creates a new LinearQueue instance.

Parameters
init:* (default = null) — An optional Array or Collection or Iterable object to fill the collection.
Method Detail
clone()method
override public function clone():*

Returns a shallow copy of this collection (optional operation).

Returns
* — a shallow copy of this collection.
dequeue()method 
public function dequeue():Boolean

Retrieves and removes the head of this queue.

Returns
Boolean
element()method 
public function element():*

Retrieves, but does not remove, the head of this queue.

Returns
*
enqueue()method 
public function enqueue(o:*):Boolean

Inserts the specified element into this queue, if possible.

Parameters

o:*

Returns
Boolean
peek()method 
public function peek():*

Retrieves, but does not remove, the head of this queue, returning null if this queue is empty.

Returns
*
poll()method 
public function poll():*

Retrieves and removes the head of this queue.

Returns
*