pool

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package queue implements a FIFO (first in first out) data structure supporting arbitrary types (even a mixture).

Internally it uses a dynamically growing circular slice of blocks, resulting in faster resizes than a simple dynamic array/slice would allow.

Package stack implements a LIFO (last in first out) data structure supporting arbitrary types (even a mixture).

Internally it uses a dynamically growing slice of blocks, resulting in faster resizes than a simple dynamic array/slice would allow.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Priority

type Priority struct {
	Order []Feature
	Worst *Query
	// contains filtered or unexported fields
}

func NewPriority

func NewPriority(order []Feature, limit int) *Priority

func (*Priority) Bottom

func (p *Priority) Bottom(n int) []*Query

func (*Priority) Empty

func (p *Priority) Empty() bool

func (*Priority) Heapify

func (p *Priority) Heapify()

func (*Priority) Len

func (p *Priority) Len() int

sort.Interface

func (*Priority) Pop

func (p *Priority) Pop() (*Query, bool)

func (*Priority) Push

func (p *Priority) Push(pat *Query)

func (*Priority) Top

func (p *Priority) Top(n int) []*Query

func (*Priority) Values

func (p *Priority) Values() []*Query

type Queue

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

First in, first out data structure.

func NewQueue

func NewQueue() *Queue

Creates a new, empty queue.

func (*Queue) Empty

func (q *Queue) Empty() bool

Checks whether the queue is empty.

func (*Queue) Len

func (q *Queue) Len() (size int)

Returns the number of elements in the queue.

func (*Queue) Pop

func (q *Queue) Pop() (res *search.Query, ok bool)

Pops out an element from the queue. Note, no bounds checking are done.

func (*Queue) Push

func (q *Queue) Push(data *search.Query)

Pushes a new element into the queue, expanding it if necessary.

func (*Queue) Values

func (q *Queue) Values() []*search.Query

Returns all values in an array

type Stack

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

Last in, first out data structure.

func NewStack

func NewStack() *Stack

Creates a new, empty stack.

func (*Stack) Empty

func (s *Stack) Empty() bool

Checks whether the stack is empty or not.

func (*Stack) Len

func (s *Stack) Len() int

Returns the number of elements in the stack.

func (*Stack) Pop

func (s *Stack) Pop() (res *search.Query, ok bool)

Pops a value off the stack and returns it. Currently no shrinking is done.

func (*Stack) Push

func (s *Stack) Push(data *search.Query)

Pushes a value onto the stack, expanding it if necessary.

func (*Stack) Values

func (s *Stack) Values() []*search.Query

Returns all values in an array

Jump to

Keyboard shortcuts

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