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 ¶
- type FixQueue
- type FixedQueueFloat
- func (m *FixedQueueFloat) Avg() (avg float64, count int)
- func (m *FixedQueueFloat) Page(begin, limit int) []float64
- func (m *FixedQueueFloat) Push(e float64)
- func (m *FixedQueueFloat) Reset()
- func (m *FixedQueueFloat) SetSize(maxLines int)
- func (m *FixedQueueFloat) Size() int
- func (m *FixedQueueFloat) Sum() (sum float64, count int)
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 (*FixQueue[G]) Push ¶
func (m *FixQueue[G]) Push(e *G)
*
- @description: 压入数据
- @param {*EventLog} e
- @return {*}
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 {*}
Click to show internal directories.
Click to hide internal directories.