priority_queue
An automatically ordered list, using the cmp proc to weight the list items
Vars | |
L | The actual queue |
---|---|
cmp | The weight function used to order the queue |
Procs | |
Dequeue | Removes and returns the first item in the queue |
Enqueue | Add an item to the list, immediatly ordering it to its position using dichotomic search |
Get | Gets the item at the positon index |
IsEmpty | |
Length | |
List | |
New | Takes a proc comparer that will be used to compare the items inserted |
ReSort | Resorts the item to its correct position in the queue. |
Remove | Removes an item from the list |
Seek | Finds an item in the list |
Var Details
L
The actual queue
cmp
The weight function used to order the queue
Proc Details
Dequeue
Removes and returns the first item in the queue
- Returns: The first
item
in the queue, otherwiseFALSE
Enqueue
Add an item
to the list, immediatly ordering it to its position using dichotomic search
Get
Gets the item at the positon index
- Returns: The
item
at the index, or0
if outside the range of the queue
IsEmpty
- Returns:
TRUE
if the queue is empty, otherwiseFALSE
Length
- Returns: The length of the queue
List
- Returns: A copy of the item list
New
Takes a proc comparer
that will be used to compare the items inserted
- Param
comparer
take two arguments and return the difference in their weight - For example: /proc/CompareItems(atom/A, atom/B) return A.size - B.size
ReSort
Resorts the item
to its correct position in the queue.
- For example: The queue is sorted based on weight and atom A changes weight after being added
Remove
Removes an item
from the list
- Returns:
TRUE
if succesfully removed, otherwiseFALSE
Seek
Finds an item
in the list
- Returns: The position of the
item
, or0
if not found