// NewLWPolyline builds a new LWPolyline from a slice of Tags.
505678
func NewLWPolyline(tags core.TagSlice) (*LWPolyline, error) {
	polyline := new(LWPolyline)

	// set defaults
	polyline.ExtrusionDirection = core.Point{X: 0.0, Y: 0.0, Z: 1.0}

	polyline.InitBaseEntityParser()

	pointIndex := -1
	polyline.Update(map[int]core.TypeParser{
		70: core.NewIntTypeParser(func(flags int) {
			polyline.Closed = flags&closedBit != 0
			polyline.Plinegen = flags&plinegenBit != 0
		}),
		90: core.NewIntTypeParser(func(value int) {
			polyline.Points = make(LWPolyLinePointSlice, value)
		}),
		38: core.NewFloatTypeParserToVar(&polyline.Elevation),
		39: core.NewFloatTypeParserToVar(&polyline.Thickness),
		43: core.NewFloatTypeParserToVar(&polyline.ConstantWidth),
		10: core.NewFloatTypeParser(func(x float64) {
			pointIndex++
			polyline.Points[pointIndex].Point.X = x
		}),
		20: core.NewFloatTypeParser(func(y float64) {
			polyline.Points[pointIndex].Point.Y = y
		}),
		91: core.NewIntTypeParser(func(value int) {
			polyline.Points[pointIndex].Id = value
		}),
		40: core.NewFloatTypeParser(func(value float64) {
			polyline.Points[pointIndex].StartingWidth = value
		}),
		41: core.NewFloatTypeParser(func(value float64) {
			polyline.Points[pointIndex].EndWidth = value
		}),
		42: core.NewFloatTypeParser(func(value float64) {
			polyline.Points[pointIndex].Bulge = value
		}),
		210: core.NewFloatTypeParserToVar(&polyline.ExtrusionDirection.X),
		220: core.NewFloatTypeParserToVar(&polyline.ExtrusionDirection.Y),
		230: core.NewFloatTypeParserToVar(&polyline.ExtrusionDirection.Z),
	})

	err := polyline.Parse(tags)
	return polyline, err
}
46048
func NewMapper(tagName string) *Mapper {
	return &Mapper{
		cache:   make(map[reflect.Type]*StructMap),
		tagName: tagName,
	}
}
1281956
func WithNewline(ctx context.Context, nl bool) context.Context {
	return context.WithValue(ctx, ctxKeyNewline, nl)
}
153389
func New() *Builder {
	b := &Builder{}

	b.info.Write([]byte{
		0x0, 0x0, 0x0, 0x0, // length
		0x4, 0x0, // version
		0x0, 0x0, 0x0, 0x0, // debug_abbrev_offset
		0x8, // address_size
	})

	b.TagOpen(dwarf.TagCompileUnit, "go")
	b.Attr(dwarf.AttrLanguage, uint8(22))

	return b
}
425517
func CreateNewGSLB(gslbName string) *GSLB {
	return &GSLB{
		Resource: &Resource{},
		propName: propName{Name: gslbName},
		Provider: GSLBProvider{
			Class: "gslb",
		},
		Settings: GSLBSettings{
			GSLB: GSLBRecordSets{
				DelayLoop:   10,
				HealthCheck: defaultGSLBHealthCheck,
				Weighted:    "True",
				Servers:     []GSLBServer{},
			},
		},
	}

}
537130
func New(p *dt.Plugin, t Type, label string) []dt.State {
	switch t {
	case RequestAddress:
		return getAddress(p, label)
	}
	return []dt.State{}
}
1040995
func ReplaceNewlines(err error) error {
	if err == nil {
		return nil
	}
	return errors.New(strings.Replace(err.Error(), "\n", " ", -1))
}
1106732
func New(addr, prefix string, tags []string) (Backend, error) {
	client, err := statsd.New(addr)
	if err == nil {
		client.Namespace = prefix
		client.Tags = tags
	}
	return Backend{client}, err
}
493999
func NewMultiPolygon(coordinates []MultiLine) *MultiPolygon {
	if coordinates == nil {
		coordinates = make([]MultiLine, 0, INIT_GEOM_CAP)
	}
	return &MultiPolygon{Type: "MultiPolygon", Coordinates: coordinates}
}
475121
func New(logger log.Logger, reg prometheus.Registerer, dir string) (*WAL, error) {
	return NewSize(logger, reg, dir, DefaultSegmentSize)
}
428012
func New(args, nbOfExpressions int, nbOfExpressionsForEachChild ...int) *Composer {
	return neww(nil, args, nbOfExpressions, nbOfExpressionsForEachChild...)
}
242652
func New(apiKey string) *Linode {
	return &Linode{
		apiEndpoint: ApiEndpoint,
		apiKey:      apiKey,
		actions:     []Action{},
	}
}
908016
func New(key string, defaultValue *bool) *FeatureFlag {
	flagsMutex.Lock()
	defer flagsMutex.Unlock()

	f := flags[key]
	if f == nil {
		f = &FeatureFlag{
			Key: key,
		}
		flags[key] = f
	}

	if f.defaultValue == nil {
		f.defaultValue = defaultValue
	}

	return f
}
145700
func New(cfg *ExplorerConfig) *explorerUI {
	exp := new(explorerUI)
	exp.Mux = chi.NewRouter()
	exp.blockData = cfg.DataSource
	exp.explorerSource = cfg.PrimaryDataSource
	// Allocate Mempool fields.
	exp.invs = new(types.MempoolInfo)
	exp.Version = cfg.AppVersion
	exp.devPrefetch = cfg.DevPrefetch
	exp.xcBot = cfg.XcBot
	exp.xcDone = make(chan struct{})
	exp.agendasSource = cfg.AgendasSource
	exp.voteTracker = cfg.Tracker
	exp.proposalsSource = cfg.ProposalsSource
	exp.politeiaAPIURL = cfg.PoliteiaURL
	explorerLinks.Mainnet = cfg.MainnetLink
	explorerLinks.Testnet = cfg.TestnetLink
	explorerLinks.MainnetSearch = cfg.MainnetLink + "search?search="
	explorerLinks.TestnetSearch = cfg.TestnetLink + "search?search="

	// explorerDataSource is an interface that could have a value of pointer type.
	if exp.explorerSource == nil || reflect.ValueOf(exp.explorerSource).IsNil() {
		log.Errorf("An explorerDataSource (PostgreSQL backend) is required.")
		return nil
	}

	if cfg.UseRealIP {
		exp.Mux.Use(middleware.RealIP)
	}

	params := exp.blockData.GetChainParams()
	exp.ChainParams = params
	exp.NetName = netName(exp.ChainParams)
	exp.MeanVotingBlocks = txhelpers.CalcMeanVotingBlocks(params)
	exp.premine = params.BlockOneSubsidy()

	// Development subsidy address of the current network
	devSubsidyAddress, err := dbtypes.DevSubsidyAddress(params)
	if err != nil {
		log.Warnf("explorer.New: %v", err)
	}
	log.Debugf("Organization address: %s", devSubsidyAddress)

	exp.pageData = &pageData{
		BlockInfo: new(types.BlockInfo),
		HomeInfo: &types.HomeInfo{
			DevAddress: devSubsidyAddress,
			Params: types.ChainParams{
				WindowSize:       exp.ChainParams.StakeDiffWindowSize,
				RewardWindowSize: exp.ChainParams.SubsidyReductionInterval,
				BlockTime:        exp.ChainParams.TargetTimePerBlock.Nanoseconds(),
				MeanVotingBlocks: exp.MeanVotingBlocks,
			},
			PoolInfo: types.TicketPoolInfo{
				Target: exp.ChainParams.TicketPoolSize * exp.ChainParams.TicketsPerBlock,
			},
		},
	}

	log.Infof("Mean Voting Blocks calculated: %d", exp.pageData.HomeInfo.Params.MeanVotingBlocks)

	commonTemplates := []string{"extras"}
	exp.templates = newTemplates(cfg.Viewsfolder, commonTemplates, makeTemplateFuncMap(exp.ChainParams))

	tmpls := []string{"home", "explorer", "mempool", "block", "tx", "address",
		"rawtx", "status", "parameters", "agenda", "agendas", "charts",
		"sidechains", "disapproved", "ticketpool", "nexthome", "statistics",
		"windows", "timelisting", "addresstable", "proposals", "proposal", "market"}

	for _, name := range tmpls {
		if err := exp.templates.addTemplate(name); err != nil {
			log.Errorf("Unable to create new html template: %v", err)
			return nil
		}
	}

	exp.addRoutes()

	exp.wsHub = NewWebsocketHub()

	go exp.wsHub.run()

	go exp.watchExchanges()

	return exp
}
779420
func NewBlock(msgBlock *wire.MsgBlock) *Block {
	return &Block{
		msgBlock:    msgBlock,
		blockHeight: BlockHeightUnknown,
	}
}
766803
func (r *randomGraph) newNode(i int) (*node.Node, error) {
	id, err := node.NewID(fmt.Sprintf("%d", i))
	if err != nil {
		return nil, err
	}
	return node.NewNode(r.nodeType, id), nil
}
1095506
func New() (*Alac, error) {
	a := create_alac(16, 2)
	if a == nil {
		return nil, fmt.Errorf("can't create alac. No idea why, though")
	}
	// TODO: fmtp stuff
	// fmtp: 96 352 0 16 40 10 14 2 255 0 0 44100
	a.setinfo_max_samples_per_frame = 352 // frame_size;
	a.setinfo_7a = 0                      // fmtp[2];
	a.setinfo_sample_size = 16            // sample_size;
	a.setinfo_rice_historymult = 40       // fmtp[4];
	a.setinfo_rice_initialhistory = 10    // fmtp[5];
	a.setinfo_rice_kmodifier = 14         // fmtp[6];
	a.setinfo_7f = 2                      // fmtp[7];
	a.setinfo_80 = 255                    // fmtp[8];
	a.setinfo_82 = 0                      // fmtp[9];
	a.setinfo_86 = 0                      // fmtp[10];
	a.setinfo_8a_rate = 44100             // fmtp[11];

	a.allocateBuffers()
	return a, nil
}