deque

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: 0

Documentation

Overview

Package deque implement a fixed size thread safe queue as a generalization of both queue and stack

Index

Constants

View Source
const (
	Default_Deque_Size = 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Deque

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

Deque implement a queue as a generalization of both queue and stack

func NewDeque

func NewDeque(size int) *Deque

a fixed size deque

func (*Deque) Cap

func (q *Deque) Cap() int

return the max capacity of deque

func (*Deque) Contains

func (q *Deque) Contains(value interface{}) bool

check if the deque contain the given value

func (*Deque) Count

func (q *Deque) Count(value interface{}) int

count the given value in the deque

func (*Deque) GetAll

func (q *Deque) GetAll() []interface{}

get all values from deque

func (*Deque) GetLeft

func (q *Deque) GetLeft() interface{}

get a item from left

func (*Deque) GetRight

func (q *Deque) GetRight() interface{}

get a item from right

func (*Deque) Len

func (q *Deque) Len() int

return the data length of deque

func (*Deque) PopLeft

func (q *Deque) PopLeft() interface{}

pop a item from left

func (*Deque) PopRight

func (q *Deque) PopRight() interface{}

pop a item from right

func (*Deque) Purge

func (q *Deque) Purge()

clear the deque

func (*Deque) PushLeft

func (q *Deque) PushLeft(item interface{}) (evicted bool)

push a new item into deque from left

func (*Deque) PushRight

func (q *Deque) PushRight(item interface{}) (evicted bool)

push a new item into deque from right

func (*Deque) Remove

func (q *Deque) Remove(value interface{})

remove the first occurrence of value

func (*Deque) Reverse

func (q *Deque) Reverse()

reverse the deque

func (*Deque) Rotate

func (q *Deque) Rotate(step int)

rotate the deque n steps to the right

Jump to

Keyboard shortcuts

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