queueUtils

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCircularQueue = errors.New("circular queue: failed")

Functions

This section is empty.

Types

type CircularQueue

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

CircularQueue *****************************************************

  • @Description: 底层基于切片实现的固定容量大小的FIFO的环形队列 *****************************************************

func New

func New(capacity int) *CircularQueue

func (*CircularQueue) At

func (c *CircularQueue) At(i int) (interface{}, error)

At *****************************************************

  • @Description: 获取第i个元素
  • @receiver c
  • @param i
  • @return interface{}
  • @return error *****************************************************

func (*CircularQueue) Back

func (c *CircularQueue) Back() (interface{}, error)

Back *****************************************************

  • @Description: 获取最后一个数据值
  • @receiver c
  • @return interface{}
  • @return error 如果队列为空,则返回错误 *****************************************************

func (*CircularQueue) Empty

func (c *CircularQueue) Empty() bool

func (*CircularQueue) Front

func (c *CircularQueue) Front() (interface{}, error)

Front *****************************************************

  • @Description: 获取第一个位置的数据
  • @receiver c
  • @return interface{}
  • @return error 如果队列为空,则返回错误 *****************************************************

func (*CircularQueue) Full

func (c *CircularQueue) Full() bool

func (*CircularQueue) PopFront

func (c *CircularQueue) PopFront() (interface{}, error)

PopFront *****************************************************

  • @Description: 抛出第一个数
  • @receiver c
  • @return interface{}
  • @return error 如果队列为空,则返回错误 *****************************************************

func (*CircularQueue) PushBack

func (c *CircularQueue) PushBack(v interface{}) error

PushBack *****************************************************

  • @Description: 在最后面插入数据
  • @receiver c
  • @param v
  • @return error 如果队列满了,则返回错误 *****************************************************

func (*CircularQueue) Size

func (c *CircularQueue) Size() int

Size *****************************************************

  • @Description: 获取队列数量
  • @receiver c
  • @return int *****************************************************

Jump to

Keyboard shortcuts

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