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:
kortschak 2014-08-01 09:15:02 +09:30
parent f8e28e066e
commit b1a70d99aa
31 changed files with 168 additions and 233 deletions

View file

@ -129,12 +129,8 @@ func (qs *queryShape) MakeNode(it graph.Iterator) *Node {
}
case graph.Fixed:
n.IsFixed = true
for {
val, more := graph.Next(it)
if !more {
break
}
n.Values = append(n.Values, qs.ts.NameOf(val))
for graph.Next(it) {
n.Values = append(n.Values, qs.ts.NameOf(it.Result()))
}
case graph.HasA:
hasa := it.(*HasA)