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

@ -36,6 +36,7 @@ type Int64 struct {
tags graph.Tagger
max, min int64
at int64
result graph.Value
}
// Creates a new Int64 with the given range.
@ -99,10 +100,19 @@ func (it *Int64) Next() (graph.Value, bool) {
if it.at > it.max {
it.at = -1
}
it.Last = val
it.result = val
return graph.NextLogOut(it, val, true)
}
// DEPRECATED
func (it *Int64) ResultTree() *graph.ResultTree {
return graph.NewResultTree(it.Result())
}
func (it *Int64) Result() graph.Value {
return it.result
}
// No sub-iterators.
func (it *Int64) SubIterators() []graph.Iterator {
return nil
@ -121,7 +131,7 @@ func (it *Int64) Check(tsv graph.Value) bool {
graph.CheckLogIn(it, tsv)
v := tsv.(int64)
if it.min <= v && v <= it.max {
it.Last = v
it.result = v
return graph.CheckLogOut(it, v, true)
}
return graph.CheckLogOut(it, v, false)