Merge branch 'materializer_iterator'

This commit is contained in:
Barak Michener 2014-08-06 15:59:24 -04:00
commit 408103b406
3 changed files with 8 additions and 8 deletions

View file

@ -32,8 +32,8 @@ type result struct {
tags map[string]graph.Value
}
type hashable interface {
Hashable() interface{}
type hasher interface {
Hasher() interface{}
}
type Materialize struct {
@ -205,8 +205,8 @@ func (it *Materialize) Contains(v graph.Value) bool {
return it.subIt.Contains(v)
}
key := v
if h, ok := v.(hashable); ok {
key = h.Hashable()
if h, ok := v.(hasher); ok {
key = h.Hasher()
}
if i, ok := it.containsMap[key]; ok {
it.index = i
@ -246,8 +246,8 @@ func (it *Materialize) materializeSet() {
break
}
val := id
if h, ok := id.(hashable); ok {
val = h.Hashable()
if h, ok := id.(hasher); ok {
val = h.Hasher()
}
if _, ok := it.containsMap[val]; !ok {
it.containsMap[val] = len(it.values)

View file

@ -44,7 +44,7 @@ const (
type Token []byte
func (t Token) Hashable() interface{} {
func (t Token) Hasher() interface{} {
return string(t)
}

View file

@ -37,7 +37,7 @@ import (
// pointers to structs, or merely triples, or whatever works best for the
// backing store.
//
// These must be comparable, or implement a `Hashable() interface{}` function
// These must be comparable, or implement a `Hasher() interface{}` function
// so that they may be stored in maps.
type Value interface{}