Simplify Nexter interface
This change allows a Nexter to be used in the same manner as a scanner
using a for graph.Next(it) {} construction.
It is important that graph.Next(it) and any associated it.Result() calls
operate on the same iterator.
This commit is contained in:
parent
f8e28e066e
commit
b1a70d99aa
31 changed files with 168 additions and 233 deletions
|
|
@ -127,20 +127,15 @@ func (it *Comparison) Clone() graph.Iterator {
|
|||
return out
|
||||
}
|
||||
|
||||
func (it *Comparison) Next() (graph.Value, bool) {
|
||||
var val graph.Value
|
||||
var ok bool
|
||||
for {
|
||||
val, ok = graph.Next(it.subIt)
|
||||
if !ok {
|
||||
return nil, false
|
||||
}
|
||||
func (it *Comparison) Next() bool {
|
||||
for graph.Next(it.subIt) {
|
||||
val := it.subIt.Result()
|
||||
if it.doComparison(val) {
|
||||
break
|
||||
it.result = val
|
||||
return true
|
||||
}
|
||||
}
|
||||
it.result = val
|
||||
return val, ok
|
||||
return false
|
||||
}
|
||||
|
||||
// DEPRECATED
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue