priority_queue 
An automatically ordered list, using the cmp proc to weight the list items
Vars | |
| cmp | The weight function used to order the queue |
|---|---|
| my_queue | The actual 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
cmp 
The weight function used to order the queue
my_queue 
The actual queue
Proc Details
Dequeue
Removes and returns the first item in the queue
- Returns: The first
itemin 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
itemat the index, or0if outside the range of the queue
IsEmpty
- Returns:
TRUEif 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
comparertake 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:
TRUEif succesfully removed, otherwiseFALSE
Seek
Finds an item in the list
- Returns: The position of the
item, or0if not found