| Package | com.developmentarc.framework.datastructures.utils |
| Class | public class Queue |
| Property | Defined by | ||
|---|---|---|---|
| hasItems : Boolean [read-only]
Used to determine if items are currently stored inside the
Queue.
| Queue | ||
| length : int [read-only]
The number of items currently in the Queue.
| Queue | ||
| Method | Defined by | ||
|---|---|---|---|
|
Queue(direction:String)
Creates a new Queue passing in the direction of Queue.
| Queue | ||
|
add(item:*):void
Adds an item to the Queue.
| Queue | ||
|
addAt(item:*, position:int = -1):void
Adds an item to the Queue at the location specified.
| Queue | ||
|
last():*
This method is used to access the last item in the Queue
depending upon the direction of the Queue.
| Queue | ||
|
next():*
This method is used to access the next item in the Queue
depending upon the direction of the Queue.
| Queue | ||
|
remove(item:*, numberOfItems:int):void
Removes the specfied item from the queue.
| Queue | ||
|
removeAll():void
Removes all items from the queue.
| Queue | ||
|
removeAt(position:int):Boolean
Removes an item at the specified position.
| Queue | ||
| Constant | Defined by | ||
|---|---|---|---|
| FIFO : String = "FIFO" [static]
| Queue | ||
| LIFO : String = "LIFO" [static]
| Queue | ||
| hasItems | property |
hasItems:Boolean [read-only]Used to determine if items are currently stored inside the Queue.
Implementation public function get hasItems():Boolean
| length | property |
length:int [read-only]The number of items currently in the Queue.
Implementation public function get length():int
| Queue | () | constructor |
public function Queue(direction:String)Creates a new Queue passing in the direction of Queue. The default direction is FIFO, accepted values are FIFO and LIFO.
Parametersdirection:String — The order items are removed by the nex() call.
|
| add | () | method |
public function add(item:*):voidAdds an item to the Queue. The order the items are added to the queue is important because this determines the order they are removed when next() is called.
Parametersitem:* — The item to add to the end of the Queue.
|
| addAt | () | method |
public function addAt(item:*, position:int = -1):voidAdds an item to the Queue at the location specified. If the value is less then zero the item is put at the beginning of the queue. If the value is equal to or greater then the length of the Queue then the item is put at the end of the Queue.
Parametersitem:* — The item to add to the Queue.
|
|
position:int (default = -1) — The position to place the item at.
|
| last | () | method |
public function last():*This method is used to access the last item in the Queue depending upon the direction of the Queue. If the Queue is typed FIFO (default) the last item in the Queue, i.e. length -1, is returned. If the the Queue is typed LIFO then the first item in the queue, i.e. position 0, is returned.
Returns* — The last item in the Queue dependent upon the direction.
|
| next | () | method |
public function next():*This method is used to access the next item in the Queue depending upon the direction of the Queue. If the Queue is typed FIFO (default) the first item in the Queue, i.e. position 0, is returned. If the the Queue is typed LIFO then the last item in the queue, i.e. position length -1, is returned.
Returns* — The next item in the Queue dependent upon the direction.
|
| remove | () | method |
public function remove(item:*, numberOfItems:int):voidRemoves the specfied item from the queue. If the item is in the Queue more then one time then the numberOfItems value is used to determine how many of the repeated items should be remove. The default is all items are removed from the queue. Passing 1 or more will then determine how many times the item is removed.
The order items are removed depends on the direction of the the Queue. If the Queue is FIFO then the removal starts at the beginning of the Queue to find items to remove. If the Queue is LIFO the method starts at the end of the Queue and works forward.
Parametersitem:* — The item to find and remove.
|
|
numberOfItems:int — The number of instances of the item to remove.
|
| removeAll | () | method |
public function removeAll():voidRemoves all items from the queue.
| removeAt | () | method |
public function removeAt(position:int):BooleanRemoves an item at the specified position. If the position is invalid then a false value is returned stating that the item was not removed at the provided position. If the position is valid the method returns a true for success.
Parametersposition:int — The position in the Queue to remove.
|
Boolean — True for successful removal, false for an invalid position.
|
| FIFO | constant |
public static const FIFO:String = "FIFO"
| LIFO | constant |
public static const LIFO:String = "LIFO"