queue

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2019 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

Package queue implement a simple fix size FILO queue

Index

Constants

View Source
const (
	Default_Queue_Size = 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

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

a fixed size FILO queue

func NewQueue

func NewQueue(size int) *Queue

NewQueue return a given size queue

func (*Queue) Cap

func (q *Queue) Cap() int

return the queue capacity

func (*Queue) GetHead

func (q *Queue) GetHead() interface{}

Get the item at the head of queue but don't remove it from queue

func (*Queue) GetTail

func (q *Queue) GetTail() interface{}

Get the item at the tail of queue

func (*Queue) IsEmpty

func (q *Queue) IsEmpty() bool

Check if the queue is empty

func (*Queue) IsFull

func (q *Queue) IsFull() bool

Check if the queue is full

func (*Queue) Len

func (q *Queue) Len() int

return the queue length

func (*Queue) Pop

func (q *Queue) Pop() interface{}

Pop a item from queue

func (*Queue) Push

func (q *Queue) Push(item interface{}) (evicted bool)

Push a new item into queue

Jump to

Keyboard shortcuts

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