Updated Except operator to the new operator interface.

This commit is contained in:
Matei Chiperi 2014-10-02 16:34:17 -07:00
parent f86bddd50a
commit 52be8fb21b

View file

@ -1,9 +1,6 @@
package iterator package iterator
import ( import (
"fmt"
"strings"
"github.com/google/cayley/graph" "github.com/google/cayley/graph"
) )
@ -76,28 +73,6 @@ func (it *Not) ResultTree() *graph.ResultTree {
return tree return tree
} }
// DebugString prints information about the iterator.
func (it *Not) DebugString(indent int) string {
var tags string
for _, k := range it.tags.Tags() {
tags += fmt.Sprintf("%s;", k)
}
spaces := strings.Repeat(" ", indent+2)
return fmt.Sprintf("%s(%s %d\n%stags:%v\n%sprimary_it:\n%s\n%sall_it:\n%s\n%s)",
strings.Repeat(" ", indent),
it.Type(),
it.UID(),
spaces,
it.tags.Tags(),
spaces,
it.primaryIt.DebugString(indent+4),
spaces,
it.allIt.DebugString(indent+4),
strings.Repeat(" ", indent),
)
}
// Next advances the Not iterator. It returns whether there is another valid // Next advances the Not iterator. It returns whether there is another valid
// new value. It fetches the next value of the all iterator which is not // new value. It fetches the next value of the all iterator which is not
// contained by the primary iterator. // contained by the primary iterator.
@ -172,3 +147,17 @@ func (it *Not) Stats() graph.IteratorStats {
func (it *Not) Size() (int64, bool) { func (it *Not) Size() (int64, bool) {
return it.Stats().Size, false return it.Stats().Size, false
} }
func (it *Not) Describe() graph.Description {
subIts := []graph.Description{
it.primaryIt.Describe(),
it.allIt.Describe(),
}
return graph.Description{
UID: it.UID(),
Type: it.Type(),
Tags: it.tags.Tags(),
Iterators: subIts,
}
}