container

package
v0.0.0-...-9853328 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeapMax = true
	HeapMin = false
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayRing

type ArrayRing[T any] struct {
	// contains filtered or unexported fields
}

func (*ArrayRing[T]) Cap

func (queue *ArrayRing[T]) Cap() int

func (*ArrayRing[T]) Dequeue

func (queue *ArrayRing[T]) Dequeue() error

func (*ArrayRing[T]) Empty

func (queue *ArrayRing[T]) Empty() bool

func (*ArrayRing[T]) Enqueue

func (queue *ArrayRing[T]) Enqueue(v T) error

func (*ArrayRing[T]) Front

func (queue *ArrayRing[T]) Front() (T, bool)

func (*ArrayRing[T]) Full

func (queue *ArrayRing[T]) Full() bool

type ArrayStack

type ArrayStack[T any] struct {
	// contains filtered or unexported fields
}

func NewStack

func NewStack[T any](cap int) *ArrayStack[T]

func (*ArrayStack[T]) Cap

func (s *ArrayStack[T]) Cap() int

func (*ArrayStack[T]) Clear

func (s *ArrayStack[T]) Clear()

func (*ArrayStack[T]) Empty

func (s *ArrayStack[T]) Empty() bool

func (*ArrayStack[T]) Full

func (s *ArrayStack[T]) Full() bool

func (*ArrayStack[T]) Iter

func (s *ArrayStack[T]) Iter() []T

func (*ArrayStack[T]) Len

func (s *ArrayStack[T]) Len() int

func (*ArrayStack[T]) Pop

func (s *ArrayStack[T]) Pop() error

func (*ArrayStack[T]) Push

func (s *ArrayStack[T]) Push(v T) error

func (*ArrayStack[T]) Top

func (s *ArrayStack[T]) Top() (T, error)

type Bitmap

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

func NewBitmap

func NewBitmap(cap int, expand ...bool) *Bitmap

func (*Bitmap) Chcek

func (bm *Bitmap) Chcek(n int) bool

func (*Bitmap) Set

func (bm *Bitmap) Set(n int)

func (*Bitmap) Unset

func (bm *Bitmap) Unset(n int)

type BloomFilter

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

func NewBloomFilter

func NewBloomFilter(size, round int) *BloomFilter

func (*BloomFilter) Check

func (filter *BloomFilter) Check(v string) bool

func (*BloomFilter) Set

func (filter *BloomFilter) Set(v string)

type DelayQueue

type DelayQueue[T any] struct {
	// contains filtered or unexported fields
}

func NewDelayQueue

func NewDelayQueue[T any]() *DelayQueue[T]

func (*DelayQueue[T]) Channel

func (queue *DelayQueue[T]) Channel(ctx context.Context, size int) <-chan T

func (*DelayQueue[T]) Push

func (queue *DelayQueue[T]) Push(value T, delay time.Duration)

func (*DelayQueue[T]) Take

func (queue *DelayQueue[T]) Take(ctx context.Context) (T, bool)

type Deque

type Deque[T any] interface {
	Queue[T]
	Back() (T, bool)
	EnqueueFront(v T) error
	DequeueBack() error
}

func NewListDeque

func NewListDeque[T any](cap ...int) Deque[T]

type DoubleLinkedList

type DoubleLinkedList[T any] interface {
	PushFront(v T) ListNode[T]
	PushBack(v T) ListNode[T]
	PopFront() ListNode[T]
	PopBack() ListNode[T]
	Find(n int) ListNode[T]
	Remove(node ListNode[T])
	Front() ListNode[T]
	Back() ListNode[T]
	Size() int
}

type HashMap

type HashMap[R util.Comparable, T any] interface {
	Put(k R, v T)
	Get(k R) (T, bool)
	Del(k R)
}

type Heap

type Heap[T any] interface {
	Fix()
	Len() int
	Peek() (T, error)
	Pop()
	Push(vals ...T)
	Empty() bool
}

type Iterator

type Iterator[T any] interface {
	Front() T
	Back() T
}

type LinkedHashMap

type LinkedHashMap[R util.Comparable, T any] struct {
	// contains filtered or unexported fields
}

func NewLinkedHashMap

func NewLinkedHashMap[R util.Comparable, T any](hash func(key R, cap int) R) *LinkedHashMap[R, T]

func (*LinkedHashMap[R, T]) Del

func (h *LinkedHashMap[R, T]) Del(k R)

func (*LinkedHashMap[R, T]) Get

func (h *LinkedHashMap[R, T]) Get(k R) (T, bool)

func (*LinkedHashMap[R, T]) Iter

func (h *LinkedHashMap[R, T]) Iter() DoubleLinkedList[T]

func (*LinkedHashMap[R, T]) Put

func (h *LinkedHashMap[R, T]) Put(k R, v T)

type ListDeque

type ListDeque[T any] struct {
	*ListQueue[T]
}

func (*ListDeque[T]) Back

func (queue *ListDeque[T]) Back() (T, bool)

func (*ListDeque[T]) DequeueBack

func (queue *ListDeque[T]) DequeueBack() error

func (*ListDeque[T]) EnqueueFront

func (queue *ListDeque[T]) EnqueueFront(v T) error

type ListNode

type ListNode[T any] interface {
	Prev() ListNode[T]
	Next() ListNode[T]
	Value() T
}

type ListQueue

type ListQueue[T any] struct {
	// contains filtered or unexported fields
}

func (*ListQueue[T]) Cap

func (queue *ListQueue[T]) Cap() int

func (*ListQueue[T]) Dequeue

func (queue *ListQueue[T]) Dequeue() error

func (*ListQueue[T]) Empty

func (queue *ListQueue[T]) Empty() bool

func (*ListQueue[T]) Enqueue

func (queue *ListQueue[T]) Enqueue(v T) error

func (*ListQueue[T]) Front

func (queue *ListQueue[T]) Front() (T, bool)

func (*ListQueue[T]) Full

func (queue *ListQueue[T]) Full() bool

type ListRing

type ListRing[T any] struct {
	// contains filtered or unexported fields
}

func NewListRing

func NewListRing[T any](cap int) *ListRing[T]

func (*ListRing[T]) Cap

func (queue *ListRing[T]) Cap() int

func (*ListRing[T]) Dequeue

func (queue *ListRing[T]) Dequeue() error

func (*ListRing[T]) Empty

func (queue *ListRing[T]) Empty() bool

func (*ListRing[T]) Enqueue

func (queue *ListRing[T]) Enqueue(v T) error

func (*ListRing[T]) Front

func (queue *ListRing[T]) Front() (T, bool)

func (*ListRing[T]) Full

func (queue *ListRing[T]) Full() bool

type ListStack

type ListStack[T any] struct {
	// contains filtered or unexported fields
}

func NewListStack

func NewListStack[T any]() *ListStack[T]

type MapTrie

type MapTrie[T any] struct {
	// contains filtered or unexported fields
}

func MapTrieOf

func MapTrieOf[T any]() *MapTrie[T]

func (*MapTrie[T]) Delete

func (t *MapTrie[T]) Delete(word string)

func (*MapTrie[T]) Find

func (t *MapTrie[T]) Find(word string) T

func (*MapTrie[T]) FindChildren

func (t *MapTrie[T]) FindChildren(word string) (ret []string)

func (*MapTrie[T]) FindNode

func (t *MapTrie[T]) FindNode(word string) (Trie[T], bool)

func (*MapTrie[T]) Insert

func (t *MapTrie[T]) Insert(word string, v T) error

func (*MapTrie[T]) Keys

func (t *MapTrie[T]) Keys() []string

func (*MapTrie[T]) Search

func (t *MapTrie[T]) Search(word string) bool

func (*MapTrie[T]) StartsWith

func (t *MapTrie[T]) StartsWith(prefix string) bool

func (*MapTrie[T]) Value

func (t *MapTrie[T]) Value() T

type Queue

type Queue[T any] interface {
	Cap() int
	Enqueue(v T) error
	Dequeue() error
	Front() (T, bool)
	Full() bool
	Empty() bool
}

func NewArrayRing

func NewArrayRing[T any](cap int) Queue[T]

func NewListQueue

func NewListQueue[T any](cap ...int) Queue[T]

type SliceHeap

type SliceHeap[T any] struct {
	// contains filtered or unexported fields
}

func NewSliceHeap

func NewSliceHeap[T any](heapType bool, cmp func(a, b T) int) *SliceHeap[T]

func (*SliceHeap[T]) Empty

func (heap *SliceHeap[T]) Empty() bool

func (*SliceHeap[T]) Fix

func (heap *SliceHeap[T]) Fix()

func (*SliceHeap[T]) Len

func (heap *SliceHeap[T]) Len() int

func (*SliceHeap[T]) Peek

func (heap *SliceHeap[T]) Peek() (T, error)

func (*SliceHeap[T]) Pop

func (heap *SliceHeap[T]) Pop()

func (*SliceHeap[T]) Push

func (heap *SliceHeap[T]) Push(vals ...T)

type Stack

type Stack[T any] interface {
	Clear()
	Empty() bool
	Full() bool
	Iter() []T
	Len() int
	Cap() int
	Pop() error
	Push(v T) error
	Top() (T, error)
}

type Trie

type Trie[T any] interface {
	Insert(word string, v T) error
	Delete(word string)
	Search(word string) bool
	StartsWith(prefix string) bool
	Find(word string) T
	FindNode(word string) (Trie[T], bool)
	FindChildren(word string) []string
	Keys() []string
	Value() T
	// contains filtered or unexported methods
}

type Vector

type Vector[T any] struct {
	// contains filtered or unexported fields
}

func VectorOf

func VectorOf[T any](cap ...int) *Vector[T]

func (*Vector[T]) Back

func (vec *Vector[T]) Back() ListNode[T]

func (*Vector[T]) Find

func (vec *Vector[T]) Find(n int) ListNode[T]

func (*Vector[T]) Front

func (vec *Vector[T]) Front() ListNode[T]

func (*Vector[T]) PopBack

func (vec *Vector[T]) PopBack() ListNode[T]

func (*Vector[T]) PopFront

func (vec *Vector[T]) PopFront() ListNode[T]

func (*Vector[T]) PushBack

func (vec *Vector[T]) PushBack(v T) ListNode[T]

func (*Vector[T]) PushFront

func (vec *Vector[T]) PushFront(v T) ListNode[T]

func (*Vector[T]) Remove

func (vec *Vector[T]) Remove(node ListNode[T])

func (*Vector[T]) Size

func (vec *Vector[T]) Size() int

type VectorNode

type VectorNode[T any] struct {
	// contains filtered or unexported fields
}

func (*VectorNode[T]) Next

func (node *VectorNode[T]) Next() ListNode[T]

func (*VectorNode[T]) Prev

func (node *VectorNode[T]) Prev() ListNode[T]

func (*VectorNode[T]) Value

func (node *VectorNode[T]) Value() T

type WordTrie

type WordTrie[T any] struct {
	// contains filtered or unexported fields
}

func WordTrieOf

func WordTrieOf[T any]() *WordTrie[T]

func (*WordTrie[T]) Delete

func (t *WordTrie[T]) Delete(word string)

func (*WordTrie[T]) Find

func (t *WordTrie[T]) Find(word string) T

func (*WordTrie[T]) FindChildren

func (t *WordTrie[T]) FindChildren(word string) []string

func (*WordTrie[T]) FindNode

func (t *WordTrie[T]) FindNode(word string) (Trie[T], bool)

func (*WordTrie[T]) Insert

func (t *WordTrie[T]) Insert(word string, v T) error

func (*WordTrie[T]) Keys

func (t *WordTrie[T]) Keys() []string

func (*WordTrie[T]) Search

func (t *WordTrie[T]) Search(word string) bool

func (*WordTrie[T]) StartsWith

func (t *WordTrie[T]) StartsWith(prefix string) bool

func (*WordTrie[T]) Value

func (t *WordTrie[T]) Value() T

Jump to

Keyboard shortcuts

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