// Next returns the closest time instant matching the spec that is after the
// passed time. If no matching instance exists, the zero value of time.Time is
// returned. The `time.Location` of the returned value matches that of the
// passed time.
15320
func (p *PeriodicConfig) Next(fromTime time.Time) (time.Time, error) {
	if *p.SpecType == PeriodicSpecCron {
		if e, err := cronexpr.Parse(*p.Spec); err == nil {
			return cronParseNext(e, fromTime, *p.Spec)
		}
	}

	return time.Time{}, nil
}
981895
func (b *ConstantBackoff) Next(retry int) (time.Duration, bool) {
	return b.interval, true
}
1018860
func (iter *iterator) Next() bool {
	if iter.first {
		iter.first = false
		return iter.n != nil
	}

	if iter.n == nil {
		return false
	}

	iter.n = iter.n.forward[0]
	return iter.n != nil
}
548957
func (b *ExponentialBackoff) Next(retry int) (time.Duration, bool) {
	r := 1.0 + rand.Float64() // random number in [1..2]
	m := math.Min(r*b.t*math.Pow(b.f, float64(retry)), b.m)
	if m >= b.m {
		return 0, false
	}
	d := time.Duration(int64(m)) * time.Millisecond
	return d, true
}
793565
func (w *srvStringsWatcher) Next() (params.StringsWatchResult, error) {
	if changes, ok := <-w.watcher.Changes(); ok {
		return params.StringsWatchResult{
			Changes: changes,
		}, nil
	}
	var err error
	if e, ok := w.watcher.(hasErr); ok {
		err = e.Err()
	}
	if err == nil {
		err = common.ErrStoppedWatcher
	}
	return params.StringsWatchResult{}, err
}
1286932
func (n *Nexter) Next() (nextID uint64) {
	nextID = atomic.AddUint64(n.id, 1)
	return nextID - 1
}
779134
func (s *sequences) next(seq string) int {
	if s.s == nil {
		s.s = make(map[string]int, 1)
	}
	v := s.s[seq] + 1
	s.s[seq] = v
	return v
}
1286553
func (e *element) Next() *element {
	if p := e.next; e.list != nil && p != &e.list.root {
		return p
	}
	return nil
}
1069761
func (b *ExponentialBackoff) Next(ctx context.Context, err error) time.Duration {
	// Get Limited base delay.
	delay := b.Limited.Next(ctx, err)
	if delay == Stop {
		return Stop
	}

	// Bound our delay.
	if b.MaxDelay > 0 && b.MaxDelay < delay {
		delay = b.MaxDelay
	} else {
		// Calculate the next delay exponentially.
		multiplier := b.Multiplier
		if multiplier < 1 {
			multiplier = 2
		}
		b.Delay = time.Duration(float64(b.Delay) * multiplier)
	}
	return delay
}
190441
func (s *Schedule) Next(now, prev time.Time) time.Time {
	if s.triggered {
		return DistantFuture
	}

	// For an absolute schedule just look at the time table.
	if s.cronExpr != nil {
		return s.cronExpr.Next(now)
	}

	// Using relative schedule and this is a first invocation ever? Randomize
	// start time, so that a bunch of newly registered cron jobs do not start all
	// at once. Otherwise just wait for 'interval' seconds after previous
	// invocation.
	if prev.IsZero() {
		// Pass seed through math/rand to make small seeds (used by unit tests),
		// less special.
		rnd := rand.New(rand.NewSource(int64(s.randSeed))).Float64()
		return now.Add(time.Duration(float64(s.interval) * rnd))
	}
	next := prev.Add(s.interval)
	if next.Sub(now) < 0 {
		next = now
	}
	return next
}
741733
func (cb *constantBackoff) Next(retry int) time.Duration {
	if retry <= 0 {
		return 0 * time.Millisecond
	}
	return (time.Duration(cb.backoffInterval) * time.Millisecond) + (time.Duration(rand.Int63n(cb.maximumJitterInterval)) * time.Millisecond)
}
823418
func Next() string {
	globalNUID.Lock()
	nuid := globalNUID.Next()
	globalNUID.Unlock()
	return nuid
}
690989
func (i *Uint) Next() uint {
	i.lock.Lock()
	defer i.lock.Unlock()
	i.increment++
	return i.increment
}
872632
func (it *iterator4List) Next() Row {
	if it.chkCursor >= it.li.NumChunks() {
		it.chkCursor = it.li.NumChunks() + 1
		return it.End()
	}
	chk := it.li.GetChunk(it.chkCursor)
	row := chk.GetRow(it.rowCursor)
	it.rowCursor++
	if it.rowCursor == chk.NumRows() {
		it.rowCursor = 0
		it.chkCursor++
	}
	return row
}
160537
func (s *Schedule) Next() <-chan time.Time {
	if len(s.items) > 0 {
		return s.time.After(s.items[0].t.Sub(s.time.Now()))
	}
	return nil
}
931773
func (s *scanner) Next() (rune, bool) {
	if s.i >= len(s.s) {
		return 0, false
	}
	r := s.s[s.i]
	s.i++
	return r, true
}
1026645
func (d *Decoder) Next() bool {
	d.i += 1

	if d.i >= d.n {
		d.read()
	}

	return len(d.bytes) >= 8 || (d.i >= 0 && d.i < d.n)
}