queue

package
v0.0.0-...-c4df37a Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2021 License: MIT Imports: 1 Imported by: 0

README

Queue

Documentation

Index

Constants

View Source
const MAX_CAPACITY = 1 << 10

Variables

View Source
var (
	ErrorExceededCapacity = errors.New("capacity is exceeded")
	ErrorWrongCapacity    = errors.New("capacity should be in range [1, 1024]")
	ErrorEmptyQueue       = errors.New("the operation can't be permitted on an empty queue")
)

Functions

This section is empty.

Types

type ArrayQueue

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

func NewArrayQueue

func NewArrayQueue(capacity int) (*ArrayQueue, error)

func (*ArrayQueue) Dequeue

func (q *ArrayQueue) Dequeue() (interface{}, error)

func (*ArrayQueue) Enqueue

func (q *ArrayQueue) Enqueue(element interface{}) error

func (*ArrayQueue) IsEmpty

func (q *ArrayQueue) IsEmpty() bool

func (*ArrayQueue) Peek

func (q *ArrayQueue) Peek() (interface{}, error)

func (*ArrayQueue) Size

func (q *ArrayQueue) Size() int

type Queue

type Queue interface {
	Enqueue(element interface{}) error
	Dequeue() (interface{}, error)
	Peek() (interface{}, error)
	IsEmpty() bool
	Size() int
}

Jump to

Keyboard shortcuts

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