Move UID handling from Base

Also clean up some of the value creation code.
This commit is contained in:
kortschak 2014-07-30 11:44:36 +09:30
parent 1604dca737
commit 01b7278c3a
13 changed files with 198 additions and 92 deletions

View file

@ -47,6 +47,7 @@ import (
// and a temporary holder for the iterator generated on Check().
type HasA struct {
Base
uid uint64
tags graph.Tagger
ts graph.TripleStore
primaryIt graph.Iterator
@ -57,14 +58,20 @@ type HasA struct {
// Construct a new HasA iterator, given the triple subiterator, and the triple
// direction for which it stands.
func NewHasA(ts graph.TripleStore, subIt graph.Iterator, d graph.Direction) *HasA {
var hasa HasA
hasa := HasA{
uid: NextUID(),
ts: ts,
primaryIt: subIt,
dir: d,
}
BaseInit(&hasa.Base)
hasa.ts = ts
hasa.primaryIt = subIt
hasa.dir = d
return &hasa
}
func (it *HasA) UID() uint64 {
return it.uid
}
// Return our sole subiterator.
func (it *HasA) SubIterators() []graph.Iterator {
return []graph.Iterator{it.primaryIt}