// Next returns true if there are remaining values to read.
330549
func (it *FloatDecoder) Next() bool {
	if it.err != nil || it.finished {
		return false
	}

	if it.first {
		it.first = false

		// mark as finished if there were no values.
		if it.val == uvnan { // IsNaN
			it.finished = true
			return false
		}

		return true
	}

	// read compressed value
	var bit bool
	if it.br.CanReadBitFast() {
		bit = it.br.ReadBitFast()
	} else if v, err := it.br.ReadBit(); err != nil {
		it.err = err
		return false
	} else {
		bit = v
	}

	if !bit {
		// it.val = it.val
	} else {
		var bit bool
		if it.br.CanReadBitFast() {
			bit = it.br.ReadBitFast()
		} else if v, err := it.br.ReadBit(); err != nil {
			it.err = err
			return false
		} else {
			bit = v
		}

		if !bit {
			// reuse leading/trailing zero bits
			// it.leading, it.trailing = it.leading, it.trailing
		} else {
			bits, err := it.br.ReadBits(5)
			if err != nil {
				it.err = err
				return false
			}
			it.leading = bits

			bits, err = it.br.ReadBits(6)
			if err != nil {
				it.err = err
				return false
			}
			mbits := bits
			// 0 significant bits here means we overflowed and we actually need 64; see comment in encoder
			if mbits == 0 {
				mbits = 64
			}
			it.trailing = 64 - it.leading - mbits
		}

		mbits := uint(64 - it.leading - it.trailing)
		bits, err := it.br.ReadBits(mbits)
		if err != nil {
			it.err = err
			return false
		}

		vbits := it.val
		vbits ^= (bits << it.trailing)

		if vbits == uvnan { // IsNaN
			it.finished = true
			return false
		}
		it.val = vbits
	}

	return true
}
132235
func (c *Container) Next() bool {
	if c.err != nil {
		return false
	}
	var b Block
	c.err = b.readFrom(c.blockData)
	if c.err == nil {
		c.block = &b
		return true
	}
	return false
}
1209838
func (ar *Reader) Next() (*Header, error) {
	var hdr *Header
	if ar.err == nil {
		ar.skipUnread()
	}
	if ar.err != nil {
		return hdr, ar.err
	}
	hdr = ar.readHeader()
	if hdr == nil {
		return hdr, ar.err
	}
	return hdr, ar.err
}
749856
func (it *ReaderIteratorImpl) Next() (v int64, err error) {
	nextValues, err := it.nextN(1)
	if err != nil {
		return 0, err
	}
	assert(len(nextValues) > 0)
	return nextValues[0], nil
}
1334372
func (it *Iter) Next() bool {
	if len(it.values) == 0 && it.meta.HasMore && !it.listParams.Single {
		// determine if we're moving forward or backwards in paging
		if it.listParams.EndingBefore != nil {
			it.listParams.EndingBefore = String(listItemID(it.cur))
			it.formValues.Set(EndingBefore, *it.listParams.EndingBefore)
		} else {
			it.listParams.StartingAfter = String(listItemID(it.cur))
			it.formValues.Set(StartingAfter, *it.listParams.StartingAfter)
		}
		it.getPage()
	}
	if len(it.values) == 0 {
		return false
	}
	it.cur = it.values[0]
	it.values = it.values[1:]
	return true
}
1252796
func (l *ReaderLexer) Next() (r rune) {
	/* Illustrated guide to how the cursors move:

	              pos
	              |
	              v
	buf | a | b | c |
	              ^
	              |
	              peekLoc

	-> l.Nex() -> returns d

	                  pos
	                  |
	                  v
	buf | a | b | c | d |
	                  ^
	                  |
	                  peekLoc


	-> l.Peek() -> returns e

	                  pos
	                  |
	                  v
	buf | a | b | c | d | e |
	                      ^
	                      |
	                      peekLoc

	-> l.Backup()
	-> l.Backup()

	              pos
	              |
	              v
	buf | a | b | c | d | e |
	              ^
	              |
	              peekLoc

	-> l.Next() -> returns c

	                  pos
	                  |
	                  v
	buf | a | b | c | d | e |
	                  ^
	                  |
	                  peekLoc

	-> l.Next() -> returns d

	                      pos
	                      |
	                      v
	buf | a | b | c | d | e |
	                      ^
	                      |
	                      peekLoc
	*/
	guard := Mark("Next")
	defer func() {
		Trace("return = %q", r)
		guard()
	}()

	if l.pos == -1 || len(l.buf) == l.peekLoc+1 {
		r, _, err := l.source.ReadRune()
		switch err {
		case nil:
			l.peekLoc++
			l.pos++
			l.buf = append(l.buf, r)
		case io.EOF:
			l.peekLoc++
			l.pos++
			r = -1
			if l.buf[len(l.buf)-1] != r {
				l.buf = append(l.buf, r)
			}
		}
	} else {
		l.peekLoc++
		l.pos++
	}

	loc := l.peekLoc

	if loc < 0 || len(l.buf) <= loc {
		return EOF
		//    panic(fmt.Sprintf("FATAL: loc = %d, l.buf = %q (len = %d)", loc, l.buf, len(l.buf)))
	}

	Trace("l.buf = %q, loc = %d", l.buf, loc)
	return l.buf[loc]
}
1162571
func (s *Sequence) Next() (uint64, error) {
	s.current += s.increment

	// Check for missed minimum condition
	if s.current < s.minvalue {
		return 0, errors.New("reached minimum bound of the sequence")
	}

	// Check for reached maximum condition
	if s.current > s.maxvalue {
		return 0, errors.New("reached maximum bound of sequence")
	}

	return s.current, nil
}
308406
func (p *Pager) Next() *Pager {
	if !p.HasNext() {
		return nil
	}
	return p.pagers[p.PageNumber()]
}
1509
func (r *SearchResults) Next(hitPtr *SearchResultHit) bool {
	if r.err != nil {
		return false
	}

	row := r.NextBytes()
	if row == nil {
		return false
	}

	r.err = json.Unmarshal(row, hitPtr)
	if r.err != nil {
		return false
	}

	return true
}
1214699
func (r *selectResult) Next(ctx context.Context, chk *chunk.Chunk) error {
	chk.Reset()
	for !chk.IsFull() {
		if r.selectResp == nil || r.respChkIdx == len(r.selectResp.Chunks) {
			err := r.getSelectResp()
			if err != nil || r.selectResp == nil {
				return err
			}
		}
		err := r.readRowsData(chk)
		if err != nil {
			return err
		}
		if len(r.selectResp.Chunks[r.respChkIdx].RowsData) == 0 {
			r.respChkIdx++
		}
	}
	return nil
}
413247
func (r *tarReader) Next() error {
	header, err := r.reader.Next()
	r.header = header
	return err
}
67898
func (i *Uint32) Next() uint32 {
	i.lock.Lock()
	defer i.lock.Unlock()
	i.increment++
	return i.increment
}
317008
func (it *ScanIterator) Next() bool {
	it.mu.Lock()
	defer it.mu.Unlock()

	// Instantly return on errors.
	if it.cmd.Err() != nil {
		return false
	}

	// Advance cursor, check if we are still within range.
	if it.pos < len(it.cmd.page) {
		it.pos++
		return true
	}

	for {
		// Return if there is no more data to fetch.
		if it.cmd.cursor == 0 {
			return false
		}

		// Fetch next page.
		if it.cmd._args[0] == "scan" {
			it.cmd._args[1] = it.cmd.cursor
		} else {
			it.cmd._args[2] = it.cmd.cursor
		}

		err := it.cmd.process(it.cmd)
		if err != nil {
			return false
		}

		it.pos = 1

		// Redis can occasionally return empty page.
		if len(it.cmd.page) > 0 {
			return true
		}
	}
}
641856
func (i *Int) Next() int {
	i.lock.Lock()
	defer i.lock.Unlock()
	i.increment++
	return i.increment
}
992624
func (iter *bitArrayIterator) Next() bool {
	iter.index++
	return uint64(iter.index) <= iter.stopIndex
}
311638
func (i *iterator) Next() (key []byte, value []byte) {
	if i.err != nil {
		return nil, nil
	}

	if i.dataBucket == nil {
		return nil, nil
	}

	if i.nextKeys == nil {
		return nil, nil
	}

	if len(i.keyCache) == 0 {
		newKeys, err := i.nextKeys(i.prepCursor, i.indexCursor)
		i.prepCursor = false
		if err != nil {
			i.err = err
			return nil, nil
		}

		if len(newKeys) == 0 {
			return nil, nil
		}

		i.keyCache = append(i.keyCache, newKeys...)
	}

	nextKey := i.keyCache[0]
	i.keyCache = i.keyCache[1:]

	val := i.dataBucket.Get(nextKey)

	return nextKey, val
}
171455
func (n *nextRow) next() error {
	var err error
	n.row, err = n.rowReader.Next()
	if err != nil {
		return err
	}
	if n.row == nil {
		return io.EOF
	}
	return nil
}