Move UID handling from Base
Also clean up some of the value creation code.
This commit is contained in:
parent
1604dca737
commit
01b7278c3a
13 changed files with 198 additions and 92 deletions
|
|
@ -31,6 +31,7 @@ import (
|
|||
// an equality function.
|
||||
type Fixed struct {
|
||||
Base
|
||||
uid uint64
|
||||
tags graph.Tagger
|
||||
values []graph.Value
|
||||
lastIndex int
|
||||
|
|
@ -55,14 +56,19 @@ func newFixed() *Fixed {
|
|||
|
||||
// Creates a new Fixed iterator with a custom comparitor.
|
||||
func NewFixedIteratorWithCompare(compareFn Equality) *Fixed {
|
||||
var it Fixed
|
||||
it := Fixed{
|
||||
uid: NextUID(),
|
||||
values: make([]graph.Value, 0, 20),
|
||||
cmp: compareFn,
|
||||
}
|
||||
BaseInit(&it.Base)
|
||||
it.values = make([]graph.Value, 0, 20)
|
||||
it.lastIndex = 0
|
||||
it.cmp = compareFn
|
||||
return &it
|
||||
}
|
||||
|
||||
func (it *Fixed) UID() uint64 {
|
||||
return it.uid
|
||||
}
|
||||
|
||||
func (it *Fixed) Reset() {
|
||||
it.lastIndex = 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue