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

@ -32,6 +32,7 @@ import (
// An All iterator across a range of int64 values, from `max` to `min`.
type Int64 struct {
Base
uid uint64
tags graph.Tagger
max, min int64
at int64
@ -39,14 +40,20 @@ type Int64 struct {
// Creates a new Int64 with the given range.
func NewInt64(min, max int64) *Int64 {
var all Int64
all := Int64{
uid: NextUID(),
min: min,
max: max,
at: min,
}
BaseInit(&all.Base)
all.max = max
all.min = min
all.at = min
return &all
}
func (it *Int64) UID() uint64 {
return it.uid
}
// Start back at the beginning
func (it *Int64) Reset() {
it.at = it.min