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

@ -39,6 +39,7 @@ import (
// and whether the last check we received was true or false.
type Optional struct {
Base
uid uint64
tags graph.Tagger
subIt graph.Iterator
lastCheck bool
@ -50,9 +51,14 @@ func NewOptional(it graph.Iterator) *Optional {
BaseInit(&o.Base)
o.canNext = false
o.subIt = it
o.uid = NextUID()
return &o
}
func (it *Optional) UID() uint64 {
return it.uid
}
func (it *Optional) Reset() {
it.subIt.Reset()
it.lastCheck = false