priority_queue

package
v0.0.0-...-baa1297 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PriorityQueue

type PriorityQueue struct {
	// contains filtered or unexported fields
}

PriorityQueue represents a task priority queue.

func NewPriorityQueue

func NewPriorityQueue() *PriorityQueue

NewPriorityQueue creates a new PriorityQueue.

func (*PriorityQueue) Len

func (pq *PriorityQueue) Len() int

Len returns the number of items in the priority queue.

func (*PriorityQueue) Less

func (pq *PriorityQueue) Less(i, j int) bool

Less compares the priority of two tasks in the priority queue.

func (*PriorityQueue) Peek

func (pq *PriorityQueue) Peek() *task.Task

Peek returns the highest-priority item from the priority queue without removing it.

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

Pop removes the highest-priority item from the priority queue.

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

Push adds an item to the priority queue.

func (*PriorityQueue) Remove

func (pq *PriorityQueue) Remove(t *task.Task)

Remove removes a specific task from the priority queue.

func (*PriorityQueue) Swap

func (pq *PriorityQueue) Swap(i, j int)

Swap swaps two tasks in the priority queue.

func (*PriorityQueue) UpdatePriority

func (pq *PriorityQueue) UpdatePriority(t *task.Task, newPriority task.Priority)

UpdatePriority updates the priority of a specific task in the priority queue.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL