materialize implementation and and optimization
This commit is contained in:
parent
f441fc4bbf
commit
09244ddd38
3 changed files with 267 additions and 0 deletions
|
|
@ -153,6 +153,19 @@ func Next(it Iterator) (Value, bool) {
|
|||
return nil, false
|
||||
}
|
||||
|
||||
// Height is a convienence function to measure the height of an iterator tree.
|
||||
func Height(it Iterator) int {
|
||||
subs := it.SubIterators()
|
||||
maxDepth := 0
|
||||
for _, sub := range subs {
|
||||
h := Height(sub)
|
||||
if h > maxDepth {
|
||||
maxDepth = h
|
||||
}
|
||||
}
|
||||
return maxDepth + 1
|
||||
}
|
||||
|
||||
// FixedIterator wraps iterators that are modifiable by addition of fixed value sets.
|
||||
type FixedIterator interface {
|
||||
Iterator
|
||||
|
|
@ -180,6 +193,7 @@ const (
|
|||
Fixed
|
||||
Not
|
||||
Optional
|
||||
Materialize
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -200,6 +214,7 @@ var (
|
|||
"fixed",
|
||||
"not",
|
||||
"optional",
|
||||
"materialize",
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue