fixedqueue

package
v0.0.0-...-212a885 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

* @Author: Wangjun * @Date: 2023-02-27 14:48:23 * @LastEditTime: 2023-02-27 14:58:43 * @LastEditors: Wangjun * @Description: * @FilePath: \golib\fixedqueue\queue.go * hnxr

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FixQueue

type FixQueue[G any] struct {
	Pos uint //当前队列位置
	Idx uint //累加器
	// contains filtered or unexported fields
}

固定大小的队列

func NewFixQueue

func NewFixQueue[G any](size int) *FixQueue[G]

*

  • @description: 新建一个固定大小的队列
  • @return {*}

func (*FixQueue[G]) Page

func (m *FixQueue[G]) Page(begin, limit int) []*G

func (*FixQueue[G]) Push

func (m *FixQueue[G]) Push(e *G)

*

  • @description: 压入数据
  • @param {*EventLog} e
  • @return {*}

func (*FixQueue[G]) SetSize

func (m *FixQueue[G]) SetSize(maxLines int)

*

  • @description: 初始化队列的最大值
  • @param {int} maxLines
  • @return {*}

func (*FixQueue[G]) Size

func (m *FixQueue[G]) Size() int

*

  • @description: 获取队列数据大小
  • @param {*}
  • @return {*}

func (*FixQueue[G]) Write

func (m *FixQueue[G]) Write(b []byte) (n int, err error)

Write .

type FixedQueueFloat

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

func NewFixedQueueFloat

func NewFixedQueueFloat(size int) *FixedQueueFloat

*

  • @description: 新建一个定长队列,只有写,没有读的数据
  • @param {int} size
  • @return {*}

func (*FixedQueueFloat) Avg

func (m *FixedQueueFloat) Avg() (avg float64, count int)

*

  • @description: 求平均值
  • @param {*}
  • @return {*}

func (*FixedQueueFloat) Page

func (m *FixedQueueFloat) Page(begin, limit int) []float64

*

  • @description: 倒序查找
  • @param {*} begin
  • @param {int} limit
  • @return {*}

func (*FixedQueueFloat) Push

func (m *FixedQueueFloat) Push(e float64)

*

  • @description: 压入数据
  • @param {*EventLog} e
  • @return {*}

func (*FixedQueueFloat) Reset

func (m *FixedQueueFloat) Reset()

*

  • @description: 复位
  • @param {*}
  • @return {*}

func (*FixedQueueFloat) SetSize

func (m *FixedQueueFloat) SetSize(maxLines int)

*

  • @description: 初始化队列的最大值
  • @param {int} maxLines
  • @return {*}

func (*FixedQueueFloat) Size

func (m *FixedQueueFloat) Size() int

*

  • @description: 获取队列数据大小
  • @param {*}
  • @return {*}

func (*FixedQueueFloat) Sum

func (m *FixedQueueFloat) Sum() (sum float64, count int)

*

  • @description:求和
  • @param {*}
  • @return {*}

Jump to

Keyboard shortcuts

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