// buildIterator is not exposed to force to use Quads and group filters together.
337245
func (s QuadFilter) buildIterator(qs graph.QuadStore) graph.Iterator {
	if s.Values == nil {
		return iterator.NewNull()
	} else if v, ok := One(s.Values); ok {
		return qs.QuadIterator(s.Dir, v)
	}
	if s.Dir == quad.Any {
		panic("direction is not set")
	}
	sub := s.Values.BuildIterator(qs)
	return iterator.NewLinksTo(qs, sub, s.Dir)
}
395983
func (p *Path) BuildIteratorOn(qs graph.QuadStore) graph.Iterator {
	return shape.BuildIterator(qs, p.Shape())
}
906810
func (b *multiErrBuilder) Build() error {
	if len(b.errs) == 0 {
		return nil
	}

	msgs := make([]string, len(b.errs))

	for i, err := range b.errs {
		msgs[i] = err.Error()
	}

	return errors.New(strings.Join(msgs, " AND "))
}
1006034
func NewIterator(cfg API) *Iterator {
	return &Iterator{
		cfg:    cfg.(*frozenConfig),
		reader: nil,
		buf:    nil,
		head:   0,
		tail:   0,
	}
}
1364802
func (p *MemoryPool) Iterator() *PoolIterator {
	p.mutex.Lock()
	defer p.mutex.Unlock()

	keys := make([]string, len(p.entries))
	i := 0
	for k := range p.entries {
		keys[i] = k
		i++
	}

	return &PoolIterator{pool: p, keys: keys, current: 0}
}
1282559
func (b *CuratorFrameworkBuilder) Build() CuratorFramework {
	if b.EnsembleProvider == nil {
		panic("missed ensemble provider")
	}

	builder := *b

	if builder.SessionTimeout == 0 {
		builder.SessionTimeout = DEFAULT_SESSION_TIMEOUT
	}
	if builder.ConnectionTimeout == 0 {
		builder.ConnectionTimeout = DEFAULT_CONNECTION_TIMEOUT
	}
	if builder.MaxCloseWait == 0 {
		builder.MaxCloseWait = DEFAULT_CLOSE_WAIT
	}
	if builder.CompressionProvider == nil {
		builder.CompressionProvider = NewGzipCompressionProvider()
	}
	if builder.AclProvider == nil {
		builder.AclProvider = NewDefaultACLProvider()
	}

	return newCuratorFramework(&builder)
}
374674
func NewBinPackIterator(ctx Context, source RankIterator, evict bool, priority int) *BinPackIterator {
	iter := &BinPackIterator{
		ctx:      ctx,
		source:   source,
		evict:    evict,
		priority: priority,
	}
	return iter
}
69818
func NewArrayIterator(s Slice) (*ArrayIterator, error) {
	if !s.IsArray() {
		return nil, InvalidTypeError{"Expected Array slice"}
	}
	size, err := s.Length()
	if err != nil {
		return nil, WithStack(err)
	}
	i := &ArrayIterator{
		s:        s,
		position: 0,
		size:     size,
	}
	if size > 0 {
		i.current, err = s.At(0)
		if err != nil {
			return nil, WithStack(err)
		}
	}
	return i, nil
}
575098
func RunIteration() {
	Time.Tick()

	if !opts.HeadlessMode {
		Input.update()
	}

	// Then update the world and all Systems
	currentUpdater.Update(Time.Delta())
}
724109
func (db *DB) NewIteratorCF(opts *ReadOptions, cf *ColumnFamilyHandle) *Iterator {
	cIter := C.rocksdb_create_iterator_cf(db.c, opts.c, cf.c)
	return NewNativeIterator(unsafe.Pointer(cIter))
}
1296473
func (kv *KV) Iterator(f func([]byte, []byte) bool) error {
	iter := kv.db.NewIterator(nil, nil)
	for iter.Next() {
		if !f(iter.Key(), iter.Value()) {
			break
		}
	}
	iter.Release()
	return iter.Error()
}
1368894
func (b ShapeValueBuilder) BuildScalar(name, memName string, ref *ShapeRef, shape interface{}, isPayload bool) string {
	if ref == nil || ref.Shape == nil {
		return ""
	}

	switch v := shape.(type) {
	case bool:
		return convertToCorrectType(memName, ref.Shape.Type, fmt.Sprintf("%t", v))
	case int:
		if ref.Shape.Type == "timestamp" {
			return parseTimeString(ref, memName, fmt.Sprintf("%d", v))
		}
		return convertToCorrectType(memName, ref.Shape.Type, fmt.Sprintf("%d", v))
	case float64:
		dataType := ref.Shape.Type
		if dataType == "integer" || dataType == "int64" || dataType == "long" {
			return convertToCorrectType(memName, ref.Shape.Type, fmt.Sprintf("%d", int(shape.(float64))))
		}
		return convertToCorrectType(memName, ref.Shape.Type, fmt.Sprintf("%f", v))
	case string:
		t := ref.Shape.Type
		switch t {
		case "timestamp":
			return parseTimeString(ref, memName, fmt.Sprintf("%s", v))
		case "blob":
			if (ref.Streaming || ref.Shape.Streaming) && isPayload {
				return fmt.Sprintf("%s: aws.ReadSeekCloser(strings.NewReader(%q)),\n", memName, v)
			}

			return fmt.Sprintf("%s: []byte(%q),\n", memName, v)
		default:
			return convertToCorrectType(memName, t, v)
		}
	default:
		panic(fmt.Errorf("Unsupported scalar type: %v", reflect.TypeOf(v)))
	}
}
982963
func (ub UpdateBuilder) buildTree() (exprNode, error) {
	if ub.operationList == nil {
		return exprNode{}, newUnsetParameterError("buildTree", "UpdateBuilder")
	}
	ret := exprNode{
		children: []exprNode{},
	}

	modes := modeList{}

	for mode := range ub.operationList {
		modes = append(modes, mode)
	}

	sort.Sort(modes)

	for _, key := range modes {
		ret.fmtExpr += string(key) + " $c\n"

		childNode, err := buildChildNodes(ub.operationList[key])
		if err != nil {
			return exprNode{}, err
		}

		ret.children = append(ret.children, childNode)
	}

	return ret, nil
}
842864
func (p *Partition) MeasurementIterator() (tsdb.MeasurementIterator, error) {
	fs, err := p.FileSet()
	if err != nil {
		return nil, err
	}
	return newFileSetMeasurementIterator(fs,
		NewTSDBMeasurementIteratorAdapter(fs.MeasurementIterator())), nil
}
521480
func RunIteration() {
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	select {
	case drawEvent <- struct{}{}:
		for {
			select {
			case <-worker.WorkAvailable():
				worker.DoWork()
			case <-drawDone:
				return
			}
		}
	case <-time.After(500 * time.Millisecond):
		return
	}
}
512088
func (t *tOps) newIterator(f *tFile, slice *util.Range, ro *opt.ReadOptions) iterator.Iterator {
	ch, err := t.open(f)
	if err != nil {
		return iterator.NewEmptyIterator(err)
	}
	iter := ch.Value().(*table.Reader).NewIterator(slice, ro)
	iter.SetReleaser(ch)
	return iter
}
397296
func newRangeIterator(index *ShapeIndex) *rangeIterator {
	r := &rangeIterator{
		it: index.Iterator(),
	}
	r.refresh()
	return r
}