Replace DebugString with Describe

This change makes tree description completely open to mechanical
analysis and ensures consistency between description formats for each of
the iterator types.

Renamed StatsContainer.(Kind -> Type) for consistency.
This commit is contained in:
kortschak 2014-09-05 09:05:02 +09:30
parent b5f113203d
commit 62013d3dfc
22 changed files with 186 additions and 162 deletions

View file

@ -23,9 +23,6 @@ package iterator
// the base iterators, and it helps just to see it here.
import (
"fmt"
"strings"
"github.com/google/cayley/graph"
)
@ -81,9 +78,12 @@ func (it *Int64) TagResults(dst map[string]graph.Value) {
}
}
// Prints the All iterator as just an "all".
func (it *Int64) DebugString(indent int) string {
return fmt.Sprintf("%s(%s tags: %v)", strings.Repeat(" ", indent), it.Type(), it.tags.Tags())
func (it *Int64) Describe() graph.Description {
return graph.Description{
UID: it.UID(),
Type: it.Type().String(),
Tags: it.tags.Tags(),
}
}
// Next() on an Int64 all iterator is a simple incrementing counter.