// factory function
493999
func NewMultiPolygon(coordinates []MultiLine) *MultiPolygon {
	if coordinates == nil {
		coordinates = make([]MultiLine, 0, INIT_GEOM_CAP)
	}
	return &MultiPolygon{Type: "MultiPolygon", Coordinates: coordinates}
}
222160
func (rr *RoundRobin) Open(factory Factory) {
	rr.mu.Lock()
	defer rr.mu.Unlock()
	rr.factory = factory
}
372791
func loadFactory(context *cli.Context) (libcontainer.Factory, error) {
	root := context.GlobalString("root")
	abs, err := filepath.Abs(root)
	if err != nil {
		return nil, err
	}

	// We default to cgroupfs, and can only use systemd if the system is a
	// systemd box.
	cgroupManager := libcontainer.Cgroupfs
	rootlessCg, err := shouldUseRootlessCgroupManager(context)
	if err != nil {
		return nil, err
	}
	if rootlessCg {
		cgroupManager = libcontainer.RootlessCgroupfs
	}
	if context.GlobalBool("systemd-cgroup") {
		if systemd.UseSystemd() {
			cgroupManager = libcontainer.SystemdCgroups
		} else {
			return nil, fmt.Errorf("systemd cgroup flag passed, but systemd support for managing cgroups is not available")
		}
	}

	intelRdtManager := libcontainer.IntelRdtFs
	if !intelrdt.IsCatEnabled() && !intelrdt.IsMbaEnabled() {
		intelRdtManager = nil
	}

	// We resolve the paths for {newuidmap,newgidmap} from the context of runc,
	// to avoid doing a path lookup in the nsexec context. TODO: The binary
	// names are not currently configurable.
	newuidmap, err := exec.LookPath("newuidmap")
	if err != nil {
		newuidmap = ""
	}
	newgidmap, err := exec.LookPath("newgidmap")
	if err != nil {
		newgidmap = ""
	}

	return libcontainer.New(abs, cgroupManager, intelRdtManager,
		libcontainer.CriuPath(context.GlobalString("criu")),
		libcontainer.NewuidmapPath(newuidmap),
		libcontainer.NewgidmapPath(newgidmap))
}
81818
func (f *FakeVtworkerClient) FakeVtworkerClientFactory(addr string) (vtworkerclient.Client, error) {
	return &perAddrFakeVtworkerClient{f, addr}, nil
}
45259
func CastFuncFactory(tp *types.FieldType) (BuiltinFunc, error) {
	switch tp.Tp {
	// Parser has restricted this.
	case mysql.TypeString, mysql.TypeDuration, mysql.TypeDatetime,
		mysql.TypeDate, mysql.TypeLonglong, mysql.TypeNewDecimal:
		return func(args []types.Datum, ctx context.Context) (d types.Datum, err error) {
			d = args[0]
			if d.IsNull() {
				return
			}
			return d.ConvertTo(ctx.GetSessionVars().StmtCtx, tp)
		}, nil
	}
	return nil, errors.Errorf("unknown cast type - %v", tp)
}
597746
func payloadFactory(t tasks.Task) payloadFn {
	rt := reflect.TypeOf(t).Elem()
	return func(id string) proto.Message {
		p := reflect.New(rt)
		p.Elem().FieldByName("Id").SetString(id)
		return p.Interface().(proto.Message)
	}
}
1327666
func NewFactory(
	state *uniter.State,
	paths context.Paths,
	contextFactory context.ContextFactory,
) (
	Factory, error,
) {
	f := &factory{
		state:          state,
		paths:          paths,
		contextFactory: contextFactory,
	}

	return f, nil
}
267488
func (c *FakeFoos) Create(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(foosResource, c.ns, foo), &v1alpha1.Foo{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.Foo), err
}
31115
func (f *Factory) Command() string {
	if len(os.Args) == 0 {
		return ""
	}
	base := filepath.Base(os.Args[0])
	args := append([]string{base}, os.Args[1:]...)
	return strings.Join(args, " ")
}
1266864
func NewNamedFactory(name string, errtext string) ErrorFactory {
	if _, ok := namedFactories[name]; ok {
		panic(fmt.Errorf("error factory name duplicated: %q", name))
	}
	factory := &errorFactory{
		errtext: errtext,
		name:    name,
	}
	namedFactories[name] = factory
	return factory
}
889722
func (ocf *outputConfigFlag) AddFactory(f outputFactory) {
	ocf.Options = append(ocf.Options, f.option())
}
441540
func MinFactory(e *MinErrorOption) ValidationFunc {
	if e == nil {
		e = &MinErrorOption{}
	}
	if e.UnsupportedTypeErrorOption == nil {
		e.UnsupportedTypeErrorOption = &UnsupportedTypeErrorOption{UnsupportedTypeError}
	}
	if e.ParamParseErrorOption == nil {
		e.ParamParseErrorOption = &ParamParseErrorOption{ParamParseError}
	}
	if e.MinError == nil {
		e.MinError = MinError
	}
	return func(t *Target, param string) error {
		v := t.FieldValue
		switch v.Kind() {
		case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
			pInt, err := strconv.ParseInt(param, 0, 64)
			if err != nil {
				return e.ParamParseError("min", t.FieldInfo, "number")
			}
			if v.Int() < pInt {
				return e.MinError(t.FieldInfo, v.Int(), pInt)
			}
		case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
			pUint, err := strconv.ParseUint(param, 0, 64)
			if err != nil {
				return e.ParamParseError("min", t.FieldInfo, "number")
			}
			if v.Uint() < pUint {
				return e.MinError(t.FieldInfo, v.Uint(), pUint)
			}
		case reflect.Float32, reflect.Float64:
			pFloat, err := strconv.ParseFloat(param, 64)
			if err != nil {
				return e.ParamParseError("min", t.FieldInfo, "number")
			}
			if v.Float() < pFloat {
				return e.MinError(t.FieldInfo, v.Float(), pFloat)
			}
		default:
			return e.UnsupportedTypeError("min", t.FieldInfo)
		}

		return nil
	}
}
1048509
func (f *Factory) Counter(options metrics.Options) metrics.Counter {
	counter := &counter{
		counters: make([]metrics.Counter, len(f.factories)),
	}
	for i, factory := range f.factories {
		counter.counters[i] = factory.Counter(options)
	}
	return counter
}
1135777
func WithFactory(c context.Context, f Factory) context.Context {
	return context.WithValue(c, &configBackendKey, f)
}
330306
func NewLinkingProviderFactory(context servicecontext.ServiceContext, config provider.LinkingProviderConfiguration) service.LinkingProviderFactory {
	factory := &linkingProviderFactoryImpl{
		BaseService: base.NewBaseService(context),
		config:      config,
	}
	return factory
}
424540
func NewProduct(parent *Products) *Product {
	product := &Product{parent: parent}
	product.Init()

	return product
}
988546
func (m MapBasedPluginMapper) PluginFactoryByName(name PluginName) validation.PluginFactory {
	return m[string(name)]
}