Move current result handling out of Base

Delete majority of Base functionality.
This commit is contained in:
kortschak 2014-07-30 15:01:09 +09:30
parent ee6d4c8db7
commit 375d953d93
14 changed files with 140 additions and 82 deletions

View file

@ -47,12 +47,13 @@ const (
type Comparison struct {
Base
uid uint64
tags graph.Tagger
subIt graph.Iterator
op Operator
val interface{}
ts graph.TripleStore
uid uint64
tags graph.Tagger
subIt graph.Iterator
op Operator
val interface{}
ts graph.TripleStore
result graph.Value
}
func NewComparison(sub graph.Iterator, op Operator, val interface{}, ts graph.TripleStore) *Comparison {
@ -141,10 +142,19 @@ func (it *Comparison) Next() (graph.Value, bool) {
break
}
}
it.Last = val
it.result = val
return val, ok
}
// DEPRECATED
func (it *Comparison) ResultTree() *graph.ResultTree {
return graph.NewResultTree(it.Result())
}
func (it *Comparison) Result() graph.Value {
return it.result
}
func (it *Comparison) NextResult() bool {
for {
hasNext := it.subIt.NextResult()
@ -155,7 +165,7 @@ func (it *Comparison) NextResult() bool {
return true
}
}
it.Last = it.subIt.Result()
it.result = it.subIt.Result()
return true
}
@ -213,6 +223,6 @@ func (it *Comparison) Stats() graph.IteratorStats {
return it.subIt.Stats()
}
func (it *Base) Size() (int64, bool) {
func (it *Comparison) Size() (int64, bool) {
return 0, true
}