coll

package
v0.0.0-...-4873089 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CycleQueue

type CycleQueue struct {
	Mutex    sync.Mutex
	Attach   interface{}
	Nodes    []interface{}
	Capacity int
	Counting int
}

CycleQueue is a basic FIFO queue based on a circular list.

func NewCycleQueue

func NewCycleQueue(capacity int) *CycleQueue

NewCycleQueue ...

func (*CycleQueue) Add

func (q *CycleQueue) Add(n interface{})

Add adds a node to the cycle queue.

func (*CycleQueue) FetchAll

func (q *CycleQueue) FetchAll(index int) ([]interface{}, int)

FetchAll ...

type FifoQueue

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

FifoQueue is a head-tail linked list data structure implementation. It is based on a doubly linked list container, so that every operations time complexity is O(1).

every operations over an instiated Deque are synchronized and safe for concurrent usage.

func NewFifoQueue

func NewFifoQueue(capacity int) *FifoQueue

NewFifoQueue creates a Deque with the specified capacity limit.

func (*FifoQueue) Append

func (s *FifoQueue) Append(item interface{}) bool

Append inserts element at the back of the Deque in a O(1) time complexity, returning true if successful or false if the deque is at capacity.

func (*FifoQueue) Capacity

func (s *FifoQueue) Capacity() int

Capacity returns the capacity

func (*FifoQueue) Empty

func (s *FifoQueue) Empty() bool

Empty checks if the deque is empty

func (*FifoQueue) First

func (s *FifoQueue) First() interface{}

First returns the first value stored in the deque in a O(1) time complexity

func (*FifoQueue) Full

func (s *FifoQueue) Full() bool

Full checks if the deque is full

func (*FifoQueue) Last

func (s *FifoQueue) Last() interface{}

Last returns the last value stored in the deque in a O(1) time complexity

func (*FifoQueue) Pop

func (s *FifoQueue) Pop() interface{}

Pop removes the last element of the deque in a O(1) time complexity

func (*FifoQueue) Shift

func (s *FifoQueue) Shift() interface{}

Shift removes the first element of the deque in a O(1) time complexity

func (*FifoQueue) Size

func (s *FifoQueue) Size() int

Size ...

type MultiMap

type MultiMap struct {
	M map[interface{}][]interface{}
}

MultiMap 多值map

func MakeMultiMap

func MakeMultiMap() *MultiMap

MakeMultiMap 创建一个MultiMap

func (*MultiMap) Delete

func (m *MultiMap) Delete(k interface{})

Delete 删除k

func (*MultiMap) Get

func (m *MultiMap) Get(k interface{}) (v []interface{}, ok bool)

Get 根据k或者v,ok

func (*MultiMap) Put

func (m *MultiMap) Put(k, v interface{})

Put 加入k,v

Jump to

Keyboard shortcuts

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