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

@ -53,6 +53,7 @@ type HasA struct {
primaryIt graph.Iterator
dir graph.Direction
resultIt graph.Iterator
result graph.Value
}
// Construct a new HasA iterator, given the triple subiterator, and the triple
@ -168,7 +169,7 @@ func (it *HasA) GetCheckResult() bool {
glog.V(4).Infoln("Triple is", it.ts.Triple(linkVal))
}
if it.primaryIt.Check(linkVal) {
it.Last = it.ts.TripleDirection(linkVal, it.dir)
it.result = it.ts.TripleDirection(linkVal, it.dir)
return true
}
}
@ -205,10 +206,14 @@ func (it *HasA) Next() (graph.Value, bool) {
}
name := it.ts.Triple(tID).Get(it.dir)
val := it.ts.ValueOf(name)
it.Last = val
it.result = val
return graph.NextLogOut(it, val, true)
}
func (it *HasA) Result() graph.Value {
return it.result
}
// GetStats() returns the statistics on the HasA iterator. This is curious. Next
// cost is easy, it's an extra call or so on top of the subiterator Next cost.
// CheckCost involves going to the graph.TripleStore, iterating out values, and hoping