trie

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const MULTI_WILDCARD = "#"
View Source
const SINGLE_WILDCARD = "+"

Variables

This section is empty.

Functions

This section is empty.

Types

type TopicTrie

type TopicTrie struct {
	Value interface{}
	// contains filtered or unexported fields
}

支持通配符的字典树

func NewRootTopicTrie

func NewRootTopicTrie() *TopicTrie

func (*TopicTrie) CountNodes

func (trie *TopicTrie) CountNodes() int

func (*TopicTrie) GetLevel

func (trie *TopicTrie) GetLevel() int

func (*TopicTrie) GetTopic

func (trie *TopicTrie) GetTopic() string

func (*TopicTrie) Insert

func (trie *TopicTrie) Insert(parts []string, value interface{}) *TopicTrie

向某个节点添加topic

func (*TopicTrie) IsEnded

func (trie *TopicTrie) IsEnded() bool

func (*TopicTrie) MatchMany

func (trie *TopicTrie) MatchMany(topicParts []string) []*TopicTrie

查找与某个topic相匹配的所有节点,topicParts中包含的统配符只会被当作普通字符处理

func (*TopicTrie) MatchOne

func (trie *TopicTrie) MatchOne(topicParts []string) *TopicTrie

查找与某个topic最匹配的节点,如果没有找到,则返回nil

func (*TopicTrie) Remove

func (trie *TopicTrie) Remove(parts []string) bool

从字典树中删除一个节点

func (*TopicTrie) SearchPrefix

func (trie *TopicTrie) SearchPrefix(parts []string) *TopicTrie

寻找字典树中层级与某个topic最接近的前缀节点

Jump to

Keyboard shortcuts

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