| Package | de.polygonal.ds |
| Class | public class PriorityQueue |
| Inheritance | PriorityQueue Object |
| Implements | Collection |
See also
| Property | Defined By | ||
|---|---|---|---|
| front : Prioritizable [read-only]
The front item or null if the heap is empty. | PriorityQueue | ||
| maxSize : int [read-only]
The maximum capacity. | PriorityQueue | ||
| size : int [read-only]
The total number of items. | PriorityQueue | ||
| Method | Defined By | ||
|---|---|---|---|
PriorityQueue(size:int)
Initializes a priority queue with a given size. | PriorityQueue | ||
clear():void
Clears all items. | PriorityQueue | ||
contains(obj:*):Boolean
Determines if the collection contains a given item. | PriorityQueue | ||
Dequeues and returns the front item. | PriorityQueue | ||
dump():String
Prints all elements (for debug/demo purposes only). | PriorityQueue | ||
enqueue(obj:Prioritizable):Boolean
Enqueues a prioritized item. | PriorityQueue | ||
Initializes an iterator object pointing to the first item in the
collection. | PriorityQueue | ||
isEmpty():Boolean
Checks if the collection is empty. | PriorityQueue | ||
remove(obj:Prioritizable):Boolean
Removes an item. | PriorityQueue | ||
reprioritize(obj:Prioritizable, newPriority:int):Boolean
Reprioritizes an item. | PriorityQueue | ||
toArray():Array
Converts the collection into an array. | PriorityQueue | ||
toString():String
Prints out a string representing the current object. | PriorityQueue | ||
| front | property |
front:Prioritizable [read-only] The front item or null if the heap is empty.
public function get front():Prioritizable| maxSize | property |
maxSize:int [read-only] The maximum capacity.
public function get maxSize():int| size | property |
size:int [read-only] The total number of items.
public function get size():int| PriorityQueue | () | Constructor |
public function PriorityQueue(size:int)Initializes a priority queue with a given size.
Parameterssize:int — The size of the priority queue.
|
| clear | () | method |
public function clear():voidClears all items.
| contains | () | method |
public function contains(obj:*):BooleanDetermines if the collection contains a given item.
Parameters
obj:* — The item to search for.
|
Boolean — True if the item exists, otherwise false.
|
| dequeue | () | method |
public function dequeue():PrioritizableDequeues and returns the front item. This is always the item with the highest priority.
ReturnsPrioritizable — The queue's front item or null if the heap is empty.
|
| dump | () | method |
public function dump():StringPrints all elements (for debug/demo purposes only).
ReturnsString |
| enqueue | () | method |
public function enqueue(obj:Prioritizable):BooleanEnqueues a prioritized item.
Parameters
obj:Prioritizable — The prioritized data.
|
Boolean — False if the queue is full, otherwise true.
|
| getIterator | () | method |
public function getIterator():IteratorInitializes an iterator object pointing to the first item in the collection.
ReturnsIterator — An iterator object.
|
| isEmpty | () | method |
public function isEmpty():BooleanChecks if the collection is empty.
ReturnsBoolean — True if empty, otherwise false.
|
| remove | () | method |
public function remove(obj:Prioritizable):BooleanRemoves an item.
Parameters
obj:Prioritizable — The item to remove.
|
Boolean — True if removal succeeded, otherwise false.
|
| reprioritize | () | method |
public function reprioritize(obj:Prioritizable, newPriority:int):BooleanReprioritizes an item.
Parameters
obj:Prioritizable — The object whose priority is changed.
| |
newPriority:int — The new priority.
|
Boolean — True if the repriorization succeeded, otherwise false.
|
| toArray | () | method |
public function toArray():ArrayConverts the collection into an array.
ReturnsArray — An array.
|
| toString | () | method |
public function toString():StringPrints out a string representing the current object.
ReturnsString — A string representing the current object.
|