A helper class for Minx's hooks implementation. More...
Public Member Functions | |
def | __init__ |
Create an empty priority queue. | |
def | add |
Add an element with specified priority. More... | |
def | max_priority |
Return priority of highest-priority item in priority queue. More... | |
def | min_priority |
Return priority of lowest-priority item in priority queue. More... | |
def | __iter__ |
Iterator interface to priority queue. More... | |
A helper class for Minx's hooks implementation.
This class implements a priority queue that the hooks class can use to prioritize its hook function lists.
def minx.core.hooks.priority_queue.__iter__ | ( | self) |
Iterator interface to priority queue.
This function returns an iterator for accessing the priority queue's elements in order of descending priority.
def minx.core.hooks.priority_queue.add | ( | self, | |
v, | |||
p | |||
) |
Add an element with specified priority.
v | The value to be added to the priority queue. |
p | The priority of the value to be added. |
This function adds v with priority p to the priority queue. This function does not perform any checks on the value of p, requiring its caller to implement appropriate policies regarding priorities.
If the priority queue already contains v, it will not be added again. Thus, clients can make repeated calls to this function with the same value without having to worry about creating duplicate entries.
def minx.core.hooks.priority_queue.max_priority | ( | self) |
Return priority of highest-priority item in priority queue.
If the priority queue is empty, this function will return -1.
def minx.core.hooks.priority_queue.min_priority | ( | self) |
Return priority of lowest-priority item in priority queue.
If the priority queue is empty, this function will return -1.