Version: v0.4.0 Latest Latest

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

Go to latest
Published: Jul 19, 2021 License: Apache-2.0 Imports: 1 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type CompareFunc

type CompareFunc func(a Item, b Item) bool

CompareFunc is a function to sort nodes in a queue

type Item

type Item interface {
	DeepCopy() Item
	Equals(Item) bool
	Priority() int

Item is an interface for the nodes to be stored in a queue

type IteratorFunc

type IteratorFunc func(Item)

IteratorFunc is a function to be used for each item in the queue

type SortedUniqueList

type SortedUniqueList struct {
	// contains filtered or unexported fields

SortedUniqueList is a kind of priority queues, whose nodes are sorted Also, uniqueness of the node is guaranteed

func NewSortedUniqueQueue

func NewSortedUniqueQueue(compareFunc CompareFunc) *SortedUniqueList

NewSortedUniqueQueue is a constructor for the SortedUniqueList

func (*SortedUniqueList) Add

func (q *SortedUniqueList) Add(item Item)

Add a node to the SortedUniqueList

func (*SortedUniqueList) Delete

func (q *SortedUniqueList) Delete(i Item)

Delete deletes a node from the queue

func (*SortedUniqueList) First

func (q *SortedUniqueList) First() Item

First retrieves the first node in the queue

func (*SortedUniqueList) ForEach

func (q *SortedUniqueList) ForEach(iteratorFunc IteratorFunc)

ForEach runs IteratorFunc for each item in the queue

func (*SortedUniqueList) Len

func (q *SortedUniqueList) Len() int

Len returns the length of the queue

Source Files

Jump to

Keyboard shortcuts

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