// iterate recursively traverses the tree and executes
// the iteration function.
544718
func (d *iterData) iterate(node *treeNode) bool {
	var proceed bool

	if node.left != nil {
		proceed = d.iterate(node.left)
		if !proceed {
			return false
		}
	}

	proceed = d.iter(node.value)
	if !proceed {
		return false
	}

	if node.right != nil {
		proceed = d.iterate(node.right)
		if !proceed {
			return false
		}
	}

	return true
}
587552
func (t *PairTree) Iter() <-chan Pair {
	c := make(chan Pair)
	go t.chanIterate(c)
	return c
}
1363655
func (in DirInput) Iterator(index int) (sophie.IterateCloser, error) {
	infos, err := in.Fs.ReadDir(in.Path)
	if err != nil {
		return nil, err
	}

	return NewReader(sophie.FsPath(in).Join(infos[index].Name()))
}
396275
func (jl *jsonLedger) Iterator(startPosition *ab.SeekPosition) (blockledger.Iterator, uint64) {
	switch start := startPosition.Type.(type) {
	case *ab.SeekPosition_Oldest:
		return &cursor{jl: jl, blockNumber: 0}, 0
	case *ab.SeekPosition_Newest:
		high := jl.height - 1
		return &cursor{jl: jl, blockNumber: high}, high
	case *ab.SeekPosition_Specified:
		if start.Specified.Number > jl.height {
			return &blockledger.NotFoundErrorIterator{}, 0
		}
		return &cursor{jl: jl, blockNumber: start.Specified.Number}, start.Specified.Number
	default:
		return &blockledger.NotFoundErrorIterator{}, 0
	}
}
552969
func (session *Session) Iterate(bean interface{}, fun IterFunc) error {
	rows, err := session.Rows(bean)
	if err != nil {
		return err
	}
	defer rows.Close()

	i := 0
	for rows.Next() {
		b := reflect.New(rows.beanType).Interface()
		err = rows.Scan(b)
		if err != nil {
			return err
		}
		err = fun(i, b)
		if err != nil {
			return err
		}
		i++
	}
	return err
}
1227687
func (p *PostingsList) Iterator(includeFreq, includeNorm, includeLocs bool,
	prealloc segment.PostingsIterator) segment.PostingsIterator {
	if p.normBits1Hit == 0 && p.postings == nil {
		return emptyPostingsIterator
	}

	var preallocPI *PostingsIterator
	pi, ok := prealloc.(*PostingsIterator)
	if ok && pi != nil {
		preallocPI = pi
	}
	if preallocPI == emptyPostingsIterator {
		preallocPI = nil
	}

	return p.iterator(includeFreq, includeNorm, includeLocs, preallocPI)
}
634530
func (p *Pipe) Iter() *Iter {
	iter := &Iter{
		session: p.session,
		timeout: -1,
	}
	iter.gotReply.L = &iter.m
	var result struct{ Result []bson.Raw }
	c := p.collection
	iter.err = c.Database.Run(bson.D{{"aggregate", c.Name}, {"pipeline", p.pipeline}}, &result)
	if iter.err != nil {
		return iter
	}
	for i := range result.Result {
		iter.docData.Push(result.Result[i].Data)
	}
	return iter
}
628746
func (xft *XFastTrie) Iter(key uint64) *Iterator {
	return &Iterator{
		n:     xft.successor(key),
		first: true,
	}
}
715153
func (c *IterateChain) Count() (int64, error) {
	c.start()
	defer c.end()
	if err := c.it.Err(); err != nil {
		return 0, err
	}
	if size, exact := c.it.Size(); exact {
		return size, nil
	}
	done := c.ctx.Done()
	var cnt int64
iteration:
	for c.next() {
		select {
		case <-done:
			break iteration
		default:
		}
		cnt++
		for c.nextPath() {
			select {
			case <-done:
				break iteration
			default:
			}
			cnt++
		}
	}
	return cnt, c.it.Err()
}
629551
func (a *Array) Iter() []Value {
	if a.chain.failed() {
		return []Value{}
	}
	ret := []Value{}
	for n := range a.value {
		ret = append(ret, Value{a.chain, a.value[n]})
	}
	return ret
}
10000
func (bl *BitList) IterateBytes() <-chan byte {
	res := make(chan byte)

	go func() {
		c := bl.count
		shift := 24
		i := 0
		for c > 0 {
			res <- byte((bl.data[i] >> uint(shift)) & 0xFF)
			shift -= 8
			if shift < 0 {
				shift = 24
				i++
			}
			c -= 8
		}
		close(res)
	}()

	return res
}
77965
func (iter *Iterator) Key() *Slice {
	var cLen C.size_t
	cKey := C.rocksdb_iter_key(iter.c, &cLen)
	if cKey == nil {
		return nil
	}
	return &Slice{cKey, cLen, true}
}
1349205
func (s *scram) iterations() int {
	if s.iterate == 0 {
		s.iterate = s.gen.GetIterations()
	}
	return s.iterate
}
1371483
func (f *functionQuery) Evaluate(t iterator) interface{} {
	return f.Func(f.Input, t)
}
259403
func (cdb *CDB) Iter() *Iterator {
	return &Iterator{
		db:     cdb,
		pos:    uint32(indexSize),
		endPos: cdb.index[0].offset,
	}
}
883743
func (n *Node) iter(comparator Comparator, start, stop interface{}) iterator {
	pointer := n.search(comparator, start)
	pointer--
	return &sliceIterator{
		stop:       stop,
		n:          n,
		pointer:    pointer,
		comparator: comparator,
	}
}
1179937
func (v *TreeStore) Set(iter *TreeIter, a ...interface{}) {
	for r := range a {
		v.SetValue(iter, r, a[r])
	}
}