Documentation ¶
Overview ¶
Implements a modified version of SetTrie that acts like a Map[Word, Data]. Reference: Savnik, Iztok. "Efficient subset and superset queries." DB&Local Proceedings. 2012.
Index ¶
- func EqualsWord[Alpha comparable](left, right Word[Alpha]) bool
- type ExistedBefore
- type Multi
- func (multi *Multi[Alphabet, Subkey, Data]) Insert(word Word[Alphabet], subkey Subkey, data Data) ExistedBefore
- func (multi *Multi[Alphabet, Subkey, Data]) Remove(word Word[Alphabet], subkey Subkey) ExistedBefore
- func (multi *Multi[Alphabet, Subkey, Data]) Subsets(word Word[Alphabet]) iter.Iter[iter.Pair[Subkey, Data]]
- type Ordered
- type SetTrie
- func (trie *SetTrie[Alpha, Data]) CreateOrUpdate(word Word[Alpha], initNode func() Data, updateNode func(*Data))
- func (trie *SetTrie[Alpha, Data]) Get(word Word[Alpha]) optional.Optional[Data]
- func (trie *SetTrie[Alpha, Data]) RetainOrDrop(word Word[Alpha], process func(Data) optional.Optional[Data])
- func (trie *SetTrie[Alpha, Data]) Subsets(word Word[Alpha]) iter.Iter[iter.Pair[Word[Alpha], Data]]
- func (trie *SetTrie[Alpha, Data]) Supersets(word Word[Alpha]) iter.Iter[iter.Pair[Word[Alpha], Data]]
- type Word
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EqualsWord ¶
func EqualsWord[Alpha comparable](left, right Word[Alpha]) bool
Types ¶
type ExistedBefore ¶
type ExistedBefore bool
type Multi ¶
type Multi[Alpha Ordered[Alpha], Subkey comparable, Data any] struct { // contains filtered or unexported fields }
A multimap that stores multiple items in each SetTrie node, analogous to map[Word]map[Subkey]Data.
func NewMulti ¶
func NewMulti[Alpha Ordered[Alpha], Subkey comparable, Data any]() *Multi[Alpha, Subkey, Data]
func (*Multi[Alphabet, Subkey, Data]) Insert ¶
func (multi *Multi[Alphabet, Subkey, Data]) Insert( word Word[Alphabet], subkey Subkey, data Data, ) ExistedBefore
func (*Multi[Alphabet, Subkey, Data]) Remove ¶
func (multi *Multi[Alphabet, Subkey, Data]) Remove( word Word[Alphabet], subkey Subkey, ) ExistedBefore
type Ordered ¶
type Ordered[Self any] interface { comparable Less(other Self) bool }
type SetTrie ¶
func (*SetTrie[Alpha, Data]) CreateOrUpdate ¶
func (*SetTrie[Alpha, Data]) RetainOrDrop ¶
type Word ¶
type Word[Alpha any] struct { // contains filtered or unexported fields }
func NewWord ¶
Creates a new word from an unsorted slice. The input slice is not mutated nor leaked.
Click to show internal directories.
Click to hide internal directories.