Documentation
¶
Index ¶
Constants ¶
View Source
const ( Extension = searchResult(1) Greater = searchResult(2) Less = searchResult(3) Matched = searchResult(4) Prefix = searchResult(5) Unmatched = searchResult(6) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Digitizer ¶
type Digitizer interface {
// Base returns the base for the Digitizer.
Base() int
// IsPrefixFree returns true if and only if the Digitizer guarantees that no element is a prefix of another.
IsPrefixFree() bool
// NumDigitsOf returns the number of digits in the provided element.
NumDigitsOf(element interface{}) int
// DigitOf returns the element of digit place for the provided element.
DigitOf(element interface{}, place int) int
// FormatDigit returns a string representation of the digit in the place specified for the given element.
FormatDigit(element interface{}, place int) string
}
Digitizer
func NewStringDigitizer ¶
NewStringDigitizer creates a new Digitizer for strings with the provided alphabet size.
type LeafNode ¶
type LeafNode interface {
Node
AddAfter(leafNode LeafNode)
SetNext(next LeafNode)
Next() LeafNode
SetPrevious(previous LeafNode)
Previous() LeafNode
IsDeleted() bool
Remove()
IsHead() bool
IsTail() bool
}
LeafNode
type Node ¶
type Node interface {
SetParent(parent Node)
Parent() Node
AddChildWithIndexOf(index int, child Node) error
ChildWithIndexOf(index int) (Node, error)
RemoveChildWithIndexOf(index int) bool
HasChildren() bool
SetValue(element interface{})
Value() interface{}
IsRoot() bool
IsLeaf() bool
}
Node
type Trie ¶
type Trie interface {
collection.Ordered
// Completions finds all elements in the Trie that match the provided prefix, and appends the matching elements
// (if any) to the provided collection.
Completions(prefix interface{}, collection collection.Collection)
// LongestCommonPrefix finds all elements in the Trie that share the longest common prefix with the provided
// element, and appends the matching elements (if any) to the provided collection.
LongestCommonPrefix(element interface{}, collection collection.Collection)
}
Trie
func NewRadixTreeWithDigitizer ¶
NewRadixTreeWithDigitizer
func NewTrie ¶
NewTrie creates a new Trie with the provided capacity. The capacity is used to set the base (or range of digits) used by the StringDigitizer for the trie. The base of the StringDigitizer is used to set the number of children each Node within the trie has.
func NewTrieWithDigitizer ¶
NewTrieWithDigitizer
Click to show internal directories.
Click to hide internal directories.