Documentation ¶
Index ¶
- Variables
- type CircularQueue
- func (c *CircularQueue) At(i int) (interface{}, error)
- func (c *CircularQueue) Back() (interface{}, error)
- func (c *CircularQueue) Empty() bool
- func (c *CircularQueue) Front() (interface{}, error)
- func (c *CircularQueue) Full() bool
- func (c *CircularQueue) PopFront() (interface{}, error)
- func (c *CircularQueue) PushBack(v interface{}) error
- func (c *CircularQueue) Size() int
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 *****************************************************
Click to show internal directories.
Click to hide internal directories.