container

package
v0.0.0-...-2f8f7b3 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROBABILITY = 0.25
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BitMap

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

一个uint64有64位可以保存64个数字 length代表bits切片长度, 保存的数字范围[0, length*64-1]

func NewBitMap

func NewBitMap(len int) *BitMap

func (*BitMap) Clear

func (b *BitMap) Clear()

func (*BitMap) IsExist

func (b *BitMap) IsExist(num int) bool

func (*BitMap) Len

func (b *BitMap) Len() int

func (*BitMap) Numbers

func (b *BitMap) Numbers() []int

func (*BitMap) Remove

func (b *BitMap) Remove(num int)

func (*BitMap) Set

func (b *BitMap) Set(num int)

func (*BitMap) String

func (b *BitMap) String() string

type ISet

type ISet interface {
	Add(key interface{})
	Remove(key interface{})
	Contains(key interface{}) bool
	ForEach(func(key interface{}) bool)
	ToArray() []interface{}
	Len() int
	Clear()
	IsEmpty() bool
}

type SetAny

type SetAny map[interface{}]struct{}

func (SetAny) Add

func (s SetAny) Add(key interface{})

func (SetAny) Clear

func (s SetAny) Clear()

func (SetAny) Contains

func (s SetAny) Contains(key interface{}) bool

func (SetAny) ForEach

func (s SetAny) ForEach(f func(key interface{}) bool)

func (SetAny) IsEmpty

func (s SetAny) IsEmpty() bool

func (SetAny) Len

func (s SetAny) Len() int

func (SetAny) Remove

func (s SetAny) Remove(key interface{})

func (SetAny) ToArray

func (s SetAny) ToArray() []interface{}

type SetInt

type SetInt map[int]struct{}

func (SetInt) Add

func (s SetInt) Add(key int)

==============================================================================

func (SetInt) Clear

func (s SetInt) Clear()

func (SetInt) Contains

func (s SetInt) Contains(key int) bool

func (SetInt) Len

func (s SetInt) Len() int

func (SetInt) Remove

func (s SetInt) Remove(key int)

func (SetInt) ToArray

func (s SetInt) ToArray() []int

type SetStr

type SetStr map[string]struct{}

func (SetStr) Add

func (s SetStr) Add(key string)

==============================================================================

func (SetStr) Clear

func (s SetStr) Clear()

func (SetStr) Contains

func (s SetStr) Contains(key string) bool

func (SetStr) Len

func (s SetStr) Len() int

func (SetStr) Remove

func (s SetStr) Remove(key string)

func (SetStr) ToArr

func (s SetStr) ToArr() []string

type SetUInt64

type SetUInt64 map[uint64]struct{}

func (SetUInt64) Add

func (s SetUInt64) Add(key uint64)

=====================================================================================

func (SetUInt64) Clear

func (s SetUInt64) Clear()

func (SetUInt64) Contains

func (s SetUInt64) Contains(key uint64) bool

func (SetUInt64) Len

func (s SetUInt64) Len() int

func (SetUInt64) Remove

func (s SetUInt64) Remove(key uint64)

func (SetUInt64) ToArray

func (s SetUInt64) ToArray() []uint64

type SkipList

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

========================================================================== 定义跳表

func NewSkipList

func NewSkipList(level int) *SkipList

func (*SkipList) Delete

func (s *SkipList) Delete(index uint64)

func (*SkipList) ForEach

func (s *SkipList) ForEach(f func(node *SkipNode) bool)

func (*SkipList) Insert

func (s *SkipList) Insert(index uint64, value interface{})

func (*SkipList) Length

func (s *SkipList) Length() int32

func (*SkipList) Level

func (s *SkipList) Level() int

func (*SkipList) Search

func (s *SkipList) Search(index uint64) (*SkipNode, bool)

func (*SkipList) SearchRagne

func (s *SkipList) SearchRagne(minIndex, maxIndex uint64) ([]*SkipNode, bool)

func (*SkipList) Snapshot

func (s *SkipList) Snapshot() []*SkipNode

type SkipNode

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

定义跳表节点

func (*SkipNode) Index

func (s *SkipNode) Index() uint64

func (*SkipNode) Value

func (s *SkipNode) Value() interface{}

Directories

Path Synopsis
此文件实现了线程安全一个队列和线程安全一个双链表
此文件实现了线程安全一个队列和线程安全一个双链表

Jump to

Keyboard shortcuts

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