| Package | vegas.data.queue |
| Class | public class CircularQueue |
| Inheritance | CircularQueue CoreObject |
| Implements | BoundedQueue |
Example :
import vegas.data.iterator.Iterator ;
import vegas.data.queue.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 | ||
|
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 | ||
|
copy():*
Returns a deep copy of the queue.
| 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 | ||
![]() |
Returns the internal
ILogger reference of this ILogable object. | CoreObject | |
![]() |
hashCode():uint
Returns a hashcode value for the object.
| CoreObject | |
|
isEmpty():Boolean
Returns
true if the queue is empty. | CircularQueue | ||
|
isFull():Boolean
Returns
true if the queue is full. | CircularQueue | ||
|
Returns the iterator of the queue.
| CircularQueue | ||
|
maxSize():uint
Returns the max number of occurrences in the given queue.
| CircularQueue | ||
|
peek():*
Returns the value of the first element in the queue or
null if the queue is empty. | CircularQueue | ||
|
poll():*
Returns the value of the first element in the queue and remove this value in the queue.
| CircularQueue | ||
![]() |
Sets the internal
ILogger reference of this ILogable object. | CoreObject | |
|
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 a eden 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 — the max number of element in the queue
|
|
elements:Array (default = null) — an array with elements to enqueue in the current stack.
|
| 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.
o:* |
Boolean — true if the queue contains the object passed in argument.
|
| copy | () | method |
public function copy():*Returns a deep copy of the queue.
Returns* — a deep copy of the queue.
|
| 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.
Parameterso:* |
Boolean |
| 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 of the queue.
See vegas.data.iterator.ProtectedIterator
Iterator —
the iterator of the queue.
|
| 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():*
Returns the value of the first element in the queue or null if the queue is empty.
* — the value of the first element in the queue or null if the queue is empty.
|
| poll | () | method |
public function poll():*Returns the value of the first element in the queue and remove this value in the queue.
Returns* — the value of the first element in the queue and remove this value in the queue.
|
| 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 override function toSource(indent:int = 0):StringReturns a eden representation of the object.
Parametersindent:int (default = 0) |
String — a string representation the source code of the object.
|
| toString | () | method |
public override function toString():StringReturns the string representation of this instance.
ReturnsString — the string representation of this instance
|