Packagede.polygonal.ds
Classpublic class LinkedQueue
InheritanceLinkedQueue Inheritance Object
Implements Collection

A queue based on a linked list. It's basically a wrapper class for a linked list to provide FIFO-like access.

See also

ArrayedQueue


Public Properties
 PropertyDefined By
  size : int
[read-only] The total number of items.
LinkedQueue
Public Methods
 MethodDefined By
  
Initializes a new queue.
LinkedQueue
  
back():*
Indicates the most recently added item.
LinkedQueue
  
clear():void
Clears all items.
LinkedQueue
  
contains(obj:*):Boolean
Determines if the collection contains a given item.
LinkedQueue
  
Dequeues and returns the front item.
LinkedQueue
  
dump():String
Prints out all elements (for debug/demo purposes).
LinkedQueue
  
enqueue(obj:*):void
Enqueues some data.
LinkedQueue
  
Initializes an iterator object pointing to the first item in the collection.
LinkedQueue
  
isEmpty():Boolean
Checks if the collection is empty.
LinkedQueue
  
peek():*
Indicates the front item.
LinkedQueue
  
toArray():Array
Converts the collection into an array.
LinkedQueue
  
toString():String
Prints out a string representing the current object.
LinkedQueue
Property Detail
sizeproperty
size:int  [read-only]

The total number of items.


Implementation
    public function get size():int
Constructor Detail
LinkedQueue()Constructor
public function LinkedQueue(list:SLinkedList = null)

Initializes a new queue. You can pass an existing singly linked list to provide queue-like access.

Parameters
list:SLinkedList (default = null) — An existing list to become the queue.
Method Detail
back()method
public function back():*

Indicates the most recently added item.

Returns
* — The last item in the queue or null if the queue is empty.
clear()method 
public function clear():void

Clears all items.

contains()method 
public function contains(obj:*):Boolean

Determines if the collection contains a given item.

Parameters

obj:* — The item to search for.

Returns
Boolean — True if the item exists, otherwise false.
dequeue()method 
public function dequeue():*

Dequeues and returns the front item.

Returns
* — The front item or null if the queue is empty.
dump()method 
public function dump():String

Prints out all elements (for debug/demo purposes).

Returns
String — A human-readable representation of the structure.
enqueue()method 
public function enqueue(obj:*):void

Enqueues some data.

Parameters

obj:* — The data to enqueue.

getIterator()method 
public function getIterator():Iterator

Initializes an iterator object pointing to the first item in the collection.

Returns
Iterator — An iterator object.
isEmpty()method 
public function isEmpty():Boolean

Checks if the collection is empty.

Returns
Boolean — True if empty, otherwise false.
peek()method 
public function peek():*

Indicates the front item.

Returns
* — The front item or null if the queue is empty.
toArray()method 
public function toArray():Array

Converts the collection into an array.

Returns
Array — An array.
toString()method 
public function toString():String

Prints out a string representing the current object.

Returns
String — A string representing the current object.