Documentation ¶
Index ¶
- func ByteComparator(a, b interface{}) int
- func Float32Comparator(a, b interface{}) int
- func Float64Comparator(a, b interface{}) int
- func Int16Comparator(a, b interface{}) int
- func Int32Comparator(a, b interface{}) int
- func Int64Comparator(a, b interface{}) int
- func Int8Comparator(a, b interface{}) int
- func IntComparator(a, b interface{}) int
- func RuneComparator(a, b interface{}) int
- func StringComparator(a, b interface{}) int
- func TimeComparator(a, b interface{}) int
- func UInt16Comparator(a, b interface{}) int
- func UInt32Comparator(a, b interface{}) int
- func UInt64Comparator(a, b interface{}) int
- func UInt8Comparator(a, b interface{}) int
- func UIntComparator(a, b interface{}) int
- type BFSIterator
- type Comparator
- type DFSIterator
- func (iter *DFSIterator) Depth() int
- func (iter *DFSIterator) Key() string
- func (iter *DFSIterator) Next() bool
- func (iter *DFSIterator) NextJump() bool
- func (iter *DFSIterator) NextJumpAddChildren() bool
- func (iter *DFSIterator) Node() *Node
- func (iter *DFSIterator) Parent() *Node
- func (iter *DFSIterator) Prev() bool
- func (iter *DFSIterator) Value() interface{}
- type Data
- type IData
- type Node
- type NodeList
- type Tree
- func (tree *Tree) BFSIterator() BFSIterator
- func (tree *Tree) BFSIteratorNode(start *Node) BFSIterator
- func (tree *Tree) DFSIterator() DFSIterator
- func (tree *Tree) DFSIteratorNode(start *Node) DFSIterator
- func (tree *Tree) Empty() bool
- func (tree *Tree) Get(key string) IData
- func (tree *Tree) Lookup(key string) (*Node, error)
- func (tree *Tree) Print()
- func (tree *Tree) Put(value IData) (node *Node, err error)
- func (tree *Tree) PutData(key, parent string, val interface{}) (node *Node, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteComparator ¶
func ByteComparator(a, b interface{}) int
ByteComparator provides a basic comparison on byte
func Float32Comparator ¶
func Float32Comparator(a, b interface{}) int
Float32Comparator provides a basic comparison on float32
func Float64Comparator ¶
func Float64Comparator(a, b interface{}) int
Float64Comparator provides a basic comparison on float64
func Int16Comparator ¶
func Int16Comparator(a, b interface{}) int
Int16Comparator provides a basic comparison on int16
func Int32Comparator ¶
func Int32Comparator(a, b interface{}) int
Int32Comparator provides a basic comparison on int32
func Int64Comparator ¶
func Int64Comparator(a, b interface{}) int
Int64Comparator provides a basic comparison on int64
func Int8Comparator ¶
func Int8Comparator(a, b interface{}) int
Int8Comparator provides a basic comparison on int8
func IntComparator ¶
func IntComparator(a, b interface{}) int
IntComparator provides a basic comparison on int
func RuneComparator ¶
func RuneComparator(a, b interface{}) int
RuneComparator provides a basic comparison on rune
func StringComparator ¶
func StringComparator(a, b interface{}) int
StringComparator provides a fast comparison on strings
func TimeComparator ¶
func TimeComparator(a, b interface{}) int
TimeComparator provides a basic comparison on time.Time
func UInt16Comparator ¶
func UInt16Comparator(a, b interface{}) int
UInt16Comparator provides a basic comparison on uint16
func UInt32Comparator ¶
func UInt32Comparator(a, b interface{}) int
UInt32Comparator provides a basic comparison on uint32
func UInt64Comparator ¶
func UInt64Comparator(a, b interface{}) int
UInt64Comparator provides a basic comparison on uint64
Types ¶
type BFSIterator ¶
type BFSIterator struct {
// contains filtered or unexported fields
}
广度优先搜索
func (*BFSIterator) Prev ¶
func (iter *BFSIterator) Prev() bool
type Comparator ¶
type Comparator func(a, b interface{}) int
Comparator will make type assertion (see IntComparator for example), which will panic if a or b are not of the asserted type.
Should return a number:
negative , if a < b zero , if a == b positive , if a > b
type DFSIterator ¶
type DFSIterator struct {
// contains filtered or unexported fields
}
广度优先搜索
func (*DFSIterator) Next ¶
func (iter *DFSIterator) Next() bool
func (*DFSIterator) NextJump ¶
func (iter *DFSIterator) NextJump() bool
func (*DFSIterator) NextJumpAddChildren ¶
func (iter *DFSIterator) NextJumpAddChildren() bool
func (*DFSIterator) Node ¶
func (iter *DFSIterator) Node() *Node
func (*DFSIterator) Prev ¶
func (iter *DFSIterator) Prev() bool
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
type Node ¶
type NodeList ¶
type NodeList []*Node
func (*NodeList) Add ¶
func (list *NodeList) Add(node *Node, comparator Comparator)
type Tree ¶
type Tree struct { Root *Node Comparator Comparator // contains filtered or unexported fields }
func NewTree ¶
func NewTree(comparator Comparator) *Tree
func (*Tree) BFSIterator ¶
func (tree *Tree) BFSIterator() BFSIterator
func (*Tree) BFSIteratorNode ¶
func (tree *Tree) BFSIteratorNode(start *Node) BFSIterator
func (*Tree) DFSIterator ¶
func (tree *Tree) DFSIterator() DFSIterator
func (*Tree) DFSIteratorNode ¶
func (tree *Tree) DFSIteratorNode(start *Node) DFSIterator
func (*Tree) Empty ¶
Empty returns true if tree does not contain any nodes