queue_util

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoundedQueue

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

BoundedQueue 基础有界队列结构

func NewBoundedQueue

func NewBoundedQueue(cap int) *BoundedQueue

NewBoundedQueue 创建有界队列,容量必须为正整数

func (*BoundedQueue) AllValue

func (q *BoundedQueue) AllValue() []string

AllValue 获取 全部元素

func (*BoundedQueue) Cap

func (q *BoundedQueue) Cap() int

Cap 获取队列容量

func (*BoundedQueue) Dequeue

func (q *BoundedQueue) Dequeue() (string, bool)

Dequeue 非阻塞出队,返回元素和是否成功

func (*BoundedQueue) Enqueue

func (q *BoundedQueue) Enqueue(item string) bool

Enqueue 非阻塞入队,返回是否成功

func (*BoundedQueue) IsEmpty

func (q *BoundedQueue) IsEmpty() bool

IsEmpty 是否为空队列

func (*BoundedQueue) IsFull

func (q *BoundedQueue) IsFull() bool

IsFull 是否已满

func (*BoundedQueue) Size

func (q *BoundedQueue) Size() int

Size 当前元素数量

type OverridableCircularQueue

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

OverridableCircularQueue 循环可覆盖队列,非线程安全

func NewOverridableQueue

func NewOverridableQueue(k int) *OverridableCircularQueue

NewOverridableQueue 初始化队列,设置实际存储容量为k

func (*OverridableCircularQueue) AllValue

func (q *OverridableCircularQueue) AllValue() string

AllValue 获取 全部元素

func (*OverridableCircularQueue) DeQueue

func (q *OverridableCircularQueue) DeQueue() bool

DeQueue 出队操作

func (*OverridableCircularQueue) EnQueue

func (q *OverridableCircularQueue) EnQueue(value string)

EnQueue 入队操作(自动覆盖最旧元素)

func (*OverridableCircularQueue) Front

func (q *OverridableCircularQueue) Front() string

Front 获取队首元素

func (*OverridableCircularQueue) IsEmpty

func (q *OverridableCircularQueue) IsEmpty() bool

IsEmpty 检查队列是否为空

func (*OverridableCircularQueue) IsFull

func (q *OverridableCircularQueue) IsFull() bool

IsFull 检查队列是否已满

func (*OverridableCircularQueue) Print

func (q *OverridableCircularQueue) Print()

Print 打印队列状态(调试用)

func (*OverridableCircularQueue) Rear

func (q *OverridableCircularQueue) Rear() string

Rear 获取队尾元素

func (*OverridableCircularQueue) Size

func (q *OverridableCircularQueue) Size() int

Size 获取当前元素数量

Jump to

Keyboard shortcuts

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