Move current result handling out of Base
Delete majority of Base functionality.
This commit is contained in:
parent
ee6d4c8db7
commit
375d953d93
14 changed files with 140 additions and 82 deletions
|
|
@ -36,6 +36,7 @@ type Fixed struct {
|
|||
values []graph.Value
|
||||
lastIndex int
|
||||
cmp Equality
|
||||
result graph.Value
|
||||
}
|
||||
|
||||
// Define the signature of an equality function.
|
||||
|
|
@ -130,7 +131,7 @@ func (it *Fixed) Check(v graph.Value) bool {
|
|||
graph.CheckLogIn(it, v)
|
||||
for _, x := range it.values {
|
||||
if it.cmp(x, v) {
|
||||
it.Last = x
|
||||
it.result = x
|
||||
return graph.CheckLogOut(it, v, true)
|
||||
}
|
||||
}
|
||||
|
|
@ -144,11 +145,20 @@ func (it *Fixed) Next() (graph.Value, bool) {
|
|||
return graph.NextLogOut(it, nil, false)
|
||||
}
|
||||
out := it.values[it.lastIndex]
|
||||
it.Last = out
|
||||
it.result = out
|
||||
it.lastIndex++
|
||||
return graph.NextLogOut(it, out, true)
|
||||
}
|
||||
|
||||
// DEPRECATED
|
||||
func (it *Fixed) ResultTree() *graph.ResultTree {
|
||||
return graph.NewResultTree(it.Result())
|
||||
}
|
||||
|
||||
func (it *Fixed) Result() graph.Value {
|
||||
return it.result
|
||||
}
|
||||
|
||||
// No sub-iterators.
|
||||
func (it *Fixed) SubIterators() []graph.Iterator {
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue