focus/tree/tree.go

40 lines
1.1 KiB
Go
Raw Permalink Normal View History

2019-07-28 18:18:22 +00:00
package tree
// IBSTreeKey Compare函数可以自定义所以key不一定value, 可以是value结构体中一个属性
type IBSTreeKey interface {
String() string
Size() int
Remove(key interface{}) (interface{}, bool)
Clear()
// Values 返回先序遍历的值
Values() []interface{}
Get(key interface{}) (interface{}, bool)
Put(key, value interface{})
Traversal(every func(k, v interface{}) bool, traversalMethod ...interface{})
}
// IBSTree
type IBSTree interface {
String() string
Size() int
Remove(key interface{}) (interface{}, bool)
Clear()
// Values 返回先序遍历的值
Values() []interface{}
Get(key interface{}) (interface{}, bool)
Put(value interface{})
Traversal(every func(v interface{}) bool, traversalMethod ...interface{})
}
2020-03-17 09:58:08 +00:00
type IBSTreeDupKey interface {
String() string
Size() int
Remove(key interface{}) (interface{}, bool)
Clear()
// Values 返回先序遍历的值
Values() []interface{}
Get(key interface{}) (interface{}, bool)
Put(key, value interface{}) bool
Traversal(every func(k, v interface{}) bool, traversalMethod ...interface{})
}