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

@ -41,6 +41,7 @@ import (
// `next_it` is the tempoarary iterator held per result in `primary_it`.
type LinksTo struct {
Base
uid uint64
tags graph.Tagger
ts graph.TripleStore
primaryIt graph.Iterator
@ -51,15 +52,21 @@ type LinksTo struct {
// Construct a new LinksTo iterator around a direction and a subiterator of
// nodes.
func NewLinksTo(ts graph.TripleStore, it graph.Iterator, d graph.Direction) *LinksTo {
var lto LinksTo
lto := LinksTo{
uid: NextUID(),
ts: ts,
primaryIt: it,
dir: d,
nextIt: &Null{},
}
BaseInit(&lto.Base)
lto.ts = ts
lto.primaryIt = it
lto.dir = d
lto.nextIt = &Null{}
return &lto
}
func (it *LinksTo) UID() uint64 {
return it.uid
}
func (it *LinksTo) Reset() {
it.primaryIt.Reset()
if it.nextIt != nil {