| Package | system.data.queues |
| Class | public class CircularQueue |
| Inheritance | CircularQueue Object |
| Implements | Boundable, Queue |
Example :
import system.data.Iterator ;
import system.datas.queues.CircularQueue ;
var q:CircularQueue = new CircularQueue(5) ;
trace ("maxSize : " + q.maxSize()) ;
trace ("enqueue item1 : " + q.enqueue ("item1")) ;
trace ("enqueue item2 : " + q.enqueue ("item2")) ;
trace ("enqueue item3 : " + q.enqueue ("item3")) ;
trace ("enqueue item4 : " + q.enqueue ("item4")) ;
trace ("enqueue item5 : " + q.enqueue ("item5")) ;
trace ("enqueue item6 : " + q.enqueue ("item6")) ;
trace ("element : " + q.element()) ;
trace ("dequeue : " + q.dequeue()) ;
trace ("element : " + q.element()) ;
trace ("size : " + q.size()) ;
trace ("isFull : " + q.isFull()) ;
trace ("array : " + q.toArray()) ;
trace("") ;
trace ("queue : " + q) ;
trace("") ;
trace ("dequeue : " + q.dequeue()) ;
trace ("enqueue item6 : " + q.enqueue("item6")) ;
trace ("enqueue item7 : " + q.enqueue("item7")) ;
trace ("peek : " + q.peek()) ;
trace ("size : " + q.size()) ;
trace ("isFull : " + q.isFull()) ;
trace("") ;
trace ("q : " + q) ;
trace ("------- clone") ;
var clone:CircularQueue = q.clone() ;
trace ("dequeue clone : " + clone.dequeue()) ;
trace ("enqueue clone item8 : " + clone.enqueue("item8")) ;
trace ("original queue : " + q) ;
trace ("clone queue : " + clone) ;
trace ("clone iterator :") ;
var i:Iterator = clone.iterator() ;
while (i.hasNext())
{
trace ("\t+ " + i.next()) ;
}
trace("clone.toSource : " + clone.toSource()) ;
| Property | Defined By | ||
|---|---|---|---|
| MAX_CAPACITY : uint = 4.294967295E9 [static]
The default numbers of elements in the queue. | CircularQueue | ||
| Method | Defined By | ||
|---|---|---|---|
CircularQueue(qSize:uint, elements:Array = null)
Creates a new CircularQueue instance. | CircularQueue | ||
add(o:*):Boolean
Unsupported method in all CircularQueue objects. | CircularQueue | ||
clear():void
Clear all elements in the queue. | CircularQueue | ||
clone():*
Returns a shallow copy of the queue. | CircularQueue | ||
contains(o:*):Boolean
Returns true if the queue contains the object passed in argument. | CircularQueue | ||
dequeue():Boolean
Retreives the first element in the queue object, return a boolean. | CircularQueue | ||
element():*
Returns the value of the first element in the queue. | CircularQueue | ||
enqueue(o:*):Boolean
Enqueue a new element in the queue if the que is not full, return a boolean. | CircularQueue | ||
get(key:*):*
Unsupported method in all CircularQueue objects. | CircularQueue | ||
indexOf(o:*, fromIndex:uint = 0):int
Unsupported method in all CircularQueue objects. | CircularQueue | ||
isEmpty():Boolean
Returns true if the queue is empty. | CircularQueue | ||
isFull():Boolean
Returns true if the queue is full. | CircularQueue | ||
Returns the iterator representation of the queue. | CircularQueue | ||
maxSize():uint
Returns the max number of occurrences in the given queue. | CircularQueue | ||
peek():*
Retrieves, but does not remove, the head of this queue, returning null if this queue is empty. | CircularQueue | ||
poll():*
Retrieves and removes the head of this queue. | CircularQueue | ||
remove(o:*):*
Unsupported method in all CircularQueue objects. | CircularQueue | ||
size():uint
Returns the number of elements in the CircularQueue. | CircularQueue | ||
toArray():Array
Returns the array representation of the CircularQueue. | CircularQueue | ||
toSource(indent:int = 0):String
Returns the source representation of the object. | CircularQueue | ||
toString():String
Returns the string representation of this instance. | CircularQueue | ||
| MAX_CAPACITY | property |
public static var MAX_CAPACITY:uint = 4.294967295E9The default numbers of elements in the queue.
| CircularQueue | () | Constructor |
public function CircularQueue(qSize:uint, elements:Array = null)Creates a new CircularQueue instance.
ParametersqSize:uint (default = NaN) — the max number of element in the queue
| |
elements:Array (default = null) — an array with elements to enqueue in the current stack.
|
| add | () | method |
public function add(o:*):BooleanUnsupported method in all CircularQueue objects.
Parameters
o:* |
Boolean |
IllegalOperationError — the add() method is unsupported in a CircularQueue instance.
|
| clear | () | method |
public function clear():voidClear all elements in the queue.
| clone | () | method |
public function clone():*Returns a shallow copy of the queue.
Returns* — a shallow copy of the queue.
|
| contains | () | method |
public function contains(o:*):Boolean
Returns true if the queue contains the object passed in argument.
Parameters
o:* |
Boolean — true if the queue contains the object passed in argument.
|
| dequeue | () | method |
public function dequeue():BooleanRetreives the first element in the queue object, return a boolean.
ReturnsBoolean — true if the first element in the queue is dequeue.
|
| element | () | method |
public function element():*Returns the value of the first element in the queue.
Returns* — the value of the first element in the queue.
|
| enqueue | () | method |
public function enqueue(o:*):BooleanEnqueue a new element in the queue if the que is not full, return a boolean.
Parameters
o:* |
Boolean |
| get | () | method |
public function get(key:*):*Unsupported method in all CircularQueue objects.
Parameters
key:* |
* |
IllegalOperationError — the get() method is unsupported in a CircularQueue instance.
|
| indexOf | () | method |
public function indexOf(o:*, fromIndex:uint = 0):intUnsupported method in all CircularQueue objects.
Parameters
o:* | |
fromIndex:uint (default = 0) |
int |
IllegalOperationError — the indexOf() method is unsupported in a CircularQueue instance.
|
| isEmpty | () | method |
public function isEmpty():Boolean
Returns true if the queue is empty.
Boolean — true if the queue is empty.
|
| isFull | () | method |
public function isFull():Boolean
Returns true if the queue is full.
Boolean — true if the queue is full.
|
| iterator | () | method |
public function iterator():IteratorReturns the iterator representation of the queue.
ReturnsIterator — the iterator representation of the queue.
|
See also
| maxSize | () | method |
public function maxSize():uintReturns the max number of occurrences in the given queue.
Returnsuint — the max number of occurrences in the given queue.
|
| 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* |
| remove | () | method |
public function remove(o:*):*Unsupported method in all CircularQueue objects.
Parameters
o:* |
* |
IllegalOperationError — the remove() method is unsupported in a CircularQueue instance.
|
| size | () | method |
public function size():uintReturns the number of elements in the CircularQueue.
Returnsuint — the number of elements in the CircularQueue.
|
| toArray | () | method |
public function toArray():ArrayReturns the array representation of the CircularQueue.
ReturnsArray — the array representation of the CircularQueue.
|
| toSource | () | method |
public function toSource(indent:int = 0):StringReturns the source representation of the object.
Parameters
indent:int (default = 0) |
String — the source representation of the object.
|
| toString | () | method |
public function toString():StringReturns the string representation of this instance.
ReturnsString — the string representation of this instance
|