container

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OrderedCompare

func OrderedCompare[Ordered generic.Ordered](n1, n2 Ordered) int

Types

type Comparable

type Comparable interface {
	Compare(other Comparable) int
}

type ComparableKeyTreeMap

type ComparableKeyTreeMap[K Comparable, V any] struct {
	TreeMap[K, V]
}

type Comparator

type Comparator[V any] func(o1, o2 V) int

type GoSlice

type GoSlice[E any] []E

func (GoSlice[E]) Append

func (s GoSlice[E]) Append(es ...E) Slice[E]

func (GoSlice[E]) Cap

func (s GoSlice[E]) Cap() int

func (GoSlice[E]) Clear

func (s GoSlice[E]) Clear() Slice[E]

func (GoSlice[E]) Cut

func (s GoSlice[E]) Cut(from, to int) Slice[E]

func (GoSlice[E]) CutCap

func (s GoSlice[E]) CutCap(from, to int, cap int) Slice[E]

func (GoSlice[E]) CutCapTo

func (s GoSlice[E]) CutCapTo(to int, cap int) Slice[E]

func (GoSlice[E]) CutFrom

func (s GoSlice[E]) CutFrom(from int) Slice[E]

func (GoSlice[E]) CutTo

func (s GoSlice[E]) CutTo(to int) Slice[E]

func (GoSlice[E]) Delete

func (s GoSlice[E]) Delete(i int) Slice[E]

func (GoSlice[E]) DeleteIf

func (s GoSlice[E]) DeleteIf(delete func(i int) bool) Slice[E]

func (GoSlice[E]) Get

func (s GoSlice[E]) Get(i int) E

func (GoSlice[E]) Len

func (s GoSlice[E]) Len() int

func (GoSlice[E]) Pointer

func (s GoSlice[E]) Pointer(i int) *E

func (GoSlice[E]) Range

func (s GoSlice[E]) Range(f func(i int) bool)

func (GoSlice[E]) Set

func (s GoSlice[E]) Set(i int, e E)

func (GoSlice[E]) Swap

func (s GoSlice[E]) Swap(i, j int)

type LinkedList

type LinkedList[E any] struct {
	// contains filtered or unexported fields
}

func NewLinkedList

func NewLinkedList[E any]() *LinkedList[E]

func (*LinkedList[E]) AddEntryHead

func (l *LinkedList[E]) AddEntryHead(entry *LinkedListEntry[E])

func (*LinkedList[E]) AddEntryTail

func (l *LinkedList[E]) AddEntryTail(entry *LinkedListEntry[E])

func (*LinkedList[E]) AddHead

func (l *LinkedList[E]) AddHead(e E) (entry *LinkedListEntry[E])

func (*LinkedList[E]) AddTail

func (l *LinkedList[E]) AddTail(e E) (entry *LinkedListEntry[E])

func (*LinkedList[E]) Clear

func (l *LinkedList[E]) Clear()

func (*LinkedList[E]) Head

func (l *LinkedList[E]) Head() (e E, exist bool)

func (*LinkedList[E]) HeadEntry

func (l *LinkedList[E]) HeadEntry() *LinkedListEntry[E]

func (*LinkedList[E]) InsertBack

func (l *LinkedList[E]) InsertBack(e E, ref *LinkedListEntry[E]) (entry *LinkedListEntry[E])

func (*LinkedList[E]) InsertEntryBack

func (l *LinkedList[E]) InsertEntryBack(entry, ref *LinkedListEntry[E])

func (*LinkedList[E]) InsertEntryFront

func (l *LinkedList[E]) InsertEntryFront(entry, ref *LinkedListEntry[E])

func (*LinkedList[E]) InsertFront

func (l *LinkedList[E]) InsertFront(e E, ref *LinkedListEntry[E]) (entry *LinkedListEntry[E])

func (*LinkedList[E]) Len

func (l *LinkedList[E]) Len() int

func (*LinkedList[E]) RemoveHead

func (l *LinkedList[E]) RemoveHead() (entry *LinkedListEntry[E])

func (*LinkedList[E]) RemoveTail

func (l *LinkedList[E]) RemoveTail() (entry *LinkedListEntry[E])

func (*LinkedList[E]) Tail

func (l *LinkedList[E]) Tail() (e E, exist bool)

func (*LinkedList[E]) TailEntry

func (l *LinkedList[E]) TailEntry() *LinkedListEntry[E]

type LinkedListEntry

type LinkedListEntry[E any] struct {
	// contains filtered or unexported fields
}

func NewLinkedListEntry

func NewLinkedListEntry[E any](e E) *LinkedListEntry[E]

func (*LinkedListEntry[E]) Next

func (e *LinkedListEntry[E]) Next() *LinkedListEntry[E]

func (*LinkedListEntry[E]) Prev

func (e *LinkedListEntry[E]) Prev() *LinkedListEntry[E]

func (*LinkedListEntry[E]) Removed

func (e *LinkedListEntry[E]) Removed() bool

func (*LinkedListEntry[E]) String

func (e *LinkedListEntry[E]) String() string

func (*LinkedListEntry[E]) Value

func (e *LinkedListEntry[E]) Value() E

type LinkedMap

type LinkedMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewLinkedMap

func NewLinkedMap[K comparable, V any](size int) *LinkedMap[K, V]

func (*LinkedMap[K, V]) Clear

func (m *LinkedMap[K, V]) Clear()

func (*LinkedMap[K, V]) Empty

func (m *LinkedMap[K, V]) Empty() bool

func (*LinkedMap[K, V]) First

func (m *LinkedMap[K, V]) First() (value V, exist bool)

func (*LinkedMap[K, V]) FirstEntry

func (m *LinkedMap[K, V]) FirstEntry() *LinkedMapEntry[K, V]

func (*LinkedMap[K, V]) Get

func (m *LinkedMap[K, V]) Get(key K) (value V, exist bool)

func (*LinkedMap[K, V]) GetEntry

func (m *LinkedMap[K, V]) GetEntry(key K) *LinkedMapEntry[K, V]

func (*LinkedMap[K, V]) Has

func (m *LinkedMap[K, V]) Has(key K) bool

func (*LinkedMap[K, V]) Last

func (m *LinkedMap[K, V]) Last() (value V, exist bool)

func (*LinkedMap[K, V]) LastEntry

func (m *LinkedMap[K, V]) LastEntry() *LinkedMapEntry[K, V]

func (*LinkedMap[K, V]) Len

func (m *LinkedMap[K, V]) Len() int

func (*LinkedMap[K, V]) Put

func (m *LinkedMap[K, V]) Put(key K, value V) (entry, old *LinkedMapEntry[K, V])

func (*LinkedMap[K, V]) PutEntry

func (m *LinkedMap[K, V]) PutEntry(e *LinkedMapEntry[K, V]) *LinkedMapEntry[K, V]

func (*LinkedMap[K, V]) PutEntryIfAbsent

func (m *LinkedMap[K, V]) PutEntryIfAbsent(e *LinkedMapEntry[K, V]) (entry *LinkedMapEntry[K, V], exist bool)

func (*LinkedMap[K, V]) PutIfAbsent

func (m *LinkedMap[K, V]) PutIfAbsent(key K, value V) (entry *LinkedMapEntry[K, V], exist bool)

func (*LinkedMap[K, V]) Range

func (m *LinkedMap[K, V]) Range(f func(key K, value V) bool) bool

func (*LinkedMap[K, V]) RangeEntry

func (m *LinkedMap[K, V]) RangeEntry(f func(e *LinkedMapEntry[K, V]) bool) bool

func (*LinkedMap[K, V]) Remove

func (m *LinkedMap[K, V]) Remove(key K) *LinkedMapEntry[K, V]

func (*LinkedMap[K, V]) RemoveEntry

func (m *LinkedMap[K, V]) RemoveEntry(e *LinkedMapEntry[K, V]) bool

func (*LinkedMap[K, V]) RemoveFirst

func (m *LinkedMap[K, V]) RemoveFirst() *LinkedMapEntry[K, V]

func (*LinkedMap[K, V]) RemoveLast

func (m *LinkedMap[K, V]) RemoveLast() *LinkedMapEntry[K, V]

func (*LinkedMap[K, V]) Size

func (m *LinkedMap[K, V]) Size() uint

type LinkedMapEntry

type LinkedMapEntry[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewLinkedMapEntry

func NewLinkedMapEntry[K comparable, V any](key K, value V) *LinkedMapEntry[K, V]

func (*LinkedMapEntry[K, V]) Key

func (e *LinkedMapEntry[K, V]) Key() K

func (*LinkedMapEntry[K, V]) Next

func (e *LinkedMapEntry[K, V]) Next() *LinkedMapEntry[K, V]

func (*LinkedMapEntry[K, V]) Prev

func (e *LinkedMapEntry[K, V]) Prev() *LinkedMapEntry[K, V]

func (*LinkedMapEntry[K, V]) Removed

func (e *LinkedMapEntry[K, V]) Removed() bool

func (*LinkedMapEntry[K, V]) SetValue

func (e *LinkedMapEntry[K, V]) SetValue(v V)

func (*LinkedMapEntry[K, V]) String

func (e *LinkedMapEntry[K, V]) String() string

func (*LinkedMapEntry[K, V]) Value

func (e *LinkedMapEntry[K, V]) Value() V

type OrderedKeyTreeMap

type OrderedKeyTreeMap[K generic.Ordered, V any] struct {
	TreeMap[K, V]
}

type Queue

type Queue[E any] struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue[E any](cap int) *Queue[E]

func (*Queue[E]) Cap

func (q *Queue[E]) Cap() int

func (*Queue[E]) Clear

func (q *Queue[E]) Clear()

func (*Queue[E]) Get

func (q *Queue[E]) Get(i int) E

func (*Queue[E]) Head

func (q *Queue[E]) Head() (e E, exist bool)

func (*Queue[E]) HeadPointer

func (q *Queue[E]) HeadPointer() *E

func (*Queue[E]) Len

func (q *Queue[E]) Len() int

func (*Queue[E]) Pointer

func (q *Queue[E]) Pointer(i int) *E

func (*Queue[E]) Pop

func (q *Queue[E]) Pop() (e E, ok bool)

func (*Queue[E]) PopAll

func (q *Queue[E]) PopAll() []E

func (*Queue[E]) PopTail

func (q *Queue[E]) PopTail() (e E, ok bool)

func (*Queue[E]) PopTo

func (q *Queue[E]) PopTo(es []E) (n int)

func (*Queue[E]) Push

func (q *Queue[E]) Push(e E) bool

func (*Queue[E]) PushHead

func (q *Queue[E]) PushHead(e E) bool

func (*Queue[E]) Set

func (q *Queue[E]) Set(i int, e E)

func (*Queue[E]) Slice

func (q *Queue[E]) Slice(start, end int) (prefix, suffix []E)

func (*Queue[E]) Swap

func (q *Queue[E]) Swap(i, j int)

func (*Queue[E]) Tail

func (q *Queue[E]) Tail() (e E, exist bool)

func (*Queue[E]) TailPointer

func (q *Queue[E]) TailPointer() *E

func (*Queue[E]) Use

func (q *Queue[E]) Use() *E

func (*Queue[E]) UseHead

func (q *Queue[E]) UseHead() *E

type Slice

type Slice[E any] interface {
	Len() int

	Cap() int

	Get(i int) E

	Pointer(i int) *E

	Cut(from, to int) Slice[E]

	CutFrom(from int) Slice[E]

	CutTo(to int) Slice[E]

	CutCap(from, to int, cap int) Slice[E]

	CutCapTo(to int, cap int) Slice[E]

	Append(es ...E) Slice[E]

	Delete(i int) Slice[E]

	DeleteIf(delete func(i int) bool) Slice[E]

	Range(f func(i int) bool)

	Set(i int, e E)

	Swap(i, j int)

	Clear() Slice[E]
}

type SyncMap

type SyncMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*SyncMap[K, V]) Delete

func (s *SyncMap[K, V]) Delete(key K)

func (*SyncMap[K, V]) Keys

func (s *SyncMap[K, V]) Keys() (keys []K)

func (*SyncMap[K, V]) Load

func (s *SyncMap[K, V]) Load(key K) (value V, ok bool)

func (*SyncMap[K, V]) LoadAndDelete

func (s *SyncMap[K, V]) LoadAndDelete(key K) (value V, loaded bool)

func (*SyncMap[K, V]) LoadOrStore

func (s *SyncMap[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool)

func (*SyncMap[K, V]) Map

func (s *SyncMap[K, V]) Map() map[K]V

func (*SyncMap[K, V]) Range

func (s *SyncMap[K, V]) Range(f func(key K, value V) bool)

func (*SyncMap[K, V]) Store

func (s *SyncMap[K, V]) Store(key K, value V)

func (*SyncMap[K, V]) Values

func (s *SyncMap[K, V]) Values() (values []V)

type TreeMap

type TreeMap[K, V any] struct {
	// contains filtered or unexported fields
}

func NewComparableKeyTreeMap

func NewComparableKeyTreeMap[K Comparable, V any]() *TreeMap[K, V]

func NewOrderedKeyTreeMap

func NewOrderedKeyTreeMap[K generic.Ordered, V any]() *TreeMap[K, V]

func NewTreeMap

func NewTreeMap[K, V any](cpr Comparator[K]) *TreeMap[K, V]

func (*TreeMap[K, V]) Clear

func (m *TreeMap[K, V]) Clear()

func (*TreeMap[K, V]) Empty

func (m *TreeMap[K, V]) Empty() bool

func (*TreeMap[K, V]) Get

func (m *TreeMap[K, V]) Get(key K) (value V, exist bool)

func (*TreeMap[K, V]) GetEntry

func (m *TreeMap[K, V]) GetEntry(key K) *TreeMapEntry[K, V]

func (*TreeMap[K, V]) GetFirst

func (m *TreeMap[K, V]) GetFirst() (value V, exist bool)

func (*TreeMap[K, V]) GetFirstEntry

func (m *TreeMap[K, V]) GetFirstEntry() *TreeMapEntry[K, V]

func (*TreeMap[K, V]) GetLast

func (m *TreeMap[K, V]) GetLast() (value V, exist bool)

func (*TreeMap[K, V]) GetLastEntry

func (m *TreeMap[K, V]) GetLastEntry() *TreeMapEntry[K, V]

func (*TreeMap[K, V]) Has

func (m *TreeMap[K, V]) Has(key K) bool

func (*TreeMap[K, V]) Put

func (m *TreeMap[K, V]) Put(key K, value V) (entry *TreeMapEntry[K, V], old *TreeMapEntry[K, V])

func (*TreeMap[K, V]) PutEntry

func (m *TreeMap[K, V]) PutEntry(e *TreeMapEntry[K, V]) *TreeMapEntry[K, V]

func (*TreeMap[K, V]) PutEntryIfAbsent

func (m *TreeMap[K, V]) PutEntryIfAbsent(e *TreeMapEntry[K, V]) (entry *TreeMapEntry[K, V], exist bool)

func (*TreeMap[K, V]) PutIfAbsent

func (m *TreeMap[K, V]) PutIfAbsent(key K, value V) (entry *TreeMapEntry[K, V], exist bool)

func (*TreeMap[K, V]) Remove

func (m *TreeMap[K, V]) Remove(key K) *TreeMapEntry[K, V]

func (*TreeMap[K, V]) RemoveEntry

func (m *TreeMap[K, V]) RemoveEntry(e *TreeMapEntry[K, V]) bool

func (*TreeMap[K, V]) RemoveFirst

func (m *TreeMap[K, V]) RemoveFirst() *TreeMapEntry[K, V]

func (*TreeMap[K, V]) RemoveLast

func (m *TreeMap[K, V]) RemoveLast() *TreeMapEntry[K, V]

func (*TreeMap[K, V]) Size

func (m *TreeMap[K, V]) Size() uint

type TreeMapEntry

type TreeMapEntry[K, V any] struct {
	// contains filtered or unexported fields
}

func NewTreeMapEntry

func NewTreeMapEntry[K, V any](key K, value V) *TreeMapEntry[K, V]

func (*TreeMapEntry[K, V]) Key

func (e *TreeMapEntry[K, V]) Key() K

func (*TreeMapEntry[K, V]) Next

func (e *TreeMapEntry[K, V]) Next() *TreeMapEntry[K, V]

func (*TreeMapEntry[K, V]) Prev

func (e *TreeMapEntry[K, V]) Prev() *TreeMapEntry[K, V]

func (*TreeMapEntry[K, V]) Removed

func (e *TreeMapEntry[K, V]) Removed() bool

func (*TreeMapEntry[K, V]) SetValue

func (e *TreeMapEntry[K, V]) SetValue(v V)

func (*TreeMapEntry[K, V]) String

func (e *TreeMapEntry[K, V]) String() string

func (*TreeMapEntry[K, V]) Value

func (e *TreeMapEntry[K, V]) Value() V

Jump to

Keyboard shortcuts

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