tree

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2015 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TRIE_NO     = iota // TRIE_NO means there is a chaacter don't match
	TRIE_PREFIX        // TRIE_PREFIX means last node's `Str` is only match the begining part
	TRIE_FULL          // TRIE_FULL means last node's `Str` is full matched
)

Variables

This section is empty.

Functions

func NopHook

func NopHook(interface{}) string

Types

type Binary

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

func (*Binary) Add

func (t *Binary) Add(score int, value interface{}, replace bool)

func (*Binary) Search

func (t *Binary) Search(score int) interface{}

type Trie

type Trie struct {
	Str        string
	ChildChars []byte
	Childs     []*Trie
	Value      interface{}
}

func (*Trie) AddPath

func (t *Trie) AddPath(path string, value interface{})

func (*Trie) AddPathFor

func (t *Trie) AddPathFor(path string, fn func(*Trie))

func (*Trie) HasElement

func (t *Trie) HasElement() bool

func (*Trie) Match

func (t *Trie) Match(path string) (*Trie, int, int)

func (*Trie) MatchFrom

func (t *Trie) MatchFrom(nodestart int, path string) (tr *Trie, index int, typ int)

func (*Trie) MatchValue

func (t *Trie) MatchValue(path string) interface{}

Match one longest route node and return values of path variable

func (*Trie) PrefixMatchValue

func (t *Trie) PrefixMatchValue(path string) interface{}

PrefixMatchValue assumes each node as a prefix, it will match the longest prefix and return it's node value or nil

func (*Trie) Print

func (t *Trie) Print(w io.Writer, withCurr bool, parentPath, sep string, hook func(value interface{}) string)

func (*Trie) Visit

func (t *Trie) Visit(visitor func(string, interface{}))

Jump to

Keyboard shortcuts

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