Canonicalise iterator receiver names
This apparently meaningless churn improves godoc readability.
This commit is contained in:
parent
dc65ebce9e
commit
60d5c60817
10 changed files with 432 additions and 435 deletions
|
|
@ -45,70 +45,69 @@ func NewInt64AllIterator(min, max int64) *Int64AllIterator {
|
|||
}
|
||||
|
||||
// Start back at the beginning
|
||||
func (a *Int64AllIterator) Reset() {
|
||||
a.at = a.min
|
||||
func (it *Int64AllIterator) Reset() {
|
||||
it.at = it.min
|
||||
}
|
||||
|
||||
func (a *Int64AllIterator) Close() {
|
||||
}
|
||||
func (it *Int64AllIterator) Close() {}
|
||||
|
||||
func (a *Int64AllIterator) Clone() Iterator {
|
||||
out := NewInt64AllIterator(a.min, a.max)
|
||||
out.CopyTagsFrom(a)
|
||||
func (it *Int64AllIterator) Clone() Iterator {
|
||||
out := NewInt64AllIterator(it.min, it.max)
|
||||
out.CopyTagsFrom(it)
|
||||
return out
|
||||
}
|
||||
|
||||
// Prints the All iterator as just an "all".
|
||||
func (a *Int64AllIterator) DebugString(indent int) string {
|
||||
return fmt.Sprintf("%s(%s)", strings.Repeat(" ", indent), a.Type())
|
||||
func (it *Int64AllIterator) DebugString(indent int) string {
|
||||
return fmt.Sprintf("%s(%s)", strings.Repeat(" ", indent), it.Type())
|
||||
}
|
||||
|
||||
// Next() on an Int64 all iterator is a simple incrementing counter.
|
||||
// Return the next integer, and mark it as the result.
|
||||
func (a *Int64AllIterator) Next() (TSVal, bool) {
|
||||
NextLogIn(a)
|
||||
if a.at == -1 {
|
||||
return NextLogOut(a, nil, false)
|
||||
func (it *Int64AllIterator) Next() (TSVal, bool) {
|
||||
NextLogIn(it)
|
||||
if it.at == -1 {
|
||||
return NextLogOut(it, nil, false)
|
||||
}
|
||||
val := a.at
|
||||
a.at = a.at + 1
|
||||
if a.at > a.max {
|
||||
a.at = -1
|
||||
val := it.at
|
||||
it.at = it.at + 1
|
||||
if it.at > it.max {
|
||||
it.at = -1
|
||||
}
|
||||
a.Last = val
|
||||
return NextLogOut(a, val, true)
|
||||
it.Last = val
|
||||
return NextLogOut(it, val, true)
|
||||
}
|
||||
|
||||
// The number of elements in an Int64AllIterator is the size of the range.
|
||||
// The size is exact.
|
||||
func (a *Int64AllIterator) Size() (int64, bool) {
|
||||
Size := ((a.max - a.min) + 1)
|
||||
func (it *Int64AllIterator) Size() (int64, bool) {
|
||||
Size := ((it.max - it.min) + 1)
|
||||
return Size, true
|
||||
}
|
||||
|
||||
// Check() for an Int64AllIterator is merely seeing if the passed value is
|
||||
// withing the range, assuming the value is an int64.
|
||||
func (a *Int64AllIterator) Check(tsv TSVal) bool {
|
||||
CheckLogIn(a, tsv)
|
||||
func (it *Int64AllIterator) Check(tsv TSVal) bool {
|
||||
CheckLogIn(it, tsv)
|
||||
v := tsv.(int64)
|
||||
if a.min <= v && v <= a.max {
|
||||
a.Last = v
|
||||
return CheckLogOut(a, v, true)
|
||||
if it.min <= v && v <= it.max {
|
||||
it.Last = v
|
||||
return CheckLogOut(it, v, true)
|
||||
}
|
||||
return CheckLogOut(a, v, false)
|
||||
return CheckLogOut(it, v, false)
|
||||
}
|
||||
|
||||
// The type of this iterator is an "all". This is important, as it puts it in
|
||||
// the class of "all iterators.
|
||||
func (a *Int64AllIterator) Type() string { return "all" }
|
||||
func (it *Int64AllIterator) Type() string { return "all" }
|
||||
|
||||
// There's nothing to optimize about this little iterator.
|
||||
func (a *Int64AllIterator) Optimize() (Iterator, bool) { return a, false }
|
||||
func (it *Int64AllIterator) Optimize() (Iterator, bool) { return it, false }
|
||||
|
||||
// Stats for an Int64AllIterator are simple. Super cheap to do any operation,
|
||||
// and as big as the range.
|
||||
func (a *Int64AllIterator) GetStats() *IteratorStats {
|
||||
s, _ := a.Size()
|
||||
func (it *Int64AllIterator) GetStats() *IteratorStats {
|
||||
s, _ := it.Size()
|
||||
return &IteratorStats{
|
||||
CheckCost: 1,
|
||||
NextCost: 1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue